@gardenfi/utils 2.1.0 → 2.1.2
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/index100.cjs +1 -1
- package/dist/index100.js +3 -79
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +10 -17
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +19 -11
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +8 -19
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +16 -10
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +638 -33
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +173 -5
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +12 -10
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +128 -2
- package/dist/index109.cjs +2 -1
- package/dist/index109.js +3 -21
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +2 -128
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +2 -7
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +38 -2
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +34 -33
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +5 -5
- package/dist/index115.cjs +1 -2
- package/dist/index115.js +11 -3
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +6 -18
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +15 -638
- package/dist/index118.cjs +1 -1
- package/dist/index118.js +5 -173
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +2 -2
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +11 -11
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +9 -9
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +18 -17
- package/dist/index21.cjs +16 -1
- package/dist/index21.js +112 -30
- package/dist/index22.cjs +1 -16
- package/dist/index22.js +30 -113
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +41 -17
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +44 -6
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +24 -44
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +6 -21
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +13 -8
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +15 -31
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +5 -26
- package/dist/index30.cjs +1 -2
- package/dist/index30.js +13 -65
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +10 -51
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +12 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +11 -24
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +13 -75
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +2 -2
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +55 -7
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +16 -32
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +5 -15
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +9 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +171 -8
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +102 -19
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +21 -41
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +17 -25
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +7 -6
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +20 -12
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +8 -15
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +31 -5
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +26 -13
- package/dist/index49.cjs +2 -1
- package/dist/index49.js +65 -10
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +51 -12
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +12 -11
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +24 -13
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +75 -55
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +7 -16
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +32 -5
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +15 -8
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -172
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +7 -102
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +20 -21
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +38 -10
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +32 -32
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +69 -8
- package/dist/index63.cjs +1 -2
- package/dist/index63.js +110 -57
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +68 -2
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +2 -7
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +16 -6
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +223 -4
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +230 -10
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +12 -3
- package/dist/index70.cjs +1 -5
- package/dist/index70.js +29 -51
- package/dist/index71.cjs +2 -2
- package/dist/index71.js +57 -32
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +21 -5
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +18 -21
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +42 -8
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +8 -10
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +104 -11
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +3 -6
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +17 -13
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +8 -32
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +10 -14
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +11 -64
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +12 -26
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +7 -3
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +78 -3
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +14 -8
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +16 -189
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +191 -18
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +63 -39
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +4 -34
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +51 -43
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +2 -70
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +5 -111
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +11 -67
- package/dist/index93.cjs +5 -1
- package/dist/index93.js +57 -2
- package/dist/index94.cjs +2 -1
- package/dist/index94.js +33 -15
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +5 -223
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +3 -231
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +6 -42
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +30 -102
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +26 -16
- package/package.json +1 -1
package/dist/index68.js
CHANGED
|
@@ -1,14 +1,234 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
const d = /* @__PURE__ */ BigInt(0), y = /* @__PURE__ */ BigInt(1), I = /* @__PURE__ */ BigInt(2);
|
|
3
|
+
function h(t) {
|
|
4
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
5
|
+
}
|
|
6
|
+
function b(t) {
|
|
7
|
+
if (!h(t))
|
|
8
|
+
throw new Error("Uint8Array expected");
|
|
9
|
+
}
|
|
10
|
+
function O(t, n) {
|
|
11
|
+
if (typeof n != "boolean")
|
|
12
|
+
throw new Error(t + " boolean expected, got " + n);
|
|
13
|
+
}
|
|
14
|
+
const T = /* @__PURE__ */ Array.from({ length: 256 }, (t, n) => n.toString(16).padStart(2, "0"));
|
|
15
|
+
function B(t) {
|
|
16
|
+
b(t);
|
|
17
|
+
let n = "";
|
|
18
|
+
for (let r = 0; r < t.length; r++)
|
|
19
|
+
n += T[t[r]];
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
function S(t) {
|
|
23
|
+
const n = t.toString(16);
|
|
24
|
+
return n.length & 1 ? "0" + n : n;
|
|
25
|
+
}
|
|
26
|
+
function U(t) {
|
|
27
|
+
if (typeof t != "string")
|
|
28
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
29
|
+
return t === "" ? d : BigInt("0x" + t);
|
|
30
|
+
}
|
|
31
|
+
const s = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
32
|
+
function E(t) {
|
|
33
|
+
if (t >= s._0 && t <= s._9)
|
|
34
|
+
return t - s._0;
|
|
35
|
+
if (t >= s.A && t <= s.F)
|
|
36
|
+
return t - (s.A - 10);
|
|
37
|
+
if (t >= s.a && t <= s.f)
|
|
38
|
+
return t - (s.a - 10);
|
|
39
|
+
}
|
|
40
|
+
function m(t) {
|
|
41
|
+
if (typeof t != "string")
|
|
42
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
43
|
+
const n = t.length, r = n / 2;
|
|
44
|
+
if (n % 2)
|
|
45
|
+
throw new Error("hex string expected, got unpadded hex of length " + n);
|
|
46
|
+
const e = new Uint8Array(r);
|
|
47
|
+
for (let o = 0, i = 0; o < r; o++, i += 2) {
|
|
48
|
+
const a = E(t.charCodeAt(i)), f = E(t.charCodeAt(i + 1));
|
|
49
|
+
if (a === void 0 || f === void 0) {
|
|
50
|
+
const c = t[i] + t[i + 1];
|
|
51
|
+
throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
|
|
52
|
+
}
|
|
53
|
+
e[o] = a * 16 + f;
|
|
54
|
+
}
|
|
55
|
+
return e;
|
|
56
|
+
}
|
|
57
|
+
function V(t) {
|
|
58
|
+
return U(B(t));
|
|
59
|
+
}
|
|
60
|
+
function H(t) {
|
|
61
|
+
return b(t), U(B(Uint8Array.from(t).reverse()));
|
|
62
|
+
}
|
|
63
|
+
function v(t, n) {
|
|
64
|
+
return m(t.toString(16).padStart(n * 2, "0"));
|
|
65
|
+
}
|
|
66
|
+
function C(t, n) {
|
|
67
|
+
return v(t, n).reverse();
|
|
68
|
+
}
|
|
69
|
+
function M(t) {
|
|
70
|
+
return m(S(t));
|
|
71
|
+
}
|
|
72
|
+
function R(t, n, r) {
|
|
73
|
+
let e;
|
|
74
|
+
if (typeof n == "string")
|
|
75
|
+
try {
|
|
76
|
+
e = m(n);
|
|
77
|
+
} catch (i) {
|
|
78
|
+
throw new Error(t + " must be hex string or Uint8Array, cause: " + i);
|
|
79
|
+
}
|
|
80
|
+
else if (h(n))
|
|
81
|
+
e = Uint8Array.from(n);
|
|
82
|
+
else
|
|
83
|
+
throw new Error(t + " must be hex string or Uint8Array");
|
|
84
|
+
const o = e.length;
|
|
85
|
+
if (typeof r == "number" && o !== r)
|
|
86
|
+
throw new Error(t + " of length " + r + " expected, got " + o);
|
|
87
|
+
return e;
|
|
88
|
+
}
|
|
89
|
+
function _(...t) {
|
|
90
|
+
let n = 0;
|
|
91
|
+
for (let e = 0; e < t.length; e++) {
|
|
92
|
+
const o = t[e];
|
|
93
|
+
b(o), n += o.length;
|
|
94
|
+
}
|
|
95
|
+
const r = new Uint8Array(n);
|
|
96
|
+
for (let e = 0, o = 0; e < t.length; e++) {
|
|
97
|
+
const i = t[e];
|
|
98
|
+
r.set(i, o), o += i.length;
|
|
99
|
+
}
|
|
100
|
+
return r;
|
|
101
|
+
}
|
|
102
|
+
function j(t, n) {
|
|
103
|
+
if (t.length !== n.length)
|
|
104
|
+
return !1;
|
|
105
|
+
let r = 0;
|
|
106
|
+
for (let e = 0; e < t.length; e++)
|
|
107
|
+
r |= t[e] ^ n[e];
|
|
108
|
+
return r === 0;
|
|
109
|
+
}
|
|
110
|
+
function z(t) {
|
|
111
|
+
if (typeof t != "string")
|
|
112
|
+
throw new Error("string expected");
|
|
113
|
+
return new Uint8Array(new TextEncoder().encode(t));
|
|
114
|
+
}
|
|
115
|
+
const w = (t) => typeof t == "bigint" && d <= t;
|
|
116
|
+
function N(t, n, r) {
|
|
117
|
+
return w(t) && w(n) && w(r) && n <= t && t < r;
|
|
118
|
+
}
|
|
119
|
+
function D(t, n, r, e) {
|
|
120
|
+
if (!N(n, r, e))
|
|
121
|
+
throw new Error("expected valid " + t + ": " + r + " <= n < " + e + ", got " + n);
|
|
122
|
+
}
|
|
123
|
+
function G(t) {
|
|
124
|
+
let n;
|
|
125
|
+
for (n = 0; t > d; t >>= y, n += 1)
|
|
126
|
+
;
|
|
127
|
+
return n;
|
|
128
|
+
}
|
|
129
|
+
function P(t, n) {
|
|
130
|
+
return t >> BigInt(n) & y;
|
|
131
|
+
}
|
|
132
|
+
function W(t, n, r) {
|
|
133
|
+
return t | (r ? y : d) << BigInt(n);
|
|
134
|
+
}
|
|
135
|
+
const q = (t) => (I << BigInt(t - 1)) - y, p = (t) => new Uint8Array(t), A = (t) => Uint8Array.from(t);
|
|
136
|
+
function J(t, n, r) {
|
|
137
|
+
if (typeof t != "number" || t < 2)
|
|
138
|
+
throw new Error("hashLen must be a number");
|
|
139
|
+
if (typeof n != "number" || n < 2)
|
|
140
|
+
throw new Error("qByteLen must be a number");
|
|
141
|
+
if (typeof r != "function")
|
|
142
|
+
throw new Error("hmacFn must be a function");
|
|
143
|
+
let e = p(t), o = p(t), i = 0;
|
|
144
|
+
const a = () => {
|
|
145
|
+
e.fill(1), o.fill(0), i = 0;
|
|
146
|
+
}, f = (...u) => r(o, e, ...u), c = (u = p()) => {
|
|
147
|
+
o = f(A([0]), u), e = f(), u.length !== 0 && (o = f(A([1]), u), e = f());
|
|
148
|
+
}, x = () => {
|
|
149
|
+
if (i++ >= 1e3)
|
|
150
|
+
throw new Error("drbg: tried 1000 values");
|
|
151
|
+
let u = 0;
|
|
152
|
+
const l = [];
|
|
153
|
+
for (; u < n; ) {
|
|
154
|
+
e = f();
|
|
155
|
+
const g = e.slice();
|
|
156
|
+
l.push(g), u += e.length;
|
|
157
|
+
}
|
|
158
|
+
return _(...l);
|
|
159
|
+
};
|
|
160
|
+
return (u, l) => {
|
|
161
|
+
a(), c(u);
|
|
162
|
+
let g;
|
|
163
|
+
for (; !(g = l(x())); )
|
|
164
|
+
c();
|
|
165
|
+
return a(), g;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const k = {
|
|
169
|
+
bigint: (t) => typeof t == "bigint",
|
|
170
|
+
function: (t) => typeof t == "function",
|
|
171
|
+
boolean: (t) => typeof t == "boolean",
|
|
172
|
+
string: (t) => typeof t == "string",
|
|
173
|
+
stringOrUint8Array: (t) => typeof t == "string" || h(t),
|
|
174
|
+
isSafeInteger: (t) => Number.isSafeInteger(t),
|
|
175
|
+
array: (t) => Array.isArray(t),
|
|
176
|
+
field: (t, n) => n.Fp.isValid(t),
|
|
177
|
+
hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
|
|
178
|
+
};
|
|
179
|
+
function K(t, n, r = {}) {
|
|
180
|
+
const e = (o, i, a) => {
|
|
181
|
+
const f = k[i];
|
|
182
|
+
if (typeof f != "function")
|
|
183
|
+
throw new Error("invalid validator function");
|
|
184
|
+
const c = t[o];
|
|
185
|
+
if (!(a && c === void 0) && !f(c, t))
|
|
186
|
+
throw new Error("param " + String(o) + " is invalid. Expected " + i + ", got " + c);
|
|
187
|
+
};
|
|
188
|
+
for (const [o, i] of Object.entries(n))
|
|
189
|
+
e(o, i, !1);
|
|
190
|
+
for (const [o, i] of Object.entries(r))
|
|
191
|
+
e(o, i, !0);
|
|
192
|
+
return t;
|
|
193
|
+
}
|
|
194
|
+
const Q = () => {
|
|
195
|
+
throw new Error("not implemented");
|
|
196
|
+
};
|
|
197
|
+
function X(t) {
|
|
198
|
+
const n = /* @__PURE__ */ new WeakMap();
|
|
199
|
+
return (r, ...e) => {
|
|
200
|
+
const o = n.get(r);
|
|
201
|
+
if (o !== void 0)
|
|
202
|
+
return o;
|
|
203
|
+
const i = t(r, ...e);
|
|
204
|
+
return n.set(r, i), i;
|
|
10
205
|
};
|
|
11
206
|
}
|
|
12
207
|
export {
|
|
13
|
-
|
|
208
|
+
D as aInRange,
|
|
209
|
+
O as abool,
|
|
210
|
+
b as abytes,
|
|
211
|
+
P as bitGet,
|
|
212
|
+
G as bitLen,
|
|
213
|
+
q as bitMask,
|
|
214
|
+
W as bitSet,
|
|
215
|
+
B as bytesToHex,
|
|
216
|
+
V as bytesToNumberBE,
|
|
217
|
+
H as bytesToNumberLE,
|
|
218
|
+
_ as concatBytes,
|
|
219
|
+
J as createHmacDrbg,
|
|
220
|
+
R as ensureBytes,
|
|
221
|
+
j as equalBytes,
|
|
222
|
+
m as hexToBytes,
|
|
223
|
+
U as hexToNumber,
|
|
224
|
+
N as inRange,
|
|
225
|
+
h as isBytes,
|
|
226
|
+
X as memoized,
|
|
227
|
+
Q as notImplemented,
|
|
228
|
+
v as numberToBytesBE,
|
|
229
|
+
C as numberToBytesLE,
|
|
230
|
+
S as numberToHexUnpadded,
|
|
231
|
+
M as numberToVarBytesBE,
|
|
232
|
+
z as utf8ToBytes,
|
|
233
|
+
K as validateObject
|
|
14
234
|
};
|
package/dist/index69.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index71.cjs");class i extends n.BaseError{constructor({max:e,min:r,signed:s,size:t,value:a}){super(`Number "${a}" is not in safe ${t?`${t*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}class u extends n.BaseError{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}exports.IntegerOutOfRangeError=i;exports.SizeOverflowError=u;
|
package/dist/index69.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BaseError as t } from "./index71.js";
|
|
2
|
+
class $ extends t {
|
|
3
|
+
constructor({ max: e, min: r, signed: s, size: n, value: a }) {
|
|
4
|
+
super(`Number "${a}" is not in safe ${n ? `${n * 8}-bit ${s ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class c extends t {
|
|
8
|
+
constructor({ givenSize: e, maxSize: r }) {
|
|
9
|
+
super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
|
|
10
|
+
}
|
|
3
11
|
}
|
|
4
12
|
export {
|
|
5
|
-
|
|
13
|
+
$ as IntegerOutOfRangeError,
|
|
14
|
+
c as SizeOverflowError
|
|
6
15
|
};
|
package/dist/index70.cjs
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./
|
|
2
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class a extends n.BaseError{constructor({expectedSize:r,value:e}){super(`Size of bytes "${e}" (bytes${i.size(e)}) does not match expected size (bytes${r}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class c extends n.BaseError{constructor({expectedLength:r,givenLength:e}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${r}`,`Given length (values): ${e}`].join(`
|
|
3
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class d extends n.BaseError{constructor({expectedSize:r,givenSize:e}){super(`Expected bytes${r}, got bytes${e}.`,{name:"BytesSizeMismatchError"})}}class E extends n.BaseError{constructor(r,{docsPath:e}){super([`Type "${r}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
4
|
-
`),{docsPath:e,name:"InvalidAbiEncodingType"})}}class g extends n.BaseError{constructor(r){super([`Value "${r}" is not a valid array.`].join(`
|
|
5
|
-
`),{name:"InvalidArrayError"})}}exports.AbiEncodingArrayLengthMismatchError=o;exports.AbiEncodingBytesSizeMismatchError=a;exports.AbiEncodingLengthMismatchError=c;exports.BytesSizeMismatchError=d;exports.InvalidAbiEncodingTypeError=E;exports.InvalidArrayError=g;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index107.cjs");function p(e,{dir:n,size:t=32}={}){return typeof e=="string"?o(e,{dir:n,size:t}):l(e,{dir:n,size:t})}function o(e,{dir:n,size:t=32}={}){if(t===null)return e;const r=e.replace("0x","");if(r.length>t*2)throw new i.SizeExceedsPaddingSizeError({size:Math.ceil(r.length/2),targetSize:t,type:"hex"});return`0x${r[n==="right"?"padEnd":"padStart"](t*2,"0")}`}function l(e,{dir:n,size:t=32}={}){if(t===null)return e;if(e.length>t)throw new i.SizeExceedsPaddingSizeError({size:e.length,targetSize:t,type:"bytes"});const r=new Uint8Array(t);for(let a=0;a<t;a++){const d=n==="right";r[d?a:t-a-1]=e[d?a:e.length-a-1]}return r}exports.pad=p;exports.padBytes=l;exports.padHex=o;
|
package/dist/index70.js
CHANGED
|
@@ -1,59 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
constructor({ expectedLength: e, givenLength: r, type: s }) {
|
|
5
|
-
super([
|
|
6
|
-
`ABI encoding array length mismatch for type ${s}.`,
|
|
7
|
-
`Expected length: ${e}`,
|
|
8
|
-
`Given length: ${r}`
|
|
9
|
-
].join(`
|
|
10
|
-
`), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
class d extends n {
|
|
14
|
-
constructor({ expectedSize: e, value: r }) {
|
|
15
|
-
super(`Size of bytes "${r}" (bytes${i(r)}) does not match expected size (bytes${e}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
class m extends n {
|
|
19
|
-
constructor({ expectedLength: e, givenLength: r }) {
|
|
20
|
-
super([
|
|
21
|
-
"ABI encoding params/values length mismatch.",
|
|
22
|
-
`Expected length (params): ${e}`,
|
|
23
|
-
`Given length (values): ${r}`
|
|
24
|
-
].join(`
|
|
25
|
-
`), { name: "AbiEncodingLengthMismatchError" });
|
|
26
|
-
}
|
|
1
|
+
import { SizeExceedsPaddingSizeError as d } from "./index107.js";
|
|
2
|
+
function f(n, { dir: r, size: t = 32 } = {}) {
|
|
3
|
+
return typeof n == "string" ? p(n, { dir: r, size: t }) : i(n, { dir: r, size: t });
|
|
27
4
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
function p(n, { dir: r, size: t = 32 } = {}) {
|
|
6
|
+
if (t === null)
|
|
7
|
+
return n;
|
|
8
|
+
const e = n.replace("0x", "");
|
|
9
|
+
if (e.length > t * 2)
|
|
10
|
+
throw new d({
|
|
11
|
+
size: Math.ceil(e.length / 2),
|
|
12
|
+
targetSize: t,
|
|
13
|
+
type: "hex"
|
|
32
14
|
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
class g extends n {
|
|
36
|
-
constructor(e, { docsPath: r }) {
|
|
37
|
-
super([
|
|
38
|
-
`Type "${e}" is not a valid encoding type.`,
|
|
39
|
-
"Please provide a valid ABI type."
|
|
40
|
-
].join(`
|
|
41
|
-
`), { docsPath: r, name: "InvalidAbiEncodingType" });
|
|
42
|
-
}
|
|
15
|
+
return `0x${e[r === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
|
|
43
16
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
function i(n, { dir: r, size: t = 32 } = {}) {
|
|
18
|
+
if (t === null)
|
|
19
|
+
return n;
|
|
20
|
+
if (n.length > t)
|
|
21
|
+
throw new d({
|
|
22
|
+
size: n.length,
|
|
23
|
+
targetSize: t,
|
|
24
|
+
type: "bytes"
|
|
49
25
|
});
|
|
26
|
+
const e = new Uint8Array(t);
|
|
27
|
+
for (let a = 0; a < t; a++) {
|
|
28
|
+
const o = r === "right";
|
|
29
|
+
e[o ? a : t - a - 1] = n[o ? a : n.length - a - 1];
|
|
50
30
|
}
|
|
31
|
+
return e;
|
|
51
32
|
}
|
|
52
33
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
E as BytesSizeMismatchError,
|
|
57
|
-
g as InvalidAbiEncodingTypeError,
|
|
58
|
-
l as InvalidArrayError
|
|
34
|
+
f as pad,
|
|
35
|
+
i as padBytes,
|
|
36
|
+
p as padHex
|
|
59
37
|
};
|
package/dist/index71.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`),{cause:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index90.cjs");let i={getDocsUrl:({docsBaseUrl:s,docsPath:t="",docsSlug:e})=>t?`${s??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${l.version}`};class u extends Error{constructor(t,e={}){var o;const r=(()=>{var c;return e.cause instanceof u?e.cause.details:(c=e.cause)!=null&&c.message?e.cause.message:e.details})(),n=e.cause instanceof u&&e.cause.docsPath||e.docsPath,a=(o=i.getDocsUrl)==null?void 0:o.call(i,{...e,docsPath:n}),b=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...i.version?[`Version: ${i.version}`]:[]].join(`
|
|
2
|
+
`);super(b,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=l.version}walk(t){return d(this,t)}}function d(s,t){return t!=null&&t(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?d(s.cause,t):t?null:s}exports.BaseError=u;
|
package/dist/index71.js
CHANGED
|
@@ -1,37 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
super([
|
|
20
|
-
`The provided tip (\`maxPriorityFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${t ? ` = ${a(t)} gwei` : ""}).`
|
|
1
|
+
import { version as l } from "./index90.js";
|
|
2
|
+
let i = {
|
|
3
|
+
getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
|
|
4
|
+
version: `viem@${l}`
|
|
5
|
+
};
|
|
6
|
+
class r extends Error {
|
|
7
|
+
constructor(t, e = {}) {
|
|
8
|
+
var o;
|
|
9
|
+
const u = (() => {
|
|
10
|
+
var c;
|
|
11
|
+
return e.cause instanceof r ? e.cause.details : (c = e.cause) != null && c.message ? e.cause.message : e.details;
|
|
12
|
+
})(), a = e.cause instanceof r && e.cause.docsPath || e.docsPath, n = (o = i.getDocsUrl) == null ? void 0 : o.call(i, { ...e, docsPath: a }), b = [
|
|
13
|
+
t || "An error occurred.",
|
|
14
|
+
"",
|
|
15
|
+
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
16
|
+
...n ? [`Docs: ${n}`] : [],
|
|
17
|
+
...u ? [`Details: ${u}`] : [],
|
|
18
|
+
...i.version ? [`Version: ${i.version}`] : []
|
|
21
19
|
].join(`
|
|
22
|
-
`)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
`);
|
|
21
|
+
super(b, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
22
|
+
enumerable: !0,
|
|
23
|
+
configurable: !0,
|
|
24
|
+
writable: !0,
|
|
25
|
+
value: void 0
|
|
26
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
27
|
+
enumerable: !0,
|
|
28
|
+
configurable: !0,
|
|
29
|
+
writable: !0,
|
|
30
|
+
value: void 0
|
|
31
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
32
|
+
enumerable: !0,
|
|
33
|
+
configurable: !0,
|
|
34
|
+
writable: !0,
|
|
35
|
+
value: void 0
|
|
36
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
configurable: !0,
|
|
39
|
+
writable: !0,
|
|
40
|
+
value: void 0
|
|
41
|
+
}), Object.defineProperty(this, "version", {
|
|
42
|
+
enumerable: !0,
|
|
43
|
+
configurable: !0,
|
|
44
|
+
writable: !0,
|
|
45
|
+
value: void 0
|
|
46
|
+
}), Object.defineProperty(this, "name", {
|
|
47
|
+
enumerable: !0,
|
|
48
|
+
configurable: !0,
|
|
49
|
+
writable: !0,
|
|
50
|
+
value: "BaseError"
|
|
51
|
+
}), this.details = u, this.docsPath = a, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = l;
|
|
26
52
|
}
|
|
53
|
+
walk(t) {
|
|
54
|
+
return d(this, t);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function d(s, t) {
|
|
58
|
+
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? d(s.cause, t) : t ? null : s;
|
|
27
59
|
}
|
|
28
|
-
Object.defineProperty(h, "nodeMessage", {
|
|
29
|
-
enumerable: !0,
|
|
30
|
-
configurable: !0,
|
|
31
|
-
writable: !0,
|
|
32
|
-
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
33
|
-
});
|
|
34
60
|
export {
|
|
35
|
-
|
|
36
|
-
h as TipAboveFeeCapError
|
|
61
|
+
r as BaseError
|
|
37
62
|
};
|
package/dist/index72.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}exports.LruMap=i;
|
package/dist/index72.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
class r extends Map {
|
|
2
|
+
constructor(e) {
|
|
3
|
+
super(), Object.defineProperty(this, "maxSize", {
|
|
4
|
+
enumerable: !0,
|
|
5
|
+
configurable: !0,
|
|
6
|
+
writable: !0,
|
|
7
|
+
value: void 0
|
|
8
|
+
}), this.maxSize = e;
|
|
9
|
+
}
|
|
10
|
+
get(e) {
|
|
11
|
+
const t = super.get(e);
|
|
12
|
+
return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
|
|
13
|
+
}
|
|
14
|
+
set(e, t) {
|
|
15
|
+
if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
|
|
16
|
+
const s = this.keys().next().value;
|
|
17
|
+
s && this.delete(s);
|
|
18
|
+
}
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
5
21
|
}
|
|
6
22
|
export {
|
|
7
|
-
|
|
23
|
+
r as LruMap
|
|
8
24
|
};
|
package/dist/index73.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(t){return typeof t[0]=="string"?f(t):o(t)}function o(t){let n=0;for(const r of t)n+=r.length;const e=new Uint8Array(n);let c=0;for(const r of t)e.set(r,c),c+=r.length;return e}function f(t){return`0x${t.reduce((n,e)=>n+e.replace("0x",""),"")}`}exports.concat=a;exports.concatBytes=o;exports.concatHex=f;
|
package/dist/index73.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const s = this.keys().next().value;
|
|
17
|
-
s && this.delete(s);
|
|
18
|
-
}
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
1
|
+
function i(t) {
|
|
2
|
+
return typeof t[0] == "string" ? f(t) : c(t);
|
|
3
|
+
}
|
|
4
|
+
function c(t) {
|
|
5
|
+
let n = 0;
|
|
6
|
+
for (const e of t)
|
|
7
|
+
n += e.length;
|
|
8
|
+
const r = new Uint8Array(n);
|
|
9
|
+
let o = 0;
|
|
10
|
+
for (const e of t)
|
|
11
|
+
r.set(e, o), o += e.length;
|
|
12
|
+
return r;
|
|
13
|
+
}
|
|
14
|
+
function f(t) {
|
|
15
|
+
return `0x${t.reduce((n, r) => n + r.replace("0x", ""), "")}`;
|
|
21
16
|
}
|
|
22
17
|
export {
|
|
23
|
-
|
|
18
|
+
i as concat,
|
|
19
|
+
c as concatBytes,
|
|
20
|
+
f as concatHex
|
|
24
21
|
};
|
package/dist/index74.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index71.cjs"),u=require("./index108.cjs"),f=require("./index36.cjs"),g=require("./index24.cjs");function c(n,e="hex"){const i=o(n),s=u.createCursor(new Uint8Array(i.length));return i.encode(s),e==="hex"?g.bytesToHex(s.bytes):s.bytes}function o(n){return Array.isArray(n)?p(n.map(e=>o(e))):y(n)}function p(n){const e=n.reduce((t,h)=>t+h.length,0),i=l(e);return{length:e<=55?1+e:1+i+e,encode(t){e<=55?t.pushByte(192+e):(t.pushByte(247+i),i===1?t.pushUint8(e):i===2?t.pushUint16(e):i===3?t.pushUint24(e):t.pushUint32(e));for(const{encode:h}of n)h(t)}}}function y(n){const e=typeof n=="string"?f.hexToBytes(n):n,i=l(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+i+e.length,encode(t){e.length===1&&e[0]<128?t.pushBytes(e):e.length<=55?(t.pushByte(128+e.length),t.pushBytes(e)):(t.pushByte(183+i),i===1?t.pushUint8(e.length):i===2?t.pushUint16(e.length):i===3?t.pushUint24(e.length):t.pushUint32(e.length),t.pushBytes(e))}}}function l(n){if(n<2**8)return 1;if(n<2**16)return 2;if(n<2**24)return 3;if(n<2**32)return 4;throw new r.BaseError("Length is too large.")}exports.toRlp=c;
|
package/dist/index74.js
CHANGED
|
@@ -1,11 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
1
|
+
import { BaseError as l } from "./index71.js";
|
|
2
|
+
import { createCursor as r } from "./index108.js";
|
|
3
|
+
import { hexToBytes as g } from "./index36.js";
|
|
4
|
+
import { bytesToHex as u } from "./index24.js";
|
|
5
|
+
function m(n, e = "hex") {
|
|
6
|
+
const i = s(n), h = r(new Uint8Array(i.length));
|
|
7
|
+
return i.encode(h), e === "hex" ? u(h.bytes) : h.bytes;
|
|
8
|
+
}
|
|
9
|
+
function s(n) {
|
|
10
|
+
return Array.isArray(n) ? p(n.map((e) => s(e))) : y(n);
|
|
11
|
+
}
|
|
12
|
+
function p(n) {
|
|
13
|
+
const e = n.reduce((t, f) => t + f.length, 0), i = o(e);
|
|
14
|
+
return {
|
|
15
|
+
length: e <= 55 ? 1 + e : 1 + i + e,
|
|
16
|
+
encode(t) {
|
|
17
|
+
e <= 55 ? t.pushByte(192 + e) : (t.pushByte(247 + i), i === 1 ? t.pushUint8(e) : i === 2 ? t.pushUint16(e) : i === 3 ? t.pushUint24(e) : t.pushUint32(e));
|
|
18
|
+
for (const { encode: f } of n)
|
|
19
|
+
f(t);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function y(n) {
|
|
24
|
+
const e = typeof n == "string" ? g(n) : n, i = o(e.length);
|
|
25
|
+
return {
|
|
26
|
+
length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
|
|
27
|
+
encode(t) {
|
|
28
|
+
e.length === 1 && e[0] < 128 ? t.pushBytes(e) : e.length <= 55 ? (t.pushByte(128 + e.length), t.pushBytes(e)) : (t.pushByte(183 + i), i === 1 ? t.pushUint8(e.length) : i === 2 ? t.pushUint16(e.length) : i === 3 ? t.pushUint24(e.length) : t.pushUint32(e.length), t.pushBytes(e));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function o(n) {
|
|
33
|
+
if (n < 2 ** 8)
|
|
34
|
+
return 1;
|
|
35
|
+
if (n < 2 ** 16)
|
|
36
|
+
return 2;
|
|
37
|
+
if (n < 2 ** 24)
|
|
38
|
+
return 3;
|
|
39
|
+
if (n < 2 ** 32)
|
|
40
|
+
return 4;
|
|
41
|
+
throw new l("Length is too large.");
|
|
8
42
|
}
|
|
9
43
|
export {
|
|
10
|
-
|
|
44
|
+
m as toRlp
|
|
11
45
|
};
|
package/dist/index75.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index109.cjs"),o=require("./index73.cjs"),s=require("./index89.cjs"),r=require("./index24.cjs");function c(e){const t=typeof e=="string"?r.stringToHex(e):typeof e.raw=="string"?e.raw:r.bytesToHex(e.raw),i=r.stringToHex(`${n.presignMessagePrefix}${s.size(t)}`);return o.concat([i,t])}exports.toPrefixedMessage=c;
|