@zama-fhe/relayer-sdk 0.3.0-0 → 0.3.0-1
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/bundle/relayer-sdk-js.js +217 -217
- package/bundle/relayer-sdk-js.umd.cjs +7 -7
- package/lib/node.cjs +4 -0
- package/lib/node.js +4 -0
- package/lib/web.js +4 -0
- package/package.json +2 -2
package/bundle/relayer-sdk-js.js
CHANGED
|
@@ -3,11 +3,11 @@ var sw = {}, Lo = {};
|
|
|
3
3
|
Lo.byteLength = Hg;
|
|
4
4
|
Lo.toByteArray = qg;
|
|
5
5
|
Lo.fromByteArray = Wg;
|
|
6
|
-
var ar = [],
|
|
6
|
+
var ar = [], je = [], jg = typeof Uint8Array < "u" ? Uint8Array : Array, xa = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
7
7
|
for (var ji = 0, Gg = xa.length; ji < Gg; ++ji)
|
|
8
|
-
ar[ji] = xa[ji],
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
ar[ji] = xa[ji], je[xa.charCodeAt(ji)] = ji;
|
|
9
|
+
je[45] = 62;
|
|
10
|
+
je[95] = 63;
|
|
11
11
|
function ow(n) {
|
|
12
12
|
var t = n.length;
|
|
13
13
|
if (t % 4 > 0)
|
|
@@ -27,8 +27,8 @@ function Vg(n, t, e) {
|
|
|
27
27
|
function qg(n) {
|
|
28
28
|
var t, e = ow(n), r = e[0], i = e[1], o = new jg(Vg(n, r, i)), a = 0, u = i > 0 ? r - 4 : r, _;
|
|
29
29
|
for (_ = 0; _ < u; _ += 4)
|
|
30
|
-
t =
|
|
31
|
-
return i === 2 && (t =
|
|
30
|
+
t = je[n.charCodeAt(_)] << 18 | je[n.charCodeAt(_ + 1)] << 12 | je[n.charCodeAt(_ + 2)] << 6 | je[n.charCodeAt(_ + 3)], o[a++] = t >> 16 & 255, o[a++] = t >> 8 & 255, o[a++] = t & 255;
|
|
31
|
+
return i === 2 && (t = je[n.charCodeAt(_)] << 2 | je[n.charCodeAt(_ + 1)] >> 4, o[a++] = t & 255), i === 1 && (t = je[n.charCodeAt(_)] << 10 | je[n.charCodeAt(_ + 1)] << 4 | je[n.charCodeAt(_ + 2)] >> 2, o[a++] = t >> 8 & 255, o[a++] = t & 255), o;
|
|
32
32
|
}
|
|
33
33
|
function Qg(n) {
|
|
34
34
|
return ar[n >> 18 & 63] + ar[n >> 12 & 63] + ar[n >> 6 & 63] + ar[n & 63];
|
|
@@ -1012,13 +1012,13 @@ Nu.write = function(n, t, e, r, i, o) {
|
|
|
1012
1012
|
return h;
|
|
1013
1013
|
}();
|
|
1014
1014
|
function ae(b) {
|
|
1015
|
-
return typeof BigInt > "u" ?
|
|
1015
|
+
return typeof BigInt > "u" ? Le : b;
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function Le() {
|
|
1018
1018
|
throw new Error("BigInt not supported");
|
|
1019
1019
|
}
|
|
1020
1020
|
})(sw);
|
|
1021
|
-
const
|
|
1021
|
+
const Ce = sw.Buffer, Jg = "6.15.0";
|
|
1022
1022
|
function $g(n, t, e) {
|
|
1023
1023
|
const r = t.split("|").map((o) => o.trim());
|
|
1024
1024
|
for (let o = 0; o < r.length; o++)
|
|
@@ -1216,30 +1216,30 @@ function Yn(n, t) {
|
|
|
1216
1216
|
function Yg(n, t) {
|
|
1217
1217
|
return uw(n, t, !1);
|
|
1218
1218
|
}
|
|
1219
|
-
const Uo = BigInt(0),
|
|
1219
|
+
const Uo = BigInt(0), Ze = BigInt(1), Ki = 9007199254740991;
|
|
1220
1220
|
function Zg(n, t) {
|
|
1221
1221
|
const e = Mo(n, "value"), r = BigInt(Tt(t, "width"));
|
|
1222
1222
|
if (_t(e >> r === Uo, "overflow", "NUMERIC_FAULT", {
|
|
1223
1223
|
operation: "fromTwos",
|
|
1224
1224
|
fault: "overflow",
|
|
1225
1225
|
value: n
|
|
1226
|
-
}), e >> r -
|
|
1227
|
-
const i = (
|
|
1228
|
-
return -((~e & i) +
|
|
1226
|
+
}), e >> r - Ze) {
|
|
1227
|
+
const i = (Ze << r) - Ze;
|
|
1228
|
+
return -((~e & i) + Ze);
|
|
1229
1229
|
}
|
|
1230
1230
|
return e;
|
|
1231
1231
|
}
|
|
1232
1232
|
function _w(n, t) {
|
|
1233
1233
|
let e = vt(n, "value");
|
|
1234
|
-
const r = BigInt(Tt(t, "width")), i =
|
|
1234
|
+
const r = BigInt(Tt(t, "width")), i = Ze << r - Ze;
|
|
1235
1235
|
if (e < Uo) {
|
|
1236
1236
|
e = -e, _t(e <= i, "too low", "NUMERIC_FAULT", {
|
|
1237
1237
|
operation: "toTwos",
|
|
1238
1238
|
fault: "overflow",
|
|
1239
1239
|
value: n
|
|
1240
1240
|
});
|
|
1241
|
-
const o = (
|
|
1242
|
-
return (~e & o) +
|
|
1241
|
+
const o = (Ze << r) - Ze;
|
|
1242
|
+
return (~e & o) + Ze;
|
|
1243
1243
|
} else
|
|
1244
1244
|
_t(e < i, "too high", "NUMERIC_FAULT", {
|
|
1245
1245
|
operation: "toTwos",
|
|
@@ -1250,7 +1250,7 @@ function _w(n, t) {
|
|
|
1250
1250
|
}
|
|
1251
1251
|
function zs(n, t) {
|
|
1252
1252
|
const e = Mo(n, "value"), r = BigInt(Tt(t, "bits"));
|
|
1253
|
-
return e & (
|
|
1253
|
+
return e & (Ze << r) - Ze;
|
|
1254
1254
|
}
|
|
1255
1255
|
function vt(n, t) {
|
|
1256
1256
|
switch (typeof n) {
|
|
@@ -1335,7 +1335,7 @@ function ge(n) {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
return r;
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1338
|
+
function $e(n) {
|
|
1339
1339
|
let t = yt(Du(n) ? n : ge(n)).substring(2);
|
|
1340
1340
|
for (; t.startsWith("0"); )
|
|
1341
1341
|
t = t.substring(1);
|
|
@@ -3188,7 +3188,7 @@ function Ku(n, t) {
|
|
|
3188
3188
|
function cy(n) {
|
|
3189
3189
|
return os(Gw(n));
|
|
3190
3190
|
}
|
|
3191
|
-
function
|
|
3191
|
+
function We(n, t, e) {
|
|
3192
3192
|
let r;
|
|
3193
3193
|
if (typeof t == "string")
|
|
3194
3194
|
try {
|
|
@@ -3306,7 +3306,7 @@ const wy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3306
3306
|
bytesToNumberLE: Qu,
|
|
3307
3307
|
concatBytes: Ns,
|
|
3308
3308
|
createHmacDrbg: Hw,
|
|
3309
|
-
ensureBytes:
|
|
3309
|
+
ensureBytes: We,
|
|
3310
3310
|
equalBytes: uy,
|
|
3311
3311
|
hexToBytes: os,
|
|
3312
3312
|
hexToNumber: qu,
|
|
@@ -3335,7 +3335,7 @@ function gy(n, t, e) {
|
|
|
3335
3335
|
t & ue && (r = r * n % e), n = n * n % e, t >>= ue;
|
|
3336
3336
|
return r;
|
|
3337
3337
|
}
|
|
3338
|
-
function
|
|
3338
|
+
function Ue(n, t, e) {
|
|
3339
3339
|
let r = n;
|
|
3340
3340
|
for (; t-- > be; )
|
|
3341
3341
|
r *= r, r %= e;
|
|
@@ -3668,7 +3668,7 @@ const { bytesToNumberBE: ky, hexToBytes: Py } = wy, xi = {
|
|
|
3668
3668
|
}, r = t(e(n.s)), i = t(e(n.r)), o = r.length / 2, a = i.length / 2, u = e(o), _ = e(a);
|
|
3669
3669
|
return `30${e(a + o + 4)}02${_}${i}02${u}${r}`;
|
|
3670
3670
|
}
|
|
3671
|
-
}, Vn = BigInt(0),
|
|
3671
|
+
}, Vn = BigInt(0), Ge = BigInt(1);
|
|
3672
3672
|
BigInt(2);
|
|
3673
3673
|
const C_ = BigInt(3);
|
|
3674
3674
|
BigInt(4);
|
|
@@ -3702,7 +3702,7 @@ function Fy(n) {
|
|
|
3702
3702
|
}
|
|
3703
3703
|
let S;
|
|
3704
3704
|
try {
|
|
3705
|
-
S = typeof F == "bigint" ? F : ki(
|
|
3705
|
+
S = typeof F == "bigint" ? F : ki(We("private key", F, T));
|
|
3706
3706
|
} catch {
|
|
3707
3707
|
throw new Error(`private key must be ${T} bytes, hex or bigint, not ${typeof F}`);
|
|
3708
3708
|
}
|
|
@@ -3754,7 +3754,7 @@ function Fy(n) {
|
|
|
3754
3754
|
* @param hex short/long ECDSA hex
|
|
3755
3755
|
*/
|
|
3756
3756
|
static fromHex(k) {
|
|
3757
|
-
const T = g.fromAffine(i(
|
|
3757
|
+
const T = g.fromAffine(i(We("pointHex", k)));
|
|
3758
3758
|
return T.assertValidity(), T;
|
|
3759
3759
|
}
|
|
3760
3760
|
// Multiplies generator point by privateKey.
|
|
@@ -3845,14 +3845,14 @@ function Fy(n) {
|
|
|
3845
3845
|
const T = g.ZERO;
|
|
3846
3846
|
if (k === Vn)
|
|
3847
3847
|
return T;
|
|
3848
|
-
if (u(k), k ===
|
|
3848
|
+
if (u(k), k === Ge)
|
|
3849
3849
|
return this;
|
|
3850
3850
|
const { endo: E } = t;
|
|
3851
3851
|
if (!E)
|
|
3852
3852
|
return v.unsafeLadder(this, k);
|
|
3853
3853
|
let { k1neg: R, k1: S, k2neg: B, k2: O } = E.splitScalar(k), C = T, N = T, L = this;
|
|
3854
3854
|
for (; S > Vn || O > Vn; )
|
|
3855
|
-
S &
|
|
3855
|
+
S & Ge && (C = C.add(L)), O & Ge && (N = N.add(L)), L = L.double(), S >>= Ge, O >>= Ge;
|
|
3856
3856
|
return R && (C = C.negate()), B && (N = N.negate()), N = new g(e.mul(N.px, E.beta), N.py, N.pz), C.add(N);
|
|
3857
3857
|
}
|
|
3858
3858
|
/**
|
|
@@ -3885,7 +3885,7 @@ function Fy(n) {
|
|
|
3885
3885
|
* @returns non-zero affine point
|
|
3886
3886
|
*/
|
|
3887
3887
|
multiplyAndAddUnsafe(k, T, E) {
|
|
3888
|
-
const R = g.BASE, S = (O, C) => C === Vn || C ===
|
|
3888
|
+
const R = g.BASE, S = (O, C) => C === Vn || C === Ge || !O.equals(R) ? O.multiplyUnsafe(C) : O.multiply(C), B = S(this, T).add(S(k, E));
|
|
3889
3889
|
return B.is0() ? void 0 : B;
|
|
3890
3890
|
}
|
|
3891
3891
|
// Converts Projective point to affine (x, y) coordinates.
|
|
@@ -3903,7 +3903,7 @@ function Fy(n) {
|
|
|
3903
3903
|
}
|
|
3904
3904
|
isTorsionFree() {
|
|
3905
3905
|
const { h: k, isTorsionFree: T } = t;
|
|
3906
|
-
if (k ===
|
|
3906
|
+
if (k === Ge)
|
|
3907
3907
|
return !0;
|
|
3908
3908
|
if (T)
|
|
3909
3909
|
return T(g, this);
|
|
@@ -3911,7 +3911,7 @@ function Fy(n) {
|
|
|
3911
3911
|
}
|
|
3912
3912
|
clearCofactor() {
|
|
3913
3913
|
const { h: k, clearCofactor: T } = t;
|
|
3914
|
-
return k ===
|
|
3914
|
+
return k === Ge ? this : T ? T(g, this) : this.multiplyUnsafe(t.h);
|
|
3915
3915
|
}
|
|
3916
3916
|
toRawBytes(k = !0) {
|
|
3917
3917
|
return this.assertValidity(), r(g, this, k);
|
|
@@ -3967,7 +3967,7 @@ function Oy(n) {
|
|
|
3967
3967
|
throw new Error("Point is not on curve");
|
|
3968
3968
|
const kt = g(xt);
|
|
3969
3969
|
let Mt = e.sqrt(kt);
|
|
3970
|
-
const W = (Mt &
|
|
3970
|
+
const W = (Mt & Ge) === Ge;
|
|
3971
3971
|
return (mt & 1) === 1 !== W && (Mt = e.neg(Mt)), { x: xt, y: Mt };
|
|
3972
3972
|
} else if (lt === o && mt === 4) {
|
|
3973
3973
|
const xt = e.fromBytes(Rt.subarray(0, e.BYTES)), kt = e.fromBytes(Rt.subarray(e.BYTES, 2 * e.BYTES));
|
|
@@ -3977,7 +3977,7 @@ function Oy(n) {
|
|
|
3977
3977
|
}
|
|
3978
3978
|
}), v = (at) => ss(as(at, t.nByteLength));
|
|
3979
3979
|
function F(at) {
|
|
3980
|
-
const lt = r >>
|
|
3980
|
+
const lt = r >> Ge;
|
|
3981
3981
|
return at > lt;
|
|
3982
3982
|
}
|
|
3983
3983
|
function k(at) {
|
|
@@ -3991,12 +3991,12 @@ function Oy(n) {
|
|
|
3991
3991
|
// pair (bytes of r, bytes of s)
|
|
3992
3992
|
static fromCompact(lt) {
|
|
3993
3993
|
const mt = t.nByteLength;
|
|
3994
|
-
return lt =
|
|
3994
|
+
return lt = We("compactSignature", lt, mt * 2), new E(T(lt, 0, mt), T(lt, mt, 2 * mt));
|
|
3995
3995
|
}
|
|
3996
3996
|
// DER encoded ECDSA signature
|
|
3997
3997
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
3998
3998
|
static fromDER(lt) {
|
|
3999
|
-
const { r: mt, s: Rt } = xi.toSig(
|
|
3999
|
+
const { r: mt, s: Rt } = xi.toSig(We("DER", lt));
|
|
4000
4000
|
return new E(mt, Rt);
|
|
4001
4001
|
}
|
|
4002
4002
|
assertValidity() {
|
|
@@ -4009,7 +4009,7 @@ function Oy(n) {
|
|
|
4009
4009
|
return new E(this.r, this.s, lt);
|
|
4010
4010
|
}
|
|
4011
4011
|
recoverPublicKey(lt) {
|
|
4012
|
-
const { r: mt, s: Rt, recovery: xt } = this, kt = N(
|
|
4012
|
+
const { r: mt, s: Rt, recovery: xt } = this, kt = N(We("msgHash", lt));
|
|
4013
4013
|
if (xt == null || ![0, 1, 2, 3].includes(xt))
|
|
4014
4014
|
throw new Error("recovery id invalid");
|
|
4015
4015
|
const Mt = xt === 2 || xt === 3 ? mt + t.n : mt;
|
|
@@ -4103,11 +4103,11 @@ function Oy(n) {
|
|
|
4103
4103
|
throw new Error("sign() legacy options not supported");
|
|
4104
4104
|
const { hash: Rt, randomBytes: xt } = t;
|
|
4105
4105
|
let { lowS: kt, prehash: Mt, extraEntropy: W } = mt;
|
|
4106
|
-
kt == null && (kt = !0), at =
|
|
4106
|
+
kt == null && (kt = !0), at = We("msgHash", at), Mt && (at = We("prehashed msgHash", Rt(at)));
|
|
4107
4107
|
const Z = N(at), rt = f(lt), gt = [J(rt), J(Z)];
|
|
4108
4108
|
if (W != null) {
|
|
4109
4109
|
const ct = W === !0 ? xt(e.BYTES) : W;
|
|
4110
|
-
gt.push(
|
|
4110
|
+
gt.push(We("extraEntropy", ct));
|
|
4111
4111
|
}
|
|
4112
4112
|
const G = Ns(...gt), M = Z;
|
|
4113
4113
|
function X(ct) {
|
|
@@ -4120,7 +4120,7 @@ function Oy(n) {
|
|
|
4120
4120
|
const ft = u(x * u(M + et * rt));
|
|
4121
4121
|
if (ft === Vn)
|
|
4122
4122
|
return;
|
|
4123
|
-
let Bt = (z.x === et ? 0 : 2) | Number(z.y &
|
|
4123
|
+
let Bt = (z.x === et ? 0 : 2) | Number(z.y & Ge), bt = ft;
|
|
4124
4124
|
return kt && F(ft) && (bt = k(ft), Bt ^= 1), new E(et, bt, Bt);
|
|
4125
4125
|
}
|
|
4126
4126
|
return { seed: G, k2sig: X };
|
|
@@ -4133,7 +4133,7 @@ function Oy(n) {
|
|
|
4133
4133
|
l.BASE._setWindowSize(8);
|
|
4134
4134
|
function dt(at, lt, mt, Rt = D) {
|
|
4135
4135
|
const xt = at;
|
|
4136
|
-
if (lt =
|
|
4136
|
+
if (lt = We("msgHash", lt), mt = We("publicKey", mt), "strict" in Rt)
|
|
4137
4137
|
throw new Error("options.strict was renamed to lowS");
|
|
4138
4138
|
const { lowS: kt, prehash: Mt } = Rt;
|
|
4139
4139
|
let W, Z;
|
|
@@ -4189,7 +4189,7 @@ function Cy(n, t) {
|
|
|
4189
4189
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4190
4190
|
const Ww = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), N_ = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), Ny = BigInt(1), gu = BigInt(2), L_ = (n, t) => (n + t / gu) / t;
|
|
4191
4191
|
function Ly(n) {
|
|
4192
|
-
const t = Ww, e = BigInt(3), r = BigInt(6), i = BigInt(11), o = BigInt(22), a = BigInt(23), u = BigInt(44), _ = BigInt(88), l = n * n * n % t, f = l * l * n % t, g =
|
|
4192
|
+
const t = Ww, e = BigInt(3), r = BigInt(6), i = BigInt(11), o = BigInt(22), a = BigInt(23), u = BigInt(44), _ = BigInt(88), l = n * n * n % t, f = l * l * n % t, g = Ue(f, e, t) * f % t, y = Ue(g, e, t) * f % t, v = Ue(y, gu, t) * l % t, F = Ue(v, i, t) * v % t, k = Ue(F, o, t) * F % t, T = Ue(k, u, t) * k % t, E = Ue(T, _, t) * T % t, R = Ue(E, u, t) * k % t, S = Ue(R, e, t) * f % t, B = Ue(S, a, t) * F % t, O = Ue(B, r, t) * l % t, C = Ue(O, gu, t);
|
|
4193
4193
|
if (!yu.eql(yu.sqr(C), n))
|
|
4194
4194
|
throw new Error("Cannot find square root");
|
|
4195
4195
|
return C;
|
|
@@ -4698,7 +4698,7 @@ function Hy(n) {
|
|
|
4698
4698
|
function Jw(n) {
|
|
4699
4699
|
return n && typeof n.getAddress == "function";
|
|
4700
4700
|
}
|
|
4701
|
-
function
|
|
4701
|
+
function He(n) {
|
|
4702
4702
|
try {
|
|
4703
4703
|
return Ut(n), !0;
|
|
4704
4704
|
} catch {
|
|
@@ -6082,7 +6082,7 @@ function Eb(n, t) {
|
|
|
6082
6082
|
];
|
|
6083
6083
|
return t && (e.push(Lt(t.yParity, "yParity")), e.push(ge(t.r)), e.push(ge(t.s))), oe(["0x04", fi(e)]);
|
|
6084
6084
|
}
|
|
6085
|
-
class
|
|
6085
|
+
class Je {
|
|
6086
6086
|
#t;
|
|
6087
6087
|
#e;
|
|
6088
6088
|
#r;
|
|
@@ -6516,7 +6516,7 @@ class We {
|
|
|
6516
6516
|
* Create a copy of this transaciton.
|
|
6517
6517
|
*/
|
|
6518
6518
|
clone() {
|
|
6519
|
-
return
|
|
6519
|
+
return Je.from(this);
|
|
6520
6520
|
}
|
|
6521
6521
|
/**
|
|
6522
6522
|
* Return a JSON-friendly object.
|
|
@@ -6545,24 +6545,24 @@ class We {
|
|
|
6545
6545
|
*/
|
|
6546
6546
|
static from(t) {
|
|
6547
6547
|
if (t == null)
|
|
6548
|
-
return new
|
|
6548
|
+
return new Je();
|
|
6549
6549
|
if (typeof t == "string") {
|
|
6550
6550
|
const r = Ot(t);
|
|
6551
6551
|
if (r[0] >= 127)
|
|
6552
|
-
return
|
|
6552
|
+
return Je.from(hb(r));
|
|
6553
6553
|
switch (r[0]) {
|
|
6554
6554
|
case 1:
|
|
6555
|
-
return
|
|
6555
|
+
return Je.from(gb(r));
|
|
6556
6556
|
case 2:
|
|
6557
|
-
return
|
|
6557
|
+
return Je.from(wb(r));
|
|
6558
6558
|
case 3:
|
|
6559
|
-
return
|
|
6559
|
+
return Je.from(bb(r));
|
|
6560
6560
|
case 4:
|
|
6561
|
-
return
|
|
6561
|
+
return Je.from(Ab(r));
|
|
6562
6562
|
}
|
|
6563
6563
|
_t(!1, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });
|
|
6564
6564
|
}
|
|
6565
|
-
const e = new
|
|
6565
|
+
const e = new Je();
|
|
6566
6566
|
return t.type != null && (e.type = t.type), t.to != null && (e.to = t.to), t.nonce != null && (e.nonce = t.nonce), t.gasLimit != null && (e.gasLimit = t.gasLimit), t.gasPrice != null && (e.gasPrice = t.gasPrice), t.maxPriorityFeePerGas != null && (e.maxPriorityFeePerGas = t.maxPriorityFeePerGas), t.maxFeePerGas != null && (e.maxFeePerGas = t.maxFeePerGas), t.maxFeePerBlobGas != null && (e.maxFeePerBlobGas = t.maxFeePerBlobGas), t.data != null && (e.data = t.data), t.value != null && (e.value = t.value), t.chainId != null && (e.chainId = t.chainId), t.signature != null && (e.signature = ie.from(t.signature)), t.accessList != null && (e.accessList = t.accessList), t.authorizationList != null && (e.authorizationList = t.authorizationList), t.blobVersionedHashes != null && (e.blobVersionedHashes = t.blobVersionedHashes), t.kzg != null && (e.kzg = t.kzg), t.blobs != null && (e.blobs = t.blobs), t.hash != null && (V(e.isSigned(), "unsigned transaction cannot define '.hash'", "tx", t), V(e.hash === t.hash, "hash mismatch", "tx", t)), t.from != null && (V(e.isSigned(), "unsigned transaction cannot define '.from'", "tx", t), V(e.from.toLowerCase() === (t.from || "").toLowerCase(), "from mismatch", "tx", t)), e;
|
|
6567
6567
|
}
|
|
6568
6568
|
}
|
|
@@ -7167,7 +7167,7 @@ const l1 = {
|
|
|
7167
7167
|
version: rf("version"),
|
|
7168
7168
|
chainId: function(n) {
|
|
7169
7169
|
const t = vt(n, "domain.chainId");
|
|
7170
|
-
return V(t >= 0, "invalid chain ID", "domain.chainId", n), Number.isSafeInteger(t) ? Number(t) :
|
|
7170
|
+
return V(t >= 0, "invalid chain ID", "domain.chainId", n), Number.isSafeInteger(t) ? Number(t) : $e(t);
|
|
7171
7171
|
},
|
|
7172
7172
|
verifyingContract: function(n) {
|
|
7173
7173
|
try {
|
|
@@ -7505,7 +7505,7 @@ const h1 = "external public payable override", p1 = Be(h1.split(" ")), zd = "con
|
|
|
7505
7505
|
",": "COMMA",
|
|
7506
7506
|
"@": "AT"
|
|
7507
7507
|
}, A1 = new RegExp("^(\\s*)"), E1 = new RegExp("^([0-9]+)"), v1 = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"), Pd = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"), Fd = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
|
|
7508
|
-
class
|
|
7508
|
+
class Ke {
|
|
7509
7509
|
#t;
|
|
7510
7510
|
#e;
|
|
7511
7511
|
get offset() {
|
|
@@ -7518,13 +7518,13 @@ class Qe {
|
|
|
7518
7518
|
this.#t = 0, this.#e = t.slice();
|
|
7519
7519
|
}
|
|
7520
7520
|
clone() {
|
|
7521
|
-
return new
|
|
7521
|
+
return new Ke(this.#e);
|
|
7522
7522
|
}
|
|
7523
7523
|
reset() {
|
|
7524
7524
|
this.#t = 0;
|
|
7525
7525
|
}
|
|
7526
7526
|
#r(t = 0, e = 0) {
|
|
7527
|
-
return new
|
|
7527
|
+
return new Ke(this.#e.slice(t, e).map((r) => Object.freeze(Object.assign({}, r, {
|
|
7528
7528
|
match: r.match - t,
|
|
7529
7529
|
linkBack: r.linkBack - t,
|
|
7530
7530
|
linkNext: r.linkNext - t
|
|
@@ -7648,7 +7648,7 @@ function hi(n) {
|
|
|
7648
7648
|
}
|
|
7649
7649
|
throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${o}`);
|
|
7650
7650
|
}
|
|
7651
|
-
return new
|
|
7651
|
+
return new Ke(t.map((a) => Object.freeze(a)));
|
|
7652
7652
|
}
|
|
7653
7653
|
function sf(n, t) {
|
|
7654
7654
|
let e = [];
|
|
@@ -7924,7 +7924,7 @@ class Zt {
|
|
|
7924
7924
|
} catch {
|
|
7925
7925
|
V(!1, "invalid param type", "obj", t);
|
|
7926
7926
|
}
|
|
7927
|
-
else if (t instanceof
|
|
7927
|
+
else if (t instanceof Ke) {
|
|
7928
7928
|
let u = "", _ = "", l = null;
|
|
7929
7929
|
Zn(t, Be(["tuple"])).has("tuple") || t.peekType("OPEN_PAREN") ? (_ = "tuple", l = t.popParams().map((k) => Zt.from(k)), u = `tuple(${l.map((k) => k.format()).join(",")})`) : (u = of(t.popType("TYPE")), _ = u);
|
|
7930
7930
|
let f = null, g = null;
|
|
@@ -8001,7 +8001,7 @@ class Ti {
|
|
|
8001
8001
|
}
|
|
8002
8002
|
return Ti.from(hi(t));
|
|
8003
8003
|
}
|
|
8004
|
-
if (t instanceof
|
|
8004
|
+
if (t instanceof Ke)
|
|
8005
8005
|
switch (t.peekKeyword(Sd)) {
|
|
8006
8006
|
case "constructor":
|
|
8007
8007
|
return Kn.from(t);
|
|
@@ -8119,7 +8119,7 @@ class Ie extends Jo {
|
|
|
8119
8119
|
return t;
|
|
8120
8120
|
if (typeof t == "string")
|
|
8121
8121
|
return Ie.from(hi(t));
|
|
8122
|
-
if (t instanceof
|
|
8122
|
+
if (t instanceof Ke) {
|
|
8123
8123
|
const e = Wo("error", t), r = $n(t);
|
|
8124
8124
|
return Oi(t), new Ie(re, e, r);
|
|
8125
8125
|
}
|
|
@@ -8182,7 +8182,7 @@ class cr extends Jo {
|
|
|
8182
8182
|
} catch {
|
|
8183
8183
|
V(!1, "invalid event fragment", "obj", t);
|
|
8184
8184
|
}
|
|
8185
|
-
else if (t instanceof
|
|
8185
|
+
else if (t instanceof Ke) {
|
|
8186
8186
|
const e = Wo("event", t), r = $n(t, !0), i = !!Zn(t, Be(["anonymous"])).has("anonymous");
|
|
8187
8187
|
return Oi(t), new cr(re, e, r, i);
|
|
8188
8188
|
}
|
|
@@ -8238,7 +8238,7 @@ class Kn extends Ti {
|
|
|
8238
8238
|
} catch {
|
|
8239
8239
|
V(!1, "invalid constuctor fragment", "obj", t);
|
|
8240
8240
|
}
|
|
8241
|
-
else if (t instanceof
|
|
8241
|
+
else if (t instanceof Ke) {
|
|
8242
8242
|
Zn(t, Be(["constructor"]));
|
|
8243
8243
|
const e = $n(t), r = !!Zn(t, p1).has("payable"), i = Od(t);
|
|
8244
8244
|
return Oi(t), new Kn(re, "constructor", e, r, i);
|
|
@@ -8284,7 +8284,7 @@ class hr extends Ti {
|
|
|
8284
8284
|
} catch {
|
|
8285
8285
|
V(!1, "invalid fallback fragment", "obj", t);
|
|
8286
8286
|
}
|
|
8287
|
-
else if (t instanceof
|
|
8287
|
+
else if (t instanceof Ke) {
|
|
8288
8288
|
const e = t.toString(), r = t.peekKeyword(Be(["fallback", "receive"]));
|
|
8289
8289
|
if (V(r, "type must be fallback or receive", "obj", e), t.popKeyword(Be(["fallback", "receive"])) === "receive") {
|
|
8290
8290
|
const u = $n(t);
|
|
@@ -8385,7 +8385,7 @@ class ur extends Jo {
|
|
|
8385
8385
|
} catch {
|
|
8386
8386
|
V(!1, "invalid function fragment", "obj", t);
|
|
8387
8387
|
}
|
|
8388
|
-
else if (t instanceof
|
|
8388
|
+
else if (t instanceof Ke) {
|
|
8389
8389
|
const r = Wo("function", t), i = $n(t), o = Id(t);
|
|
8390
8390
|
let a = [];
|
|
8391
8391
|
Zn(t, Be(["returns"])).has("returns") && (a = $n(t));
|
|
@@ -8426,7 +8426,7 @@ class Pi extends Jo {
|
|
|
8426
8426
|
} catch {
|
|
8427
8427
|
V(!1, "invalid struct fragment", "obj", t);
|
|
8428
8428
|
}
|
|
8429
|
-
else if (t instanceof
|
|
8429
|
+
else if (t instanceof Ke) {
|
|
8430
8430
|
const e = Wo("struct", t), r = $n(t);
|
|
8431
8431
|
return Oi(t), new Pi(re, e, r);
|
|
8432
8432
|
}
|
|
@@ -11894,7 +11894,7 @@ class rm extends Zs {
|
|
|
11894
11894
|
}
|
|
11895
11895
|
}
|
|
11896
11896
|
const Da = /* @__PURE__ */ new Map();
|
|
11897
|
-
class
|
|
11897
|
+
class Ne {
|
|
11898
11898
|
#t;
|
|
11899
11899
|
#e;
|
|
11900
11900
|
#r;
|
|
@@ -12001,7 +12001,7 @@ class Ce {
|
|
|
12001
12001
|
* Create a copy of this Network.
|
|
12002
12002
|
*/
|
|
12003
12003
|
clone() {
|
|
12004
|
-
const t = new
|
|
12004
|
+
const t = new Ne(this.name, this.chainId);
|
|
12005
12005
|
return this.plugins.forEach((e) => {
|
|
12006
12006
|
t.attachPlugin(e.clone());
|
|
12007
12007
|
}), t;
|
|
@@ -12030,20 +12030,20 @@ class Ce {
|
|
|
12030
12030
|
*/
|
|
12031
12031
|
static from(t) {
|
|
12032
12032
|
if (nm(), t == null)
|
|
12033
|
-
return
|
|
12033
|
+
return Ne.from("mainnet");
|
|
12034
12034
|
if (typeof t == "number" && (t = BigInt(t)), typeof t == "string" || typeof t == "bigint") {
|
|
12035
12035
|
const e = Da.get(t);
|
|
12036
12036
|
if (e)
|
|
12037
12037
|
return e();
|
|
12038
12038
|
if (typeof t == "bigint")
|
|
12039
|
-
return new
|
|
12039
|
+
return new Ne("unknown", t);
|
|
12040
12040
|
V(!1, "unknown network", "network", t);
|
|
12041
12041
|
}
|
|
12042
12042
|
if (typeof t.clone == "function")
|
|
12043
12043
|
return t.clone();
|
|
12044
12044
|
if (typeof t == "object") {
|
|
12045
12045
|
V(typeof t.name == "string" && typeof t.chainId == "number", "invalid network object name or chainId", "network", t);
|
|
12046
|
-
const e = new
|
|
12046
|
+
const e = new Ne(t.name, t.chainId);
|
|
12047
12047
|
return (t.ensAddress || t.ensNetwork != null) && e.attachPlugin(new Zo(t.ensAddress, t.ensNetwork)), e;
|
|
12048
12048
|
}
|
|
12049
12049
|
V(!1, "invalid network", "network", t);
|
|
@@ -12101,13 +12101,13 @@ function nm() {
|
|
|
12101
12101
|
Rf = !0;
|
|
12102
12102
|
function n(t, e, r) {
|
|
12103
12103
|
const i = function() {
|
|
12104
|
-
const o = new
|
|
12104
|
+
const o = new Ne(t, e);
|
|
12105
12105
|
return r.ensNetwork != null && o.attachPlugin(new Zo(null, r.ensNetwork)), o.attachPlugin(new Yo()), (r.plugins || []).forEach((a) => {
|
|
12106
12106
|
o.attachPlugin(a);
|
|
12107
12107
|
}), o;
|
|
12108
12108
|
};
|
|
12109
|
-
|
|
12110
|
-
|
|
12109
|
+
Ne.register(t, i), Ne.register(e, i), r.altNames && r.altNames.forEach((o) => {
|
|
12110
|
+
Ne.register(o, i);
|
|
12111
12111
|
});
|
|
12112
12112
|
}
|
|
12113
12113
|
n("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }), n("ropsten", 3, { ensNetwork: 3 }), n("rinkeby", 4, { ensNetwork: 4 }), n("goerli", 5, { ensNetwork: 5 }), n("kovan", 42, { ensNetwork: 42 }), n("sepolia", 11155111, { ensNetwork: 11155111 }), n("holesky", 17e3, { ensNetwork: 17e3 }), n("classic", 61, {}), n("classicKotti", 6, {}), n("arbitrum", 42161, {
|
|
@@ -12409,7 +12409,7 @@ class lm {
|
|
|
12409
12409
|
if (this.#w = Object.assign({}, fm, e || {}), t === "any")
|
|
12410
12410
|
this.#o = !0, this.#i = null;
|
|
12411
12411
|
else if (t) {
|
|
12412
|
-
const r =
|
|
12412
|
+
const r = Ne.from(t);
|
|
12413
12413
|
this.#o = !1, this.#i = Promise.resolve(r), setTimeout(() => {
|
|
12414
12414
|
this.emit("network", r, null);
|
|
12415
12415
|
}, 0);
|
|
@@ -12585,9 +12585,9 @@ class lm {
|
|
|
12585
12585
|
return t;
|
|
12586
12586
|
}
|
|
12587
12587
|
if (Xt(t))
|
|
12588
|
-
return Xt(t, 32) ? t :
|
|
12588
|
+
return Xt(t, 32) ? t : $e(t);
|
|
12589
12589
|
if (typeof t == "bigint" && (t = Tt(t, "blockTag")), typeof t == "number")
|
|
12590
|
-
return t >= 0 ?
|
|
12590
|
+
return t >= 0 ? $e(t) : this.#a >= 0 ? $e(this.#a + t) : this.getBlockNumber().then((e) => $e(e + t));
|
|
12591
12591
|
V(!1, "invalid blockTag", "blockTag", t);
|
|
12592
12592
|
}
|
|
12593
12593
|
/**
|
|
@@ -12802,7 +12802,7 @@ class lm {
|
|
|
12802
12802
|
signedTransaction: t
|
|
12803
12803
|
}),
|
|
12804
12804
|
network: this.getNetwork()
|
|
12805
|
-
}), o =
|
|
12805
|
+
}), o = Je.from(t);
|
|
12806
12806
|
if (o.hash !== r)
|
|
12807
12807
|
throw new Error("@TODO: the returned hash did not match");
|
|
12808
12808
|
return this._wrapTransactionResponse(o, i).replaceableTransaction(e);
|
|
@@ -13340,7 +13340,7 @@ class ym {
|
|
|
13340
13340
|
async sendTransaction(t) {
|
|
13341
13341
|
const e = wi(this, "sendTransaction"), r = await this.populateTransaction(t);
|
|
13342
13342
|
delete r.from;
|
|
13343
|
-
const i =
|
|
13343
|
+
const i = Je.from(r);
|
|
13344
13344
|
return await e.broadcastTransaction(await this.signTransaction(i));
|
|
13345
13345
|
}
|
|
13346
13346
|
// @TODO: in v7 move this to be abstract
|
|
@@ -13671,7 +13671,7 @@ class xm extends lm {
|
|
|
13671
13671
|
this.#i = { promise: o, resolve: i };
|
|
13672
13672
|
}
|
|
13673
13673
|
const r = this._getOption("staticNetwork");
|
|
13674
|
-
typeof r == "boolean" ? (V(!r || t !== "any", "staticNetwork cannot be used on special network 'any'", "options", e), r && t != null && (this.#o =
|
|
13674
|
+
typeof r == "boolean" ? (V(!r || t !== "any", "staticNetwork cannot be used on special network 'any'", "options", e), r && t != null && (this.#o = Ne.from(t))) : r && (V(t == null || r.matches(t), "staticNetwork MUST match network object", "options", e), this.#o = r);
|
|
13675
13675
|
}
|
|
13676
13676
|
/**
|
|
13677
13677
|
* Returns the value associated with the option %%key%%.
|
|
@@ -13724,7 +13724,7 @@ class xm extends lm {
|
|
|
13724
13724
|
return t;
|
|
13725
13725
|
return this.#s ? await this.#s : this.ready ? (this.#s = (async () => {
|
|
13726
13726
|
try {
|
|
13727
|
-
const e =
|
|
13727
|
+
const e = Ne.from(vt(await this.send("eth_chainId", [])));
|
|
13728
13728
|
return this.#s = null, e;
|
|
13729
13729
|
} catch (e) {
|
|
13730
13730
|
throw this.#s = null, e;
|
|
@@ -13744,7 +13744,7 @@ class xm extends lm {
|
|
|
13744
13744
|
throw this.#s = null, this.emit("debug", { action: "receiveRpcError", error: i }), i;
|
|
13745
13745
|
}
|
|
13746
13746
|
if (this.emit("debug", { action: "receiveRpcResult", result: r }), "result" in r)
|
|
13747
|
-
return
|
|
13747
|
+
return Ne.from(vt(r.result));
|
|
13748
13748
|
throw this.getRpcError(e, r);
|
|
13749
13749
|
})(), await this.#s);
|
|
13750
13750
|
}
|
|
@@ -13803,18 +13803,18 @@ class xm extends lm {
|
|
|
13803
13803
|
if (t[r] == null)
|
|
13804
13804
|
return;
|
|
13805
13805
|
let i = r;
|
|
13806
|
-
r === "gasLimit" && (i = "gas"), e[i] =
|
|
13806
|
+
r === "gasLimit" && (i = "gas"), e[i] = $e(vt(t[r], `tx.${r}`));
|
|
13807
13807
|
}), ["from", "to", "data"].forEach((r) => {
|
|
13808
13808
|
t[r] != null && (e[r] = yt(t[r]));
|
|
13809
13809
|
}), t.accessList && (e.accessList = Li(t.accessList)), t.blobVersionedHashes && (e.blobVersionedHashes = t.blobVersionedHashes.map((r) => r.toLowerCase())), t.authorizationList && (e.authorizationList = t.authorizationList.map((r) => {
|
|
13810
13810
|
const i = Xw(r);
|
|
13811
13811
|
return {
|
|
13812
13812
|
address: i.address,
|
|
13813
|
-
nonce:
|
|
13814
|
-
chainId:
|
|
13815
|
-
yParity:
|
|
13816
|
-
r:
|
|
13817
|
-
s:
|
|
13813
|
+
nonce: $e(i.nonce),
|
|
13814
|
+
chainId: $e(i.chainId),
|
|
13815
|
+
yParity: $e(i.signature.yParity),
|
|
13816
|
+
r: $e(i.signature.r),
|
|
13817
|
+
s: $e(i.signature.s)
|
|
13818
13818
|
};
|
|
13819
13819
|
})), e;
|
|
13820
13820
|
}
|
|
@@ -15200,13 +15200,13 @@ function Xo() {
|
|
|
15200
15200
|
return p = p >>> 0, d || Gt(p, 4, this.length), (this[p] | this[p + 1] << 8 | this[p + 2] << 16) + this[p + 3] * 16777216;
|
|
15201
15201
|
}, D.prototype.readUint32BE = D.prototype.readUInt32BE = function(p, d) {
|
|
15202
15202
|
return p = p >>> 0, d || Gt(p, 4, this.length), this[p] * 16777216 + (this[p + 1] << 16 | this[p + 2] << 8 | this[p + 3]);
|
|
15203
|
-
}, D.prototype.readBigUInt64LE =
|
|
15203
|
+
}, D.prototype.readBigUInt64LE = De(function(p) {
|
|
15204
15204
|
p = p >>> 0, U(p, "offset");
|
|
15205
15205
|
const d = this[p], I = this[p + 7];
|
|
15206
15206
|
(d === void 0 || I === void 0) && $(p, this.length - 8);
|
|
15207
15207
|
const H = d + this[++p] * 2 ** 8 + this[++p] * 2 ** 16 + this[++p] * 2 ** 24, Y = this[++p] + this[++p] * 2 ** 8 + this[++p] * 2 ** 16 + I * 2 ** 24;
|
|
15208
15208
|
return BigInt(H) + (BigInt(Y) << BigInt(32));
|
|
15209
|
-
}), D.prototype.readBigUInt64BE =
|
|
15209
|
+
}), D.prototype.readBigUInt64BE = De(function(p) {
|
|
15210
15210
|
p = p >>> 0, U(p, "offset");
|
|
15211
15211
|
const d = this[p], I = this[p + 7];
|
|
15212
15212
|
(d === void 0 || I === void 0) && $(p, this.length - 8);
|
|
@@ -15238,13 +15238,13 @@ function Xo() {
|
|
|
15238
15238
|
return p = p >>> 0, d || Gt(p, 4, this.length), this[p] | this[p + 1] << 8 | this[p + 2] << 16 | this[p + 3] << 24;
|
|
15239
15239
|
}, D.prototype.readInt32BE = function(p, d) {
|
|
15240
15240
|
return p = p >>> 0, d || Gt(p, 4, this.length), this[p] << 24 | this[p + 1] << 16 | this[p + 2] << 8 | this[p + 3];
|
|
15241
|
-
}, D.prototype.readBigInt64LE =
|
|
15241
|
+
}, D.prototype.readBigInt64LE = De(function(p) {
|
|
15242
15242
|
p = p >>> 0, U(p, "offset");
|
|
15243
15243
|
const d = this[p], I = this[p + 7];
|
|
15244
15244
|
(d === void 0 || I === void 0) && $(p, this.length - 8);
|
|
15245
15245
|
const H = this[p + 4] + this[p + 5] * 2 ** 8 + this[p + 6] * 2 ** 16 + (I << 24);
|
|
15246
15246
|
return (BigInt(H) << BigInt(32)) + BigInt(d + this[++p] * 2 ** 8 + this[++p] * 2 ** 16 + this[++p] * 2 ** 24);
|
|
15247
|
-
}), D.prototype.readBigInt64BE =
|
|
15247
|
+
}), D.prototype.readBigInt64BE = De(function(p) {
|
|
15248
15248
|
p = p >>> 0, U(p, "offset");
|
|
15249
15249
|
const d = this[p], I = this[p + 7];
|
|
15250
15250
|
(d === void 0 || I === void 0) && $(p, this.length - 8);
|
|
@@ -15308,9 +15308,9 @@ function Xo() {
|
|
|
15308
15308
|
let ot = Number(p >> BigInt(32) & BigInt(4294967295));
|
|
15309
15309
|
return m[d + 3] = ot, ot = ot >> 8, m[d + 2] = ot, ot = ot >> 8, m[d + 1] = ot, ot = ot >> 8, m[d] = ot, d + 8;
|
|
15310
15310
|
}
|
|
15311
|
-
D.prototype.writeBigUInt64LE =
|
|
15311
|
+
D.prototype.writeBigUInt64LE = De(function(p, d = 0) {
|
|
15312
15312
|
return de(this, p, d, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
15313
|
-
}), D.prototype.writeBigUInt64BE =
|
|
15313
|
+
}), D.prototype.writeBigUInt64BE = De(function(p, d = 0) {
|
|
15314
15314
|
return fe(this, p, d, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
15315
15315
|
}), D.prototype.writeIntLE = function(p, d, I, H) {
|
|
15316
15316
|
if (p = +p, d = d >>> 0, !H) {
|
|
@@ -15340,9 +15340,9 @@ function Xo() {
|
|
|
15340
15340
|
return p = +p, d = d >>> 0, I || Qt(this, p, d, 4, 2147483647, -2147483648), this[d] = p & 255, this[d + 1] = p >>> 8, this[d + 2] = p >>> 16, this[d + 3] = p >>> 24, d + 4;
|
|
15341
15341
|
}, D.prototype.writeInt32BE = function(p, d, I) {
|
|
15342
15342
|
return p = +p, d = d >>> 0, I || Qt(this, p, d, 4, 2147483647, -2147483648), p < 0 && (p = 4294967295 + p + 1), this[d] = p >>> 24, this[d + 1] = p >>> 16, this[d + 2] = p >>> 8, this[d + 3] = p & 255, d + 4;
|
|
15343
|
-
}, D.prototype.writeBigInt64LE =
|
|
15343
|
+
}, D.prototype.writeBigInt64LE = De(function(p, d = 0) {
|
|
15344
15344
|
return de(this, p, d, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
15345
|
-
}), D.prototype.writeBigInt64BE =
|
|
15345
|
+
}), D.prototype.writeBigInt64BE = De(function(p, d = 0) {
|
|
15346
15346
|
return fe(this, p, d, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
15347
15347
|
});
|
|
15348
15348
|
function Ee(m, p, d, I, H, Y) {
|
|
@@ -15407,9 +15407,9 @@ function Xo() {
|
|
|
15407
15407
|
}
|
|
15408
15408
|
return this;
|
|
15409
15409
|
};
|
|
15410
|
-
const
|
|
15410
|
+
const Le = {};
|
|
15411
15411
|
function b(m, p, d) {
|
|
15412
|
-
|
|
15412
|
+
Le[m] = class extends d {
|
|
15413
15413
|
constructor() {
|
|
15414
15414
|
super(), Object.defineProperty(this, "message", {
|
|
15415
15415
|
value: p.apply(this, arguments),
|
|
@@ -15467,16 +15467,16 @@ function Xo() {
|
|
|
15467
15467
|
if (m > d || m < p) {
|
|
15468
15468
|
const ot = typeof p == "bigint" ? "n" : "";
|
|
15469
15469
|
let Ft;
|
|
15470
|
-
throw p === 0 || p === BigInt(0) ? Ft = `>= 0${ot} and < 2${ot} ** ${(Y + 1) * 8}${ot}` : Ft = `>= -(2${ot} ** ${(Y + 1) * 8 - 1}${ot}) and < 2 ** ${(Y + 1) * 8 - 1}${ot}`, new
|
|
15470
|
+
throw p === 0 || p === BigInt(0) ? Ft = `>= 0${ot} and < 2${ot} ** ${(Y + 1) * 8}${ot}` : Ft = `>= -(2${ot} ** ${(Y + 1) * 8 - 1}${ot}) and < 2 ** ${(Y + 1) * 8 - 1}${ot}`, new Le.ERR_OUT_OF_RANGE("value", Ft, m);
|
|
15471
15471
|
}
|
|
15472
15472
|
w(I, H, Y);
|
|
15473
15473
|
}
|
|
15474
15474
|
function U(m, p) {
|
|
15475
15475
|
if (typeof m != "number")
|
|
15476
|
-
throw new
|
|
15476
|
+
throw new Le.ERR_INVALID_ARG_TYPE(p, "number", m);
|
|
15477
15477
|
}
|
|
15478
15478
|
function $(m, p, d) {
|
|
15479
|
-
throw Math.floor(m) !== m ? (U(m, d), new
|
|
15479
|
+
throw Math.floor(m) !== m ? (U(m, d), new Le.ERR_OUT_OF_RANGE("offset", "an integer", m)) : p < 0 ? new Le.ERR_BUFFER_OUT_OF_BOUNDS() : new Le.ERR_OUT_OF_RANGE(
|
|
15480
15480
|
"offset",
|
|
15481
15481
|
`>= 0 and <= ${p}`,
|
|
15482
15482
|
m
|
|
@@ -15580,7 +15580,7 @@ function Xo() {
|
|
|
15580
15580
|
}
|
|
15581
15581
|
return p;
|
|
15582
15582
|
}();
|
|
15583
|
-
function
|
|
15583
|
+
function De(m) {
|
|
15584
15584
|
return typeof BigInt > "u" ? As : m;
|
|
15585
15585
|
}
|
|
15586
15586
|
function As() {
|
|
@@ -18567,9 +18567,9 @@ function g2() {
|
|
|
18567
18567
|
r(i);
|
|
18568
18568
|
}
|
|
18569
18569
|
update(r, i) {
|
|
18570
|
-
if (!
|
|
18570
|
+
if (!Ce.isBuffer(r) && typeof r != "string") throw new TypeError("Data must be a string or a buffer");
|
|
18571
18571
|
if (this._finalized) throw new Error("Digest already called");
|
|
18572
|
-
return
|
|
18572
|
+
return Ce.isBuffer(r) || (r = Ce.from(r, i)), this._state.absorb(r), this;
|
|
18573
18573
|
}
|
|
18574
18574
|
digest(r) {
|
|
18575
18575
|
if (this._finalized) throw new Error("Digest already called");
|
|
@@ -18612,9 +18612,9 @@ function y2() {
|
|
|
18612
18612
|
this.push(this.squeeze(r));
|
|
18613
18613
|
}
|
|
18614
18614
|
update(r, i) {
|
|
18615
|
-
if (!
|
|
18615
|
+
if (!Ce.isBuffer(r) && typeof r != "string") throw new TypeError("Data must be a string or a buffer");
|
|
18616
18616
|
if (this._finalized) throw new Error("Squeeze already called");
|
|
18617
|
-
return
|
|
18617
|
+
return Ce.isBuffer(r) || (r = Ce.from(r, i)), this._state.absorb(r), this;
|
|
18618
18618
|
}
|
|
18619
18619
|
squeeze(r, i) {
|
|
18620
18620
|
this._finalized || (this._finalized = !0, this._state.absorbLastFewBits(this._delimitedSuffix));
|
|
@@ -18682,8 +18682,8 @@ function m2() {
|
|
|
18682
18682
|
v = u ^ (g << 1 | y >>> 31), F = _ ^ (y << 1 | g >>> 31);
|
|
18683
18683
|
const ct = t[6] ^ v, ut = t[7] ^ F, x = t[16] ^ v, z = t[17] ^ F, et = t[26] ^ v, ft = t[27] ^ F, Bt = t[36] ^ v, bt = t[37] ^ F, St = t[46] ^ v, he = t[47] ^ F;
|
|
18684
18684
|
v = l ^ (r << 1 | i >>> 31), F = f ^ (i << 1 | r >>> 31);
|
|
18685
|
-
const it = t[8] ^ v, pe = t[9] ^ F, we = t[18] ^ v, Gt = t[19] ^ F, Qt = t[28] ^ v, de = t[29] ^ F, fe = t[38] ^ v, Ee = t[39] ^ F, Se = t[48] ^ v, ae = t[49] ^ F,
|
|
18686
|
-
t[0] =
|
|
18685
|
+
const it = t[8] ^ v, pe = t[9] ^ F, we = t[18] ^ v, Gt = t[19] ^ F, Qt = t[28] ^ v, de = t[29] ^ F, fe = t[38] ^ v, Ee = t[39] ^ F, Se = t[48] ^ v, ae = t[49] ^ F, Le = k, b = T, h = R << 4 | E >>> 28, w = E << 4 | R >>> 28, P = S << 3 | B >>> 29, U = B << 3 | S >>> 29, $ = C << 9 | O >>> 23, st = O << 9 | C >>> 23, Pt = N << 18 | L >>> 14, Vt = L << 18 | N >>> 14, qt = J << 1 | nt >>> 31, Kt = nt << 1 | J >>> 31, Dt = D << 12 | ht >>> 20, ei = ht << 12 | D >>> 20, ke = Et << 10 | dt >>> 22, pi = dt << 10 | Et >>> 22, ms = lt << 13 | at >>> 19, De = at << 13 | lt >>> 19, As = mt << 2 | Rt >>> 30, m = Rt << 2 | mt >>> 30, p = kt << 30 | xt >>> 2, d = xt << 30 | kt >>> 2, I = Mt << 6 | W >>> 26, H = W << 6 | Mt >>> 26, Y = rt << 11 | Z >>> 21, ot = Z << 11 | rt >>> 21, Ft = gt << 15 | G >>> 17, $t = G << 15 | gt >>> 17, Wt = X << 29 | M >>> 3, Yt = M << 29 | X >>> 3, Ht = ct << 28 | ut >>> 4, sa = ut << 28 | ct >>> 4, oa = z << 23 | x >>> 9, aa = x << 23 | z >>> 9, ca = et << 25 | ft >>> 7, ua = ft << 25 | et >>> 7, _a = Bt << 21 | bt >>> 11, fa = bt << 21 | Bt >>> 11, la = he << 24 | St >>> 8, ha = St << 24 | he >>> 8, pa = it << 27 | pe >>> 5, wa = pe << 27 | it >>> 5, da = we << 20 | Gt >>> 12, ga = Gt << 20 | we >>> 12, ya = de << 7 | Qt >>> 25, ba = Qt << 7 | de >>> 25, ma = fe << 8 | Ee >>> 24, Aa = Ee << 8 | fe >>> 24, Ea = Se << 14 | ae >>> 18, va = ae << 14 | Se >>> 18;
|
|
18686
|
+
t[0] = Le ^ ~Dt & Y, t[1] = b ^ ~ei & ot, t[10] = Ht ^ ~da & P, t[11] = sa ^ ~ga & U, t[20] = qt ^ ~I & ca, t[21] = Kt ^ ~H & ua, t[30] = pa ^ ~h & ke, t[31] = wa ^ ~w & pi, t[40] = p ^ ~oa & ya, t[41] = d ^ ~aa & ba, t[2] = Dt ^ ~Y & _a, t[3] = ei ^ ~ot & fa, t[12] = da ^ ~P & ms, t[13] = ga ^ ~U & De, t[22] = I ^ ~ca & ma, t[23] = H ^ ~ua & Aa, t[32] = h ^ ~ke & Ft, t[33] = w ^ ~pi & $t, t[42] = oa ^ ~ya & $, t[43] = aa ^ ~ba & st, t[4] = Y ^ ~_a & Ea, t[5] = ot ^ ~fa & va, t[14] = P ^ ~ms & Wt, t[15] = U ^ ~De & Yt, t[24] = ca ^ ~ma & Pt, t[25] = ua ^ ~Aa & Vt, t[34] = ke ^ ~Ft & la, t[35] = pi ^ ~$t & ha, t[44] = ya ^ ~$ & As, t[45] = ba ^ ~st & m, t[6] = _a ^ ~Ea & Le, t[7] = fa ^ ~va & b, t[16] = ms ^ ~Wt & Ht, t[17] = De ^ ~Yt & sa, t[26] = ma ^ ~Pt & qt, t[27] = Aa ^ ~Vt & Kt, t[36] = Ft ^ ~la & pa, t[37] = $t ^ ~ha & wa, t[46] = $ ^ ~As & p, t[47] = st ^ ~m & d, t[8] = Ea ^ ~Le & Dt, t[9] = va ^ ~b & ei, t[18] = Wt ^ ~Ht & da, t[19] = Yt ^ ~sa & ga, t[28] = Pt ^ ~qt & I, t[29] = Vt ^ ~Kt & H, t[38] = la ^ ~pa & h, t[39] = ha ^ ~wa & w, t[48] = As ^ ~p & oa, t[49] = m ^ ~d & aa, t[0] ^= n[e * 2], t[1] ^= n[e * 2 + 1];
|
|
18687
18687
|
}
|
|
18688
18688
|
}, ou;
|
|
18689
18689
|
}
|
|
@@ -18731,7 +18731,7 @@ function A2() {
|
|
|
18731
18731
|
this.state[~~(this.count / 4)] ^= e << 8 * (this.count % 4), (e & 128) !== 0 && this.count === this.blockSize - 1 && n.p1600(this.state), this.state[~~((this.blockSize - 1) / 4)] ^= 128 << 8 * ((this.blockSize - 1) % 4), n.p1600(this.state), this.count = 0, this.squeezing = !0;
|
|
18732
18732
|
}, t.prototype.squeeze = function(e) {
|
|
18733
18733
|
this.squeezing || this.absorbLastFewBits(1);
|
|
18734
|
-
const r =
|
|
18734
|
+
const r = Ce.alloc(e);
|
|
18735
18735
|
for (let i = 0; i < e; ++i)
|
|
18736
18736
|
r[i] = this.state[~~(this.count / 4)] >>> 8 * (this.count % 4) & 255, this.count += 1, this.count === this.blockSize && (n.p1600(this.state), this.count = 0);
|
|
18737
18737
|
return r;
|
|
@@ -19045,7 +19045,7 @@ class ui {
|
|
|
19045
19045
|
* @returns {CompactCiphertextListBuilder}
|
|
19046
19046
|
*/
|
|
19047
19047
|
static builder(t) {
|
|
19048
|
-
A(t,
|
|
19048
|
+
A(t, Xe);
|
|
19049
19049
|
const e = s.compactciphertextlist_builder(t.__wbg_ptr);
|
|
19050
19050
|
if (e[2])
|
|
19051
19051
|
throw c(e[1]);
|
|
@@ -19493,7 +19493,7 @@ class eo {
|
|
|
19493
19493
|
* @returns {ProvenCompactCiphertextList}
|
|
19494
19494
|
*/
|
|
19495
19495
|
build_with_proof_packed(t, e, r) {
|
|
19496
|
-
A(t,
|
|
19496
|
+
A(t, Ye);
|
|
19497
19497
|
const i = q(e, s.__wbindgen_malloc), o = j, a = s.compactciphertextlistbuilder_build_with_proof_packed(this.__wbg_ptr, t.__wbg_ptr, i, o, r);
|
|
19498
19498
|
if (a[2])
|
|
19499
19499
|
throw c(a[1]);
|
|
@@ -20707,10 +20707,10 @@ class ls {
|
|
|
20707
20707
|
const ah = typeof FinalizationRegistry > "u" ? { register: () => {
|
|
20708
20708
|
}, unregister: () => {
|
|
20709
20709
|
} } : new FinalizationRegistry((n) => s.__wbg_compactpkecrs_free(n >>> 0, 1));
|
|
20710
|
-
class
|
|
20710
|
+
class Ye {
|
|
20711
20711
|
static __wrap(t) {
|
|
20712
20712
|
t = t >>> 0;
|
|
20713
|
-
const e = Object.create(
|
|
20713
|
+
const e = Object.create(Ye.prototype);
|
|
20714
20714
|
return e.__wbg_ptr = t, ah.register(e, e.__wbg_ptr, e), e;
|
|
20715
20715
|
}
|
|
20716
20716
|
__destroy_into_raw() {
|
|
@@ -20740,7 +20740,7 @@ class $e {
|
|
|
20740
20740
|
const e = q(t, s.__wbindgen_malloc), r = j, i = s.compactpkecrs_deserialize(e, r);
|
|
20741
20741
|
if (i[2])
|
|
20742
20742
|
throw c(i[1]);
|
|
20743
|
-
return
|
|
20743
|
+
return Ye.__wrap(i[0]);
|
|
20744
20744
|
}
|
|
20745
20745
|
/**
|
|
20746
20746
|
* @param {bigint} serialized_size_limit
|
|
@@ -20762,7 +20762,7 @@ class $e {
|
|
|
20762
20762
|
const r = q(t, s.__wbindgen_malloc), i = j, o = s.compactpkecrs_safe_deserialize(r, i, e);
|
|
20763
20763
|
if (o[2])
|
|
20764
20764
|
throw c(o[1]);
|
|
20765
|
-
return
|
|
20765
|
+
return Ye.__wrap(o[0]);
|
|
20766
20766
|
}
|
|
20767
20767
|
/**
|
|
20768
20768
|
* @param {TfheConfig} config
|
|
@@ -20774,7 +20774,7 @@ class $e {
|
|
|
20774
20774
|
const r = s.compactpkecrs_from_config(t.__wbg_ptr, e);
|
|
20775
20775
|
if (r[2])
|
|
20776
20776
|
throw c(r[1]);
|
|
20777
|
-
return
|
|
20777
|
+
return Ye.__wrap(r[0]);
|
|
20778
20778
|
}
|
|
20779
20779
|
/**
|
|
20780
20780
|
* @param {Uint8Array} buffer
|
|
@@ -20784,7 +20784,7 @@ class $e {
|
|
|
20784
20784
|
const e = q(t, s.__wbindgen_malloc), r = j, i = s.compactpkecrs_deserialize_from_public_params(e, r);
|
|
20785
20785
|
if (i[2])
|
|
20786
20786
|
throw c(i[1]);
|
|
20787
|
-
return
|
|
20787
|
+
return Ye.__wrap(i[0]);
|
|
20788
20788
|
}
|
|
20789
20789
|
/**
|
|
20790
20790
|
* @param {Uint8Array} buffer
|
|
@@ -20795,7 +20795,7 @@ class $e {
|
|
|
20795
20795
|
const r = q(t, s.__wbindgen_malloc), i = j, o = s.compactpkecrs_safe_deserialize_from_public_params(r, i, e);
|
|
20796
20796
|
if (o[2])
|
|
20797
20797
|
throw c(o[1]);
|
|
20798
|
-
return
|
|
20798
|
+
return Ye.__wrap(o[0]);
|
|
20799
20799
|
}
|
|
20800
20800
|
}
|
|
20801
20801
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((n) => s.__wbg_compressedfhebool_free(n >>> 0, 1));
|
|
@@ -29784,7 +29784,7 @@ class es {
|
|
|
29784
29784
|
* @returns {CompactCiphertextListBuilder}
|
|
29785
29785
|
*/
|
|
29786
29786
|
static builder(t) {
|
|
29787
|
-
A(t,
|
|
29787
|
+
A(t, Xe);
|
|
29788
29788
|
const e = s.provencompactciphertextlist_builder(t.__wbg_ptr);
|
|
29789
29789
|
if (e[2])
|
|
29790
29790
|
throw c(e[1]);
|
|
@@ -29817,7 +29817,7 @@ class es {
|
|
|
29817
29817
|
* @returns {CompactCiphertextListExpander}
|
|
29818
29818
|
*/
|
|
29819
29819
|
verify_and_expand(t, e, r) {
|
|
29820
|
-
A(t,
|
|
29820
|
+
A(t, Ye), A(e, Xe);
|
|
29821
29821
|
const i = q(r, s.__wbindgen_malloc), o = j, a = s.provencompactciphertextlist_verify_and_expand(this.__wbg_ptr, t.__wbg_ptr, e.__wbg_ptr, i, o);
|
|
29822
29822
|
if (a[2])
|
|
29823
29823
|
throw c(a[1]);
|
|
@@ -30030,10 +30030,10 @@ class K {
|
|
|
30030
30030
|
const Mp = typeof FinalizationRegistry > "u" ? { register: () => {
|
|
30031
30031
|
}, unregister: () => {
|
|
30032
30032
|
} } : new FinalizationRegistry((n) => s.__wbg_tfhecompactpublickey_free(n >>> 0, 1));
|
|
30033
|
-
class
|
|
30033
|
+
class Xe {
|
|
30034
30034
|
static __wrap(t) {
|
|
30035
30035
|
t = t >>> 0;
|
|
30036
|
-
const e = Object.create(
|
|
30036
|
+
const e = Object.create(Xe.prototype);
|
|
30037
30037
|
return e.__wbg_ptr = t, Mp.register(e, e.__wbg_ptr, e), e;
|
|
30038
30038
|
}
|
|
30039
30039
|
__destroy_into_raw() {
|
|
@@ -30053,7 +30053,7 @@ class Ze {
|
|
|
30053
30053
|
const e = s.tfhecompactpublickey_new(t.__wbg_ptr);
|
|
30054
30054
|
if (e[2])
|
|
30055
30055
|
throw c(e[1]);
|
|
30056
|
-
return
|
|
30056
|
+
return Xe.__wrap(e[0]);
|
|
30057
30057
|
}
|
|
30058
30058
|
/**
|
|
30059
30059
|
* @returns {Uint8Array}
|
|
@@ -30073,7 +30073,7 @@ class Ze {
|
|
|
30073
30073
|
const e = q(t, s.__wbindgen_malloc), r = j, i = s.tfhecompactpublickey_deserialize(e, r);
|
|
30074
30074
|
if (i[2])
|
|
30075
30075
|
throw c(i[1]);
|
|
30076
|
-
return
|
|
30076
|
+
return Xe.__wrap(i[0]);
|
|
30077
30077
|
}
|
|
30078
30078
|
/**
|
|
30079
30079
|
* @param {bigint} serialized_size_limit
|
|
@@ -30095,7 +30095,7 @@ class Ze {
|
|
|
30095
30095
|
const r = q(t, s.__wbindgen_malloc), i = j, o = s.tfhecompactpublickey_safe_deserialize(r, i, e);
|
|
30096
30096
|
if (o[2])
|
|
30097
30097
|
throw c(o[1]);
|
|
30098
|
-
return
|
|
30098
|
+
return Xe.__wrap(o[0]);
|
|
30099
30099
|
}
|
|
30100
30100
|
/**
|
|
30101
30101
|
* @param {Uint8Array} buffer
|
|
@@ -30109,7 +30109,7 @@ class Ze {
|
|
|
30109
30109
|
const a = s.tfhecompactpublickey_safe_deserialize_conformant(i, o, e, r.__wbg_ptr);
|
|
30110
30110
|
if (a[2])
|
|
30111
30111
|
throw c(a[1]);
|
|
30112
|
-
return
|
|
30112
|
+
return Xe.__wrap(a[0]);
|
|
30113
30113
|
}
|
|
30114
30114
|
}
|
|
30115
30115
|
typeof FinalizationRegistry > "u" || new FinalizationRegistry((n) => s.__wbg_tfhecompressedcompactpublickey_free(n >>> 0, 1));
|
|
@@ -30516,7 +30516,7 @@ var N2 = /* @__PURE__ */ Object.freeze({
|
|
|
30516
30516
|
CompactCiphertextList: ui,
|
|
30517
30517
|
CompactCiphertextListBuilder: eo,
|
|
30518
30518
|
CompactCiphertextListExpander: ls,
|
|
30519
|
-
CompactPkeCrs:
|
|
30519
|
+
CompactPkeCrs: Ye,
|
|
30520
30520
|
FheBool: pr,
|
|
30521
30521
|
FheInt10: wr,
|
|
30522
30522
|
FheInt1024: dr,
|
|
@@ -30604,7 +30604,7 @@ var N2 = /* @__PURE__ */ Object.freeze({
|
|
|
30604
30604
|
ShortintCompactPublicKeyEncryptionParameters: Vs,
|
|
30605
30605
|
ShortintNoiseDistribution: ra,
|
|
30606
30606
|
TfheClientKey: K,
|
|
30607
|
-
TfheCompactPublicKey:
|
|
30607
|
+
TfheCompactPublicKey: Xe,
|
|
30608
30608
|
TfheCompressedPublicKey: wt,
|
|
30609
30609
|
TfheConfig: hs,
|
|
30610
30610
|
TfhePublicKey: pt,
|
|
@@ -30651,7 +30651,7 @@ function Si(n, t, e) {
|
|
|
30651
30651
|
return te = a, i;
|
|
30652
30652
|
}
|
|
30653
30653
|
let bi = null;
|
|
30654
|
-
function
|
|
30654
|
+
function Me() {
|
|
30655
30655
|
return (bi === null || bi.buffer.detached === !0 || bi.buffer.detached === void 0 && bi.buffer !== tt.memory.buffer) && (bi = new DataView(tt.memory.buffer)), bi;
|
|
30656
30656
|
}
|
|
30657
30657
|
function Wi(n) {
|
|
@@ -30717,10 +30717,10 @@ function Fi(n, t) {
|
|
|
30717
30717
|
if (!(n instanceof t))
|
|
30718
30718
|
throw new Error(`expected instance of ${t.name}`);
|
|
30719
30719
|
}
|
|
30720
|
-
function
|
|
30720
|
+
function qe(n, t) {
|
|
30721
30721
|
return n = n >>> 0, rs().subarray(n / 1, n / 1 + t);
|
|
30722
30722
|
}
|
|
30723
|
-
function
|
|
30723
|
+
function Qe(n, t) {
|
|
30724
30724
|
const e = t(n.length * 1, 1) >>> 0;
|
|
30725
30725
|
return rs().set(n, e / 1), te = n.length, e;
|
|
30726
30726
|
}
|
|
@@ -30738,7 +30738,7 @@ function kg(n, t) {
|
|
|
30738
30738
|
const e = t(n.length * 4, 4) >>> 0;
|
|
30739
30739
|
for (let r = 0; r < n.length; r++) {
|
|
30740
30740
|
const i = Wi(n[r]);
|
|
30741
|
-
|
|
30741
|
+
Me().setUint32(e + 4 * r, i, !0);
|
|
30742
30742
|
}
|
|
30743
30743
|
return te = n.length, e;
|
|
30744
30744
|
}
|
|
@@ -30750,7 +30750,7 @@ function U2(n, t, e) {
|
|
|
30750
30750
|
}
|
|
30751
30751
|
function Pg(n, t) {
|
|
30752
30752
|
n = n >>> 0;
|
|
30753
|
-
const e =
|
|
30753
|
+
const e = Me(), r = [];
|
|
30754
30754
|
for (let i = n; i < n + 4 * t; i += 4)
|
|
30755
30755
|
r.push(tt.__wbindgen_export_4.get(e.getUint32(i, !0)));
|
|
30756
30756
|
return tt.__externref_drop_slice(n, t), r;
|
|
@@ -30769,7 +30769,7 @@ function G2(n) {
|
|
|
30769
30769
|
const t = tt.ml_kem_pke_pk_to_u8vec(n.__wbg_ptr);
|
|
30770
30770
|
if (t[3])
|
|
30771
30771
|
throw Ui(t[2]);
|
|
30772
|
-
var e =
|
|
30772
|
+
var e = qe(t[0], t[1]).slice();
|
|
30773
30773
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
30774
30774
|
}
|
|
30775
30775
|
function H2(n) {
|
|
@@ -30777,17 +30777,17 @@ function H2(n) {
|
|
|
30777
30777
|
const t = tt.ml_kem_pke_sk_to_u8vec(n.__wbg_ptr);
|
|
30778
30778
|
if (t[3])
|
|
30779
30779
|
throw Ui(t[2]);
|
|
30780
|
-
var e =
|
|
30780
|
+
var e = qe(t[0], t[1]).slice();
|
|
30781
30781
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
30782
30782
|
}
|
|
30783
30783
|
function V2(n) {
|
|
30784
|
-
const t =
|
|
30784
|
+
const t = Qe(n, tt.__wbindgen_malloc), e = te, r = tt.u8vec_to_ml_kem_pke_pk(t, e);
|
|
30785
30785
|
if (r[2])
|
|
30786
30786
|
throw Ui(r[1]);
|
|
30787
30787
|
return bs.__wrap(r[0]);
|
|
30788
30788
|
}
|
|
30789
30789
|
function q2(n) {
|
|
30790
|
-
const t =
|
|
30790
|
+
const t = Qe(n, tt.__wbindgen_malloc), e = te, r = tt.u8vec_to_ml_kem_pke_sk(t, e);
|
|
30791
30791
|
if (r[2])
|
|
30792
30792
|
throw Ui(r[1]);
|
|
30793
30793
|
return Mi.__wrap(r[0]);
|
|
@@ -30907,7 +30907,7 @@ class qs {
|
|
|
30907
30907
|
*/
|
|
30908
30908
|
get ciphertext() {
|
|
30909
30909
|
const t = tt.__wbg_get_typedciphertext_ciphertext(this.__wbg_ptr);
|
|
30910
|
-
var e =
|
|
30910
|
+
var e = qe(t[0], t[1]).slice();
|
|
30911
30911
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
30912
30912
|
}
|
|
30913
30913
|
/**
|
|
@@ -30915,7 +30915,7 @@ class qs {
|
|
|
30915
30915
|
* @param {Uint8Array} arg0
|
|
30916
30916
|
*/
|
|
30917
30917
|
set ciphertext(t) {
|
|
30918
|
-
const e =
|
|
30918
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
30919
30919
|
tt.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, e, r);
|
|
30920
30920
|
}
|
|
30921
30921
|
/**
|
|
@@ -30940,7 +30940,7 @@ class qs {
|
|
|
30940
30940
|
*/
|
|
30941
30941
|
get external_handle() {
|
|
30942
30942
|
const t = tt.__wbg_get_typedciphertext_external_handle(this.__wbg_ptr);
|
|
30943
|
-
var e =
|
|
30943
|
+
var e = qe(t[0], t[1]).slice();
|
|
30944
30944
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
30945
30945
|
}
|
|
30946
30946
|
/**
|
|
@@ -30948,7 +30948,7 @@ class qs {
|
|
|
30948
30948
|
* @param {Uint8Array} arg0
|
|
30949
30949
|
*/
|
|
30950
30950
|
set external_handle(t) {
|
|
30951
|
-
const e =
|
|
30951
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
30952
30952
|
tt.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, e, r);
|
|
30953
30953
|
}
|
|
30954
30954
|
/**
|
|
@@ -30991,7 +30991,7 @@ class f_ {
|
|
|
30991
30991
|
*/
|
|
30992
30992
|
get bytes() {
|
|
30993
30993
|
const t = tt.__wbg_get_typedplaintext_bytes(this.__wbg_ptr);
|
|
30994
|
-
var e =
|
|
30994
|
+
var e = qe(t[0], t[1]).slice();
|
|
30995
30995
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
30996
30996
|
}
|
|
30997
30997
|
/**
|
|
@@ -30999,7 +30999,7 @@ class f_ {
|
|
|
30999
30999
|
* @param {Uint8Array} arg0
|
|
31000
31000
|
*/
|
|
31001
31001
|
set bytes(t) {
|
|
31002
|
-
const e =
|
|
31002
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31003
31003
|
tt.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, e, r);
|
|
31004
31004
|
}
|
|
31005
31005
|
/**
|
|
@@ -31062,7 +31062,7 @@ class Qs {
|
|
|
31062
31062
|
*/
|
|
31063
31063
|
get signcrypted_ciphertext() {
|
|
31064
31064
|
const t = tt.__wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr);
|
|
31065
|
-
var e =
|
|
31065
|
+
var e = qe(t[0], t[1]).slice();
|
|
31066
31066
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31067
31067
|
}
|
|
31068
31068
|
/**
|
|
@@ -31071,7 +31071,7 @@ class Qs {
|
|
|
31071
31071
|
* @param {Uint8Array} arg0
|
|
31072
31072
|
*/
|
|
31073
31073
|
set signcrypted_ciphertext(t) {
|
|
31074
|
-
const e =
|
|
31074
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31075
31075
|
tt.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, e, r);
|
|
31076
31076
|
}
|
|
31077
31077
|
/**
|
|
@@ -31080,7 +31080,7 @@ class Qs {
|
|
|
31080
31080
|
*/
|
|
31081
31081
|
get external_handle() {
|
|
31082
31082
|
const t = tt.__wbg_get_typedsigncryptedciphertext_external_handle(this.__wbg_ptr);
|
|
31083
|
-
var e =
|
|
31083
|
+
var e = qe(t[0], t[1]).slice();
|
|
31084
31084
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31085
31085
|
}
|
|
31086
31086
|
/**
|
|
@@ -31088,7 +31088,7 @@ class Qs {
|
|
|
31088
31088
|
* @param {Uint8Array} arg0
|
|
31089
31089
|
*/
|
|
31090
31090
|
set external_handle(t) {
|
|
31091
|
-
const e =
|
|
31091
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31092
31092
|
tt.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, e, r);
|
|
31093
31093
|
}
|
|
31094
31094
|
/**
|
|
@@ -31129,14 +31129,14 @@ class l_ {
|
|
|
31129
31129
|
*/
|
|
31130
31130
|
get signature() {
|
|
31131
31131
|
const t = tt.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);
|
|
31132
|
-
var e =
|
|
31132
|
+
var e = qe(t[0], t[1]).slice();
|
|
31133
31133
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31134
31134
|
}
|
|
31135
31135
|
/**
|
|
31136
31136
|
* @param {Uint8Array} arg0
|
|
31137
31137
|
*/
|
|
31138
31138
|
set signature(t) {
|
|
31139
|
-
const e =
|
|
31139
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31140
31140
|
tt.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, e, r);
|
|
31141
31141
|
}
|
|
31142
31142
|
/**
|
|
@@ -31152,7 +31152,7 @@ class l_ {
|
|
|
31152
31152
|
*/
|
|
31153
31153
|
get external_signature() {
|
|
31154
31154
|
const t = tt.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);
|
|
31155
|
-
var e =
|
|
31155
|
+
var e = qe(t[0], t[1]).slice();
|
|
31156
31156
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31157
31157
|
}
|
|
31158
31158
|
/**
|
|
@@ -31167,7 +31167,7 @@ class l_ {
|
|
|
31167
31167
|
* @param {Uint8Array} arg0
|
|
31168
31168
|
*/
|
|
31169
31169
|
set external_signature(t) {
|
|
31170
|
-
const e =
|
|
31170
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31171
31171
|
tt.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, e, r);
|
|
31172
31172
|
}
|
|
31173
31173
|
/**
|
|
@@ -31192,7 +31192,7 @@ class l_ {
|
|
|
31192
31192
|
*/
|
|
31193
31193
|
get extra_data() {
|
|
31194
31194
|
const t = tt.__wbg_get_userdecryptionresponse_extra_data(this.__wbg_ptr);
|
|
31195
|
-
var e =
|
|
31195
|
+
var e = qe(t[0], t[1]).slice();
|
|
31196
31196
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31197
31197
|
}
|
|
31198
31198
|
/**
|
|
@@ -31200,7 +31200,7 @@ class l_ {
|
|
|
31200
31200
|
* @param {Uint8Array} arg0
|
|
31201
31201
|
*/
|
|
31202
31202
|
set extra_data(t) {
|
|
31203
|
-
const e =
|
|
31203
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31204
31204
|
tt.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, e, r);
|
|
31205
31205
|
}
|
|
31206
31206
|
}
|
|
@@ -31229,7 +31229,7 @@ class No {
|
|
|
31229
31229
|
*/
|
|
31230
31230
|
get verification_key() {
|
|
31231
31231
|
const t = tt.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);
|
|
31232
|
-
var e =
|
|
31232
|
+
var e = qe(t[0], t[1]).slice();
|
|
31233
31233
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31234
31234
|
}
|
|
31235
31235
|
/**
|
|
@@ -31239,7 +31239,7 @@ class No {
|
|
|
31239
31239
|
* @param {Uint8Array} arg0
|
|
31240
31240
|
*/
|
|
31241
31241
|
set verification_key(t) {
|
|
31242
|
-
const e =
|
|
31242
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31243
31243
|
tt.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, e, r);
|
|
31244
31244
|
}
|
|
31245
31245
|
/**
|
|
@@ -31250,7 +31250,7 @@ class No {
|
|
|
31250
31250
|
*/
|
|
31251
31251
|
get digest() {
|
|
31252
31252
|
const t = tt.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);
|
|
31253
|
-
var e =
|
|
31253
|
+
var e = qe(t[0], t[1]).slice();
|
|
31254
31254
|
return tt.__wbindgen_free(t[0], t[1] * 1, 1), e;
|
|
31255
31255
|
}
|
|
31256
31256
|
/**
|
|
@@ -31260,7 +31260,7 @@ class No {
|
|
|
31260
31260
|
* @param {Uint8Array} arg0
|
|
31261
31261
|
*/
|
|
31262
31262
|
set digest(t) {
|
|
31263
|
-
const e =
|
|
31263
|
+
const e = Qe(t, tt.__wbindgen_malloc), r = te;
|
|
31264
31264
|
tt.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, e, r);
|
|
31265
31265
|
}
|
|
31266
31266
|
/**
|
|
@@ -31337,7 +31337,7 @@ function J2() {
|
|
|
31337
31337
|
const n = {};
|
|
31338
31338
|
return n.wbg = {}, n.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(t, e) {
|
|
31339
31339
|
const r = String(e), i = Si(r, tt.__wbindgen_malloc, tt.__wbindgen_realloc), o = te;
|
|
31340
|
-
|
|
31340
|
+
Me().setInt32(t + 4 * 1, o, !0), Me().setInt32(t + 4 * 0, i, !0);
|
|
31341
31341
|
}, n.wbg.__wbg_buffer_609cc3eee51ed158 = function(t) {
|
|
31342
31342
|
return t.buffer;
|
|
31343
31343
|
}, n.wbg.__wbg_call_672a4d21634d4a24 = function() {
|
|
@@ -31435,7 +31435,7 @@ function J2() {
|
|
|
31435
31435
|
t.set(e, r >>> 0);
|
|
31436
31436
|
}, n.wbg.__wbg_stack_0ed75d68575b0f3c = function(t, e) {
|
|
31437
31437
|
const r = e.stack, i = Si(r, tt.__wbindgen_malloc, tt.__wbindgen_realloc), o = te;
|
|
31438
|
-
|
|
31438
|
+
Me().setInt32(t + 4 * 1, o, !0), Me().setInt32(t + 4 * 0, i, !0);
|
|
31439
31439
|
}, n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
31440
31440
|
const t = typeof Co > "u" ? null : Co;
|
|
31441
31441
|
return ai(t) ? 0 : Wi(t);
|
|
@@ -31473,7 +31473,7 @@ function J2() {
|
|
|
31473
31473
|
return typeof e == "boolean" ? e ? 1 : 0 : 2;
|
|
31474
31474
|
}, n.wbg.__wbindgen_debug_string = function(t, e) {
|
|
31475
31475
|
const r = Cu(e), i = Si(r, tt.__wbindgen_malloc, tt.__wbindgen_realloc), o = te;
|
|
31476
|
-
|
|
31476
|
+
Me().setInt32(t + 4 * 1, o, !0), Me().setInt32(t + 4 * 0, i, !0);
|
|
31477
31477
|
}, n.wbg.__wbindgen_error_new = function(t, e) {
|
|
31478
31478
|
return new Error(Rs(t, e));
|
|
31479
31479
|
}, n.wbg.__wbindgen_in = function(t, e) {
|
|
@@ -31498,11 +31498,11 @@ function J2() {
|
|
|
31498
31498
|
return tt.memory;
|
|
31499
31499
|
}, n.wbg.__wbindgen_number_get = function(t, e) {
|
|
31500
31500
|
const r = e, i = typeof r == "number" ? r : void 0;
|
|
31501
|
-
|
|
31501
|
+
Me().setFloat64(t + 8 * 1, ai(i) ? 0 : i, !0), Me().setInt32(t + 4 * 0, !ai(i), !0);
|
|
31502
31502
|
}, n.wbg.__wbindgen_string_get = function(t, e) {
|
|
31503
31503
|
const r = e, i = typeof r == "string" ? r : void 0;
|
|
31504
31504
|
var o = ai(i) ? 0 : Si(i, tt.__wbindgen_malloc, tt.__wbindgen_realloc), a = te;
|
|
31505
|
-
|
|
31505
|
+
Me().setInt32(t + 4 * 1, a, !0), Me().setInt32(t + 4 * 0, o, !0);
|
|
31506
31506
|
}, n.wbg.__wbindgen_string_new = function(t, e) {
|
|
31507
31507
|
return Rs(t, e);
|
|
31508
31508
|
}, n.wbg.__wbindgen_throw = function(t, e) {
|
|
@@ -31527,7 +31527,7 @@ async function h_(n) {
|
|
|
31527
31527
|
const Y2 = BigInt(1024 * 1024 * 512), p_ = BigInt(1024 * 1024 * 512), w_ = BigInt(1024 * 1024 * 512), Cs = (n) => n ? n.endsWith("/") ? n.slice(0, -1) : n : "", Xp = (n) => {
|
|
31528
31528
|
let t = n.toString(16);
|
|
31529
31529
|
return t.length % 2 ? "0" + t : t;
|
|
31530
|
-
},
|
|
31530
|
+
}, Ve = (n) => {
|
|
31531
31531
|
const t = n.replace(/^(0x)/, "").match(/.{1,2}/g);
|
|
31532
31532
|
return t ? Uint8Array.from(t.map((e) => parseInt(e, 16))) : new Uint8Array();
|
|
31533
31533
|
};
|
|
@@ -31564,12 +31564,12 @@ function Fg(n) {
|
|
|
31564
31564
|
if (n instanceof Error && typeof n.cause == "object" && n.cause !== null)
|
|
31565
31565
|
return n.cause;
|
|
31566
31566
|
}
|
|
31567
|
-
function
|
|
31567
|
+
function TA(n) {
|
|
31568
31568
|
const t = Fg(n);
|
|
31569
31569
|
if (!(!t || !("code" in t) || !t.code) && typeof t.code == "string")
|
|
31570
31570
|
return t.code;
|
|
31571
31571
|
}
|
|
31572
|
-
function
|
|
31572
|
+
function CA(n) {
|
|
31573
31573
|
const t = Fg(n);
|
|
31574
31574
|
if (!(!t || !("status" in t) || t.status === void 0) && typeof t.status == "number")
|
|
31575
31575
|
return t.status;
|
|
@@ -31946,12 +31946,12 @@ const hA = (n, t, e, r, i, o, a, u) => async (_, l, f, g, y, v, F, k, T) => {
|
|
|
31946
31946
|
const E = "0x00";
|
|
31947
31947
|
let R, S;
|
|
31948
31948
|
try {
|
|
31949
|
-
R = TKMS.u8vec_to_ml_kem_pke_pk(
|
|
31949
|
+
R = TKMS.u8vec_to_ml_kem_pke_pk(Ve(f)), S = TKMS.u8vec_to_ml_kem_pke_sk(Ve(l));
|
|
31950
31950
|
} catch (dt) {
|
|
31951
31951
|
throw new Error("Invalid public or private key", { cause: dt });
|
|
31952
31952
|
}
|
|
31953
31953
|
const B = g.replace(/^(0x)/, ""), O = f.replace(/^(0x)/, ""), C = _.map((dt) => ({
|
|
31954
|
-
handle: typeof dt.handle == "string" ? _r(
|
|
31954
|
+
handle: typeof dt.handle == "string" ? _r(Ve(dt.handle), !0) : _r(dt.handle, !0),
|
|
31955
31955
|
contractAddress: Ro(dt.contractAddress)
|
|
31956
31956
|
}));
|
|
31957
31957
|
Mg(C.map((dt) => dt.handle)), lA(BigInt(F), BigInt(k));
|
|
@@ -32018,9 +32018,9 @@ const hA = (n, t, e, r, i, o, a, u) => async (_, l, f, g, y, v, F, k, T) => {
|
|
|
32018
32018
|
if (n > e)
|
|
32019
32019
|
throw new Error(`The value exceeds the limit for ${t}bits integer (${e.toString()}).`);
|
|
32020
32020
|
}, pA = ({ aclContractAddress: n, chainId: t, tfheCompactPublicKey: e, publicParams: r, contractAddress: i, userAddress: o }) => {
|
|
32021
|
-
if (!
|
|
32021
|
+
if (!He(i))
|
|
32022
32022
|
throw new Error("Contract address is not a valid address.");
|
|
32023
|
-
if (!
|
|
32023
|
+
if (!He(o))
|
|
32024
32024
|
throw new Error("User address is not a valid address.");
|
|
32025
32025
|
const a = e, u = [], _ = TFHE.CompactCiphertextList.builder(a);
|
|
32026
32026
|
let l = new Uint8Array();
|
|
@@ -32056,7 +32056,7 @@ const hA = (n, t, e, r, i, o, a, u) => async (_, l, f, g, y, v, F, k, T) => {
|
|
|
32056
32056
|
return ir(g, 128), f(128), _.push_u128(BigInt(g)), u.push(128), this;
|
|
32057
32057
|
},
|
|
32058
32058
|
addAddress(g) {
|
|
32059
|
-
if (!
|
|
32059
|
+
if (!He(g))
|
|
32060
32060
|
throw new Error("The value must be a valid address.");
|
|
32061
32061
|
return f(160), _.push_u160(BigInt(g)), u.push(160), this;
|
|
32062
32062
|
},
|
|
@@ -32090,7 +32090,7 @@ const hA = (n, t, e, r, i, o, a, u) => async (_, l, f, g, y, v, F, k, T) => {
|
|
|
32090
32090
|
if (!N)
|
|
32091
32091
|
throw new Error(`Too many bits in provided values. Maximum is ${C[C.length - 1]}.`);
|
|
32092
32092
|
return N;
|
|
32093
|
-
})(), v = r[y].publicParams, F =
|
|
32093
|
+
})(), v = r[y].publicParams, F = Ve(i), k = Ve(o), T = Ve(n), E = Ve(t.toString(16).padStart(64, "0")), R = new Uint8Array(F.length + k.length + T.length + 32);
|
|
32094
32094
|
return R.set(F, 0), R.set(k, 20), R.set(T, 40), R.set(E, R.length - E.length), l = _.build_with_proof_packed(v, R, TFHE.ZkComputeLoad.Verify).safe_serialize(Y2), l;
|
|
32095
32095
|
}
|
|
32096
32096
|
};
|
|
@@ -32107,17 +32107,17 @@ const hA = (n, t, e, r, i, o, a, u) => async (_, l, f, g, y, v, F, k, T) => {
|
|
|
32107
32107
|
512: 9,
|
|
32108
32108
|
1024: 10,
|
|
32109
32109
|
2048: 11
|
|
32110
|
-
}, dA = BigInt("18446744073709551615"), gA = (n, t, e, r, i) => {
|
|
32111
|
-
const o = rh("keccak256").update(
|
|
32110
|
+
}, dA = BigInt("18446744073709551615"), gA = "ZK-w_rct", yA = "ZK-w_hdl", bA = (n, t, e, r, i) => {
|
|
32111
|
+
const o = rh("keccak256").update(Ce.from(gA)).update(Ce.from(n)).digest(), a = Ce.from(Ve(e)), u = r.toString(16).padStart(64, "0"), _ = Ce.from(u, "hex");
|
|
32112
32112
|
return t.map((f, g) => {
|
|
32113
|
-
const y = wA[f], v =
|
|
32113
|
+
const y = wA[f], v = Ce.from([g]), F = rh("keccak256").update(Ce.from(yA)).update(o).update(v).update(a).update(_).digest(), k = new Uint8Array(32);
|
|
32114
32114
|
if (k.set(F, 0), BigInt(r) > dA)
|
|
32115
32115
|
throw new Error("ChainId exceeds maximum allowed value (8 bytes)");
|
|
32116
|
-
const T =
|
|
32116
|
+
const T = Ve(u).slice(24, 32);
|
|
32117
32117
|
return k[21] = g, k.set(T, 22), k[30] = y, k[31] = i, k;
|
|
32118
32118
|
});
|
|
32119
|
-
}, nw = (n) => Ut(n),
|
|
32120
|
-
function
|
|
32119
|
+
}, nw = (n) => Ut(n), mA = () => 0;
|
|
32120
|
+
function AA(n, t, e) {
|
|
32121
32121
|
const r = /* @__PURE__ */ new Map();
|
|
32122
32122
|
t.forEach((i, o) => {
|
|
32123
32123
|
if (r.has(i)) {
|
|
@@ -32131,14 +32131,14 @@ function bA(n, t, e) {
|
|
|
32131
32131
|
throw new Error(`Invalid address found: ${i} is not in the list of coprocessor signers`);
|
|
32132
32132
|
return t.length >= e;
|
|
32133
32133
|
}
|
|
32134
|
-
function
|
|
32134
|
+
function EA(n) {
|
|
32135
32135
|
const t = n.response;
|
|
32136
32136
|
return typeof t != "object" || t === null || !("handles" in t && Array.isArray(t.handles)) || !("signatures" in t && Array.isArray(t.signatures)) ? !1 : t.signatures.every((e) => typeof e == "string") && t.handles.every((e) => typeof e == "string");
|
|
32137
32137
|
}
|
|
32138
|
-
const
|
|
32139
|
-
if (!
|
|
32138
|
+
const vA = (n, t, e, r, i, o, a, u, _, l) => (f, g) => {
|
|
32139
|
+
if (!He(f))
|
|
32140
32140
|
throw new Error("Contract address is not a valid address.");
|
|
32141
|
-
if (!
|
|
32141
|
+
if (!He(g))
|
|
32142
32142
|
throw new Error("User address is not a valid address.");
|
|
32143
32143
|
const y = pA({
|
|
32144
32144
|
aclContractAddress: n,
|
|
@@ -32185,10 +32185,10 @@ const AA = (n, t, e, r, i, o, a, u, _, l) => (f, g) => {
|
|
|
32185
32185
|
contractChainId: "0x" + e.toString(16),
|
|
32186
32186
|
extraData: F
|
|
32187
32187
|
}, R = await d_("INPUT_PROOF", `${i}/v1/input-proof`, E, v ?? l);
|
|
32188
|
-
|
|
32189
|
-
const S =
|
|
32188
|
+
EA(R) || X2("INPUT_PROOF", R);
|
|
32189
|
+
const S = bA(T, k, n, e, mA());
|
|
32190
32190
|
if (R.response.handles && R.response.handles.length > 0) {
|
|
32191
|
-
const D = R.response.handles.map(
|
|
32191
|
+
const D = R.response.handles.map(Ve);
|
|
32192
32192
|
if (S.length != D.length)
|
|
32193
32193
|
throw new Error(`Incorrect Handles list sizes: (expected) ${S.length} != ${D.length} (received)`);
|
|
32194
32194
|
for (let Et = 0; Et < S.length; Et += 1) {
|
|
@@ -32220,20 +32220,20 @@ const AA = (n, t, e, r, i, o, a, u, _, l) => (f, g) => {
|
|
|
32220
32220
|
extraData: F
|
|
32221
32221
|
}, Et);
|
|
32222
32222
|
});
|
|
32223
|
-
if (!
|
|
32223
|
+
if (!AA(u, N, _))
|
|
32224
32224
|
throw Error("Coprocessor signers threshold is not reached");
|
|
32225
32225
|
let J = Xp(S.length);
|
|
32226
32226
|
const nt = B.length;
|
|
32227
32227
|
return J += Xp(nt), S.map((D) => _r(D)).map((D) => J += D), B.map((D) => J += D.slice(2)), J += F.slice(2), {
|
|
32228
32228
|
handles: S,
|
|
32229
|
-
inputProof:
|
|
32229
|
+
inputProof: Ve(J)
|
|
32230
32230
|
};
|
|
32231
32231
|
}
|
|
32232
32232
|
};
|
|
32233
|
-
},
|
|
32233
|
+
}, xA = [
|
|
32234
32234
|
"function isAllowedForDecryption(bytes32 handle) view returns (bool)"
|
|
32235
32235
|
];
|
|
32236
|
-
function
|
|
32236
|
+
function RA(n, t, e) {
|
|
32237
32237
|
const r = /* @__PURE__ */ new Map();
|
|
32238
32238
|
t.forEach((i, o) => {
|
|
32239
32239
|
if (r.has(i)) {
|
|
@@ -32247,7 +32247,7 @@ function vA(n, t, e) {
|
|
|
32247
32247
|
throw new Error(`Invalid address found: ${i} is not in the list of KMS signers`);
|
|
32248
32248
|
return t.length >= e;
|
|
32249
32249
|
}
|
|
32250
|
-
const
|
|
32250
|
+
const zA = {
|
|
32251
32251
|
0: "bool",
|
|
32252
32252
|
2: "uint256",
|
|
32253
32253
|
3: "uint256",
|
|
@@ -32257,23 +32257,23 @@ const xA = {
|
|
|
32257
32257
|
7: "address",
|
|
32258
32258
|
8: "uint256"
|
|
32259
32259
|
};
|
|
32260
|
-
function
|
|
32260
|
+
function BA(n, t) {
|
|
32261
32261
|
let e = [];
|
|
32262
32262
|
for (const l of n) {
|
|
32263
32263
|
const f = l.slice(-4, -2).toLowerCase(), g = parseInt(f, 16);
|
|
32264
32264
|
e.push(g);
|
|
32265
32265
|
}
|
|
32266
32266
|
const r = "0x" + "00".repeat(32) + // dummy requestID (ignored)
|
|
32267
|
-
t.slice(2) + "00".repeat(32), i = e.map((l) =>
|
|
32267
|
+
t.slice(2) + "00".repeat(32), i = e.map((l) => zA[l]), u = new Ci().decode(["uint256", ...i, "bytes[]"], r).slice(1, 1 + e.length);
|
|
32268
32268
|
let _ = {};
|
|
32269
32269
|
return n.forEach((l, f) => _[l] = u[f]), _;
|
|
32270
32270
|
}
|
|
32271
|
-
const
|
|
32272
|
-
const f = "0x00", g = new tr(i,
|
|
32271
|
+
const SA = (n, t, e, r, i, o, a, u) => async (_, l) => {
|
|
32272
|
+
const f = "0x00", g = new tr(i, xA, a);
|
|
32273
32273
|
let y;
|
|
32274
32274
|
try {
|
|
32275
32275
|
y = await Promise.all(_.map(async (L) => {
|
|
32276
|
-
const J = _r(typeof L == "string" ?
|
|
32276
|
+
const J = _r(typeof L == "string" ? Ve(L) : L, !0);
|
|
32277
32277
|
if (!await g.isAllowedForDecryption(J))
|
|
32278
32278
|
throw new Error(`Handle ${J} is not allowed for public decryption!`);
|
|
32279
32279
|
return J;
|
|
@@ -32300,16 +32300,16 @@ const zA = (n, t, e, r, i, o, a, u) => async (_, l) => {
|
|
|
32300
32300
|
const J = L.startsWith("0x") ? L : `0x${L}`;
|
|
32301
32301
|
return Rd(k, T, { ctHandles: y, decryptedResult: R, extraData: B }, J);
|
|
32302
32302
|
});
|
|
32303
|
-
if (!
|
|
32303
|
+
if (!RA(n, O, t))
|
|
32304
32304
|
throw Error("KMS signers threshold is not reached");
|
|
32305
|
-
return
|
|
32306
|
-
},
|
|
32305
|
+
return BA(y, R);
|
|
32306
|
+
}, kA = (n, t) => (e, r, i, o, a) => {
|
|
32307
32307
|
const u = "0x00";
|
|
32308
|
-
if (a && !
|
|
32308
|
+
if (a && !He(a))
|
|
32309
32309
|
throw new Error("Invalid delegated account.");
|
|
32310
|
-
if (!
|
|
32310
|
+
if (!He(n))
|
|
32311
32311
|
throw new Error("Invalid verifying contract address.");
|
|
32312
|
-
if (!r.every((v) =>
|
|
32312
|
+
if (!r.every((v) => He(v)))
|
|
32313
32313
|
throw new Error("Invalid contract address.");
|
|
32314
32314
|
const _ = typeof e == "string" ? e.startsWith("0x") ? e : `0x${e}` : e, l = typeof i == "number" ? i.toString() : i, f = typeof o == "number" ? o.toString() : o, g = [
|
|
32315
32315
|
{ name: "name", type: "string" },
|
|
@@ -32368,7 +32368,7 @@ const zA = (n, t, e, r, i, o, a, u) => async (_, l) => {
|
|
|
32368
32368
|
extraData: u
|
|
32369
32369
|
}
|
|
32370
32370
|
};
|
|
32371
|
-
},
|
|
32371
|
+
}, PA = () => {
|
|
32372
32372
|
const n = TKMS.ml_kem_pke_keygen();
|
|
32373
32373
|
return {
|
|
32374
32374
|
publicKey: _r(TKMS.ml_kem_pke_pk_to_u8vec(TKMS.ml_kem_pke_get_pk(n))),
|
|
@@ -32376,7 +32376,7 @@ const zA = (n, t, e, r, i, o, a, u) => async (_, l) => {
|
|
|
32376
32376
|
};
|
|
32377
32377
|
};
|
|
32378
32378
|
ns.fetch = B2(ns.fetch, { retries: 5, retryDelay: 500 });
|
|
32379
|
-
const
|
|
32379
|
+
const NA = {
|
|
32380
32380
|
// ACL_CONTRACT_ADDRESS (FHEVM Host chain)
|
|
32381
32381
|
aclContractAddress: "0x687820221192C5B662b25367F70076A37bc79b6c",
|
|
32382
32382
|
// KMS_VERIFIER_CONTRACT_ADDRESS (FHEVM Host chain)
|
|
@@ -32395,15 +32395,15 @@ const TA = {
|
|
|
32395
32395
|
network: "https://eth-sepolia.public.blastapi.io",
|
|
32396
32396
|
// Relayer URL
|
|
32397
32397
|
relayerUrl: "https://relayer.testnet.zama.cloud"
|
|
32398
|
-
},
|
|
32398
|
+
}, LA = async (n) => {
|
|
32399
32399
|
const { verifyingContractAddressDecryption: t, verifyingContractAddressInputVerification: e, publicKey: r, kmsContractAddress: i, aclContractAddress: o, gatewayChainId: a, auth: u } = n;
|
|
32400
|
-
if (!i || !
|
|
32400
|
+
if (!i || !He(i))
|
|
32401
32401
|
throw new Error("KMS contract address is not valid or empty");
|
|
32402
|
-
if (!t || !
|
|
32402
|
+
if (!t || !He(t))
|
|
32403
32403
|
throw new Error("Verifying contract for Decryption address is not valid or empty");
|
|
32404
|
-
if (!e || !
|
|
32404
|
+
if (!e || !He(e))
|
|
32405
32405
|
throw new Error("Verifying contract for InputVerification address is not valid or empty");
|
|
32406
|
-
if (!o || !
|
|
32406
|
+
if (!o || !He(o))
|
|
32407
32407
|
throw new Error("ACL contract address is not valid or empty");
|
|
32408
32408
|
if (r && !(r.data instanceof Uint8Array))
|
|
32409
32409
|
throw new Error("publicKey must be a Uint8Array");
|
|
@@ -32412,10 +32412,10 @@ const TA = {
|
|
|
32412
32412
|
throw new Error("No network has been provided!");
|
|
32413
32413
|
const l = await rA(_, n), f = await nA(n), g = await iA(n), y = await sA(_, n), v = await oA(_, n), F = await aA(_, n), k = await cA(_, n);
|
|
32414
32414
|
return {
|
|
32415
|
-
createEncryptedInput:
|
|
32416
|
-
generateKeypair:
|
|
32417
|
-
createEIP712:
|
|
32418
|
-
publicDecrypt:
|
|
32415
|
+
createEncryptedInput: vA(o, e, l, a, Cs(n.relayerUrl), f.publicKey, g, F, k),
|
|
32416
|
+
generateKeypair: PA,
|
|
32417
|
+
createEIP712: kA(t, l),
|
|
32418
|
+
publicDecrypt: SA(y, v, a, t, o, Cs(n.relayerUrl), _, u && { auth: u }),
|
|
32419
32419
|
userDecrypt: hA(y, a, l, t, o, Cs(n.relayerUrl), _, u && { auth: u }),
|
|
32420
32420
|
getPublicKey: () => f.publicKey ? {
|
|
32421
32421
|
publicKey: f.publicKey.safe_serialize(p_),
|
|
@@ -32428,7 +32428,7 @@ const TA = {
|
|
|
32428
32428
|
};
|
|
32429
32429
|
};
|
|
32430
32430
|
let iw = !1;
|
|
32431
|
-
const
|
|
32431
|
+
const DA = async ({ tfheParams: n, kmsParams: t, thread: e } = {}) => (e == null && (e = navigator.hardwareConcurrency), await S2() || (console.warn(`This browser does not support threads. Verify that your server returns correct headers:
|
|
32432
32432
|
`, `'Cross-Origin-Opener-Policy': 'same-origin'
|
|
32433
32433
|
`, "'Cross-Origin-Embedder-Policy': 'require-corp'"), e = void 0), iw || (await ro({ module_or_path: n }), await h_({
|
|
32434
32434
|
module_or_path: t
|
|
@@ -32437,8 +32437,8 @@ window.TFHE = {
|
|
|
32437
32437
|
default: ro,
|
|
32438
32438
|
initThreadPool: __,
|
|
32439
32439
|
init_panic_hook: u_,
|
|
32440
|
-
TfheCompactPublicKey:
|
|
32441
|
-
CompactPkeCrs:
|
|
32440
|
+
TfheCompactPublicKey: Xe,
|
|
32441
|
+
CompactPkeCrs: Ye,
|
|
32442
32442
|
CompactCiphertextList: ui,
|
|
32443
32443
|
ZkComputeLoad: Bg
|
|
32444
32444
|
};
|
|
@@ -32456,11 +32456,11 @@ window.TKMS = {
|
|
|
32456
32456
|
};
|
|
32457
32457
|
export {
|
|
32458
32458
|
wA as ENCRYPTION_TYPES,
|
|
32459
|
-
|
|
32460
|
-
|
|
32461
|
-
|
|
32462
|
-
|
|
32463
|
-
|
|
32464
|
-
|
|
32465
|
-
|
|
32459
|
+
NA as SepoliaConfig,
|
|
32460
|
+
kA as createEIP712,
|
|
32461
|
+
LA as createInstance,
|
|
32462
|
+
PA as generateKeypair,
|
|
32463
|
+
TA as getErrorCauseCode,
|
|
32464
|
+
CA as getErrorCauseStatus,
|
|
32465
|
+
DA as initSDK
|
|
32466
32466
|
};
|