@hashgraphonline/standards-sdk 0.0.83 → 0.0.84
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/connections-manager.d.ts +185 -0
- package/dist/es/hcs-10/connections-manager.d.ts.map +1 -0
- package/dist/es/hcs-10/index.d.ts +1 -0
- package/dist/es/hcs-10/index.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +13 -11
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es10.js +594 -117
- package/dist/es/standards-sdk.es10.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +3 -158
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +3 -22
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +12 -792
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +13 -4
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +14 -141
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +4 -173
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +39 -34
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +37 -30
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +37 -9
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +74 -30
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es11.js +103 -58
- package/dist/es/standards-sdk.es11.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +3 -418
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +34 -2
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +29 -116
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +9 -21
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +33 -26
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +3 -26
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +2 -38
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +5 -0
- package/dist/es/standards-sdk.es117.js.map +1 -0
- package/dist/es/standards-sdk.es12.js +82 -628
- package/dist/es/standards-sdk.es12.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +650 -85
- package/dist/es/standards-sdk.es13.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +84 -58
- package/dist/es/standards-sdk.es14.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +57 -20
- package/dist/es/standards-sdk.es15.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +18 -156
- package/dist/es/standards-sdk.es16.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +138 -385
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +385 -315
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +310 -128
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es2.js +1 -1
- package/dist/es/standards-sdk.es20.js +155 -7
- package/dist/es/standards-sdk.es20.js.map +1 -1
- package/dist/es/standards-sdk.es21.js +7 -1767
- package/dist/es/standards-sdk.es21.js.map +1 -1
- package/dist/es/standards-sdk.es22.js +1041 -36
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +1766 -47
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +36 -7190
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es25.js +48 -3
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +7190 -2
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +3 -4167
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es28.js +2 -1041
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js +2 -2
- package/dist/es/standards-sdk.es3.js +1 -1
- package/dist/es/standards-sdk.es30.js +4147 -81
- package/dist/es/standards-sdk.es30.js.map +1 -1
- package/dist/es/standards-sdk.es31.js +2 -2
- package/dist/es/standards-sdk.es31.js.map +1 -1
- package/dist/es/standards-sdk.es32.js +363 -15
- package/dist/es/standards-sdk.es32.js.map +1 -1
- package/dist/es/standards-sdk.es33.js +4 -407
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +163 -348
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +79 -4
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +97 -162
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +45 -74
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +8 -112
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +89 -44
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es4.js +2 -2
- package/dist/es/standards-sdk.es40.js +3 -9
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +2 -97
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +112 -3
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +74 -2
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +5 -112
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +4 -73
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +220 -5
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +58 -5
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +68 -220
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +189 -52
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +6 -8
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +437 -68
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +25 -2282
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +125 -150
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +12 -7130
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +29 -3
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +24 -27
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +15 -57
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +39 -45
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +17 -9
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +57 -61
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +1288 -5
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +145 -12
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +91 -7
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +82 -43
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +32 -2
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +6 -136
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +148 -161
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +22 -12
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +793 -13
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +101 -2
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +8 -8
- package/dist/es/standards-sdk.es70.js +2 -32
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +15 -14
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +408 -3
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +173 -3
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +141 -14
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +2282 -5
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +164 -39
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +419 -40
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +2 -37
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +113 -71
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +8 -8
- package/dist/es/standards-sdk.es80.js +21 -3
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +3 -2
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +32 -2
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +44 -176
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +47 -435
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +9 -24
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +57 -131
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +6 -18
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +14 -28
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +7 -29
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +2 -2
- package/dist/es/standards-sdk.es90.js +44 -20
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +2 -44
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +136 -18
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +165 -54
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +7060 -1213
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +22 -143
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +26 -91
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +33 -79
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +30 -30
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +14 -5
- 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/connections-manager.d.ts +185 -0
- package/dist/umd/hcs-10/connections-manager.d.ts.map +1 -0
- package/dist/umd/hcs-10/index.d.ts +1 -0
- package/dist/umd/hcs-10/index.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +2 -2
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +9 -4
|
@@ -1,151 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (value == null) {
|
|
5
|
-
return "null";
|
|
6
|
-
}
|
|
7
|
-
if (Array.isArray(value)) {
|
|
8
|
-
return "[ " + value.map(stringify).join(", ") + " ]";
|
|
9
|
-
}
|
|
10
|
-
if (value instanceof Uint8Array) {
|
|
11
|
-
const HEX = "0123456789abcdef";
|
|
12
|
-
let result = "0x";
|
|
13
|
-
for (let i = 0; i < value.length; i++) {
|
|
14
|
-
result += HEX[value[i] >> 4];
|
|
15
|
-
result += HEX[value[i] & 15];
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
if (typeof value === "object" && typeof value.toJSON === "function") {
|
|
20
|
-
return stringify(value.toJSON());
|
|
21
|
-
}
|
|
22
|
-
switch (typeof value) {
|
|
23
|
-
case "boolean":
|
|
24
|
-
case "symbol":
|
|
25
|
-
return value.toString();
|
|
26
|
-
case "bigint":
|
|
27
|
-
return BigInt(value).toString();
|
|
28
|
-
case "number":
|
|
29
|
-
return value.toString();
|
|
30
|
-
case "string":
|
|
31
|
-
return JSON.stringify(value);
|
|
32
|
-
case "object": {
|
|
33
|
-
const keys = Object.keys(value);
|
|
34
|
-
keys.sort();
|
|
35
|
-
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return `[ COULD NOT SERIALIZE ]`;
|
|
1
|
+
function number(n) {
|
|
2
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
3
|
+
throw new Error(`Wrong positive integer: ${n}`);
|
|
39
4
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
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}`);
|
|
42
10
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if ("message" in info || "code" in info || "name" in info) {
|
|
49
|
-
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
|
50
|
-
}
|
|
51
|
-
for (const key in info) {
|
|
52
|
-
if (key === "shortMessage") {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const value = info[key];
|
|
56
|
-
details.push(key + "=" + stringify(value));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
details.push(`code=${code}`);
|
|
60
|
-
details.push(`version=${version}`);
|
|
61
|
-
if (details.length) {
|
|
62
|
-
message += " (" + details.join(", ") + ")";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
let error;
|
|
66
|
-
switch (code) {
|
|
67
|
-
case "INVALID_ARGUMENT":
|
|
68
|
-
error = new TypeError(message);
|
|
69
|
-
break;
|
|
70
|
-
case "NUMERIC_FAULT":
|
|
71
|
-
case "BUFFER_OVERRUN":
|
|
72
|
-
error = new RangeError(message);
|
|
73
|
-
break;
|
|
74
|
-
default:
|
|
75
|
-
error = new Error(message);
|
|
76
|
-
}
|
|
77
|
-
defineProperties(error, { code });
|
|
78
|
-
if (info) {
|
|
79
|
-
Object.assign(error, info);
|
|
80
|
-
}
|
|
81
|
-
if (error.shortMessage == null) {
|
|
82
|
-
defineProperties(error, { shortMessage });
|
|
83
|
-
}
|
|
84
|
-
return error;
|
|
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");
|
|
85
16
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
function assertArgument(check, message, name, value) {
|
|
92
|
-
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
|
93
|
-
}
|
|
94
|
-
function assertArgumentCount(count, expectedCount, message) {
|
|
95
|
-
if (message == null) {
|
|
96
|
-
message = "";
|
|
97
|
-
}
|
|
98
|
-
if (message) {
|
|
99
|
-
message = ": " + message;
|
|
100
|
-
}
|
|
101
|
-
assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", {
|
|
102
|
-
count,
|
|
103
|
-
expectedCount
|
|
104
|
-
});
|
|
105
|
-
assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", {
|
|
106
|
-
count,
|
|
107
|
-
expectedCount
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
|
111
|
-
try {
|
|
112
|
-
if ("test".normalize(form) !== "test") {
|
|
113
|
-
throw new Error("bad");
|
|
114
|
-
}
|
|
115
|
-
;
|
|
116
|
-
if (form === "NFD") {
|
|
117
|
-
const check = String.fromCharCode(233).normalize("NFD");
|
|
118
|
-
const expected = String.fromCharCode(101, 769);
|
|
119
|
-
if (check !== expected) {
|
|
120
|
-
throw new Error("broken");
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
accum.push(form);
|
|
124
|
-
} catch (error) {
|
|
125
|
-
}
|
|
126
|
-
return accum;
|
|
127
|
-
}, []);
|
|
128
|
-
function assertPrivate(givenGuard, guard, className) {
|
|
129
|
-
if (className == null) {
|
|
130
|
-
className = "";
|
|
131
|
-
}
|
|
132
|
-
if (givenGuard !== guard) {
|
|
133
|
-
let method = className, operation = "new";
|
|
134
|
-
if (className) {
|
|
135
|
-
method += ".";
|
|
136
|
-
operation += " " + className;
|
|
137
|
-
}
|
|
138
|
-
assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", {
|
|
139
|
-
operation
|
|
140
|
-
});
|
|
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}`);
|
|
141
22
|
}
|
|
142
23
|
}
|
|
143
24
|
export {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
isError,
|
|
149
|
-
makeError
|
|
25
|
+
bytes,
|
|
26
|
+
exists,
|
|
27
|
+
number,
|
|
28
|
+
output
|
|
150
29
|
};
|
|
151
30
|
//# sourceMappingURL=standards-sdk.es95.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es95.js","sources":["../../node_modules/ethers/lib.esm/utils/errors.js"],"sourcesContent":["/**\n * All errors in ethers include properties to ensure they are both\n * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).\n *\n * The [[isError]] function can be used to check the error ``code`` and\n * provide a type guard for the properties present on that error interface.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\nimport { version } from \"../_version.js\";\nimport { defineProperties } from \"./properties.js\";\nfunction stringify(value) {\n if (value == null) {\n return \"null\";\n }\n if (Array.isArray(value)) {\n return \"[ \" + (value.map(stringify)).join(\", \") + \" ]\";\n }\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n if (typeof (value) === \"object\" && typeof (value.toJSON) === \"function\") {\n return stringify(value.toJSON());\n }\n switch (typeof (value)) {\n case \"boolean\":\n case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"number\":\n return (value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{ \" + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(\", \") + \" }\";\n }\n }\n return `[ COULD NOT SERIALIZE ]`;\n}\n/**\n * Returns true if the %%error%% matches an error thrown by ethers\n * that matches the error %%code%%.\n *\n * In TypeScript environments, this can be used to check that %%error%%\n * matches an EthersError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError(error, code) {\n return (error && error.code === code);\n}\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error) {\n return isError(error, \"CALL_EXCEPTION\");\n}\n/**\n * Returns a new Error configured to the format ethers emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties\n * for the corresponding EthersError.\n *\n * Each error in ethers includes the version of ethers, a\n * machine-readable [[ErrorCode]], and depending on %%code%%, additional\n * required properties. The error message will also include the %%message%%,\n * ethers version, %%code%% and all additional properties, serialized.\n */\nexport function makeError(message, code, info) {\n let shortMessage = message;\n {\n const details = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${stringify(info)}`);\n }\n for (const key in info) {\n if (key === \"shortMessage\") {\n continue;\n }\n const value = (info[key]);\n // try {\n details.push(key + \"=\" + stringify(value));\n // } catch (error: any) {\n // console.log(\"MMM\", error.message);\n // details.push(key + \"=[could not serialize object]\");\n // }\n }\n }\n details.push(`code=${code}`);\n details.push(`version=${version}`);\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n defineProperties(error, { code });\n if (info) {\n Object.assign(error, info);\n }\n if (error.shortMessage == null) {\n defineProperties(error, { shortMessage });\n }\n return error;\n}\n/**\n * Throws an EthersError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert(check, message, code, info) {\n if (!check) {\n throw makeError(message, code, info);\n }\n}\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check, message, name, value) {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\nexport function assertArgumentCount(count, expectedCount, message) {\n if (message == null) {\n message = \"\";\n }\n if (message) {\n message = \": \" + message;\n }\n assert(count >= expectedCount, \"missing argument\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n assert(count <= expectedCount, \"too many arguments\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n}\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad\");\n }\n ;\n /* c8 ignore stop */\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301);\n /* c8 ignore start */\n if (check !== expected) {\n throw new Error(\"broken\");\n }\n /* c8 ignore stop */\n }\n accum.push(form);\n }\n catch (error) { }\n return accum;\n}, []);\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form) {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\", info: { form }\n });\n}\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard, guard, className) {\n if (className == null) {\n className = \"\";\n }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${method}from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation\n });\n }\n}\n//# sourceMappingURL=errors.js.map"],"names":[],"mappings":";;AAWA,SAAS,UAAU,OAAO;AACtB,MAAI,SAAS,MAAM;AACf,WAAO;AAAA,EACf;AACI,MAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,WAAO,OAAQ,MAAM,IAAI,SAAS,EAAG,KAAK,IAAI,IAAI;AAAA,EAC1D;AACI,MAAI,iBAAiB,YAAY;AAC7B,UAAM,MAAM;AACZ,QAAI,SAAS;AACb,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACnC,gBAAU,IAAI,MAAM,CAAC,KAAK,CAAC;AAC3B,gBAAU,IAAI,MAAM,CAAC,IAAI,EAAG;AAAA,IACxC;AACQ,WAAO;AAAA,EACf;AACI,MAAI,OAAQ,UAAW,YAAY,OAAQ,MAAM,WAAY,YAAY;AACrE,WAAO,UAAU,MAAM,QAAQ;AAAA,EACvC;AACI,UAAQ,OAAQ,OAAM;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AACD,aAAO,MAAM,SAAU;AAAA,IAC3B,KAAK;AACD,aAAO,OAAO,KAAK,EAAE,SAAU;AAAA,IACnC,KAAK;AACD,aAAQ,MAAO,SAAU;AAAA,IAC7B,KAAK;AACD,aAAO,KAAK,UAAU,KAAK;AAAA,IAC/B,KAAK,UAAU;AACX,YAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,WAAK,KAAM;AACX,aAAO,OAAO,KAAK,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,KAAK,UAAU,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,IAAI,IAAI;AAAA,IAClG;AAAA,EACA;AACI,SAAO;AACX;AAoBO,SAAS,QAAQ,OAAO,MAAM;AACjC,SAAQ,SAAS,MAAM,SAAS;AACpC;AAiBO,SAAS,UAAU,SAAS,MAAM,MAAM;AAC3C,MAAI,eAAe;AACnB;AACI,UAAM,UAAU,CAAE;AAClB,QAAI,MAAM;AACN,UAAI,aAAa,QAAQ,UAAU,QAAQ,UAAU,MAAM;AACvD,cAAM,IAAI,MAAM,0CAA0C,UAAU,IAAI,CAAC,EAAE;AAAA,MAC3F;AACY,iBAAW,OAAO,MAAM;AACpB,YAAI,QAAQ,gBAAgB;AACxB;AAAA,QACpB;AACgB,cAAM,QAAS,KAAK,GAAG;AAEvB,gBAAQ,KAAK,MAAM,MAAM,UAAU,KAAK,CAAC;AAAA,MAKzD;AAAA,IACA;AACQ,YAAQ,KAAK,QAAQ,IAAI,EAAE;AAC3B,YAAQ,KAAK,WAAW,OAAO,EAAE;AACjC,QAAI,QAAQ,QAAQ;AAChB,iBAAW,OAAO,QAAQ,KAAK,IAAI,IAAI;AAAA,IACnD;AAAA,EACA;AACI,MAAI;AACJ,UAAQ,MAAI;AAAA,IACR,KAAK;AACD,cAAQ,IAAI,UAAU,OAAO;AAC7B;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AACD,cAAQ,IAAI,WAAW,OAAO;AAC9B;AAAA,IACJ;AACI,cAAQ,IAAI,MAAM,OAAO;AAAA,EACrC;AACI,mBAAiB,OAAO,EAAE,MAAM;AAChC,MAAI,MAAM;AACN,WAAO,OAAO,OAAO,IAAI;AAAA,EACjC;AACI,MAAI,MAAM,gBAAgB,MAAM;AAC5B,qBAAiB,OAAO,EAAE,cAAc;AAAA,EAChD;AACI,SAAO;AACX;AAOO,SAAS,OAAO,OAAO,SAAS,MAAM,MAAM;AAC/C,MAAI,CAAC,OAAO;AACR,UAAM,UAAU,SAAS,MAAM,IAAI;AAAA,EAC3C;AACA;AAQO,SAAS,eAAe,OAAO,SAAS,MAAM,OAAO;AACxD,SAAO,OAAO,SAAS,oBAAoB,EAAE,UAAU,MAAM,OAAc;AAC/E;AACO,SAAS,oBAAoB,OAAO,eAAe,SAAS;AAC/D,MAAI,WAAW,MAAM;AACjB,cAAU;AAAA,EAClB;AACI,MAAI,SAAS;AACT,cAAU,OAAO;AAAA,EACzB;AACI,SAAO,SAAS,eAAe,qBAAqB,SAAS,oBAAoB;AAAA,IAC7E;AAAA,IACA;AAAA,EACR,CAAK;AACD,SAAO,SAAS,eAAe,uBAAuB,SAAS,uBAAuB;AAAA,IAClF;AAAA,IACA;AAAA,EACR,CAAK;AACL;AACwB,CAAC,OAAO,OAAO,QAAQ,MAAM,EAAE,OAAO,CAAC,OAAO,SAAS;AAC3E,MAAI;AAGA,QAAI,OAAO,UAAU,IAAI,MAAM,QAAQ;AACnC,YAAM,IAAI,MAAM,KAAK;AAAA,IACjC;AACQ;AAEA,QAAI,SAAS,OAAO;AAChB,YAAM,QAAQ,OAAO,aAAa,GAAI,EAAE,UAAU,KAAK;AACvD,YAAM,WAAW,OAAO,aAAa,KAAM,GAAM;AAEjD,UAAI,UAAU,UAAU;AACpB,cAAM,IAAI,MAAM,QAAQ;AAAA,MACxC;AAAA,IAEA;AACQ,UAAM,KAAK,IAAI;AAAA,EACvB,SACW,OAAO;AAAA,EAAA;AACd,SAAO;AACX,GAAG,CAAE,CAAA;AAeE,SAAS,cAAc,YAAY,OAAO,WAAW;AACxD,MAAI,aAAa,MAAM;AACnB,gBAAY;AAAA,EACpB;AACI,MAAI,eAAe,OAAO;AACtB,QAAI,SAAS,WAAW,YAAY;AACpC,QAAI,WAAW;AACX,gBAAU;AACV,mBAAa,MAAM;AAAA,IAC/B;AACQ,WAAO,OAAO,4BAA4B,MAAM,iBAAiB,yBAAyB;AAAA,MACtF;AAAA,IACZ,CAAS;AAAA,EACT;AACA;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es95.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,94 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return _getBytes(value, name, false);
|
|
22
|
-
}
|
|
23
|
-
function getBytesCopy(value, name) {
|
|
24
|
-
return _getBytes(value, name, true);
|
|
25
|
-
}
|
|
26
|
-
function isHexString(value, length) {
|
|
27
|
-
if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if (typeof length === "number" && value.length !== 2 + 2 * length) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (length === true && value.length % 2 !== 0) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
const HexCharacters = "0123456789abcdef";
|
|
39
|
-
function hexlify(data) {
|
|
40
|
-
const bytes = getBytes(data);
|
|
41
|
-
let result = "0x";
|
|
42
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
43
|
-
const v = bytes[i];
|
|
44
|
-
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
function concat(datas) {
|
|
49
|
-
return "0x" + datas.map((d) => hexlify(d).substring(2)).join("");
|
|
50
|
-
}
|
|
51
|
-
function dataSlice(data, start, end) {
|
|
52
|
-
const bytes = getBytes(data);
|
|
53
|
-
if (end != null && end > bytes.length) {
|
|
54
|
-
assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
|
|
55
|
-
buffer: bytes,
|
|
56
|
-
length: bytes.length,
|
|
57
|
-
offset: end
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end));
|
|
61
|
-
}
|
|
62
|
-
function zeroPad(data, length, left) {
|
|
63
|
-
const bytes = getBytes(data);
|
|
64
|
-
assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", {
|
|
65
|
-
buffer: new Uint8Array(bytes),
|
|
66
|
-
length,
|
|
67
|
-
offset: length + 1
|
|
68
|
-
});
|
|
69
|
-
const result = new Uint8Array(length);
|
|
70
|
-
result.fill(0);
|
|
71
|
-
if (left) {
|
|
72
|
-
result.set(bytes, length - bytes.length);
|
|
73
|
-
} else {
|
|
74
|
-
result.set(bytes, 0);
|
|
75
|
-
}
|
|
76
|
-
return hexlify(result);
|
|
77
|
-
}
|
|
78
|
-
function zeroPadValue(data, length) {
|
|
79
|
-
return zeroPad(data, length, true);
|
|
80
|
-
}
|
|
81
|
-
function zeroPadBytes(data, length) {
|
|
82
|
-
return zeroPad(data, length, false);
|
|
83
|
-
}
|
|
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;
|
|
84
21
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
zeroPadBytes,
|
|
92
|
-
zeroPadValue
|
|
22
|
+
fromBig,
|
|
23
|
+
rotlBH,
|
|
24
|
+
rotlBL,
|
|
25
|
+
rotlSH,
|
|
26
|
+
rotlSL,
|
|
27
|
+
split
|
|
93
28
|
};
|
|
94
29
|
//# sourceMappingURL=standards-sdk.es96.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es96.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es96.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,87 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
expanded[i] = chars[i].charCodeAt(0);
|
|
12
|
-
}
|
|
13
|
-
const hashed = getBytes(keccak256(expanded));
|
|
14
|
-
for (let i = 0; i < 40; i += 2) {
|
|
15
|
-
if (hashed[i >> 1] >> 4 >= 8) {
|
|
16
|
-
chars[i] = chars[i].toUpperCase();
|
|
17
|
-
}
|
|
18
|
-
if ((hashed[i >> 1] & 15) >= 8) {
|
|
19
|
-
chars[i + 1] = chars[i + 1].toUpperCase();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return "0x" + chars.join("");
|
|
23
|
-
}
|
|
24
|
-
const ibanLookup = {};
|
|
25
|
-
for (let i = 0; i < 10; i++) {
|
|
26
|
-
ibanLookup[String(i)] = String(i);
|
|
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));
|
|
27
11
|
}
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
|
30
18
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let expanded = address.split("").map((c) => {
|
|
36
|
-
return ibanLookup[c];
|
|
37
|
-
}).join("");
|
|
38
|
-
while (expanded.length >= safeDigits) {
|
|
39
|
-
let block = expanded.substring(0, safeDigits);
|
|
40
|
-
expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
|
|
19
|
+
class Hash {
|
|
20
|
+
// Safe version that clones internal state
|
|
21
|
+
clone() {
|
|
22
|
+
return this._cloneInto();
|
|
41
23
|
}
|
|
42
|
-
let checksum = String(98 - parseInt(expanded, 10) % 97);
|
|
43
|
-
while (checksum.length < 2) {
|
|
44
|
-
checksum = "0" + checksum;
|
|
45
|
-
}
|
|
46
|
-
return checksum;
|
|
47
24
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return
|
|
55
|
-
}();
|
|
56
|
-
function fromBase36(value) {
|
|
57
|
-
value = value.toLowerCase();
|
|
58
|
-
let result = BN_0;
|
|
59
|
-
for (let i = 0; i < value.length; i++) {
|
|
60
|
-
result = result * BN_36 + Base36[value[i]];
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
function getAddress(address) {
|
|
65
|
-
assertArgument(typeof address === "string", "invalid address", "address", address);
|
|
66
|
-
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
|
67
|
-
if (!address.startsWith("0x")) {
|
|
68
|
-
address = "0x" + address;
|
|
69
|
-
}
|
|
70
|
-
const result = getChecksumAddress(address);
|
|
71
|
-
assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
|
75
|
-
assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
|
|
76
|
-
let result = fromBase36(address.substring(4)).toString(16);
|
|
77
|
-
while (result.length < 40) {
|
|
78
|
-
result = "0" + result;
|
|
79
|
-
}
|
|
80
|
-
return getChecksumAddress("0x" + result);
|
|
81
|
-
}
|
|
82
|
-
assertArgument(false, "invalid address", "address", address);
|
|
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;
|
|
83
32
|
}
|
|
84
33
|
export {
|
|
85
|
-
|
|
34
|
+
Hash,
|
|
35
|
+
isLE,
|
|
36
|
+
toBytes,
|
|
37
|
+
u32,
|
|
38
|
+
utf8ToBytes,
|
|
39
|
+
wrapConstructor
|
|
86
40
|
};
|
|
87
41
|
//# sourceMappingURL=standards-sdk.es97.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es97.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es97.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]}
|