@hashgraphonline/standards-sdk 0.0.82 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/hcs-10/base-client.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/services/mirror-node.d.ts.map +1 -1
- package/dist/es/standards-sdk.es100.js +156 -29
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +22 -14
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +792 -3
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +3 -3
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +141 -14
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +173 -4
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +34 -39
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +30 -37
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +9 -37
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +30 -74
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +419 -3
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +2 -2
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +120 -2
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +20 -33
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +26 -32
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +26 -9
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +37 -33
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +54 -38
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +17 -17
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es28.js +10 -10
- package/dist/es/standards-sdk.es29.js +2 -2
- package/dist/es/standards-sdk.es30.js +87 -405
- package/dist/es/standards-sdk.es30.js.map +1 -1
- package/dist/es/standards-sdk.es31.js +2 -2
- package/dist/es/standards-sdk.es32.js +15 -119
- package/dist/es/standards-sdk.es32.js.map +1 -1
- package/dist/es/standards-sdk.es33.js +409 -2
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +363 -3
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +5 -83
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +177 -21
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +70 -137
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +110 -87
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +39 -7123
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es40.js +9 -194
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +71 -412
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +3 -24
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +2 -139
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +107 -12
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +70 -25
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +5 -28
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +4 -20
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +218 -41
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +57 -17
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +26 -18
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +69 -61
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +2281 -1288
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +159 -27
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +7135 -5
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +3 -159
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +29 -790
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +55 -166
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +43 -136
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +10 -3
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +53 -352
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +6 -6
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +12 -176
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +7 -81
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +42 -111
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +2 -52
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +136 -10
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +162 -87
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +13 -4
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +13 -2
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +2 -113
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +31 -25
- package/dist/es/standards-sdk.es7.js.map +1 -1
- package/dist/es/standards-sdk.es70.js +30 -72
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +14 -5
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +3 -4
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +3 -220
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +15 -57
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +5 -69
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +39 -21
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +39 -26
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +36 -25
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +77 -37
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +3 -101
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +2 -2
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +2 -16
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +190 -404
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +412 -138
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +20 -27
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +131 -55
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +14 -46
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +28 -9
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +24 -60
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +21 -6
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +41 -12
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +18 -7
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +60 -44
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +1289 -2
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +138 -126
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +81 -162
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +84 -2282
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +32 -13
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +6 -13
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
- package/dist/umd/hcs-10/sdk.d.ts.map +1 -1
- package/dist/umd/services/mirror-node.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +1 -1
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,37 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
bytesCount += bytes[i++];
|
|
21
|
-
i = i % samplesCount;
|
|
22
|
-
}
|
|
23
|
-
head = (head + 1) % samplesCount;
|
|
24
|
-
if (head === tail) {
|
|
25
|
-
tail = (tail + 1) % samplesCount;
|
|
26
|
-
}
|
|
27
|
-
if (now - firstSampleTS < min) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const passed = startedAt && now - startedAt;
|
|
31
|
-
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
32
|
-
};
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { Coder } from "./standards-sdk.es84.js";
|
|
5
|
+
class AnonymousCoder extends Coder {
|
|
6
|
+
constructor(coder) {
|
|
7
|
+
super(coder.name, coder.type, "_", coder.dynamic);
|
|
8
|
+
__publicField(this, "coder");
|
|
9
|
+
this.coder = coder;
|
|
10
|
+
}
|
|
11
|
+
defaultValue() {
|
|
12
|
+
return this.coder.defaultValue();
|
|
13
|
+
}
|
|
14
|
+
encode(writer, value) {
|
|
15
|
+
return this.coder.encode(writer, value);
|
|
16
|
+
}
|
|
17
|
+
decode(reader) {
|
|
18
|
+
return this.coder.decode(reader);
|
|
19
|
+
}
|
|
33
20
|
}
|
|
34
21
|
export {
|
|
35
|
-
|
|
22
|
+
AnonymousCoder
|
|
36
23
|
};
|
|
37
24
|
//# sourceMappingURL=standards-sdk.es113.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es113.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es113.js","sources":["../../node_modules/ethers/lib.esm/abi/coders/anonymous.js"],"sourcesContent":["import { Coder } from \"./abstract-coder.js\";\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n coder;\n constructor(coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n defaultValue() {\n return this.coder.defaultValue();\n }\n encode(writer, value) {\n return this.coder.encode(writer, value);\n }\n decode(reader) {\n return this.coder.decode(reader);\n }\n}\n//# sourceMappingURL=anonymous.js.map"],"names":[],"mappings":";;;;AAMO,MAAM,uBAAuB,MAAM;AAAA,EAEtC,YAAY,OAAO;AACf,UAAM,MAAM,MAAM,MAAM,MAAM,KAAK,MAAM,OAAO;AAFpD;AAGI,SAAK,QAAQ;AAAA,EACrB;AAAA,EACI,eAAe;AACX,WAAO,KAAK,MAAM,aAAc;AAAA,EACxC;AAAA,EACI,OAAO,QAAQ,OAAO;AAClB,WAAO,KAAK,MAAM,OAAO,QAAQ,KAAK;AAAA,EAC9C;AAAA,EACI,OAAO,QAAQ;AACX,WAAO,KAAK,MAAM,OAAO,MAAM;AAAA,EACvC;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
timer = setTimeout(() => {
|
|
24
|
-
timer = null;
|
|
25
|
-
invoke(lastArgs);
|
|
26
|
-
}, threshold - passed);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
31
|
-
return [throttled, flush];
|
|
1
|
+
function number(n) {
|
|
2
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
3
|
+
throw new Error(`Wrong positive integer: ${n}`);
|
|
4
|
+
}
|
|
5
|
+
function bytes(b, ...lengths) {
|
|
6
|
+
if (!(b instanceof Uint8Array))
|
|
7
|
+
throw new Error("Expected Uint8Array");
|
|
8
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
9
|
+
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
|
10
|
+
}
|
|
11
|
+
function exists(instance, checkFinished = true) {
|
|
12
|
+
if (instance.destroyed)
|
|
13
|
+
throw new Error("Hash instance has been destroyed");
|
|
14
|
+
if (checkFinished && instance.finished)
|
|
15
|
+
throw new Error("Hash#digest() has already been called");
|
|
16
|
+
}
|
|
17
|
+
function output(out, instance) {
|
|
18
|
+
bytes(out);
|
|
19
|
+
const min = instance.outputLen;
|
|
20
|
+
if (out.length < min) {
|
|
21
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
22
|
+
}
|
|
32
23
|
}
|
|
33
24
|
export {
|
|
34
|
-
|
|
25
|
+
bytes,
|
|
26
|
+
exists,
|
|
27
|
+
number,
|
|
28
|
+
output
|
|
35
29
|
};
|
|
36
30
|
//# sourceMappingURL=standards-sdk.es114.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es114.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es114.js","sources":["../../node_modules/@noble/hashes/esm/_assert.js"],"sourcesContent":["function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nfunction bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map"],"names":[],"mappings":"AAAA,SAAS,OAAO,GAAG;AACf,MAAI,CAAC,OAAO,cAAc,CAAC,KAAK,IAAI;AAChC,UAAM,IAAI,MAAM,2BAA2B,CAAC,EAAE;AACtD;AAKA,SAAS,MAAM,MAAM,SAAS;AAC1B,MAAI,EAAE,aAAa;AACf,UAAM,IAAI,MAAM,qBAAqB;AACzC,MAAI,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,EAAE,MAAM;AAChD,UAAM,IAAI,MAAM,iCAAiC,OAAO,mBAAmB,EAAE,MAAM,EAAE;AAC7F;AAOA,SAAS,OAAO,UAAU,gBAAgB,MAAM;AAC5C,MAAI,SAAS;AACT,UAAM,IAAI,MAAM,kCAAkC;AACtD,MAAI,iBAAiB,SAAS;AAC1B,UAAM,IAAI,MAAM,uCAAuC;AAC/D;AACA,SAAS,OAAO,KAAK,UAAU;AAC3B,QAAM,GAAG;AACT,QAAM,MAAM,SAAS;AACrB,MAAI,IAAI,SAAS,KAAK;AAClB,UAAM,IAAI,MAAM,yDAAyD,GAAG,EAAE;AAAA,EACtF;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
2
|
+
const _32n = /* @__PURE__ */ BigInt(32);
|
|
3
|
+
function fromBig(n, le = false) {
|
|
4
|
+
if (le)
|
|
5
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
6
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
7
|
+
}
|
|
8
|
+
function split(lst, le = false) {
|
|
9
|
+
let Ah = new Uint32Array(lst.length);
|
|
10
|
+
let Al = new Uint32Array(lst.length);
|
|
11
|
+
for (let i = 0; i < lst.length; i++) {
|
|
12
|
+
const { h, l } = fromBig(lst[i], le);
|
|
13
|
+
[Ah[i], Al[i]] = [h, l];
|
|
14
|
+
}
|
|
15
|
+
return [Ah, Al];
|
|
16
|
+
}
|
|
17
|
+
const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
18
|
+
const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
19
|
+
const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
20
|
+
const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
9
21
|
export {
|
|
10
|
-
|
|
22
|
+
fromBig,
|
|
23
|
+
rotlBH,
|
|
24
|
+
rotlBL,
|
|
25
|
+
rotlSH,
|
|
26
|
+
rotlSL,
|
|
27
|
+
split
|
|
11
28
|
};
|
|
12
29
|
//# sourceMappingURL=standards-sdk.es115.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es115.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es115.js","sources":["../../node_modules/@noble/hashes/esm/_u64.js"],"sourcesContent":["const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map"],"names":[],"mappings":"AAAA,MAAM,aAA6B,uBAAO,KAAK,KAAK,CAAC;AACrD,MAAM,OAAuB,uBAAO,EAAE;AAEtC,SAAS,QAAQ,GAAG,KAAK,OAAO;AAC5B,MAAI;AACA,WAAO,EAAE,GAAG,OAAO,IAAI,UAAU,GAAG,GAAG,OAAQ,KAAK,OAAQ,UAAU,EAAG;AAC7E,SAAO,EAAE,GAAG,OAAQ,KAAK,OAAQ,UAAU,IAAI,GAAG,GAAG,OAAO,IAAI,UAAU,IAAI,EAAG;AACrF;AACA,SAAS,MAAM,KAAK,KAAK,OAAO;AAC5B,MAAI,KAAK,IAAI,YAAY,IAAI,MAAM;AACnC,MAAI,KAAK,IAAI,YAAY,IAAI,MAAM;AACnC,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACjC,UAAM,EAAE,GAAG,EAAG,IAAG,QAAQ,IAAI,CAAC,GAAG,EAAE;AACnC,KAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAAA,EAC9B;AACI,SAAO,CAAC,IAAI,EAAE;AAClB;AAeK,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAK,IAAM,MAAO,KAAK;AAC/C,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAK,IAAM,MAAO,KAAK;AAE/C,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAM,IAAI,KAAQ,MAAO,KAAK;AACtD,MAAC,SAAS,CAAC,GAAG,GAAG,MAAO,KAAM,IAAI,KAAQ,MAAO,KAAK;","x_google_ignoreList":[0]}
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
const u8a = (a) => a instanceof Uint8Array;
|
|
3
|
+
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
4
|
+
const isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
5
|
+
if (!isLE)
|
|
6
|
+
throw new Error("Non little-endian hardware is not supported");
|
|
7
|
+
function utf8ToBytes(str) {
|
|
8
|
+
if (typeof str !== "string")
|
|
9
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
10
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
11
|
+
}
|
|
12
|
+
function toBytes(data) {
|
|
13
|
+
if (typeof data === "string")
|
|
14
|
+
data = utf8ToBytes(data);
|
|
15
|
+
if (!u8a(data))
|
|
16
|
+
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
class Hash {
|
|
20
|
+
// Safe version that clones internal state
|
|
21
|
+
clone() {
|
|
22
|
+
return this._cloneInto();
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
);
|
|
24
|
+
}
|
|
25
|
+
function wrapConstructor(hashCons) {
|
|
26
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
27
|
+
const tmp = hashCons();
|
|
28
|
+
hashC.outputLen = tmp.outputLen;
|
|
29
|
+
hashC.blockLen = tmp.blockLen;
|
|
30
|
+
hashC.create = () => hashCons();
|
|
31
|
+
return hashC;
|
|
32
|
+
}
|
|
34
33
|
export {
|
|
35
|
-
|
|
34
|
+
Hash,
|
|
35
|
+
isLE,
|
|
36
|
+
toBytes,
|
|
37
|
+
u32,
|
|
38
|
+
utf8ToBytes,
|
|
39
|
+
wrapConstructor
|
|
36
40
|
};
|
|
37
41
|
//# sourceMappingURL=standards-sdk.es116.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es116.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es116.js","sources":["../../node_modules/@noble/hashes/esm/utils.js"],"sourcesContent":["/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nconst u8a = (a) => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n if (!u8a(bytes))\n throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!u8a(data))\n throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a))\n throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map"],"names":[],"mappings":"AAAA;AAQA,MAAM,MAAM,CAAC,MAAM,aAAa;AAGpB,MAAC,MAAM,CAAC,QAAQ,IAAI,YAAY,IAAI,QAAQ,IAAI,YAAY,KAAK,MAAM,IAAI,aAAa,CAAC,CAAC;AAO1F,MAAC,OAAO,IAAI,WAAW,IAAI,YAAY,CAAC,SAAU,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM;AAChF,IAAI,CAAC;AACD,QAAM,IAAI,MAAM,6CAA6C;AAuD1D,SAAS,YAAY,KAAK;AAC7B,MAAI,OAAO,QAAQ;AACf,UAAM,IAAI,MAAM,oCAAoC,OAAO,GAAG,EAAE;AACpE,SAAO,IAAI,WAAW,IAAI,YAAa,EAAC,OAAO,GAAG,CAAC;AACvD;AAMO,SAAS,QAAQ,MAAM;AAC1B,MAAI,OAAO,SAAS;AAChB,WAAO,YAAY,IAAI;AAC3B,MAAI,CAAC,IAAI,IAAI;AACT,UAAM,IAAI,MAAM,4BAA4B,OAAO,IAAI,EAAE;AAC7D,SAAO;AACX;AAgBO,MAAM,KAAK;AAAA;AAAA,EAEd,QAAQ;AACJ,WAAO,KAAK,WAAY;AAAA,EAChC;AACA;AAQO,SAAS,gBAAgB,UAAU;AACtC,QAAM,QAAQ,CAAC,QAAQ,SAAU,EAAC,OAAO,QAAQ,GAAG,CAAC,EAAE,OAAQ;AAC/D,QAAM,MAAM,SAAU;AACtB,QAAM,YAAY,IAAI;AACtB,QAAM,WAAW,IAAI;AACrB,QAAM,SAAS,MAAM,SAAU;AAC/B,SAAO;AACX;","x_google_ignoreList":[0]}
|
|
@@ -32,10 +32,11 @@ class HederaMirrorNode {
|
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
return PublicKey.fromString(accountInfo.key.key);
|
|
35
|
-
} catch (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
const error = e;
|
|
37
|
+
const logMessage = `Error fetching public key from Mirror Node: ${error.message}`;
|
|
38
|
+
this.logger.error(logMessage);
|
|
39
|
+
throw new Error(logMessage);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
@@ -58,10 +59,10 @@ class HederaMirrorNode {
|
|
|
58
59
|
if (attempt < maxRetries - 1) {
|
|
59
60
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
60
61
|
}
|
|
61
|
-
} catch (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
const error = e;
|
|
64
|
+
const logMessage = `Error getting account memo (attempt ${attempt + 1}): ${error.message}`;
|
|
65
|
+
this.logger.error(logMessage);
|
|
65
66
|
if (attempt < maxRetries - 1) {
|
|
66
67
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
67
68
|
}
|
|
@@ -80,9 +81,11 @@ class HederaMirrorNode {
|
|
|
80
81
|
const topicInfoUrl = `${this.baseUrl}/api/v1/topics/${topicId}`;
|
|
81
82
|
const response = await axios.get(topicInfoUrl);
|
|
82
83
|
return response.data;
|
|
83
|
-
} catch (
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
} catch (e) {
|
|
85
|
+
const error = e;
|
|
86
|
+
const logMessage = `Error retrieving topic information: ${error.message}`;
|
|
87
|
+
this.logger.error(logMessage);
|
|
88
|
+
throw new Error(logMessage);
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
@@ -95,8 +98,10 @@ class HederaMirrorNode {
|
|
|
95
98
|
try {
|
|
96
99
|
const topicInfo = await this.getTopicInfo(topicId);
|
|
97
100
|
return topicInfo.custom_fees;
|
|
98
|
-
} catch (
|
|
99
|
-
|
|
101
|
+
} catch (e) {
|
|
102
|
+
const error = e;
|
|
103
|
+
const logMessage = `Error retrieving topic fees: ${error.message}`;
|
|
104
|
+
this.logger.error(logMessage);
|
|
100
105
|
return null;
|
|
101
106
|
}
|
|
102
107
|
}
|
|
@@ -116,6 +121,9 @@ class HederaMirrorNode {
|
|
|
116
121
|
const usdPrice = Number(response?.current_rate?.cent_equivalent) / Number(response?.current_rate?.hbar_equivalent) / 100;
|
|
117
122
|
return usdPrice;
|
|
118
123
|
} catch (e) {
|
|
124
|
+
const error = e;
|
|
125
|
+
const logMessage = `Error retrieving HBAR price: ${error.message}`;
|
|
126
|
+
this.logger.error(logMessage);
|
|
119
127
|
return null;
|
|
120
128
|
}
|
|
121
129
|
}
|
|
@@ -136,10 +144,10 @@ class HederaMirrorNode {
|
|
|
136
144
|
}
|
|
137
145
|
this.logger.warn(`No token info found for ${tokenId}`);
|
|
138
146
|
return null;
|
|
139
|
-
} catch (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
);
|
|
147
|
+
} catch (e) {
|
|
148
|
+
const error = e;
|
|
149
|
+
const logMessage = `Error fetching token info for ${tokenId}: ${error.message}`;
|
|
150
|
+
this.logger.error(logMessage);
|
|
143
151
|
return null;
|
|
144
152
|
}
|
|
145
153
|
}
|
|
@@ -179,16 +187,16 @@ class HederaMirrorNode {
|
|
|
179
187
|
);
|
|
180
188
|
}
|
|
181
189
|
} catch (error) {
|
|
182
|
-
|
|
190
|
+
const logMessage = `Error decoding message: ${error}`;
|
|
191
|
+
this.logger.error(logMessage);
|
|
183
192
|
continue;
|
|
184
193
|
}
|
|
185
194
|
let messageJson;
|
|
186
195
|
try {
|
|
187
196
|
messageJson = JSON.parse(messageContent);
|
|
188
197
|
} catch (error) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
);
|
|
198
|
+
const logMessage = `Invalid JSON message content: ${messageContent}`;
|
|
199
|
+
this.logger.error(logMessage);
|
|
192
200
|
return;
|
|
193
201
|
}
|
|
194
202
|
messageJson.sequence_number = message.sequence_number;
|
|
@@ -199,14 +207,17 @@ class HederaMirrorNode {
|
|
|
199
207
|
created: new Date(Number(message.consensus_timestamp) * 1e3)
|
|
200
208
|
});
|
|
201
209
|
} catch (error) {
|
|
202
|
-
|
|
210
|
+
const logMessage = `Error processing message: ${error.message}`;
|
|
211
|
+
this.logger.error(logMessage);
|
|
203
212
|
}
|
|
204
213
|
}
|
|
205
214
|
}
|
|
206
215
|
nextUrl = data.links?.next ? `${this.baseUrl}${data.links.next}` : "";
|
|
207
|
-
} catch (
|
|
208
|
-
|
|
209
|
-
|
|
216
|
+
} catch (e) {
|
|
217
|
+
const error = e;
|
|
218
|
+
const logMessage = `Error querying topic messages: ${error.message} on ${topicId}`;
|
|
219
|
+
this.logger.error(logMessage);
|
|
220
|
+
throw new Error(logMessage);
|
|
210
221
|
}
|
|
211
222
|
}
|
|
212
223
|
return messages;
|
|
@@ -227,9 +238,11 @@ class HederaMirrorNode {
|
|
|
227
238
|
);
|
|
228
239
|
}
|
|
229
240
|
return response.data;
|
|
230
|
-
} catch (
|
|
231
|
-
|
|
232
|
-
|
|
241
|
+
} catch (e) {
|
|
242
|
+
const error = e;
|
|
243
|
+
const logMessage = `Failed to fetch account: ${error.message}`;
|
|
244
|
+
this.logger.error(logMessage);
|
|
245
|
+
throw new Error(logMessage);
|
|
233
246
|
}
|
|
234
247
|
}
|
|
235
248
|
/**
|
|
@@ -242,11 +255,11 @@ class HederaMirrorNode {
|
|
|
242
255
|
try {
|
|
243
256
|
const key = proto.Key.decode(keyBytes);
|
|
244
257
|
return this.evaluateKeyAccess(key, userPublicKey);
|
|
245
|
-
} catch (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
);
|
|
249
|
-
|
|
258
|
+
} catch (e) {
|
|
259
|
+
const error = e;
|
|
260
|
+
const logMessage = `Error decoding protobuf key: ${error.message}`;
|
|
261
|
+
this.logger.error(logMessage);
|
|
262
|
+
throw new Error(logMessage);
|
|
250
263
|
}
|
|
251
264
|
}
|
|
252
265
|
/**
|
|
@@ -294,10 +307,10 @@ class HederaMirrorNode {
|
|
|
294
307
|
if (hasNestedAccess) {
|
|
295
308
|
return true;
|
|
296
309
|
}
|
|
297
|
-
} catch (
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
);
|
|
310
|
+
} catch (e) {
|
|
311
|
+
const error = e;
|
|
312
|
+
const logMessage = `Error in nested key: ${error.message}`;
|
|
313
|
+
this.logger.debug(logMessage);
|
|
301
314
|
}
|
|
302
315
|
}
|
|
303
316
|
}
|
|
@@ -313,7 +326,10 @@ class HederaMirrorNode {
|
|
|
313
326
|
try {
|
|
314
327
|
const decodedKey = PublicKey.fromBytes(Buffer.from(keyData));
|
|
315
328
|
return decodedKey.toString() === userPublicKey.toString();
|
|
316
|
-
} catch (
|
|
329
|
+
} catch (e) {
|
|
330
|
+
const error = e;
|
|
331
|
+
const logMessage = `Error comparing Ed25519 key: ${error.message}`;
|
|
332
|
+
this.logger.debug(logMessage);
|
|
317
333
|
return false;
|
|
318
334
|
}
|
|
319
335
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es18.js","sources":["../../src/services/mirror-node.ts"],"sourcesContent":["import { PublicKey, Timestamp } from '@hashgraph/sdk';\nimport axios from 'axios';\nimport { Logger } from '../utils/logger';\nimport { HCSMessage } from '../hcs-10/base-client';\nimport { proto } from '@hashgraph/proto';\nimport {\n AccountResponse,\n CustomFees,\n HBARPrice,\n TokenInfoResponse,\n TopicMessagesResponse,\n TopicResponse,\n} from './types';\nimport { NetworkType } from '../utils/types';\nexport class HederaMirrorNode {\n private network: NetworkType;\n private baseUrl: string;\n private logger: Logger;\n private isServerEnvironment: boolean;\n\n constructor(network: NetworkType, logger: Logger) {\n this.network = network;\n this.baseUrl = this.getMirrorNodeUrl();\n this.logger = logger;\n this.isServerEnvironment = typeof window === 'undefined';\n }\n\n private getMirrorNodeUrl(): string {\n return this.network === 'mainnet'\n ? 'https://mainnet-public.mirrornode.hedera.com'\n : 'https://testnet.mirrornode.hedera.com';\n }\n\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Retrieves the public key for a given account ID from the mirror node.\n * @param accountId The ID of the account to retrieve the public key for.\n * @returns A promise that resolves to the public key for the given account.\n * @throws An error if the account ID is invalid or the public key cannot be retrieved.\n */\n async getPublicKey(accountId: string): Promise<PublicKey> {\n this.logger.info(`Getting public key for account ${accountId}`);\n\n const accountInfo = await this.requestAccount(accountId);\n\n try {\n if (!accountInfo || !accountInfo.key) {\n throw new Error(\n `Failed to retrieve public key for account ID: ${accountId}`\n );\n }\n\n return PublicKey.fromString(accountInfo.key.key);\n } catch (error: any) {\n throw new Error(\n `Error fetching public key from Mirror Node: ${error.message}`\n );\n }\n }\n\n /**\n * Retrieves the memo for a given account ID from the mirror node.\n * @param accountId The ID of the account to retrieve the memo for.\n * @returns A promise that resolves to the memo for the given account.\n * @throws An error if the account ID is invalid or the memo cannot be retrieved.\n */\n async getAccountMemo(accountId: string): Promise<string | null> {\n const maxRetries = 3;\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n const accountInfoUrl = `${this.baseUrl}/api/v1/accounts/${accountId}`;\n\n const response = await axios.get(accountInfoUrl);\n const accountInfo = response.data;\n\n if (accountInfo && accountInfo.memo) {\n return accountInfo.memo;\n }\n\n this.logger.error(`No memo found for account ${accountId}`);\n\n if (attempt < maxRetries - 1) {\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n } catch (error: any) {\n this.logger.error(\n `Error getting account memo (attempt ${attempt + 1}): ${\n error.message\n }`\n );\n\n if (attempt < maxRetries - 1) {\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves topic information for a given topic ID from the mirror node.\n * @param topicId The ID of the topic to retrieve information for.\n * @returns A promise that resolves to the topic information.\n * @throws An error if the topic ID is invalid or the information cannot be retrieved.\n */\n async getTopicInfo(topicId: string): Promise<TopicResponse> {\n try {\n const topicInfoUrl = `${this.baseUrl}/api/v1/topics/${topicId}`;\n const response = await axios.get(topicInfoUrl);\n return response.data;\n } catch (error: any) {\n this.logger.error(`Error retrieving topic information: ${error.message}`);\n throw new Error(`Failed to retrieve topic information: ${error.message}`);\n }\n }\n\n /**\n * Retrieves custom fees for a given topic ID from the mirror node.\n * @param topicId The ID of the topic to retrieve custom fees for.\n * @returns A promise that resolves to the custom fees for the given topic.\n * @throws An error if the topic ID is invalid or the custom fees cannot be retrieved.\n */\n async getTopicFees(topicId: string): Promise<CustomFees | null> {\n try {\n const topicInfo = await this.getTopicInfo(topicId);\n return topicInfo.custom_fees;\n } catch (error: any) {\n this.logger.error(`Error retrieving topic fees: ${error.message}`);\n return null;\n }\n }\n\n /**\n * Retrieves the current HBAR price from the mirror node.\n * @param date The date to retrieve the HBAR price for.\n * @returns A promise that resolves to the HBAR price for the given date.\n * @throws An error if the date is invalid or the price cannot be retrieved.\n */\n async getHBARPrice(date: Date): Promise<number | null> {\n try {\n const timestamp = Timestamp.fromDate(date).toString();\n\n const request = await fetch(\n `https://mainnet-public.mirrornode.hedera.com/api/v1/network/exchangerate?timestamp=${timestamp}`\n );\n const response = (await request.json()) as HBARPrice;\n\n const usdPrice =\n Number(response?.current_rate?.cent_equivalent) /\n Number(response?.current_rate?.hbar_equivalent) /\n 100;\n\n return usdPrice;\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Retrieves token information for a given token ID from the mirror node.\n * @param tokenId The ID of the token to retrieve information for.\n * @returns A promise that resolves to the token information.\n * @throws An error if the token ID is invalid or the information cannot be retrieved.\n */\n async getTokenInfo(tokenId: string): Promise<TokenInfoResponse | null> {\n this.logger.debug(`Fetching token info for ${tokenId}`);\n try {\n const tokenInfoUrl = `${this.baseUrl}/api/v1/tokens/${tokenId}`;\n const response = await axios.get<TokenInfoResponse>(tokenInfoUrl);\n if (response.data) {\n this.logger.trace(`Token info found for ${tokenId}:`, response.data);\n return response.data;\n }\n this.logger.warn(`No token info found for ${tokenId}`);\n return null;\n } catch (error: any) {\n this.logger.error(\n `Error fetching token info for ${tokenId}: ${error.message}`\n );\n\n return null;\n }\n }\n\n /**\n * Retrieves messages for a given topic ID from the mirror node.\n * @param topicId The ID of the topic to retrieve messages for.\n * @returns A promise that resolves to the messages for the given topic.\n * @throws An error if the topic ID is invalid or the messages cannot be retrieved.\n */\n async getTopicMessages(topicId: string): Promise<HCSMessage[]> {\n this.logger.trace(`Querying messages for topic ${topicId}`);\n\n let nextUrl = `${this.baseUrl}/api/v1/topics/${topicId}/messages`;\n const messages: HCSMessage[] = [];\n\n while (nextUrl) {\n try {\n const response = await axios.get<TopicMessagesResponse>(nextUrl);\n const data = response.data;\n\n if (data.messages && data.messages.length > 0) {\n for (const message of data.messages) {\n try {\n if (!message.message) {\n continue;\n }\n\n let messageContent: string;\n try {\n if (this.isServerEnvironment) {\n messageContent = Buffer.from(\n message.message,\n 'base64'\n ).toString('utf-8');\n } else {\n messageContent = new TextDecoder().decode(\n Uint8Array.from(atob(message.message), (c) =>\n c.charCodeAt(0)\n )\n );\n }\n } catch (error) {\n this.logger.error(`Error decoding message: ${error}`);\n continue;\n }\n\n let messageJson;\n try {\n messageJson = JSON.parse(messageContent);\n } catch (error) {\n this.logger.error(\n `Invalid JSON message content: ${messageContent}`\n );\n return;\n }\n\n messageJson.sequence_number = message.sequence_number;\n messages.push({\n ...messageJson,\n consensus_timestamp: message.consensus_timestamp,\n sequence_number: message.sequence_number,\n created: new Date(Number(message.consensus_timestamp) * 1000),\n });\n } catch (error: any) {\n this.logger.error(`Error processing message: ${error.message}`);\n }\n }\n }\n\n nextUrl = data.links?.next ? `${this.baseUrl}${data.links.next}` : '';\n } catch (error: any) {\n this.logger.error(`Error querying topic messages: ${error.message}`);\n throw new Error(`Failed to query topic messages: ${error.message}`);\n }\n }\n\n return messages;\n }\n\n /**\n * Requests account information for a given account ID from the mirror node.\n * @param accountId The ID of the account to retrieve information for.\n * @returns A promise that resolves to the account information.\n * @throws An error if the account ID is invalid or the information cannot be retrieved.\n */\n async requestAccount(accountId: string): Promise<AccountResponse> {\n try {\n const accountInfoUrl = `${this.baseUrl}/api/v1/accounts/${accountId}`;\n const response = await axios.get(accountInfoUrl);\n if (!response.data) {\n throw new Error(\n `Failed to make request to mirror node for account: ${accountId}`\n );\n }\n return response.data;\n } catch (error: any) {\n this.logger.error(`Failed to fetch account: ${error.message}`);\n throw new Error(`Failed to fetch account: ${error.message}`);\n }\n }\n\n /**\n * Checks if a user has access to a given key list.\n * @param keyBytes The key list to check access for.\n * @param userPublicKey The public key of the user to check access for.\n * @returns A promise that resolves to true if the user has access, false otherwise.\n */\n async checkKeyListAccess(\n keyBytes: Buffer,\n userPublicKey: PublicKey\n ): Promise<boolean> {\n try {\n const key = proto.Key.decode(keyBytes);\n return this.evaluateKeyAccess(key, userPublicKey);\n } catch (error) {\n this.logger.error(\n `Error decoding protobuf key: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n return false;\n }\n }\n\n /**\n * Evaluates the access of a given key to a user's public key.\n * @param key The key to evaluate access for.\n * @param userPublicKey The public key of the user to evaluate access for.\n * @returns A promise that resolves to true if the key has access, false otherwise.\n */\n private async evaluateKeyAccess(\n key: proto.IKey,\n userPublicKey: PublicKey\n ): Promise<boolean> {\n if (key.ed25519) {\n return this.compareEd25519Key(key.ed25519, userPublicKey);\n }\n\n if (key.keyList) {\n return this.evaluateKeyList(key.keyList, userPublicKey);\n }\n\n if (key.thresholdKey && key.thresholdKey.keys) {\n return this.evaluateKeyList(key.thresholdKey.keys, userPublicKey);\n }\n\n return false;\n }\n\n /**\n * Evaluates the access of a given key list to a user's public key.\n * @param keyList The key list to evaluate access for.\n * @param userPublicKey The public key of the user to evaluate access for.\n * @returns A promise that resolves to true if the key list has access, false otherwise.\n */\n private async evaluateKeyList(\n keyList: proto.IKeyList,\n userPublicKey: PublicKey\n ): Promise<boolean> {\n const keys = keyList.keys || [];\n\n for (const listKey of keys) {\n if (!listKey) continue;\n\n if (listKey.ed25519) {\n if (this.compareEd25519Key(listKey.ed25519, userPublicKey)) {\n return true;\n }\n } else if (listKey.keyList || listKey.thresholdKey) {\n try {\n const nestedKeyBytes = proto.Key.encode({\n ...(listKey.keyList ? { keyList: listKey.keyList } : {}),\n ...(listKey.thresholdKey\n ? { thresholdKey: listKey.thresholdKey }\n : {}),\n }).finish();\n\n const hasNestedAccess = await this.checkKeyListAccess(\n Buffer.from(nestedKeyBytes),\n userPublicKey\n );\n\n if (hasNestedAccess) {\n return true;\n }\n } catch (err) {\n this.logger.debug(\n `Error in nested key: ${\n err instanceof Error ? err.message : String(err)\n }`\n );\n }\n }\n }\n\n return false;\n }\n\n /**\n * Compares an Ed25519 key with a user's public key.\n * @param keyData The Ed25519 key data to compare.\n * @param userPublicKey The public key of the user to compare with.\n * @returns A boolean indicating whether the key matches the user's public key.\n */\n private compareEd25519Key(\n keyData: Uint8Array,\n userPublicKey: PublicKey\n ): boolean {\n try {\n const decodedKey = PublicKey.fromBytes(Buffer.from(keyData));\n return decodedKey.toString() === user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,YACjC,OAAO,KAAK,cAAc;AAAA,YAC1B;AAAA,UACF;AAEA,cAAI,iBAAiB;AACZ,mBAAA;AAAA,UAAA;AAAA,iBAEF,KAAK;AACZ,eAAK,OAAO;AAAA,YACV,wBACE,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CACjD;AAAA,UACF;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAGK,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASD,kBACN,SACA,eACS;AACL,QAAA;AACF,YAAM,aAAa,UAAU,UAAU,OAAO,KAAK,OAAO,CAAC;AAC3D,aAAO,WAAW,eAAe,cAAc,SAAS;AAAA,aACjD,KAAK;AACL,aAAA;AAAA,IAAA;AAAA,EACT;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es18.js","sources":["../../src/services/mirror-node.ts"],"sourcesContent":["import { PublicKey, Timestamp } from '@hashgraph/sdk';\nimport axios from 'axios';\nimport { Logger } from '../utils/logger';\nimport { HCSMessage } from '../hcs-10/base-client';\nimport { proto } from '@hashgraph/proto';\nimport {\n AccountResponse,\n CustomFees,\n HBARPrice,\n TokenInfoResponse,\n TopicMessagesResponse,\n TopicResponse,\n} from './types';\nimport { NetworkType } from '../utils/types';\nexport class HederaMirrorNode {\n private network: NetworkType;\n private baseUrl: string;\n private logger: Logger;\n private isServerEnvironment: boolean;\n\n constructor(network: NetworkType, logger: Logger) {\n this.network = network;\n this.baseUrl = this.getMirrorNodeUrl();\n this.logger = logger;\n this.isServerEnvironment = typeof window === 'undefined';\n }\n\n private getMirrorNodeUrl(): string {\n return this.network === 'mainnet'\n ? 'https://mainnet-public.mirrornode.hedera.com'\n : 'https://testnet.mirrornode.hedera.com';\n }\n\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Retrieves the public key for a given account ID from the mirror node.\n * @param accountId The ID of the account to retrieve the public key for.\n * @returns A promise that resolves to the public key for the given account.\n * @throws An error if the account ID is invalid or the public key cannot be retrieved.\n */\n async getPublicKey(accountId: string): Promise<PublicKey> {\n this.logger.info(`Getting public key for account ${accountId}`);\n\n const accountInfo = await this.requestAccount(accountId);\n\n try {\n if (!accountInfo || !accountInfo.key) {\n throw new Error(\n `Failed to retrieve public key for account ID: ${accountId}`\n );\n }\n\n return PublicKey.fromString(accountInfo.key.key);\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error fetching public key from Mirror Node: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Retrieves the memo for a given account ID from the mirror node.\n * @param accountId The ID of the account to retrieve the memo for.\n * @returns A promise that resolves to the memo for the given account.\n * @throws An error if the account ID is invalid or the memo cannot be retrieved.\n */\n async getAccountMemo(accountId: string): Promise<string | null> {\n const maxRetries = 3;\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n const accountInfoUrl = `${this.baseUrl}/api/v1/accounts/${accountId}`;\n\n const response = await axios.get(accountInfoUrl);\n const accountInfo = response.data;\n\n if (accountInfo && accountInfo.memo) {\n return accountInfo.memo;\n }\n\n this.logger.error(`No memo found for account ${accountId}`);\n\n if (attempt < maxRetries - 1) {\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error getting account memo (attempt ${attempt + 1}): ${error.message}`;\n this.logger.error(logMessage);\n\n if (attempt < maxRetries - 1) {\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves topic information for a given topic ID from the mirror node.\n * @param topicId The ID of the topic to retrieve information for.\n * @returns A promise that resolves to the topic information.\n * @throws An error if the topic ID is invalid or the information cannot be retrieved.\n */\n async getTopicInfo(topicId: string): Promise<TopicResponse> {\n try {\n const topicInfoUrl = `${this.baseUrl}/api/v1/topics/${topicId}`;\n const response = await axios.get(topicInfoUrl);\n return response.data;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error retrieving topic information: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Retrieves custom fees for a given topic ID from the mirror node.\n * @param topicId The ID of the topic to retrieve custom fees for.\n * @returns A promise that resolves to the custom fees for the given topic.\n * @throws An error if the topic ID is invalid or the custom fees cannot be retrieved.\n */\n async getTopicFees(topicId: string): Promise<CustomFees | null> {\n try {\n const topicInfo = await this.getTopicInfo(topicId);\n return topicInfo.custom_fees;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error retrieving topic fees: ${error.message}`;\n this.logger.error(logMessage);\n return null;\n }\n }\n\n /**\n * Retrieves the current HBAR price from the mirror node.\n * @param date The date to retrieve the HBAR price for.\n * @returns A promise that resolves to the HBAR price for the given date.\n * @throws An error if the date is invalid or the price cannot be retrieved.\n */\n async getHBARPrice(date: Date): Promise<number | null> {\n try {\n const timestamp = Timestamp.fromDate(date).toString();\n\n const request = await fetch(\n `https://mainnet-public.mirrornode.hedera.com/api/v1/network/exchangerate?timestamp=${timestamp}`\n );\n const response = (await request.json()) as HBARPrice;\n\n const usdPrice =\n Number(response?.current_rate?.cent_equivalent) /\n Number(response?.current_rate?.hbar_equivalent) /\n 100;\n\n return usdPrice;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error retrieving HBAR price: ${error.message}`;\n this.logger.error(logMessage);\n return null;\n }\n }\n\n /**\n * Retrieves token information for a given token ID from the mirror node.\n * @param tokenId The ID of the token to retrieve information for.\n * @returns A promise that resolves to the token information.\n * @throws An error if the token ID is invalid or the information cannot be retrieved.\n */\n async getTokenInfo(tokenId: string): Promise<TokenInfoResponse | null> {\n this.logger.debug(`Fetching token info for ${tokenId}`);\n try {\n const tokenInfoUrl = `${this.baseUrl}/api/v1/tokens/${tokenId}`;\n const response = await axios.get<TokenInfoResponse>(tokenInfoUrl);\n if (response.data) {\n this.logger.trace(`Token info found for ${tokenId}:`, response.data);\n return response.data;\n }\n this.logger.warn(`No token info found for ${tokenId}`);\n return null;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error fetching token info for ${tokenId}: ${error.message}`;\n this.logger.error(logMessage);\n\n return null;\n }\n }\n\n /**\n * Retrieves messages for a given topic ID from the mirror node.\n * @param topicId The ID of the topic to retrieve messages for.\n * @returns A promise that resolves to the messages for the given topic.\n * @throws An error if the topic ID is invalid or the messages cannot be retrieved.\n */\n async getTopicMessages(topicId: string): Promise<HCSMessage[]> {\n this.logger.trace(`Querying messages for topic ${topicId}`);\n\n let nextUrl = `${this.baseUrl}/api/v1/topics/${topicId}/messages`;\n const messages: HCSMessage[] = [];\n\n while (nextUrl) {\n try {\n const response = await axios.get<TopicMessagesResponse>(nextUrl);\n const data = response.data;\n\n if (data.messages && data.messages.length > 0) {\n for (const message of data.messages) {\n try {\n if (!message.message) {\n continue;\n }\n\n let messageContent: string;\n try {\n if (this.isServerEnvironment) {\n messageContent = Buffer.from(\n message.message,\n 'base64'\n ).toString('utf-8');\n } else {\n messageContent = new TextDecoder().decode(\n Uint8Array.from(atob(message.message), (c) =>\n c.charCodeAt(0)\n )\n );\n }\n } catch (error) {\n const logMessage = `Error decoding message: ${error}`;\n this.logger.error(logMessage);\n continue;\n }\n\n let messageJson;\n try {\n messageJson = JSON.parse(messageContent);\n } catch (error) {\n const logMessage = `Invalid JSON message content: ${messageContent}`;\n this.logger.error(logMessage);\n return;\n }\n\n messageJson.sequence_number = message.sequence_number;\n messages.push({\n ...messageJson,\n consensus_timestamp: message.consensus_timestamp,\n sequence_number: message.sequence_number,\n created: new Date(Number(message.consensus_timestamp) * 1000),\n });\n } catch (error: any) {\n const logMessage = `Error processing message: ${error.message}`;\n this.logger.error(logMessage);\n }\n }\n }\n\n nextUrl = data.links?.next ? `${this.baseUrl}${data.links.next}` : '';\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error querying topic messages: ${error.message} on ${topicId}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n return messages;\n }\n\n /**\n * Requests account information for a given account ID from the mirror node.\n * @param accountId The ID of the account to retrieve information for.\n * @returns A promise that resolves to the account information.\n * @throws An error if the account ID is invalid or the information cannot be retrieved.\n */\n async requestAccount(accountId: string): Promise<AccountResponse> {\n try {\n const accountInfoUrl = `${this.baseUrl}/api/v1/accounts/${accountId}`;\n const response = await axios.get(accountInfoUrl);\n if (!response.data) {\n throw new Error(\n `Failed to make request to mirror node for account: ${accountId}`\n );\n }\n return response.data;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to fetch account: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Checks if a user has access to a given key list.\n * @param keyBytes The key list to check access for.\n * @param userPublicKey The public key of the user to check access for.\n * @returns A promise that resolves to true if the user has access, false otherwise.\n */\n async checkKeyListAccess(\n keyBytes: Buffer,\n userPublicKey: PublicKey\n ): Promise<boolean> {\n try {\n const key = proto.Key.decode(keyBytes);\n return this.evaluateKeyAccess(key, userPublicKey);\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error decoding protobuf key: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Evaluates the access of a given key to a user's public key.\n * @param key The key to evaluate access for.\n * @param userPublicKey The public key of the user to evaluate access for.\n * @returns A promise that resolves to true if the key has access, false otherwise.\n */\n private async evaluateKeyAccess(\n key: proto.IKey,\n userPublicKey: PublicKey\n ): Promise<boolean> {\n if (key.ed25519) {\n return this.compareEd25519Key(key.ed25519, userPublicKey);\n }\n\n if (key.keyList) {\n return this.evaluateKeyList(key.keyList, userPublicKey);\n }\n\n if (key.thresholdKey && key.thresholdKey.keys) {\n return this.evaluateKeyList(key.thresholdKey.keys, userPublicKey);\n }\n\n return false;\n }\n\n /**\n * Evaluates the access of a given key list to a user's public key.\n * @param keyList The key list to evaluate access for.\n * @param userPublicKey The public key of the user to evaluate access for.\n * @returns A promise that resolves to true if the key list has access, false otherwise.\n */\n private async evaluateKeyList(\n keyList: proto.IKeyList,\n userPublicKey: PublicKey\n ): Promise<boolean> {\n const keys = keyList.keys || [];\n\n for (const listKey of keys) {\n if (!listKey) continue;\n\n if (listKey.ed25519) {\n if (this.compareEd25519Key(listKey.ed25519, userPublicKey)) {\n return true;\n }\n } else if (listKey.keyList || listKey.thresholdKey) {\n try {\n const nestedKeyBytes = proto.Key.encode({\n ...(listKey.keyList ? { keyList: listKey.keyList } : {}),\n ...(listKey.thresholdKey\n ? { thresholdKey: listKey.thresholdKey }\n : {}),\n }).finish();\n\n const hasNestedAccess = await this.checkKeyListAccess(\n Buffer.from(nestedKeyBytes),\n userPublicKey\n );\n\n if (hasNestedAccess) {\n return true;\n }\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error in nested key: ${error.message}`;\n this.logger.debug(logMessage);\n }\n }\n }\n\n return false;\n }\n\n /**\n * Compares an Ed25519 key with a user's public key.\n * @param keyData The Ed25519 key data to compare.\n * @param userPublicKey The public key of the user to compare with.\n * @returns A boolean indicating whether the key matches the user's public key.\n */\n private compareEd25519Key(\n keyData: Uint8Array,\n userPublicKey: PublicKey\n ): boolean {\n try {\n const decodedKey = PublicKey.fromBytes(Buffer.from(keyData));\n return decodedKey.toString() === userPublicKey.toString();\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error comparing Ed25519 key: ${error.message}`;\n this.logger.debug(logMessage);\n return false;\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAcO,MAAM,iBAAiB;AAAA,EAM5B,YAAY,SAAsB,QAAgB;AAChD,SAAK,UAAU;AACV,SAAA,UAAU,KAAK,iBAAiB;AACrC,SAAK,SAAS;AACT,SAAA,sBAAsB,OAAO,WAAW;AAAA,EAAA;AAAA,EAGvC,mBAA2B;AAC1B,WAAA,KAAK,YAAY,YACpB,iDACA;AAAA,EAAA;AAAA,EAGN,aAAqB;AACnB,WAAO,KAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASd,MAAM,aAAa,WAAuC;AACxD,SAAK,OAAO,KAAK,kCA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