@gardenfi/utils 2.1.2-beta.4 → 2.1.2-beta.6
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 +5 -5
- package/dist/index101.cjs +1 -2
- package/dist/index101.js +11 -3
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +18 -16
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +6 -643
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +5 -173
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +2 -2
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +9 -9
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +3 -3
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +1 -2
- package/dist/index23.js +40 -49
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +45 -24
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +25 -41
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +6 -45
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +12 -24
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +15 -6
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +5 -13
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +12 -14
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +10 -5
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +12 -13
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +11 -10
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +13 -12
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +23 -11
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +55 -13
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +16 -23
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +5 -55
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +8 -16
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +23 -22
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +171 -5
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +103 -8
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +20 -170
- package/dist/index43.cjs +2 -1
- package/dist/index43.js +44 -97
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +24 -21
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +38 -10
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +32 -32
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +69 -6
- package/dist/index48.cjs +1 -2
- package/dist/index48.js +110 -57
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +68 -2
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +2 -7
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +16 -4
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +222 -10
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +231 -7
- package/dist/index54.cjs +1 -5
- package/dist/index54.js +9 -53
- package/dist/index55.cjs +1 -2
- package/dist/index55.js +30 -30
- package/dist/index56.cjs +2 -1
- package/dist/index56.js +59 -5
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +22 -2
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +101 -18
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +3 -8
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +16 -9
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +8 -11
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +10 -6
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +11 -13
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +12 -31
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +18 -14
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +6 -64
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +40 -25
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +79 -3
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +14 -3
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +18 -8
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +8 -191
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +3 -17
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +189 -9
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +63 -18
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +2 -41
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +6 -34
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +11 -69
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +8 -113
- package/dist/index79.cjs +5 -1
- package/dist/index79.js +50 -61
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +2 -2
- package/dist/index81.cjs +2 -1
- package/dist/index81.js +33 -15
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +5 -223
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +6 -231
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +32 -8
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +25 -40
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +3 -105
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +10 -16
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +18 -77
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +8 -18
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +16 -10
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +638 -33
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +173 -5
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +12 -10
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +128 -2
- package/dist/index95.cjs +2 -1
- package/dist/index95.js +3 -128
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +2 -7
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +2 -2
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +2 -2
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +35 -17
- package/package.json +1 -1
package/dist/index83.js
CHANGED
|
@@ -1,234 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
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;
|
|
205
|
-
};
|
|
1
|
+
import { bytesToHex as i } from "./index24.js";
|
|
2
|
+
import { sha256 as m } from "./index103.js";
|
|
3
|
+
function f(t) {
|
|
4
|
+
const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
|
|
5
|
+
return o.set([s], 0), n === "bytes" ? o : i(o);
|
|
206
6
|
}
|
|
207
7
|
export {
|
|
208
|
-
|
|
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
|
|
8
|
+
f as commitmentToVersionedHash
|
|
234
9
|
};
|
package/dist/index84.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index104.cjs"),y=require("./index98.cjs"),u=require("./index94.cjs"),B=require("./index72.cjs"),h=require("./index36.cjs"),d=require("./index24.cjs");function f(t){const a=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?h.hexToBytes(t.data):t.data,s=B.size(n);if(!s)throw new y.EmptyBlobError;if(s>o.maxBytesPerTransaction)throw new y.BlobSizeTooLargeError({maxSize:o.maxBytesPerTransaction,size:s});const r=[];let b=!0,i=0;for(;b;){const e=u.createCursor(new Uint8Array(o.bytesPerBlob));let l=0;for(;l<o.fieldElementsPerBlob;){const c=n.slice(i,i+(o.bytesPerFieldElement-1));if(e.pushByte(0),e.pushBytes(c),c.length<31){e.pushByte(128),b=!1;break}l++,i+=31}r.push(e)}return a==="bytes"?r.map(e=>e.bytes):r.map(e=>d.bytesToHex(e.bytes))}exports.toBlobs=f;
|
package/dist/index84.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index104.js";
|
|
2
|
+
import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index98.js";
|
|
3
|
+
import { createCursor as B } from "./index94.js";
|
|
4
|
+
import { size as u } from "./index72.js";
|
|
5
|
+
import { hexToBytes as x } from "./index36.js";
|
|
6
|
+
import { bytesToHex as d } from "./index24.js";
|
|
7
|
+
function S(e) {
|
|
8
|
+
const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
|
|
9
|
+
if (!o)
|
|
10
|
+
throw new c();
|
|
11
|
+
if (o > y)
|
|
12
|
+
throw new h({
|
|
13
|
+
maxSize: y,
|
|
14
|
+
size: o
|
|
15
|
+
});
|
|
16
|
+
const s = [];
|
|
17
|
+
let n = !0, r = 0;
|
|
18
|
+
for (; n; ) {
|
|
19
|
+
const t = B(new Uint8Array(a));
|
|
20
|
+
let l = 0;
|
|
21
|
+
for (; l < f; ) {
|
|
22
|
+
const b = i.slice(r, r + (p - 1));
|
|
23
|
+
if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
|
|
24
|
+
t.pushByte(128), n = !1;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
l++, r += 31;
|
|
28
|
+
}
|
|
29
|
+
s.push(t);
|
|
30
|
+
}
|
|
31
|
+
return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
|
|
8
32
|
}
|
|
9
33
|
export {
|
|
10
|
-
|
|
34
|
+
S as toBlobs
|
|
11
35
|
};
|
package/dist/index85.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 s=require("./index80.cjs"),e=require("./index56.cjs");class i extends e.BaseError{constructor({domain:r}){super(`Invalid domain "${s.stringify(r)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class o extends e.BaseError{constructor({primaryType:r,types:a}){super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(a))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class n extends e.BaseError{constructor({type:r}){super(`Struct type "${r}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}exports.InvalidDomainError=i;exports.InvalidPrimaryTypeError=o;exports.InvalidStructTypeError=n;
|
package/dist/index85.js
CHANGED
|
@@ -1,45 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { stringify as a } from "./index80.js";
|
|
2
|
+
import { BaseError as t } from "./index56.js";
|
|
3
|
+
class n extends t {
|
|
4
|
+
constructor({ domain: r }) {
|
|
5
|
+
super(`Invalid domain "${a(r)}".`, {
|
|
6
|
+
metaMessages: ["Must be a valid EIP-712 domain."]
|
|
7
|
+
});
|
|
8
|
+
}
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
class p extends t {
|
|
11
|
+
constructor({ primaryType: r, types: s }) {
|
|
12
|
+
super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(s))}\`.`, {
|
|
13
|
+
docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
|
|
14
|
+
metaMessages: ["Check that the primary type is a key in `types`."]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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.");
|
|
18
|
+
class y extends t {
|
|
19
|
+
constructor({ type: r }) {
|
|
20
|
+
super(`Struct type "${r}" is invalid.`, {
|
|
21
|
+
metaMessages: ["Struct type must not be a Solidity type."],
|
|
22
|
+
name: "InvalidStructTypeError"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
42
25
|
}
|
|
43
26
|
export {
|
|
44
|
-
|
|
27
|
+
n as InvalidDomainError,
|
|
28
|
+
p as InvalidPrimaryTypeError,
|
|
29
|
+
y as InvalidStructTypeError
|
|
45
30
|
};
|
package/dist/index86.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 e=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,t=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;exports.bytesRegex=e;exports.integerRegex=t;
|
package/dist/index86.js
CHANGED
|
@@ -1,107 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./index102.js";
|
|
3
|
-
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index77.js";
|
|
4
|
-
const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
|
|
5
|
-
for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
|
|
6
|
-
[s, n] = [n, (2 * s + 3 * n) % 5], y.push(2 * (5 * n + s)), L.push((e + 1) * (e + 2) / 2 % 64);
|
|
7
|
-
let o = M;
|
|
8
|
-
for (let r = 0; r < 7; r++)
|
|
9
|
-
t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
|
|
10
|
-
b.push(o);
|
|
11
|
-
}
|
|
12
|
-
const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? S(e, t, s) : H(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : m(e, t, s);
|
|
13
|
-
function D(e, t = 24) {
|
|
14
|
-
const s = new Uint32Array(10);
|
|
15
|
-
for (let n = 24 - t; n < 24; n++) {
|
|
16
|
-
for (let i = 0; i < 10; i++)
|
|
17
|
-
s[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
|
|
18
|
-
for (let i = 0; i < 10; i += 2) {
|
|
19
|
-
const h = (i + 8) % 10, l = (i + 2) % 10, u = s[l], c = s[l + 1], _ = O(u, c, 1) ^ s[h], g = w(u, c, 1) ^ s[h + 1];
|
|
20
|
-
for (let a = 0; a < 50; a += 10)
|
|
21
|
-
e[i + a] ^= _, e[i + a + 1] ^= g;
|
|
22
|
-
}
|
|
23
|
-
let o = e[2], r = e[3];
|
|
24
|
-
for (let i = 0; i < 24; i++) {
|
|
25
|
-
const h = L[i], l = O(o, r, h), u = w(o, r, h), c = y[i];
|
|
26
|
-
o = e[c], r = e[c + 1], e[c] = l, e[c + 1] = u;
|
|
27
|
-
}
|
|
28
|
-
for (let i = 0; i < 50; i += 10) {
|
|
29
|
-
for (let h = 0; h < 10; h++)
|
|
30
|
-
s[h] = e[i + h];
|
|
31
|
-
for (let h = 0; h < 10; h++)
|
|
32
|
-
e[i + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
|
|
33
|
-
}
|
|
34
|
-
e[0] ^= v[n], e[1] ^= z[n];
|
|
35
|
-
}
|
|
36
|
-
s.fill(0);
|
|
37
|
-
}
|
|
38
|
-
class p extends E {
|
|
39
|
-
// NOTE: we accept arguments in bytes instead of bits here.
|
|
40
|
-
constructor(t, s, n, o = !1, r = 24) {
|
|
41
|
-
if (super(), this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = o, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, d(n), 0 >= this.blockLen || this.blockLen >= 200)
|
|
42
|
-
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
43
|
-
this.state = new Uint8Array(200), this.state32 = U(this.state);
|
|
44
|
-
}
|
|
45
|
-
keccak() {
|
|
46
|
-
x || I(this.state32), D(this.state32, this.rounds), x || I(this.state32), this.posOut = 0, this.pos = 0;
|
|
47
|
-
}
|
|
48
|
-
update(t) {
|
|
49
|
-
k(this);
|
|
50
|
-
const { blockLen: s, state: n } = this;
|
|
51
|
-
t = P(t);
|
|
52
|
-
const o = t.length;
|
|
53
|
-
for (let r = 0; r < o; ) {
|
|
54
|
-
const i = Math.min(s - this.pos, o - r);
|
|
55
|
-
for (let h = 0; h < i; h++)
|
|
56
|
-
n[this.pos++] ^= t[r++];
|
|
57
|
-
this.pos === s && this.keccak();
|
|
58
|
-
}
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
finish() {
|
|
62
|
-
if (this.finished)
|
|
63
|
-
return;
|
|
64
|
-
this.finished = !0;
|
|
65
|
-
const { state: t, suffix: s, pos: n, blockLen: o } = this;
|
|
66
|
-
t[n] ^= s, s & 128 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
|
|
67
|
-
}
|
|
68
|
-
writeInto(t) {
|
|
69
|
-
k(this, !1), B(t), this.finish();
|
|
70
|
-
const s = this.state, { blockLen: n } = this;
|
|
71
|
-
for (let o = 0, r = t.length; o < r; ) {
|
|
72
|
-
this.posOut >= n && this.keccak();
|
|
73
|
-
const i = Math.min(n - this.posOut, r - o);
|
|
74
|
-
t.set(s.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
|
|
75
|
-
}
|
|
76
|
-
return t;
|
|
77
|
-
}
|
|
78
|
-
xofInto(t) {
|
|
79
|
-
if (!this.enableXOF)
|
|
80
|
-
throw new Error("XOF is not possible for this instance");
|
|
81
|
-
return this.writeInto(t);
|
|
82
|
-
}
|
|
83
|
-
xof(t) {
|
|
84
|
-
return d(t), this.xofInto(new Uint8Array(t));
|
|
85
|
-
}
|
|
86
|
-
digestInto(t) {
|
|
87
|
-
if (A(t, this), this.finished)
|
|
88
|
-
throw new Error("digest() was already called");
|
|
89
|
-
return this.writeInto(t), this.destroy(), t;
|
|
90
|
-
}
|
|
91
|
-
digest() {
|
|
92
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
93
|
-
}
|
|
94
|
-
destroy() {
|
|
95
|
-
this.destroyed = !0, this.state.fill(0);
|
|
96
|
-
}
|
|
97
|
-
_cloneInto(t) {
|
|
98
|
-
const { blockLen: s, suffix: n, outputLen: o, rounds: r, enableXOF: i } = this;
|
|
99
|
-
return t || (t = new p(s, n, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = n, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
|
|
1
|
+
const e = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, t = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
103
2
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Q as keccak_256
|
|
3
|
+
e as bytesRegex,
|
|
4
|
+
t as integerRegex
|
|
107
5
|
};
|
package/dist/index87.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 a=require("./index56.cjs");class t extends a.BaseError{constructor(e){const{docsPath:s,field:r,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${r}".`,{docsPath:s,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}exports.SiweInvalidMessageFieldError=t;
|
package/dist/index87.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
n ? i(n) : "0x",
|
|
11
|
-
a,
|
|
12
|
-
e ? i(e) : "0x",
|
|
13
|
-
...c({}, s)
|
|
14
|
-
]);
|
|
1
|
+
import { BaseError as i } from "./index56.js";
|
|
2
|
+
class d extends i {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
const { docsPath: s, field: r, metaMessages: a } = e;
|
|
5
|
+
super(`Invalid Sign-In with Ethereum message field "${r}".`, {
|
|
6
|
+
docsPath: s,
|
|
7
|
+
metaMessages: a,
|
|
8
|
+
name: "SiweInvalidMessageFieldError"
|
|
9
|
+
});
|
|
15
10
|
}
|
|
16
|
-
return t;
|
|
17
11
|
}
|
|
18
12
|
export {
|
|
19
|
-
|
|
13
|
+
d as SiweInvalidMessageFieldError
|
|
20
14
|
};
|
package/dist/index88.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 o(e){if(/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)||/%[^0-9a-f]/i.test(e)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))return!1;const s=a(e),f=s[1],t=s[2],i=s[3],r=s[4],l=s[5];if(!(f!=null&&f.length&&i.length>=0))return!1;if(t!=null&&t.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9\+\-\.]*$/.test(f.toLowerCase()))return!1;let n="";return n+=`${f}:`,t!=null&&t.length&&(n+=`//${t}`),n+=i,r!=null&&r.length&&(n+=`?${r}`),l!=null&&l.length&&(n+=`#${l}`),n}function a(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}exports.isUri=o;
|
package/dist/index88.js
CHANGED
|
@@ -1,81 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const { chainId: r } = o, i = o.address;
|
|
17
|
-
if (!f(i))
|
|
18
|
-
throw new s({ address: i });
|
|
19
|
-
if (r < 0)
|
|
20
|
-
throw new n({ chainId: r });
|
|
21
|
-
}
|
|
22
|
-
d(t);
|
|
1
|
+
function o(e) {
|
|
2
|
+
if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e) || /%[^0-9a-f]/i.test(e) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))
|
|
3
|
+
return !1;
|
|
4
|
+
const s = a(e), f = s[1], t = s[2], i = s[3], r = s[4], l = s[5];
|
|
5
|
+
if (!(f != null && f.length && i.length >= 0))
|
|
6
|
+
return !1;
|
|
7
|
+
if (t != null && t.length) {
|
|
8
|
+
if (!(i.length === 0 || /^\//.test(i)))
|
|
9
|
+
return !1;
|
|
10
|
+
} else if (/^\/\//.test(i))
|
|
11
|
+
return !1;
|
|
12
|
+
if (!/^[a-z][a-z0-9\+\-\.]*$/.test(f.toLowerCase()))
|
|
13
|
+
return !1;
|
|
14
|
+
let n = "";
|
|
15
|
+
return n += `${f}:`, t != null && t.length && (n += `//${t}`), n += i, r != null && r.length && (n += `?${r}`), l != null && l.length && (n += `#${l}`), n;
|
|
23
16
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
if (e) {
|
|
27
|
-
if (e.length === 0)
|
|
28
|
-
throw new P();
|
|
29
|
-
for (const o of e) {
|
|
30
|
-
const r = F(o), i = G(I(o, 0, 1));
|
|
31
|
-
if (r !== 32)
|
|
32
|
-
throw new p({ hash: o, size: r });
|
|
33
|
-
if (i !== c)
|
|
34
|
-
throw new x({
|
|
35
|
-
hash: o,
|
|
36
|
-
version: i
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
d(t);
|
|
41
|
-
}
|
|
42
|
-
function d(t) {
|
|
43
|
-
const { chainId: e, maxPriorityFeePerGas: o, maxFeePerGas: r, to: i } = t;
|
|
44
|
-
if (e <= 0)
|
|
45
|
-
throw new n({ chainId: e });
|
|
46
|
-
if (i && !f(i))
|
|
47
|
-
throw new s({ address: i });
|
|
48
|
-
if (r && r > m)
|
|
49
|
-
throw new w({ maxFeePerGas: r });
|
|
50
|
-
if (o && r && o > r)
|
|
51
|
-
throw new E({ maxFeePerGas: r, maxPriorityFeePerGas: o });
|
|
52
|
-
}
|
|
53
|
-
function B(t) {
|
|
54
|
-
const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
|
|
55
|
-
if (e <= 0)
|
|
56
|
-
throw new n({ chainId: e });
|
|
57
|
-
if (a && !f(a))
|
|
58
|
-
throw new s({ address: a });
|
|
59
|
-
if (o || i)
|
|
60
|
-
throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
61
|
-
if (r && r > m)
|
|
62
|
-
throw new w({ maxFeePerGas: r });
|
|
63
|
-
}
|
|
64
|
-
function K(t) {
|
|
65
|
-
const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
|
|
66
|
-
if (a && !f(a))
|
|
67
|
-
throw new s({ address: a });
|
|
68
|
-
if (typeof e < "u" && e <= 0)
|
|
69
|
-
throw new n({ chainId: e });
|
|
70
|
-
if (o || i)
|
|
71
|
-
throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
72
|
-
if (r && r > m)
|
|
73
|
-
throw new w({ maxFeePerGas: r });
|
|
17
|
+
function a(e) {
|
|
18
|
+
return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
|
|
74
19
|
}
|
|
75
20
|
export {
|
|
76
|
-
|
|
77
|
-
B as assertTransactionEIP2930,
|
|
78
|
-
L as assertTransactionEIP4844,
|
|
79
|
-
C as assertTransactionEIP7702,
|
|
80
|
-
K as assertTransactionLegacy
|
|
21
|
+
o as isUri
|
|
81
22
|
};
|
package/dist/index89.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 n(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}exports.defineChain=n;
|