@coinbase/cdp-hooks 0.0.25 → 0.0.26
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/README.md +195 -3
- package/dist/esm/index10.js +10 -33
- package/dist/esm/index100.js +24 -32
- package/dist/esm/index101.js +22 -182
- package/dist/esm/index102.js +32 -6
- package/dist/esm/index103.js +194 -2
- package/dist/esm/index104.js +6 -10
- package/dist/esm/index105.js +2 -19
- package/dist/esm/index106.js +10 -25
- package/dist/esm/index107.js +18 -8
- package/dist/esm/index108.js +24 -52
- package/dist/esm/index109.js +8 -45
- package/dist/esm/index11.js +8 -3
- package/dist/esm/index110.js +55 -8
- package/dist/esm/index111.js +45 -7
- package/dist/esm/index112.js +8 -16
- package/dist/esm/index113.js +7 -18
- package/dist/esm/index114.js +16 -24
- package/dist/esm/index115.js +18 -16
- package/dist/esm/index116.js +22 -52
- package/dist/esm/index117.js +16 -11
- package/dist/esm/index118.js +53 -159
- package/dist/esm/index119.js +11 -21
- package/dist/esm/index12.js +31 -8
- package/dist/esm/index120.js +157 -124
- package/dist/esm/index121.js +20 -37
- package/dist/esm/index122.js +127 -6
- package/dist/esm/index123.js +35 -24
- package/dist/esm/index124.js +6 -191
- package/dist/esm/index125.js +28 -4
- package/dist/esm/index126.js +184 -57
- package/dist/esm/index127.js +4 -3
- package/dist/esm/index128.js +60 -16
- package/dist/esm/index129.js +3 -17
- package/dist/esm/index13.js +3 -68
- package/dist/esm/index130.js +19 -22
- package/dist/esm/index131.js +16 -11
- package/dist/esm/index132.js +22 -33
- package/dist/esm/index133.js +12 -3
- package/dist/esm/index134.js +33 -17
- package/dist/esm/index135.js +3 -28
- package/dist/esm/index136.js +18 -35
- package/dist/esm/index137.js +27 -7
- package/dist/esm/index138.js +34 -24
- package/dist/esm/index139.js +7 -28
- package/dist/esm/index14.js +8 -8
- package/dist/esm/index140.js +24 -63
- package/dist/esm/index141.js +28 -9
- package/dist/esm/index142.js +62 -31
- package/dist/esm/index143.js +9 -27
- package/dist/esm/index144.js +32 -23
- package/dist/esm/index145.js +27 -3
- package/dist/esm/index146.js +24 -14
- package/dist/esm/index147.js +3 -103
- package/dist/esm/index148.js +14 -64
- package/dist/esm/index149.js +103 -5
- package/dist/esm/index15.js +67 -27
- package/dist/esm/index150.js +64 -6
- package/dist/esm/index151.js +5 -27
- package/dist/esm/index152.js +6 -39
- package/dist/esm/index153.js +27 -13
- package/dist/esm/index154.js +38 -41
- package/dist/esm/index155.js +13 -5
- package/dist/esm/index156.js +42 -11
- package/dist/esm/index157.js +5 -19
- package/dist/esm/index158.js +11 -78
- package/dist/esm/index159.js +20 -2
- package/dist/esm/index16.js +9 -70
- package/dist/esm/index160.js +74 -33
- package/dist/esm/index161.js +2 -111
- package/dist/esm/index162.js +27 -38
- package/dist/esm/index163.js +108 -30
- package/dist/esm/index164.js +48 -8
- package/dist/esm/index165.js +32 -6
- package/dist/esm/index166.js +8 -6
- package/dist/esm/index167.js +6 -11
- package/dist/esm/index168.js +6 -10
- package/dist/esm/index169.js +11 -13
- package/dist/esm/index17.js +26 -17
- package/dist/esm/index170.js +9 -31
- package/dist/esm/index171.js +14 -5
- package/dist/esm/index172.js +32 -8
- package/dist/esm/index173.js +5 -20
- package/dist/esm/index174.js +19 -31
- package/dist/esm/index175.js +31 -20
- package/dist/esm/index176.js +20 -3
- package/dist/esm/index177.js +3 -17
- package/dist/esm/index178.js +17 -10
- package/dist/esm/index179.js +10 -21
- package/dist/esm/index18.js +68 -108
- package/dist/esm/index180.js +21 -22
- package/dist/esm/index181.js +22 -5
- package/dist/esm/index182.js +5 -5
- package/dist/esm/index183.js +5 -8
- package/dist/esm/index184.js +8 -104
- package/dist/esm/index185.js +105 -3
- package/dist/esm/index186.js +3 -19
- package/dist/esm/index187.js +17 -170
- package/dist/esm/index188.js +170 -16
- package/dist/esm/index189.js +18 -10
- package/dist/esm/index19.js +19 -60
- package/dist/esm/index190.js +12 -40
- package/dist/esm/index191.js +36 -2
- package/dist/esm/index192.js +41 -4
- package/dist/esm/index193.js +39 -9
- package/dist/esm/index194.js +2 -20
- package/dist/esm/index195.js +4 -7
- package/dist/esm/index196.js +9 -10
- package/dist/esm/index197.js +19 -66
- package/dist/esm/index198.js +7 -65
- package/dist/esm/index199.js +10 -184
- package/dist/esm/index20.js +110 -24
- package/dist/esm/index200.js +66 -22
- package/dist/esm/index201.js +61 -38
- package/dist/esm/index202.js +178 -69
- package/dist/esm/index203.js +21 -39
- package/dist/esm/index204.js +35 -9
- package/dist/esm/index205.js +70 -7
- package/dist/esm/index206.js +40 -7
- package/dist/esm/index207.js +16 -6
- package/dist/esm/index208.js +13 -36
- package/dist/esm/index209.js +7 -15
- package/dist/esm/index21.js +51 -31
- package/dist/esm/index210.js +6 -8
- package/dist/esm/index211.js +36 -9
- package/dist/esm/index212.js +15 -16
- package/dist/esm/index213.js +8 -22
- package/dist/esm/index214.js +8 -26
- package/dist/esm/index215.js +10 -2
- package/dist/esm/index216.js +16 -13
- package/dist/esm/index217.js +21 -11
- package/dist/esm/index218.js +30 -47
- package/dist/esm/index219.js +2 -10
- package/dist/esm/index22.js +23 -36
- package/dist/esm/index220.js +10 -10
- package/dist/esm/index221.js +11 -13
- package/dist/esm/index222.js +47 -8
- package/dist/esm/index223.js +9 -15
- package/dist/esm/index224.js +12 -23
- package/dist/esm/index225.js +14 -11
- package/dist/esm/index226.js +8 -24
- package/dist/esm/index227.js +15 -51
- package/dist/esm/index228.js +24 -17
- package/dist/esm/index229.js +11 -14
- package/dist/esm/index23.js +28 -46
- package/dist/esm/index230.js +24 -11
- package/dist/esm/index231.js +50 -11
- package/dist/esm/index232.js +17 -103
- package/dist/esm/index233.js +14 -6
- package/dist/esm/index234.js +11 -224
- package/dist/esm/index235.js +103 -6
- package/dist/esm/index236.js +7 -7
- package/dist/esm/index237.js +223 -25
- package/dist/esm/index238.js +6 -19
- package/dist/esm/index239.js +7 -147
- package/dist/esm/index24.js +34 -160
- package/dist/esm/index240.js +26 -12
- package/dist/esm/index241.js +20 -36
- package/dist/esm/index242.js +146 -41
- package/dist/esm/index245.js +2 -2
- package/dist/esm/index248.js +5 -5
- package/dist/esm/index249.js +2 -2
- package/dist/esm/index25.js +55 -36
- package/dist/esm/index251.js +1 -1
- package/dist/esm/index253.js +2 -2
- package/dist/esm/index254.js +2 -2
- package/dist/esm/index255.js +1 -1
- package/dist/esm/index256.js +1 -1
- package/dist/esm/index26.js +162 -8
- package/dist/esm/index260.js +1 -1
- package/dist/esm/index27.js +39 -31
- package/dist/esm/index28.js +8 -35
- package/dist/esm/index29.js +30 -8
- package/dist/esm/index30.js +35 -28
- package/dist/esm/index31.js +9 -46
- package/dist/esm/index32.js +24 -83
- package/dist/esm/index33.js +43 -37
- package/dist/esm/index34.js +88 -8
- package/dist/esm/index35.js +40 -6
- package/dist/esm/index36.js +8 -16
- package/dist/esm/index37.js +6 -8
- package/dist/esm/index38.js +16 -13
- package/dist/esm/index39.js +8 -7
- package/dist/esm/index40.js +13 -9
- package/dist/esm/index41.js +7 -16
- package/dist/esm/index42.js +9 -46
- package/dist/esm/index43.js +16 -13
- package/dist/esm/index44.js +46 -16
- package/dist/esm/index45.js +13 -13
- package/dist/esm/index46.js +15 -5
- package/dist/esm/index47.js +13 -35
- package/dist/esm/index48.js +5 -8
- package/dist/esm/index49.js +34 -7
- package/dist/esm/index50.js +9 -25
- package/dist/esm/index51.js +8 -10
- package/dist/esm/index52.js +25 -14
- package/dist/esm/index53.js +10 -11
- package/dist/esm/index54.js +14 -116
- package/dist/esm/index55.js +11 -33
- package/dist/esm/index56.js +113 -76
- package/dist/esm/index57.js +30 -174
- package/dist/esm/index58.js +77 -42
- package/dist/esm/index59.js +177 -6
- package/dist/esm/index6.js +2 -2
- package/dist/esm/index60.js +44 -13
- package/dist/esm/index61.js +5 -12
- package/dist/esm/index62.js +13 -99
- package/dist/esm/index63.js +13 -72
- package/dist/esm/index64.js +95 -83
- package/dist/esm/index65.js +62 -138
- package/dist/esm/index66.js +71 -120
- package/dist/esm/index67.js +126 -46
- package/dist/esm/index68.js +136 -23
- package/dist/esm/index69.js +65 -102
- package/dist/esm/index7.js +2 -2
- package/dist/esm/index70.js +23 -6
- package/dist/esm/index71.js +102 -128
- package/dist/esm/index72.js +7 -276
- package/dist/esm/index73.js +132 -3
- package/dist/esm/index74.js +276 -4
- package/dist/esm/index75.js +3 -9
- package/dist/esm/index76.js +4 -2
- package/dist/esm/index77.js +9 -2
- package/dist/esm/index78.js +2 -3
- package/dist/esm/index79.js +2 -327
- package/dist/esm/index8.js +5 -5
- package/dist/esm/index80.js +3 -14
- package/dist/esm/index81.js +326 -4
- package/dist/esm/index82.js +12 -54
- package/dist/esm/index83.js +5 -2
- package/dist/esm/index84.js +54 -6
- package/dist/esm/index85.js +2 -215
- package/dist/esm/index86.js +8 -32
- package/dist/esm/index87.js +213 -20
- package/dist/esm/index88.js +32 -6
- package/dist/esm/index89.js +21 -73
- package/dist/esm/index9.js +2 -2
- package/dist/esm/index90.js +5 -5
- package/dist/esm/index91.js +73 -5
- package/dist/esm/index92.js +5 -35
- package/dist/esm/index93.js +5 -75
- package/dist/esm/index94.js +36 -3
- package/dist/esm/index95.js +67 -15
- package/dist/esm/index96.js +3 -452
- package/dist/esm/index97.js +15 -22
- package/dist/esm/index98.js +440 -15
- package/dist/esm/index99.js +21 -24
- package/package.json +3 -3
package/dist/esm/index237.js
CHANGED
|
@@ -1,29 +1,227 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { numberToBytesLE as y, numberToBytesBE as I, bitMask as Z, bytesToNumberLE as S, bytesToNumberBE as _, _validateObject as j } from "./index254.js";
|
|
2
|
+
import { anumber as z } from "./index242.js";
|
|
3
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4
|
+
const g = BigInt(0), d = BigInt(1), q = /* @__PURE__ */ BigInt(2), V = /* @__PURE__ */ BigInt(3), x = /* @__PURE__ */ BigInt(4), T = /* @__PURE__ */ BigInt(5), L = /* @__PURE__ */ BigInt(8);
|
|
5
|
+
function h(t, n) {
|
|
6
|
+
const o = t % n;
|
|
7
|
+
return o >= g ? o : n + o;
|
|
8
|
+
}
|
|
9
|
+
function O(t, n, o) {
|
|
10
|
+
let r = t;
|
|
11
|
+
for (; n-- > g; )
|
|
12
|
+
r *= r, r %= o;
|
|
13
|
+
return r;
|
|
14
|
+
}
|
|
15
|
+
function B(t, n) {
|
|
16
|
+
if (t === g)
|
|
17
|
+
throw new Error("invert: expected non-zero number");
|
|
18
|
+
if (n <= g)
|
|
19
|
+
throw new Error("invert: expected positive modulus, got " + n);
|
|
20
|
+
let o = h(t, n), r = n, s = g, f = d;
|
|
21
|
+
for (; o !== g; ) {
|
|
22
|
+
const u = r / o, i = r % o, w = s - f * u;
|
|
23
|
+
r = o, o = i, s = f, f = w;
|
|
22
24
|
}
|
|
23
|
-
if (
|
|
24
|
-
throw new
|
|
25
|
-
return
|
|
25
|
+
if (r !== d)
|
|
26
|
+
throw new Error("invert: does not exist");
|
|
27
|
+
return h(s, n);
|
|
28
|
+
}
|
|
29
|
+
function M(t, n) {
|
|
30
|
+
const o = (t.ORDER + d) / x, r = t.pow(n, o);
|
|
31
|
+
if (!t.eql(t.sqr(r), n))
|
|
32
|
+
throw new Error("Cannot find square root");
|
|
33
|
+
return r;
|
|
34
|
+
}
|
|
35
|
+
function H(t, n) {
|
|
36
|
+
const o = (t.ORDER - T) / L, r = t.mul(n, q), s = t.pow(r, o), f = t.mul(n, s), c = t.mul(t.mul(f, q), s), u = t.mul(f, t.sub(c, t.ONE));
|
|
37
|
+
if (!t.eql(t.sqr(u), n))
|
|
38
|
+
throw new Error("Cannot find square root");
|
|
39
|
+
return u;
|
|
40
|
+
}
|
|
41
|
+
function K(t) {
|
|
42
|
+
if (t < BigInt(3))
|
|
43
|
+
throw new Error("sqrt is not defined for small field");
|
|
44
|
+
let n = t - d, o = 0;
|
|
45
|
+
for (; n % q === g; )
|
|
46
|
+
n /= q, o++;
|
|
47
|
+
let r = q;
|
|
48
|
+
const s = U(t);
|
|
49
|
+
for (; N(s, r) === 1; )
|
|
50
|
+
if (r++ > 1e3)
|
|
51
|
+
throw new Error("Cannot find square root: probably non-prime P");
|
|
52
|
+
if (o === 1)
|
|
53
|
+
return M;
|
|
54
|
+
let f = s.pow(r, n);
|
|
55
|
+
const c = (n + d) / q;
|
|
56
|
+
return function(i, w) {
|
|
57
|
+
if (i.is0(w))
|
|
58
|
+
return w;
|
|
59
|
+
if (N(i, w) !== 1)
|
|
60
|
+
throw new Error("Cannot find square root");
|
|
61
|
+
let e = o, l = i.mul(i.ONE, f), a = i.pow(w, n), b = i.pow(w, c);
|
|
62
|
+
for (; !i.eql(a, i.ONE); ) {
|
|
63
|
+
if (i.is0(a))
|
|
64
|
+
return i.ZERO;
|
|
65
|
+
let m = 1, E = i.sqr(a);
|
|
66
|
+
for (; !i.eql(E, i.ONE); )
|
|
67
|
+
if (m++, E = i.sqr(E), m === e)
|
|
68
|
+
throw new Error("Cannot find square root");
|
|
69
|
+
const C = d << BigInt(e - m - 1), v = i.pow(l, C);
|
|
70
|
+
e = m, l = i.sqr(v), a = i.mul(a, l), b = i.mul(b, v);
|
|
71
|
+
}
|
|
72
|
+
return b;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function Q(t) {
|
|
76
|
+
return t % x === V ? M : t % L === T ? H : K(t);
|
|
77
|
+
}
|
|
78
|
+
const Y = [
|
|
79
|
+
"create",
|
|
80
|
+
"isValid",
|
|
81
|
+
"is0",
|
|
82
|
+
"neg",
|
|
83
|
+
"inv",
|
|
84
|
+
"sqrt",
|
|
85
|
+
"sqr",
|
|
86
|
+
"eql",
|
|
87
|
+
"add",
|
|
88
|
+
"sub",
|
|
89
|
+
"mul",
|
|
90
|
+
"pow",
|
|
91
|
+
"div",
|
|
92
|
+
"addN",
|
|
93
|
+
"subN",
|
|
94
|
+
"mulN",
|
|
95
|
+
"sqrN"
|
|
96
|
+
];
|
|
97
|
+
function P(t) {
|
|
98
|
+
const n = {
|
|
99
|
+
ORDER: "bigint",
|
|
100
|
+
MASK: "bigint",
|
|
101
|
+
BYTES: "number",
|
|
102
|
+
BITS: "number"
|
|
103
|
+
}, o = Y.reduce((r, s) => (r[s] = "function", r), n);
|
|
104
|
+
return j(t, o), t;
|
|
105
|
+
}
|
|
106
|
+
function k(t, n, o) {
|
|
107
|
+
if (o < g)
|
|
108
|
+
throw new Error("invalid exponent, negatives unsupported");
|
|
109
|
+
if (o === g)
|
|
110
|
+
return t.ONE;
|
|
111
|
+
if (o === d)
|
|
112
|
+
return n;
|
|
113
|
+
let r = t.ONE, s = n;
|
|
114
|
+
for (; o > g; )
|
|
115
|
+
o & d && (r = t.mul(r, s)), s = t.sqr(s), o >>= d;
|
|
116
|
+
return r;
|
|
117
|
+
}
|
|
118
|
+
function G(t, n, o = !1) {
|
|
119
|
+
const r = new Array(n.length).fill(o ? t.ZERO : void 0), s = n.reduce((c, u, i) => t.is0(u) ? c : (r[i] = c, t.mul(c, u)), t.ONE), f = t.inv(s);
|
|
120
|
+
return n.reduceRight((c, u, i) => t.is0(u) ? c : (r[i] = t.mul(c, r[i]), t.mul(c, u)), f), r;
|
|
121
|
+
}
|
|
122
|
+
function N(t, n) {
|
|
123
|
+
const o = (t.ORDER - d) / q, r = t.pow(n, o), s = t.eql(r, t.ONE), f = t.eql(r, t.ZERO), c = t.eql(r, t.neg(t.ONE));
|
|
124
|
+
if (!s && !f && !c)
|
|
125
|
+
throw new Error("invalid Legendre symbol result");
|
|
126
|
+
return s ? 1 : f ? 0 : -1;
|
|
127
|
+
}
|
|
128
|
+
function J(t, n) {
|
|
129
|
+
n !== void 0 && z(n);
|
|
130
|
+
const o = n !== void 0 ? n : t.toString(2).length, r = Math.ceil(o / 8);
|
|
131
|
+
return { nBitLength: o, nByteLength: r };
|
|
132
|
+
}
|
|
133
|
+
function U(t, n, o = !1, r = {}) {
|
|
134
|
+
if (t <= g)
|
|
135
|
+
throw new Error("invalid field: expected ORDER > 0, got " + t);
|
|
136
|
+
let s, f;
|
|
137
|
+
if (typeof n == "object" && n != null) {
|
|
138
|
+
if (r.sqrt || o)
|
|
139
|
+
throw new Error("cannot specify opts in two arguments");
|
|
140
|
+
const e = n;
|
|
141
|
+
e.BITS && (s = e.BITS), e.sqrt && (f = e.sqrt), typeof e.isLE == "boolean" && (o = e.isLE);
|
|
142
|
+
} else
|
|
143
|
+
typeof n == "number" && (s = n), r.sqrt && (f = r.sqrt);
|
|
144
|
+
const { nBitLength: c, nByteLength: u } = J(t, s);
|
|
145
|
+
if (u > 2048)
|
|
146
|
+
throw new Error("invalid field: expected ORDER of <= 2048 bytes");
|
|
147
|
+
let i;
|
|
148
|
+
const w = Object.freeze({
|
|
149
|
+
ORDER: t,
|
|
150
|
+
isLE: o,
|
|
151
|
+
BITS: c,
|
|
152
|
+
BYTES: u,
|
|
153
|
+
MASK: Z(c),
|
|
154
|
+
ZERO: g,
|
|
155
|
+
ONE: d,
|
|
156
|
+
create: (e) => h(e, t),
|
|
157
|
+
isValid: (e) => {
|
|
158
|
+
if (typeof e != "bigint")
|
|
159
|
+
throw new Error("invalid field element: expected bigint, got " + typeof e);
|
|
160
|
+
return g <= e && e < t;
|
|
161
|
+
},
|
|
162
|
+
is0: (e) => e === g,
|
|
163
|
+
// is valid and invertible
|
|
164
|
+
isValidNot0: (e) => !w.is0(e) && w.isValid(e),
|
|
165
|
+
isOdd: (e) => (e & d) === d,
|
|
166
|
+
neg: (e) => h(-e, t),
|
|
167
|
+
eql: (e, l) => e === l,
|
|
168
|
+
sqr: (e) => h(e * e, t),
|
|
169
|
+
add: (e, l) => h(e + l, t),
|
|
170
|
+
sub: (e, l) => h(e - l, t),
|
|
171
|
+
mul: (e, l) => h(e * l, t),
|
|
172
|
+
pow: (e, l) => k(w, e, l),
|
|
173
|
+
div: (e, l) => h(e * B(l, t), t),
|
|
174
|
+
// Same as above, but doesn't normalize
|
|
175
|
+
sqrN: (e) => e * e,
|
|
176
|
+
addN: (e, l) => e + l,
|
|
177
|
+
subN: (e, l) => e - l,
|
|
178
|
+
mulN: (e, l) => e * l,
|
|
179
|
+
inv: (e) => B(e, t),
|
|
180
|
+
sqrt: f || ((e) => (i || (i = Q(t)), i(w, e))),
|
|
181
|
+
toBytes: (e) => o ? y(e, u) : I(e, u),
|
|
182
|
+
fromBytes: (e) => {
|
|
183
|
+
if (e.length !== u)
|
|
184
|
+
throw new Error("Field.fromBytes: expected " + u + " bytes, got " + e.length);
|
|
185
|
+
return o ? S(e) : _(e);
|
|
186
|
+
},
|
|
187
|
+
// TODO: we don't need it here, move out to separate fn
|
|
188
|
+
invertBatch: (e) => G(w, e),
|
|
189
|
+
// We can't move this out because Fp6, Fp12 implement it
|
|
190
|
+
// and it's unclear what to return in there.
|
|
191
|
+
cmov: (e, l, a) => a ? l : e
|
|
192
|
+
});
|
|
193
|
+
return Object.freeze(w);
|
|
194
|
+
}
|
|
195
|
+
function A(t) {
|
|
196
|
+
if (typeof t != "bigint")
|
|
197
|
+
throw new Error("field order must be bigint");
|
|
198
|
+
const n = t.toString(2).length;
|
|
199
|
+
return Math.ceil(n / 8);
|
|
200
|
+
}
|
|
201
|
+
function W(t) {
|
|
202
|
+
const n = A(t);
|
|
203
|
+
return n + Math.ceil(n / 2);
|
|
204
|
+
}
|
|
205
|
+
function D(t, n, o = !1) {
|
|
206
|
+
const r = t.length, s = A(n), f = W(n);
|
|
207
|
+
if (r < 16 || r < f || r > 1024)
|
|
208
|
+
throw new Error("expected " + f + "-1024 bytes of input, got " + r);
|
|
209
|
+
const c = o ? S(t) : _(t), u = h(c, n - d) + d;
|
|
210
|
+
return o ? y(u, s) : I(u, s);
|
|
26
211
|
}
|
|
27
212
|
export {
|
|
28
|
-
|
|
213
|
+
U as Field,
|
|
214
|
+
G as FpInvertBatch,
|
|
215
|
+
N as FpLegendre,
|
|
216
|
+
k as FpPow,
|
|
217
|
+
Q as FpSqrt,
|
|
218
|
+
A as getFieldBytesLength,
|
|
219
|
+
W as getMinHashLength,
|
|
220
|
+
B as invert,
|
|
221
|
+
D as mapHashToField,
|
|
222
|
+
h as mod,
|
|
223
|
+
J as nLength,
|
|
224
|
+
O as pow2,
|
|
225
|
+
K as tonelliShanks,
|
|
226
|
+
P as validateField
|
|
29
227
|
};
|
package/dist/esm/index238.js
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { toBytes as o } from "./index110.js";
|
|
2
|
+
import { keccak256 as r } from "./index112.js";
|
|
3
|
+
const e = (t) => r(o(t));
|
|
4
|
+
function c(t) {
|
|
5
|
+
return e(t);
|
|
4
6
|
}
|
|
5
|
-
function h(t, r = !1) {
|
|
6
|
-
const n = t.length;
|
|
7
|
-
let l = new Uint32Array(n), c = new Uint32Array(n);
|
|
8
|
-
for (let e = 0; e < n; e++) {
|
|
9
|
-
const { h: u, l: f } = s(t[e], r);
|
|
10
|
-
[l[e], c[e]] = [u, f];
|
|
11
|
-
}
|
|
12
|
-
return [l, c];
|
|
13
|
-
}
|
|
14
|
-
const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
|
|
15
7
|
export {
|
|
16
|
-
|
|
17
|
-
B as rotlBH,
|
|
18
|
-
a as rotlBL,
|
|
19
|
-
m as rotlSH,
|
|
20
|
-
A as rotlSL,
|
|
21
|
-
h as split
|
|
8
|
+
c as hashSignature
|
|
22
9
|
};
|
package/dist/esm/index239.js
CHANGED
|
@@ -1,149 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (!Number.isSafeInteger(t) || t < 0)
|
|
8
|
-
throw new Error("positive integer expected, got " + t);
|
|
9
|
-
}
|
|
10
|
-
function c(t, ...e) {
|
|
11
|
-
if (!w(t))
|
|
12
|
-
throw new Error("Uint8Array expected");
|
|
13
|
-
if (e.length > 0 && !e.includes(t.length))
|
|
14
|
-
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
15
|
-
}
|
|
16
|
-
function U(t) {
|
|
17
|
-
if (typeof t != "function" || typeof t.create != "function")
|
|
18
|
-
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
19
|
-
l(t.outputLen), l(t.blockLen);
|
|
20
|
-
}
|
|
21
|
-
function B(t, e = !0) {
|
|
22
|
-
if (t.destroyed)
|
|
23
|
-
throw new Error("Hash instance has been destroyed");
|
|
24
|
-
if (e && t.finished)
|
|
25
|
-
throw new Error("Hash#digest() has already been called");
|
|
26
|
-
}
|
|
27
|
-
function H(t, e) {
|
|
28
|
-
c(t);
|
|
29
|
-
const n = e.outputLen;
|
|
30
|
-
if (t.length < n)
|
|
31
|
-
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
32
|
-
}
|
|
33
|
-
function L(t) {
|
|
34
|
-
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
35
|
-
}
|
|
36
|
-
function V(...t) {
|
|
37
|
-
for (let e = 0; e < t.length; e++)
|
|
38
|
-
t[e].fill(0);
|
|
39
|
-
}
|
|
40
|
-
function _(t) {
|
|
41
|
-
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
42
|
-
}
|
|
43
|
-
function S(t, e) {
|
|
44
|
-
return t << 32 - e | t >>> e;
|
|
45
|
-
}
|
|
46
|
-
const d = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
47
|
-
function h(t) {
|
|
48
|
-
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
49
|
-
}
|
|
50
|
-
function x(t) {
|
|
51
|
-
for (let e = 0; e < t.length; e++)
|
|
52
|
-
t[e] = h(t[e]);
|
|
53
|
-
return t;
|
|
54
|
-
}
|
|
55
|
-
const T = d ? (t) => t : x, p = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", A = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
56
|
-
function k(t) {
|
|
57
|
-
if (c(t), p)
|
|
58
|
-
return t.toHex();
|
|
59
|
-
let e = "";
|
|
60
|
-
for (let n = 0; n < t.length; n++)
|
|
61
|
-
e += A[t[n]];
|
|
62
|
-
return e;
|
|
63
|
-
}
|
|
64
|
-
const f = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
65
|
-
function y(t) {
|
|
66
|
-
if (t >= f._0 && t <= f._9)
|
|
67
|
-
return t - f._0;
|
|
68
|
-
if (t >= f.A && t <= f.F)
|
|
69
|
-
return t - (f.A - 10);
|
|
70
|
-
if (t >= f.a && t <= f.f)
|
|
71
|
-
return t - (f.a - 10);
|
|
72
|
-
}
|
|
73
|
-
function I(t) {
|
|
74
|
-
if (typeof t != "string")
|
|
75
|
-
throw new Error("hex string expected, got " + typeof t);
|
|
76
|
-
if (p)
|
|
77
|
-
return Uint8Array.fromHex(t);
|
|
78
|
-
const e = t.length, n = e / 2;
|
|
79
|
-
if (e % 2)
|
|
80
|
-
throw new Error("hex string expected, got unpadded hex of length " + e);
|
|
81
|
-
const r = new Uint8Array(n);
|
|
82
|
-
for (let o = 0, i = 0; o < n; o++, i += 2) {
|
|
83
|
-
const s = y(t.charCodeAt(i)), a = y(t.charCodeAt(i + 1));
|
|
84
|
-
if (s === void 0 || a === void 0) {
|
|
85
|
-
const g = t[i] + t[i + 1];
|
|
86
|
-
throw new Error('hex string expected, got non-hex character "' + g + '" at index ' + i);
|
|
87
|
-
}
|
|
88
|
-
r[o] = s * 16 + a;
|
|
89
|
-
}
|
|
90
|
-
return r;
|
|
91
|
-
}
|
|
92
|
-
function m(t) {
|
|
93
|
-
if (typeof t != "string")
|
|
94
|
-
throw new Error("string expected");
|
|
95
|
-
return new Uint8Array(new TextEncoder().encode(t));
|
|
96
|
-
}
|
|
97
|
-
function b(t) {
|
|
98
|
-
return typeof t == "string" && (t = m(t)), c(t), t;
|
|
99
|
-
}
|
|
100
|
-
function R(...t) {
|
|
101
|
-
let e = 0;
|
|
102
|
-
for (let r = 0; r < t.length; r++) {
|
|
103
|
-
const o = t[r];
|
|
104
|
-
c(o), e += o.length;
|
|
105
|
-
}
|
|
106
|
-
const n = new Uint8Array(e);
|
|
107
|
-
for (let r = 0, o = 0; r < t.length; r++) {
|
|
108
|
-
const i = t[r];
|
|
109
|
-
n.set(i, o), o += i.length;
|
|
110
|
-
}
|
|
111
|
-
return n;
|
|
112
|
-
}
|
|
113
|
-
class F {
|
|
114
|
-
}
|
|
115
|
-
function O(t) {
|
|
116
|
-
const e = (r) => t().update(b(r)).digest(), n = t();
|
|
117
|
-
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
118
|
-
}
|
|
119
|
-
function v(t = 32) {
|
|
120
|
-
if (u && typeof u.getRandomValues == "function")
|
|
121
|
-
return u.getRandomValues(new Uint8Array(t));
|
|
122
|
-
if (u && typeof u.randomBytes == "function")
|
|
123
|
-
return Uint8Array.from(u.randomBytes(t));
|
|
124
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
125
|
-
}
|
|
1
|
+
import { normalizeSignature as o } from "./index240.js";
|
|
2
|
+
import { formatAbiItem as n } from "./index195.js";
|
|
3
|
+
const m = (r) => {
|
|
4
|
+
const t = typeof r == "string" ? r : n(r);
|
|
5
|
+
return o(t);
|
|
6
|
+
};
|
|
126
7
|
export {
|
|
127
|
-
|
|
128
|
-
c as abytes,
|
|
129
|
-
B as aexists,
|
|
130
|
-
U as ahash,
|
|
131
|
-
l as anumber,
|
|
132
|
-
H as aoutput,
|
|
133
|
-
h as byteSwap,
|
|
134
|
-
x as byteSwap32,
|
|
135
|
-
k as bytesToHex,
|
|
136
|
-
V as clean,
|
|
137
|
-
R as concatBytes,
|
|
138
|
-
O as createHasher,
|
|
139
|
-
_ as createView,
|
|
140
|
-
I as hexToBytes,
|
|
141
|
-
w as isBytes,
|
|
142
|
-
d as isLE,
|
|
143
|
-
v as randomBytes,
|
|
144
|
-
S as rotr,
|
|
145
|
-
T as swap32IfBE,
|
|
146
|
-
b as toBytes,
|
|
147
|
-
L as u32,
|
|
148
|
-
m as utf8ToBytes
|
|
8
|
+
m as toSignature
|
|
149
9
|
};
|
package/dist/esm/index24.js
CHANGED
|
@@ -1,166 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { formatTransactionRequest as rt } from "./index144.js";
|
|
17
|
-
import { createBatchScheduler as ot } from "./index15.js";
|
|
18
|
-
import { serializeStateOverride as ct } from "./index218.js";
|
|
19
|
-
import { assertRequest as nt } from "./index157.js";
|
|
20
|
-
import { parseAbi as z } from "./index196.js";
|
|
21
|
-
async function Et(t, a) {
|
|
22
|
-
const { account: e = t.account, authorizationList: n, batch: r = !!t.batch?.multicall, blockNumber: m, blockTag: C = t.experimental_blockTag ?? "latest", accessList: x, blobs: D, blockOverrides: d, code: p, data: o, factory: u, factoryData: s, gas: B, gasPrice: b, maxFeePerBlobGas: h, maxFeePerGas: y, maxPriorityFeePerGas: g, nonce: k, to: f, value: H, stateOverride: L, ...j } = a, R = e ? W(e) : void 0;
|
|
23
|
-
if (p && (u || s))
|
|
24
|
-
throw new N("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
|
|
25
|
-
if (p && f)
|
|
26
|
-
throw new N("Cannot provide both `code` & `to` as parameters.");
|
|
27
|
-
const S = p && o, _ = u && s && f && o, A = S || _, G = S ? lt({
|
|
28
|
-
code: p,
|
|
29
|
-
data: o
|
|
30
|
-
}) : _ ? dt({
|
|
31
|
-
data: o,
|
|
32
|
-
factory: u,
|
|
33
|
-
factoryData: s,
|
|
34
|
-
to: f
|
|
35
|
-
}) : o;
|
|
36
|
-
try {
|
|
37
|
-
nt(a);
|
|
38
|
-
const w = (typeof m == "bigint" ? V(m) : void 0) || C, i = d ? $(d) : void 0, l = ct(L), q = t.chain?.formatters?.transactionRequest?.format, v = (q || rt)({
|
|
39
|
-
// Pick out extra data that might exist on the chain's transaction request type.
|
|
40
|
-
...et(j, { format: q }),
|
|
41
|
-
from: R?.address,
|
|
42
|
-
accessList: x,
|
|
43
|
-
authorizationList: n,
|
|
44
|
-
blobs: D,
|
|
45
|
-
data: G,
|
|
46
|
-
gas: B,
|
|
47
|
-
gasPrice: b,
|
|
48
|
-
maxFeePerBlobGas: h,
|
|
49
|
-
maxFeePerGas: y,
|
|
50
|
-
maxPriorityFeePerGas: g,
|
|
51
|
-
nonce: k,
|
|
52
|
-
to: A ? void 0 : f,
|
|
53
|
-
value: H
|
|
1
|
+
import { getChainContractAddress as l } from "./index174.js";
|
|
2
|
+
import { toHex as u } from "./index111.js";
|
|
3
|
+
import { packetToBytes as v } from "./index216.js";
|
|
4
|
+
import { getAction as f } from "./index209.js";
|
|
5
|
+
import { readContract as m } from "./index57.js";
|
|
6
|
+
async function A(o, r) {
|
|
7
|
+
const { blockNumber: n, blockTag: i, name: s } = r, { chain: e } = o, a = (() => {
|
|
8
|
+
if (r.universalResolverAddress)
|
|
9
|
+
return r.universalResolverAddress;
|
|
10
|
+
if (!e)
|
|
11
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
12
|
+
return l({
|
|
13
|
+
blockNumber: n,
|
|
14
|
+
chain: e,
|
|
15
|
+
contract: "ensUniversalResolver"
|
|
54
16
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
17
|
+
})(), t = e?.ensTlds;
|
|
18
|
+
if (t && !t.some((c) => s.endsWith(c)))
|
|
19
|
+
throw new Error(`${s} is not a valid ENS TLD (${t?.join(", ")}) for chain "${e.name}" (id: ${e.id}).`);
|
|
20
|
+
const [d] = await f(o, m, "readContract")({
|
|
21
|
+
address: a,
|
|
22
|
+
abi: [
|
|
23
|
+
{
|
|
24
|
+
inputs: [{ type: "bytes" }],
|
|
25
|
+
name: "findResolver",
|
|
26
|
+
outputs: [{ type: "address" }, { type: "bytes32" }],
|
|
27
|
+
stateMutability: "view",
|
|
28
|
+
type: "function"
|
|
65
29
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return l && i ? [...c, l, i] : l ? [...c, l] : i ? [...c, {}, i] : c;
|
|
72
|
-
})(), E = await t.request({
|
|
73
|
-
method: "eth_call",
|
|
74
|
-
params: M
|
|
75
|
-
});
|
|
76
|
-
return E === "0x" ? { data: void 0 } : { data: E };
|
|
77
|
-
} catch (F) {
|
|
78
|
-
const w = ut(F), { offchainLookup: i, offchainLookupSignature: l } = await import("./index161.js");
|
|
79
|
-
if (t.ccipRead !== !1 && w?.slice(0, 10) === l && f)
|
|
80
|
-
return { data: await i(t, { data: w, to: f }) };
|
|
81
|
-
throw A && w?.slice(0, 10) === "0x101bb98d" ? new U({ factory: u }) : at(F, {
|
|
82
|
-
...a,
|
|
83
|
-
account: R,
|
|
84
|
-
chain: t.chain
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function st({ request: t }) {
|
|
89
|
-
const { data: a, to: e, ...n } = t;
|
|
90
|
-
return !(!a || a.startsWith(I) || !e || Object.values(n).filter((r) => typeof r < "u").length > 0);
|
|
91
|
-
}
|
|
92
|
-
async function it(t, a) {
|
|
93
|
-
const { batchSize: e = 1024, wait: n = 0 } = typeof t.batch?.multicall == "object" ? t.batch.multicall : {}, { blockNumber: r, blockTag: m = t.experimental_blockTag ?? "latest", data: C, multicallAddress: x, to: D } = a;
|
|
94
|
-
let d = x;
|
|
95
|
-
if (!d) {
|
|
96
|
-
if (!t.chain)
|
|
97
|
-
throw new P();
|
|
98
|
-
d = tt({
|
|
99
|
-
blockNumber: r,
|
|
100
|
-
chain: t.chain,
|
|
101
|
-
contract: "multicall3"
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
const o = (typeof r == "bigint" ? V(r) : void 0) || m, { schedule: u } = ot({
|
|
105
|
-
id: `${t.uid}.${o}`,
|
|
106
|
-
wait: n,
|
|
107
|
-
shouldSplitBatch(b) {
|
|
108
|
-
return b.reduce((y, { data: g }) => y + (g.length - 2), 0) > e * 2;
|
|
109
|
-
},
|
|
110
|
-
fn: async (b) => {
|
|
111
|
-
const h = b.map((k) => ({
|
|
112
|
-
allowFailure: !0,
|
|
113
|
-
callData: k.data,
|
|
114
|
-
target: k.to
|
|
115
|
-
})), y = Z({
|
|
116
|
-
abi: O,
|
|
117
|
-
args: [h],
|
|
118
|
-
functionName: "aggregate3"
|
|
119
|
-
}), g = await t.request({
|
|
120
|
-
method: "eth_call",
|
|
121
|
-
params: [
|
|
122
|
-
{
|
|
123
|
-
data: y,
|
|
124
|
-
to: d
|
|
125
|
-
},
|
|
126
|
-
o
|
|
127
|
-
]
|
|
128
|
-
});
|
|
129
|
-
return Y({
|
|
130
|
-
abi: O,
|
|
131
|
-
args: [h],
|
|
132
|
-
functionName: "aggregate3",
|
|
133
|
-
data: g || "0x"
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}), [{ returnData: s, success: B }] = await u({ data: C, to: D });
|
|
137
|
-
if (!B)
|
|
138
|
-
throw new X({ data: s });
|
|
139
|
-
return s === "0x" ? { data: void 0 } : { data: s };
|
|
140
|
-
}
|
|
141
|
-
function lt(t) {
|
|
142
|
-
const { code: a, data: e } = t;
|
|
143
|
-
return T({
|
|
144
|
-
abi: z(["constructor(bytes, bytes)"]),
|
|
145
|
-
bytecode: J,
|
|
146
|
-
args: [a, e]
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function dt(t) {
|
|
150
|
-
const { data: a, factory: e, factoryData: n, to: r } = t;
|
|
151
|
-
return T({
|
|
152
|
-
abi: z(["constructor(address, bytes, address, bytes)"]),
|
|
153
|
-
bytecode: K,
|
|
154
|
-
args: [r, a, e, n]
|
|
30
|
+
],
|
|
31
|
+
functionName: "findResolver",
|
|
32
|
+
args: [u(v(s))],
|
|
33
|
+
blockNumber: n,
|
|
34
|
+
blockTag: i
|
|
155
35
|
});
|
|
156
|
-
|
|
157
|
-
function ut(t) {
|
|
158
|
-
if (!(t instanceof N))
|
|
159
|
-
return;
|
|
160
|
-
const a = t.walk();
|
|
161
|
-
return typeof a?.data == "object" ? a.data?.data : a.data;
|
|
36
|
+
return d;
|
|
162
37
|
}
|
|
163
38
|
export {
|
|
164
|
-
|
|
165
|
-
ut as getRevertErrorData
|
|
39
|
+
A as getEnsResolver
|
|
166
40
|
};
|
package/dist/esm/index240.js
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { BaseError as u } from "./index84.js";
|
|
2
|
+
function a(r) {
|
|
3
|
+
let l = !0, i = "", f = 0, t = "", o = !1;
|
|
4
|
+
for (let n = 0; n < r.length; n++) {
|
|
5
|
+
const e = r[n];
|
|
6
|
+
if (["(", ")", ","].includes(e) && (l = !0), e === "(" && f++, e === ")" && f--, !!l) {
|
|
7
|
+
if (f === 0) {
|
|
8
|
+
if (e === " " && ["event", "function", ""].includes(t))
|
|
9
|
+
t = "";
|
|
10
|
+
else if (t += e, e === ")") {
|
|
11
|
+
o = !0;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (e === " ") {
|
|
17
|
+
r[n - 1] !== "," && i !== "," && i !== ",(" && (i = "", l = !1);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
t += e, i += e;
|
|
21
|
+
}
|
|
11
22
|
}
|
|
12
|
-
|
|
23
|
+
if (!o)
|
|
24
|
+
throw new u("Unable to normalize signature.");
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
13
27
|
export {
|
|
14
|
-
|
|
28
|
+
a as normalizeSignature
|
|
15
29
|
};
|