@hashgraphonline/standards-sdk 0.1.137 → 0.1.138
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/hcs-21/base-client.d.ts +31 -0
- package/dist/cjs/hcs-21/base-client.d.ts.map +1 -0
- package/dist/cjs/hcs-21/browser.d.ts +20 -0
- package/dist/cjs/hcs-21/browser.d.ts.map +1 -0
- package/dist/cjs/hcs-21/errors.d.ts +6 -0
- package/dist/cjs/hcs-21/errors.d.ts.map +1 -0
- package/dist/cjs/hcs-21/index.d.ts +7 -0
- package/dist/cjs/hcs-21/index.d.ts.map +1 -0
- package/dist/cjs/hcs-21/sdk.d.ts +48 -0
- package/dist/cjs/hcs-21/sdk.d.ts.map +1 -0
- package/dist/cjs/hcs-21/tx.d.ts +20 -0
- package/dist/cjs/hcs-21/tx.d.ts.map +1 -0
- package/dist/cjs/hcs-21/types.d.ts +72 -0
- package/dist/cjs/hcs-21/types.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
- package/dist/cjs/services/types.d.ts +1 -1
- package/dist/cjs/services/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/hcs-21/base-client.d.ts +31 -0
- package/dist/es/hcs-21/base-client.d.ts.map +1 -0
- package/dist/es/hcs-21/browser.d.ts +20 -0
- package/dist/es/hcs-21/browser.d.ts.map +1 -0
- package/dist/es/hcs-21/errors.d.ts +6 -0
- package/dist/es/hcs-21/errors.d.ts.map +1 -0
- package/dist/es/hcs-21/index.d.ts +7 -0
- package/dist/es/hcs-21/index.d.ts.map +1 -0
- package/dist/es/hcs-21/sdk.d.ts +48 -0
- package/dist/es/hcs-21/sdk.d.ts.map +1 -0
- package/dist/es/hcs-21/tx.d.ts +20 -0
- package/dist/es/hcs-21/tx.d.ts.map +1 -0
- package/dist/es/hcs-21/types.d.ts +72 -0
- package/dist/es/hcs-21/types.d.ts.map +1 -0
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client.d.ts.map +1 -1
- package/dist/es/services/types.d.ts +1 -1
- package/dist/es/services/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +66 -48
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es10.js +2 -2
- package/dist/es/standards-sdk.es100.js +231 -28
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +109 -18
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +32 -158
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +80 -204
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +21 -780
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +140 -11
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +29 -567
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +17 -597
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +159 -12
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +208 -2
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +774 -67
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +11 -37
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +567 -2
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +576 -197
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +12 -1139
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +2 -306
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +79 -418
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +35 -351
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +2 -761
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +204 -185
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +1055 -1482
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +265 -2024
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +420 -50
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +350 -82
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +741 -139
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +204 -7
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +1533 -52
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +2077 -59
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +52 -28
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +80 -131
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es130.js +152 -35
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +7 -17
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +53 -12241
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +65 -694
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +28 -172
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +115 -299
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +36 -340
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +55 -452
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +52 -319
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +694 -76
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +15 -54
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +12254 -44
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +175 -0
- package/dist/es/standards-sdk.es142.js.map +1 -0
- package/dist/es/standards-sdk.es143.js +325 -0
- package/dist/es/standards-sdk.es143.js.map +1 -0
- package/dist/es/standards-sdk.es144.js +349 -0
- package/dist/es/standards-sdk.es144.js.map +1 -0
- package/dist/es/standards-sdk.es145.js +456 -0
- package/dist/es/standards-sdk.es145.js.map +1 -0
- package/dist/es/standards-sdk.es146.js +334 -0
- package/dist/es/standards-sdk.es146.js.map +1 -0
- package/dist/es/standards-sdk.es147.js +79 -0
- package/dist/es/standards-sdk.es147.js.map +1 -0
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es16.js +1 -1
- package/dist/es/standards-sdk.es17.js +5 -5
- package/dist/es/standards-sdk.es19.js +12 -12
- package/dist/es/standards-sdk.es20.js +9 -9
- package/dist/es/standards-sdk.es21.js +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es26.js +1 -1
- package/dist/es/standards-sdk.es27.js +1 -1
- package/dist/es/standards-sdk.es28.js +12 -12
- package/dist/es/standards-sdk.es3.js +2 -2
- package/dist/es/standards-sdk.es31.js +2 -2
- package/dist/es/standards-sdk.es32.js +4 -4
- package/dist/es/standards-sdk.es33.js +1 -1
- package/dist/es/standards-sdk.es36.js +6 -6
- package/dist/es/standards-sdk.es37.js +4 -4
- package/dist/es/standards-sdk.es38.js +2 -2
- package/dist/es/standards-sdk.es39.js +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +1 -1
- package/dist/es/standards-sdk.es42.js +2 -2
- package/dist/es/standards-sdk.es47.js +1 -1
- package/dist/es/standards-sdk.es5.js +2 -2
- package/dist/es/standards-sdk.es52.js +1 -1
- package/dist/es/standards-sdk.es54.js +1 -1
- package/dist/es/standards-sdk.es57.js +2 -2
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es61.js +7 -7
- package/dist/es/standards-sdk.es63.js +1 -1
- package/dist/es/standards-sdk.es65.js +2 -2
- package/dist/es/standards-sdk.es66.js +3 -3
- package/dist/es/standards-sdk.es69.js +2 -2
- package/dist/es/standards-sdk.es7.js +2 -2
- package/dist/es/standards-sdk.es70.js +3 -3
- package/dist/es/standards-sdk.es71.js +2 -2
- package/dist/es/standards-sdk.es72.js +1 -1
- package/dist/es/standards-sdk.es75.js +2 -2
- package/dist/es/standards-sdk.es77.js +2 -2
- package/dist/es/standards-sdk.es78.js +4 -4
- package/dist/es/standards-sdk.es79.js +1 -1
- package/dist/es/standards-sdk.es8.js +1 -1
- package/dist/es/standards-sdk.es80.js +25 -27
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +6 -78
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +27 -64
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +67 -23
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +165 -23
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +31 -166
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +24 -127
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +65 -142
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +52 -127
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +26 -41
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +23 -261
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +162 -93
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +112 -83
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +156 -28
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +133 -225
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +40 -108
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +253 -24
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +96 -80
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +91 -21
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +28 -141
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,325 +1,141 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { AccountId, Client, PrivateKey } from "@hashgraph/sdk";
|
|
2
|
+
import { detectKeyTypeFromString } from "./standards-sdk.es113.js";
|
|
3
|
+
class NodeOperatorResolver {
|
|
4
|
+
constructor(params) {
|
|
5
|
+
this.mirror = params.mirrorNode;
|
|
6
|
+
this.logger = params.logger;
|
|
7
|
+
}
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
+
* Best-guess parsing for an operator key without network calls.
|
|
10
|
+
* - If PrivateKey: returns immediately with provided or fallback type.
|
|
11
|
+
* - If string with explicitType: parse directly.
|
|
12
|
+
* - If string without type: detect format; fallback to ECDSA.
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
bestGuessOperatorKey(operatorKeyInput, explicitType) {
|
|
15
|
+
if (typeof operatorKeyInput !== "string") {
|
|
16
|
+
return { keyType: explicitType || "ecdsa", privateKey: operatorKeyInput };
|
|
17
|
+
}
|
|
18
|
+
if (explicitType) {
|
|
19
|
+
const pk = explicitType === "ed25519" ? PrivateKey.fromStringED25519(operatorKeyInput) : PrivateKey.fromStringECDSA(operatorKeyInput);
|
|
20
|
+
return { keyType: explicitType, privateKey: pk };
|
|
21
|
+
}
|
|
11
22
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const signedTx = proto.SignedTransaction.decode(
|
|
23
|
-
tx.signedTransactionBytes
|
|
24
|
-
);
|
|
25
|
-
if (signedTx.bodyBytes) {
|
|
26
|
-
txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (txBody) {
|
|
30
|
-
const protoResult = this.parseFromProtobufTxBody(txBody);
|
|
31
|
-
if (protoResult.type && protoResult.type !== "UNKNOWN") {
|
|
32
|
-
return protoResult;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
} catch (protoError) {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return this.parseFromTransactionInternals(transaction);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return { type: "UNKNOWN", humanReadableType: "Unknown File Transaction" };
|
|
23
|
+
const detected = detectKeyTypeFromString(operatorKeyInput);
|
|
24
|
+
return {
|
|
25
|
+
keyType: detected.detectedType,
|
|
26
|
+
privateKey: detected.privateKey
|
|
27
|
+
};
|
|
28
|
+
} catch {
|
|
29
|
+
return {
|
|
30
|
+
keyType: "ecdsa",
|
|
31
|
+
privateKey: PrivateKey.fromStringECDSA(operatorKeyInput)
|
|
32
|
+
};
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
35
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
36
|
+
* Resolve an operator key using Mirror Node for key type when possible.
|
|
37
|
+
* - If PrivateKey: return immediately.
|
|
38
|
+
* - If explicitType: parse directly.
|
|
39
|
+
* - Else: query Mirror Node; fallback to local detection.
|
|
47
40
|
*/
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
if (fileCreate) {
|
|
52
|
-
return {
|
|
53
|
-
type: "FILECREATE",
|
|
54
|
-
humanReadableType: "File Create",
|
|
55
|
-
fileCreate
|
|
56
|
-
};
|
|
57
|
-
}
|
|
41
|
+
async resolveOperatorKey(operatorId, operatorKeyInput, explicitType) {
|
|
42
|
+
if (typeof operatorKeyInput !== "string") {
|
|
43
|
+
return { keyType: explicitType || "ecdsa", privateKey: operatorKeyInput };
|
|
58
44
|
}
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
type: "FILEAPPEND",
|
|
64
|
-
humanReadableType: "File Append",
|
|
65
|
-
fileAppend
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (txBody.fileUpdate) {
|
|
70
|
-
const fileUpdate = this.parseFileUpdate(txBody.fileUpdate);
|
|
71
|
-
if (fileUpdate) {
|
|
72
|
-
return {
|
|
73
|
-
type: "FILEUPDATE",
|
|
74
|
-
humanReadableType: "File Update",
|
|
75
|
-
fileUpdate
|
|
76
|
-
};
|
|
77
|
-
}
|
|
45
|
+
if (explicitType) {
|
|
46
|
+
const pk = explicitType === "ed25519" ? PrivateKey.fromStringED25519(operatorKeyInput) : PrivateKey.fromStringECDSA(operatorKeyInput);
|
|
47
|
+
return { keyType: explicitType, privateKey: pk };
|
|
78
48
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
49
|
+
const account = typeof operatorId === "string" ? operatorId : operatorId.toString();
|
|
50
|
+
try {
|
|
51
|
+
const info = await this.mirror.requestAccount(account);
|
|
52
|
+
const t = info?.key?._type || "";
|
|
53
|
+
const keyType = t.includes("ED25519") ? "ed25519" : "ecdsa";
|
|
54
|
+
const privateKey = keyType === "ed25519" ? PrivateKey.fromStringED25519(operatorKeyInput) : PrivateKey.fromStringECDSA(operatorKeyInput);
|
|
55
|
+
return { keyType, privateKey };
|
|
56
|
+
} catch {
|
|
57
|
+
this.logger.warn(
|
|
58
|
+
"Mirror node key detection failed; using local detection or default ECDSA"
|
|
59
|
+
);
|
|
60
|
+
return this.bestGuessOperatorKey(operatorKeyInput);
|
|
88
61
|
}
|
|
89
|
-
return {};
|
|
90
62
|
}
|
|
91
63
|
/**
|
|
92
|
-
*
|
|
93
|
-
* This handles cases where data is stored in Transaction object internals
|
|
64
|
+
* Resolve a supply key for the given token using Mirror Node token supply_key._type when possible.
|
|
94
65
|
*/
|
|
95
|
-
|
|
66
|
+
async resolveSupplyKey(tokenId, keyInput, fallbackType, explicitType) {
|
|
96
67
|
try {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const contentInfo = this.analyzeContent(tx._contents);
|
|
102
|
-
fileCreate.contents = contentInfo.encoded;
|
|
103
|
-
if (contentInfo.contentType) {
|
|
104
|
-
fileCreate.contentType = contentInfo.contentType;
|
|
105
|
-
}
|
|
106
|
-
if (contentInfo.size) {
|
|
107
|
-
fileCreate.contentSize = contentInfo.size;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (tx._keys && tx._keys.length > 0) {
|
|
111
|
-
const keyList = {
|
|
112
|
-
keys: tx._keys
|
|
113
|
-
};
|
|
114
|
-
fileCreate.keys = parseKey({ keyList });
|
|
115
|
-
}
|
|
116
|
-
if (tx._expirationTime) {
|
|
117
|
-
fileCreate.expirationTime = tx._expirationTime.toString();
|
|
118
|
-
}
|
|
119
|
-
if (tx._memo) {
|
|
120
|
-
fileCreate.memo = tx._memo;
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
type: "FILECREATE",
|
|
124
|
-
humanReadableType: "File Create",
|
|
125
|
-
fileCreate
|
|
126
|
-
};
|
|
68
|
+
const info = await this.mirror.getTokenInfo(tokenId);
|
|
69
|
+
const t = info?.supply_key?._type || "";
|
|
70
|
+
if (typeof keyInput !== "string") {
|
|
71
|
+
return keyInput;
|
|
127
72
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
fileId: tx._fileId.toString()
|
|
131
|
-
};
|
|
132
|
-
if (tx._contents) {
|
|
133
|
-
const contentInfo = this.analyzeContent(tx._contents);
|
|
134
|
-
fileAppend.contents = contentInfo.encoded;
|
|
135
|
-
if (contentInfo.size) {
|
|
136
|
-
fileAppend.contentSize = contentInfo.size;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
type: "FILEAPPEND",
|
|
141
|
-
humanReadableType: "File Append",
|
|
142
|
-
fileAppend
|
|
143
|
-
};
|
|
73
|
+
if (explicitType) {
|
|
74
|
+
return explicitType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
|
|
144
75
|
}
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
fileId: tx._fileId.toString()
|
|
148
|
-
};
|
|
149
|
-
if (tx._contents) {
|
|
150
|
-
const contentInfo = this.analyzeContent(tx._contents);
|
|
151
|
-
fileUpdate.contents = contentInfo.encoded;
|
|
152
|
-
if (contentInfo.size) {
|
|
153
|
-
fileUpdate.contentSize = contentInfo.size;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (tx._keys && tx._keys.length > 0) {
|
|
157
|
-
const keyList = {
|
|
158
|
-
keys: tx._keys
|
|
159
|
-
};
|
|
160
|
-
fileUpdate.keys = parseKey({ keyList });
|
|
161
|
-
}
|
|
162
|
-
if (tx._expirationTime) {
|
|
163
|
-
fileUpdate.expirationTime = tx._expirationTime.toString();
|
|
164
|
-
}
|
|
165
|
-
if (tx._memo) {
|
|
166
|
-
fileUpdate.memo = tx._memo;
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
type: "FILEUPDATE",
|
|
170
|
-
humanReadableType: "File Update",
|
|
171
|
-
fileUpdate
|
|
172
|
-
};
|
|
76
|
+
if (t.includes("ED25519")) {
|
|
77
|
+
return PrivateKey.fromStringED25519(keyInput);
|
|
173
78
|
}
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
fileId: tx._fileId.toString()
|
|
177
|
-
};
|
|
178
|
-
return {
|
|
179
|
-
type: "FILEDELETE",
|
|
180
|
-
humanReadableType: "File Delete",
|
|
181
|
-
fileDelete
|
|
182
|
-
};
|
|
79
|
+
if (t.includes("ECDSA")) {
|
|
80
|
+
return PrivateKey.fromStringECDSA(keyInput);
|
|
183
81
|
}
|
|
184
|
-
return
|
|
185
|
-
} catch
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Enhanced content analysis with type detection and metadata
|
|
191
|
-
*/
|
|
192
|
-
static analyzeContent(contents) {
|
|
193
|
-
const size = contents.length;
|
|
194
|
-
const contentBuffer = Buffer.from(contents);
|
|
195
|
-
let contentType;
|
|
196
|
-
if (size >= 4) {
|
|
197
|
-
const header = contentBuffer.subarray(0, 4);
|
|
198
|
-
const headerHex = header.toString("hex");
|
|
199
|
-
const signatures = {
|
|
200
|
-
"89504e47": "image/png",
|
|
201
|
-
ffd8ffe0: "image/jpeg",
|
|
202
|
-
ffd8ffe1: "image/jpeg",
|
|
203
|
-
"47494638": "image/gif",
|
|
204
|
-
"25504446": "application/pdf",
|
|
205
|
-
"504b0304": "application/zip",
|
|
206
|
-
"7f454c46": "application/x-executable",
|
|
207
|
-
d0cf11e0: "application/msoffice"
|
|
208
|
-
};
|
|
209
|
-
contentType = signatures[headerHex.toLowerCase()];
|
|
210
|
-
}
|
|
211
|
-
if (!contentType) {
|
|
212
|
-
try {
|
|
213
|
-
const textContent = contentBuffer.toString("utf8");
|
|
214
|
-
const hasControlChars = /[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(
|
|
215
|
-
textContent
|
|
216
|
-
);
|
|
217
|
-
const hasReplacementChars = textContent.includes("�");
|
|
218
|
-
if (!hasControlChars && !hasReplacementChars) {
|
|
219
|
-
if (textContent.trim().startsWith("{") && textContent.trim().endsWith("}")) {
|
|
220
|
-
contentType = "application/json";
|
|
221
|
-
} else if (textContent.includes("<?xml") || textContent.includes("<html")) {
|
|
222
|
-
contentType = "text/xml";
|
|
223
|
-
} else if (textContent.includes("<!DOCTYPE html")) {
|
|
224
|
-
contentType = "text/html";
|
|
225
|
-
} else {
|
|
226
|
-
contentType = "text/plain";
|
|
227
|
-
}
|
|
228
|
-
} else {
|
|
229
|
-
contentType = "application/octet-stream";
|
|
230
|
-
}
|
|
231
|
-
} catch {
|
|
232
|
-
contentType = "application/octet-stream";
|
|
82
|
+
return fallbackType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
|
|
83
|
+
} catch {
|
|
84
|
+
if (typeof keyInput !== "string") {
|
|
85
|
+
return keyInput;
|
|
233
86
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (contentType?.startsWith("text/") || contentType === "application/json") {
|
|
237
|
-
try {
|
|
238
|
-
encoded = contentBuffer.toString("utf8");
|
|
239
|
-
if (encoded.includes("�") || /[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(encoded)) {
|
|
240
|
-
encoded = contentBuffer.toString("base64");
|
|
241
|
-
}
|
|
242
|
-
} catch {
|
|
243
|
-
encoded = contentBuffer.toString("base64");
|
|
87
|
+
if (explicitType) {
|
|
88
|
+
return explicitType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
|
|
244
89
|
}
|
|
245
|
-
|
|
246
|
-
encoded = contentBuffer.toString("base64");
|
|
247
|
-
}
|
|
248
|
-
return {
|
|
249
|
-
encoded,
|
|
250
|
-
contentType,
|
|
251
|
-
size
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
static parseFileCreate(body) {
|
|
255
|
-
if (!body) return void 0;
|
|
256
|
-
const data = {};
|
|
257
|
-
if (body.expirationTime?.seconds) {
|
|
258
|
-
data.expirationTime = `${Long.fromValue(
|
|
259
|
-
body.expirationTime.seconds
|
|
260
|
-
).toString()}.${body.expirationTime.nanos}`;
|
|
261
|
-
}
|
|
262
|
-
if (body.keys) {
|
|
263
|
-
data.keys = parseKey({ keyList: body.keys });
|
|
264
|
-
}
|
|
265
|
-
if (body.contents) {
|
|
266
|
-
data.contents = Buffer.from(body.contents).toString("base64");
|
|
267
|
-
}
|
|
268
|
-
if (body.memo) {
|
|
269
|
-
data.memo = body.memo;
|
|
270
|
-
}
|
|
271
|
-
return data;
|
|
272
|
-
}
|
|
273
|
-
static parseFileAppend(body) {
|
|
274
|
-
if (!body) return void 0;
|
|
275
|
-
const data = {};
|
|
276
|
-
if (body.fileID) {
|
|
277
|
-
data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
|
|
278
|
-
}
|
|
279
|
-
if (body.contents) {
|
|
280
|
-
data.contents = Buffer.from(body.contents).toString("base64");
|
|
281
|
-
}
|
|
282
|
-
return data;
|
|
283
|
-
}
|
|
284
|
-
static parseFileUpdate(body) {
|
|
285
|
-
if (!body) return void 0;
|
|
286
|
-
const data = {};
|
|
287
|
-
if (body.fileID) {
|
|
288
|
-
data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
|
|
289
|
-
}
|
|
290
|
-
if (body.expirationTime?.seconds) {
|
|
291
|
-
data.expirationTime = `${Long.fromValue(
|
|
292
|
-
body.expirationTime.seconds
|
|
293
|
-
).toString()}.${body.expirationTime.nanos}`;
|
|
90
|
+
return fallbackType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
|
|
294
91
|
}
|
|
295
|
-
if (body.keys) {
|
|
296
|
-
data.keys = parseKey({ keyList: body.keys });
|
|
297
|
-
}
|
|
298
|
-
if (body.contents) {
|
|
299
|
-
data.contents = Buffer.from(body.contents).toString("base64");
|
|
300
|
-
}
|
|
301
|
-
if (body.memo?.value !== void 0) {
|
|
302
|
-
data.memo = body.memo.value;
|
|
303
|
-
}
|
|
304
|
-
return data;
|
|
305
|
-
}
|
|
306
|
-
static parseFileDelete(body) {
|
|
307
|
-
if (!body) return void 0;
|
|
308
|
-
const data = {};
|
|
309
|
-
if (body.fileID) {
|
|
310
|
-
data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
|
|
311
|
-
}
|
|
312
|
-
return data;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Parse File Service transaction from Transaction object
|
|
316
|
-
* This is the unified entry point that delegates to the comprehensive parsing logic
|
|
317
|
-
*/
|
|
318
|
-
static parseFromTransactionObject(transaction) {
|
|
319
|
-
return this.parseFileTransaction(transaction);
|
|
320
92
|
}
|
|
321
93
|
}
|
|
94
|
+
function createNodeOperatorContext(params) {
|
|
95
|
+
const operatorId = typeof params.operatorId === "string" ? AccountId.fromString(params.operatorId) : params.operatorId;
|
|
96
|
+
const client = params.client ? params.client : params.network === "mainnet" ? Client.forMainnet() : Client.forTestnet();
|
|
97
|
+
const resolver = new NodeOperatorResolver({
|
|
98
|
+
mirrorNode: params.mirrorNode,
|
|
99
|
+
logger: params.logger
|
|
100
|
+
});
|
|
101
|
+
let currentKeyType;
|
|
102
|
+
let currentPrivateKey;
|
|
103
|
+
const guess = resolver.bestGuessOperatorKey(
|
|
104
|
+
params.operatorKey,
|
|
105
|
+
params.keyType
|
|
106
|
+
);
|
|
107
|
+
currentKeyType = guess.keyType;
|
|
108
|
+
currentPrivateKey = guess.privateKey;
|
|
109
|
+
client.setOperator(operatorId.toString(), currentPrivateKey);
|
|
110
|
+
const initPromise = (async () => {
|
|
111
|
+
try {
|
|
112
|
+
const resolved = await resolver.resolveOperatorKey(
|
|
113
|
+
operatorId,
|
|
114
|
+
params.operatorKey,
|
|
115
|
+
params.keyType
|
|
116
|
+
);
|
|
117
|
+
currentKeyType = resolved.keyType;
|
|
118
|
+
currentPrivateKey = resolved.privateKey;
|
|
119
|
+
client.setOperator(operatorId.toString(), currentPrivateKey);
|
|
120
|
+
} catch {
|
|
121
|
+
}
|
|
122
|
+
})();
|
|
123
|
+
return {
|
|
124
|
+
client,
|
|
125
|
+
operatorId,
|
|
126
|
+
get operatorKey() {
|
|
127
|
+
return currentPrivateKey;
|
|
128
|
+
},
|
|
129
|
+
get keyType() {
|
|
130
|
+
return currentKeyType;
|
|
131
|
+
},
|
|
132
|
+
ensureInitialized: async () => {
|
|
133
|
+
await initPromise;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
322
137
|
export {
|
|
323
|
-
|
|
138
|
+
NodeOperatorResolver,
|
|
139
|
+
createNodeOperatorContext
|
|
324
140
|
};
|
|
325
141
|
//# sourceMappingURL=standards-sdk.es135.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es135.js","sources":["../../src/utils/parsers/file-parser.ts"],"sourcesContent":["import { proto } from '@hashgraph/proto';\nimport { Long, Transaction } from '@hashgraph/sdk';\nimport {\n FileCreateData,\n FileAppendData,\n FileUpdateData,\n FileDeleteData,\n} from '../transaction-parser-types';\nimport {\n parseKey,\n extractTransactionBody,\n hasTransactionType,\n} from './parser-utils';\nimport { Buffer } from 'buffer';\nimport { FileId } from '@hashgraph/sdk';\n\n/**\n * File Service Parser\n *\n * Handles parsing for all file-related transaction types including:\n * - File creation, updates, append, and deletion\n * - Proper dual-branch parsing (regular vs signed transactions)\n * - Comprehensive protobuf extraction\n * - Enhanced content handling with type detection\n */\nexport class FileParser {\n /**\n * Parse File Service transaction using unified dual-branch approach\n * This handles both regular transactions and signed transaction variants\n */\n static parseFileTransaction(\n transaction: Transaction,\n originalBytes?: Uint8Array,\n ): {\n type?: string;\n humanReadableType?: string;\n fileCreate?: FileCreateData;\n fileAppend?: FileAppendData;\n fileUpdate?: FileUpdateData;\n fileDelete?: FileDeleteData;\n [key: string]: unknown;\n } {\n try {\n if (originalBytes || transaction.toBytes) {\n try {\n const bytesToParse = originalBytes || transaction.toBytes();\n const decoded = proto.TransactionList.decode(bytesToParse);\n\n if (decoded.transactionList && decoded.transactionList.length > 0) {\n const tx = decoded.transactionList[0];\n let txBody: proto.ITransactionBody | null = null;\n\n if (tx.bodyBytes && tx.bodyBytes.length > 0) {\n txBody = proto.TransactionBody.decode(tx.bodyBytes);\n } else if (\n tx.signedTransactionBytes &&\n tx.signedTransactionBytes.length > 0\n ) {\n const signedTx = proto.SignedTransaction.decode(\n tx.signedTransactionBytes,\n );\n if (signedTx.bodyBytes) {\n txBody = proto.TransactionBody.decode(signedTx.bodyBytes);\n }\n }\n\n if (txBody) {\n const protoResult = this.parseFromProtobufTxBody(txBody);\n if (protoResult.type && protoResult.type !== 'UNKNOWN') {\n return protoResult;\n }\n }\n }\n } catch (protoError) {}\n }\n\n return this.parseFromTransactionInternals(transaction);\n } catch (error) {\n return { type: 'UNKNOWN', humanReadableType: 'Unknown File Transaction' };\n }\n }\n\n /**\n * Parse file transaction from protobuf TransactionBody\n * Handles all file operations from decoded protobuf data\n */\n private static parseFromProtobufTxBody(txBody: proto.ITransactionBody): {\n type?: string;\n humanReadableType?: string;\n [key: string]: unknown;\n } {\n if (txBody.fileCreate) {\n const fileCreate = this.parseFileCreate(txBody.fileCreate);\n if (fileCreate) {\n return {\n type: 'FILECREATE',\n humanReadableType: 'File Create',\n fileCreate,\n };\n }\n }\n\n if (txBody.fileAppend) {\n const fileAppend = this.parseFileAppend(txBody.fileAppend);\n if (fileAppend) {\n return {\n type: 'FILEAPPEND',\n humanReadableType: 'File Append',\n fileAppend,\n };\n }\n }\n\n if (txBody.fileUpdate) {\n const fileUpdate = this.parseFileUpdate(txBody.fileUpdate);\n if (fileUpdate) {\n return {\n type: 'FILEUPDATE',\n humanReadableType: 'File Update',\n fileUpdate,\n };\n }\n }\n\n if (txBody.fileDelete) {\n const fileDelete = this.parseFileDelete(txBody.fileDelete);\n if (fileDelete) {\n return {\n type: 'FILEDELETE',\n humanReadableType: 'File Delete',\n fileDelete,\n };\n }\n }\n\n return {};\n }\n\n /**\n * Extract file data from Transaction internal fields\n * This handles cases where data is stored in Transaction object internals\n */\n private static parseFromTransactionInternals(transaction: Transaction): {\n type?: string;\n humanReadableType?: string;\n [key: string]: unknown;\n } {\n try {\n const tx = transaction as unknown as {\n _fileId?: { toString(): string };\n _contents?: Uint8Array;\n _keys?: unknown[];\n _expirationTime?: { toString(): string };\n _memo?: string;\n constructor?: { name?: string };\n };\n\n if (hasTransactionType(transaction, 'fileCreate')) {\n const fileCreate: FileCreateData = {};\n\n if (tx._contents) {\n const contentInfo = this.analyzeContent(tx._contents);\n fileCreate.contents = contentInfo.encoded;\n if (contentInfo.contentType) {\n fileCreate.contentType = contentInfo.contentType;\n }\n if (contentInfo.size) {\n fileCreate.contentSize = contentInfo.size;\n }\n }\n\n if (tx._keys && tx._keys.length > 0) {\n const keyList: proto.IKeyList = {\n keys: tx._keys as unknown as proto.IKey[],\n };\n fileCreate.keys = parseKey({ keyList });\n }\n\n if (tx._expirationTime) {\n fileCreate.expirationTime = tx._expirationTime.toString();\n }\n\n if (tx._memo) {\n fileCreate.memo = tx._memo;\n }\n\n return {\n type: 'FILECREATE',\n humanReadableType: 'File Create',\n fileCreate,\n };\n }\n\n if (hasTransactionType(transaction, 'fileAppend')) {\n const fileAppend: FileAppendData = {\n fileId: tx._fileId.toString(),\n };\n\n if (tx._contents) {\n const contentInfo = this.analyzeContent(tx._contents);\n fileAppend.contents = contentInfo.encoded;\n if (contentInfo.size) {\n fileAppend.contentSize = contentInfo.size;\n }\n }\n\n return {\n type: 'FILEAPPEND',\n humanReadableType: 'File Append',\n fileAppend,\n };\n }\n\n if (hasTransactionType(transaction, 'fileUpdate')) {\n const fileUpdate: FileUpdateData = {\n fileId: tx._fileId.toString(),\n };\n\n if (tx._contents) {\n const contentInfo = this.analyzeContent(tx._contents);\n fileUpdate.contents = contentInfo.encoded;\n if (contentInfo.size) {\n fileUpdate.contentSize = contentInfo.size;\n }\n }\n\n if (tx._keys && tx._keys.length > 0) {\n const keyList: proto.IKeyList = {\n keys: tx._keys as unknown as proto.IKey[],\n };\n fileUpdate.keys = parseKey({ keyList });\n }\n\n if (tx._expirationTime) {\n fileUpdate.expirationTime = tx._expirationTime.toString();\n }\n\n if (tx._memo) {\n fileUpdate.memo = tx._memo;\n }\n\n return {\n type: 'FILEUPDATE',\n humanReadableType: 'File Update',\n fileUpdate,\n };\n }\n\n if (hasTransactionType(transaction, 'fileDelete')) {\n const fileDelete: FileDeleteData = {\n fileId: tx._fileId.toString(),\n };\n\n return {\n type: 'FILEDELETE',\n humanReadableType: 'File Delete',\n fileDelete,\n };\n }\n\n return {};\n } catch (error) {\n return {};\n }\n }\n\n /**\n * Enhanced content analysis with type detection and metadata\n */\n private static analyzeContent(contents: Uint8Array): {\n encoded: string;\n contentType?: string;\n size: number;\n } {\n const size = contents.length;\n const contentBuffer = Buffer.from(contents);\n\n let contentType: string | undefined;\n\n if (size >= 4) {\n const header = contentBuffer.subarray(0, 4);\n const headerHex = header.toString('hex');\n\n const signatures: Record<string, string> = {\n '89504e47': 'image/png',\n ffd8ffe0: 'image/jpeg',\n ffd8ffe1: 'image/jpeg',\n '47494638': 'image/gif',\n '25504446': 'application/pdf',\n '504b0304': 'application/zip',\n '7f454c46': 'application/x-executable',\n d0cf11e0: 'application/msoffice',\n };\n\n contentType = signatures[headerHex.toLowerCase()];\n }\n\n if (!contentType) {\n try {\n const textContent = contentBuffer.toString('utf8');\n const hasControlChars = /[\\x00-\\x08\\x0B\\x0E-\\x1F\\x7F]/.test(\n textContent,\n );\n const hasReplacementChars = textContent.includes('\\uFFFD');\n\n if (!hasControlChars && !hasReplacementChars) {\n if (\n textContent.trim().startsWith('{') &&\n textContent.trim().endsWith('}')\n ) {\n contentType = 'application/json';\n } else if (\n textContent.includes('<?xml') ||\n textContent.includes('<html')\n ) {\n contentType = 'text/xml';\n } else if (textContent.includes('<!DOCTYPE html')) {\n contentType = 'text/html';\n } else {\n contentType = 'text/plain';\n }\n } else {\n contentType = 'application/octet-stream';\n }\n } catch {\n contentType = 'application/octet-stream';\n }\n }\n\n let encoded: string;\n if (\n contentType?.startsWith('text/') ||\n contentType === 'application/json'\n ) {\n try {\n encoded = contentBuffer.toString('utf8');\n if (\n encoded.includes('\\uFFFD') ||\n /[\\x00-\\x08\\x0B\\x0E-\\x1F\\x7F]/.test(encoded)\n ) {\n encoded = contentBuffer.toString('base64');\n }\n } catch {\n encoded = contentBuffer.toString('base64');\n }\n } else {\n encoded = contentBuffer.toString('base64');\n }\n\n return {\n encoded,\n contentType,\n size,\n };\n }\n static parseFileCreate(\n body: proto.IFileCreateTransactionBody,\n ): FileCreateData | undefined {\n if (!body) return undefined;\n const data: FileCreateData = {};\n if (body.expirationTime?.seconds) {\n data.expirationTime = `${Long.fromValue(\n body.expirationTime.seconds,\n ).toString()}.${body.expirationTime.nanos}`;\n }\n if (body.keys) {\n data.keys = parseKey({ keyList: body.keys });\n }\n if (body.contents) {\n data.contents = Buffer.from(body.contents).toString('base64');\n }\n if (body.memo) {\n data.memo = body.memo;\n }\n return data;\n }\n\n static parseFileAppend(\n body: proto.IFileAppendTransactionBody,\n ): FileAppendData | undefined {\n if (!body) return undefined;\n const data: FileAppendData = {};\n if (body.fileID) {\n data.fileId = `${body.fileID.shardNum ?? 0}.${\n body.fileID.realmNum ?? 0\n }.${body.fileID.fileNum ?? 0}`;\n }\n if (body.contents) {\n data.contents = Buffer.from(body.contents).toString('base64');\n }\n return data;\n }\n\n static parseFileUpdate(\n body: proto.IFileUpdateTransactionBody,\n ): FileUpdateData | undefined {\n if (!body) return undefined;\n const data: FileUpdateData = {};\n if (body.fileID) {\n data.fileId = `${body.fileID.shardNum ?? 0}.${\n body.fileID.realmNum ?? 0\n }.${body.fileID.fileNum ?? 0}`;\n }\n if (body.expirationTime?.seconds) {\n data.expirationTime = `${Long.fromValue(\n body.expirationTime.seconds,\n ).toString()}.${body.expirationTime.nanos}`;\n }\n if (body.keys) {\n data.keys = parseKey({ keyList: body.keys });\n }\n if (body.contents) {\n data.contents = Buffer.from(body.contents).toString('base64');\n }\n if (body.memo?.value !== undefined) {\n data.memo = body.memo.value;\n }\n return data;\n }\n\n static parseFileDelete(\n body: proto.IFileDeleteTransactionBody,\n ): FileDeleteData | undefined {\n if (!body) return undefined;\n const data: FileDeleteData = {};\n if (body.fileID) {\n data.fileId = `${body.fileID.shardNum ?? 0}.${\n body.fileID.realmNum ?? 0\n }.${body.fileID.fileNum ?? 0}`;\n }\n return data;\n }\n\n /**\n * Parse File Service transaction from Transaction object\n * This is the unified entry point that delegates to the comprehensive parsing logic\n */\n static parseFromTransactionObject(transaction: Transaction): {\n type?: string;\n humanReadableType?: string;\n [key: string]: unknown;\n } {\n return this.parseFileTransaction(transaction);\n }\n}\n"],"names":[],"mappings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MAC4B;AAC5B,QAAI,CAAC,KAAM,QAAO;AAClB,UAAM,OAAuB,CAAA;AAC7B,QAAI,KAAK,QAAQ;AACf,WAAK,SAAS,GAAG,KAAK,OAAO,YAAY,CAAC,IACxC,KAAK,OAAO,YAAY,CAC1B,IAAI,KAAK,OAAO,WAAW,CAAC;AAAA,IAC9B;AACA,QAAI,KAAK,gBAAgB,SAAS;AAChC,WAAK,iBAAiB,GAAG,KAAK;AAAA,QAC5B,KAAK,eAAe;AAAA,MAAA,EACpB,SAAA,CAAU,IAAI,KAAK,eAAe,KAAK;AAAA,IAC3C;AACA,QAAI,KAAK,MAAM;AACb,WAAK,OAAO,SAAS,EAAE,SAAS,KAAK,MAAM;AAAA,IAC7C;AACA,QAAI,KAAK,UAAU;AACjB,WAAK,WAAW,OAAO,KAAK,KAAK,QAAQ,EAAE,SAAS,QAAQ;AAAA,IAC9D;AACA,QAAI,KAAK,MAAM,UAAU,QAAW;AAClC,WAAK,OAAO,KAAK,KAAK;AAAA,IACxB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,gBACL,MAC4B;AAC5B,QAAI,CAAC,KAAM,QAAO;AAClB,UAAM,OAAuB,CAAA;AAC7B,QAAI,KAAK,QAAQ;AACf,WAAK,SAAS,GAAG,KAAK,OAAO,YAAY,CAAC,IACxC,KAAK,OAAO,YAAY,CAC1B,IAAI,KAAK,OAAO,WAAW,CAAC;AAAA,IAC9B;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,2BAA2B,aAIhC;AACA,WAAO,KAAK,qBAAqB,WAAW;AAAA,EAC9C;AACF;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es135.js","sources":["../../src/common/node-operator-resolver.ts"],"sourcesContent":["import { AccountId, Client, PrivateKey } from '@hashgraph/sdk';\nimport { HederaMirrorNode } from '../services/mirror-node';\nimport { ILogger } from '../utils/logger';\nimport { detectKeyTypeFromString } from '../utils/key-type-detector';\nimport { NetworkType } from '../utils/types';\n\n/**\n * Resolves operator and supply private keys using Mirror Node as source of truth\n * with format-detection fallbacks for string keys.\n */\nexport class NodeOperatorResolver {\n private readonly mirror: HederaMirrorNode;\n private readonly logger: ILogger;\n\n constructor(params: { mirrorNode: HederaMirrorNode; logger: ILogger }) {\n this.mirror = params.mirrorNode;\n this.logger = params.logger;\n }\n\n /**\n * Best-guess parsing for an operator key without network calls.\n * - If PrivateKey: returns immediately with provided or fallback type.\n * - If string with explicitType: parse directly.\n * - If string without type: detect format; fallback to ECDSA.\n */\n bestGuessOperatorKey(\n operatorKeyInput: string | PrivateKey,\n explicitType?: 'ed25519' | 'ecdsa',\n ): { keyType: 'ed25519' | 'ecdsa'; privateKey: PrivateKey } {\n if (typeof operatorKeyInput !== 'string') {\n return { keyType: explicitType || 'ecdsa', privateKey: operatorKeyInput };\n }\n if (explicitType) {\n const pk =\n explicitType === 'ed25519'\n ? PrivateKey.fromStringED25519(operatorKeyInput)\n : PrivateKey.fromStringECDSA(operatorKeyInput);\n return { keyType: explicitType, privateKey: pk };\n }\n try {\n const detected = detectKeyTypeFromString(operatorKeyInput);\n return {\n keyType: detected.detectedType,\n privateKey: detected.privateKey,\n };\n } catch {\n return {\n keyType: 'ecdsa',\n privateKey: PrivateKey.fromStringECDSA(operatorKeyInput),\n };\n }\n }\n\n /**\n * Resolve an operator key using Mirror Node for key type when possible.\n * - If PrivateKey: return immediately.\n * - If explicitType: parse directly.\n * - Else: query Mirror Node; fallback to local detection.\n */\n async resolveOperatorKey(\n operatorId: string | AccountId,\n operatorKeyInput: string | PrivateKey,\n explicitType?: 'ed25519' | 'ecdsa',\n ): Promise<{ keyType: 'ed25519' | 'ecdsa'; privateKey: PrivateKey }> {\n if (typeof operatorKeyInput !== 'string') {\n return { keyType: explicitType || 'ecdsa', privateKey: operatorKeyInput };\n }\n if (explicitType) {\n const pk =\n explicitType === 'ed25519'\n ? PrivateKey.fromStringED25519(operatorKeyInput)\n : PrivateKey.fromStringECDSA(operatorKeyInput);\n return { keyType: explicitType, privateKey: pk };\n }\n const account =\n typeof operatorId === 'string' ? operatorId : operatorId.toString();\n try {\n const info = await this.mirror.requestAccount(account);\n const t = info?.key?._type || '';\n const keyType: 'ed25519' | 'ecdsa' = t.includes('ED25519')\n ? 'ed25519'\n : 'ecdsa';\n const privateKey =\n keyType === 'ed25519'\n ? PrivateKey.fromStringED25519(operatorKeyInput)\n : PrivateKey.fromStringECDSA(operatorKeyInput);\n return { keyType, privateKey };\n } catch {\n this.logger.warn(\n 'Mirror node key detection failed; using local detection or default ECDSA',\n );\n return this.bestGuessOperatorKey(operatorKeyInput);\n }\n }\n\n /**\n * Resolve a supply key for the given token using Mirror Node token supply_key._type when possible.\n */\n async resolveSupplyKey(\n tokenId: string,\n keyInput: string | PrivateKey,\n fallbackType: 'ed25519' | 'ecdsa',\n explicitType?: 'ed25519' | 'ecdsa',\n ): Promise<PrivateKey> {\n try {\n const info = await this.mirror.getTokenInfo(tokenId);\n const t = info?.supply_key?._type || '';\n if (typeof keyInput !== 'string') {\n return keyInput;\n }\n if (explicitType) {\n return explicitType === 'ed25519'\n ? PrivateKey.fromStringED25519(keyInput)\n : PrivateKey.fromStringECDSA(keyInput);\n }\n if (t.includes('ED25519')) {\n return PrivateKey.fromStringED25519(keyInput);\n }\n if (t.includes('ECDSA')) {\n return PrivateKey.fromStringECDSA(keyInput);\n }\n return fallbackType === 'ed25519'\n ? PrivateKey.fromStringED25519(keyInput)\n : PrivateKey.fromStringECDSA(keyInput);\n } catch {\n if (typeof keyInput !== 'string') {\n return keyInput;\n }\n if (explicitType) {\n return explicitType === 'ed25519'\n ? PrivateKey.fromStringED25519(keyInput)\n : PrivateKey.fromStringECDSA(keyInput);\n }\n return fallbackType === 'ed25519'\n ? PrivateKey.fromStringED25519(keyInput)\n : PrivateKey.fromStringECDSA(keyInput);\n }\n }\n}\n\nexport interface NodeOperatorInitParams {\n network: NetworkType;\n operatorId: string | AccountId;\n operatorKey: string | PrivateKey;\n keyType?: 'ed25519' | 'ecdsa';\n mirrorNode: HederaMirrorNode;\n logger: ILogger;\n client?: Client;\n}\n\nexport interface NodeOperatorContext {\n client: Client;\n operatorId: AccountId;\n readonly operatorKey: PrivateKey;\n readonly keyType: 'ed25519' | 'ecdsa';\n ensureInitialized(): Promise<void>;\n}\n\nexport function createNodeOperatorContext(\n params: NodeOperatorInitParams,\n): NodeOperatorContext {\n const operatorId: AccountId =\n typeof params.operatorId === 'string'\n ? AccountId.fromString(params.operatorId)\n : params.operatorId;\n\n const client: Client = params.client\n ? params.client\n : params.network === 'mainnet'\n ? Client.forMainnet()\n : Client.forTestnet();\n\n const resolver = new NodeOperatorResolver({\n mirrorNode: params.mirrorNode,\n logger: params.logger,\n });\n\n let currentKeyType: 'ed25519' | 'ecdsa';\n let currentPrivateKey: PrivateKey;\n\n const guess = resolver.bestGuessOperatorKey(\n params.operatorKey,\n params.keyType,\n );\n currentKeyType = guess.keyType;\n currentPrivateKey = guess.privateKey;\n client.setOperator(operatorId.toString(), currentPrivateKey);\n\n const initPromise = (async () => {\n try {\n const resolved = await resolver.resolveOperatorKey(\n operatorId,\n params.operatorKey,\n params.keyType,\n );\n currentKeyType = resolved.keyType;\n currentPrivateKey = resolved.privateKey;\n client.setOperator(operatorId.toString(), currentPrivateKey);\n } catch {}\n })();\n\n return {\n client,\n operatorId,\n get operatorKey() {\n return currentPrivateKey;\n },\n get keyType() {\n return currentKeyType;\n },\n ensureInitialized: async () => {\n await initPromise;\n },\n };\n}\n"],"names":[],"mappings":";;AAUO,MAAM,qBAAqB;AAAA,EAIhC,YAAY,QAA2D;AACrE,SAAK,SAAS,OAAO;AACrB,SAAK,SAAS,OAAO;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,qBACE,kBACA,cAC0D;AAC1D,QAAI,OAAO,qBAAqB,UAAU;AACxC,aAAO,EAAE,SAAS,gBAAgB,SAAS,YAAY,iBAAA;AAAA,IACzD;AACA,QAAI,cAAc;AA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