@coinbase/cdp-hooks 0.0.96 → 0.0.97

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.
Files changed (282) hide show
  1. package/dist/esm/index100.js +35 -25
  2. package/dist/esm/index101.js +9 -46
  3. package/dist/esm/index102.js +31 -69
  4. package/dist/esm/index103.js +36 -40
  5. package/dist/esm/index104.js +9 -75
  6. package/dist/esm/index105.js +25 -27
  7. package/dist/esm/index106.js +46 -6
  8. package/dist/esm/index107.js +69 -16
  9. package/dist/esm/index108.js +40 -8
  10. package/dist/esm/index109.js +75 -13
  11. package/dist/esm/index110.js +31 -7
  12. package/dist/esm/index111.js +6 -9
  13. package/dist/esm/index112.js +16 -16
  14. package/dist/esm/index113.js +8 -12
  15. package/dist/esm/index114.js +13 -46
  16. package/dist/esm/index115.js +7 -13
  17. package/dist/esm/index116.js +9 -16
  18. package/dist/esm/index117.js +16 -13
  19. package/dist/esm/index118.js +11 -5
  20. package/dist/esm/index119.js +46 -35
  21. package/dist/esm/index120.js +13 -9
  22. package/dist/esm/index121.js +15 -7
  23. package/dist/esm/index122.js +13 -28
  24. package/dist/esm/index123.js +6 -10
  25. package/dist/esm/index124.js +32 -11
  26. package/dist/esm/index125.js +9 -11
  27. package/dist/esm/index126.js +8 -120
  28. package/dist/esm/index127.js +27 -32
  29. package/dist/esm/index128.js +10 -80
  30. package/dist/esm/index129.js +13 -176
  31. package/dist/esm/index130.js +11 -44
  32. package/dist/esm/index131.js +120 -6
  33. package/dist/esm/index132.js +30 -151
  34. package/dist/esm/index133.js +80 -14
  35. package/dist/esm/index134.js +177 -14
  36. package/dist/esm/index135.js +42 -97
  37. package/dist/esm/index136.js +6 -72
  38. package/dist/esm/index137.js +153 -86
  39. package/dist/esm/index138.js +14 -148
  40. package/dist/esm/index139.js +14 -136
  41. package/dist/esm/index140.js +94 -63
  42. package/dist/esm/index141.js +72 -23
  43. package/dist/esm/index142.js +83 -154
  44. package/dist/esm/index143.js +148 -6
  45. package/dist/esm/index144.js +136 -11
  46. package/dist/esm/index145.js +68 -19
  47. package/dist/esm/index146.js +23 -135
  48. package/dist/esm/index147.js +155 -75
  49. package/dist/esm/index148.js +6 -9
  50. package/dist/esm/index149.js +11 -28
  51. package/dist/esm/index150.js +17 -87
  52. package/dist/esm/index151.js +135 -350
  53. package/dist/esm/index152.js +79 -3
  54. package/dist/esm/index153.js +10 -5
  55. package/dist/esm/index154.js +29 -2
  56. package/dist/esm/index155.js +90 -3
  57. package/dist/esm/index156.js +351 -9
  58. package/dist/esm/index157.js +3 -327
  59. package/dist/esm/index158.js +5 -14
  60. package/dist/esm/index159.js +2 -5
  61. package/dist/esm/index160.js +3 -56
  62. package/dist/esm/index161.js +9 -13
  63. package/dist/esm/index162.js +327 -2
  64. package/dist/esm/index163.js +13 -7
  65. package/dist/esm/index164.js +4 -30
  66. package/dist/esm/index165.js +29 -188
  67. package/dist/esm/index166.js +13 -32
  68. package/dist/esm/index167.js +2 -22
  69. package/dist/esm/index168.js +7 -5
  70. package/dist/esm/index169.js +25 -68
  71. package/dist/esm/index170.js +214 -5
  72. package/dist/esm/index171.js +32 -6
  73. package/dist/esm/index172.js +20 -34
  74. package/dist/esm/index173.js +5 -119
  75. package/dist/esm/index174.js +74 -3
  76. package/dist/esm/index175.js +5 -18
  77. package/dist/esm/index176.js +5 -26
  78. package/dist/esm/index177.js +28 -26
  79. package/dist/esm/index178.js +105 -20
  80. package/dist/esm/index179.js +3 -24
  81. package/dist/esm/index180.js +17 -7
  82. package/dist/esm/index181.js +18 -185
  83. package/dist/esm/index182.js +34 -2
  84. package/dist/esm/index183.js +28 -461
  85. package/dist/esm/index184.js +16 -20
  86. package/dist/esm/index185.js +6 -158
  87. package/dist/esm/index186.js +193 -21
  88. package/dist/esm/index187.js +2 -128
  89. package/dist/esm/index188.js +467 -38
  90. package/dist/esm/index189.js +27 -6
  91. package/dist/esm/index190.js +160 -27
  92. package/dist/esm/index191.js +20 -54
  93. package/dist/esm/index192.js +126 -44
  94. package/dist/esm/index193.js +31 -184
  95. package/dist/esm/index194.js +7 -4
  96. package/dist/esm/index195.js +26 -72
  97. package/dist/esm/index196.js +52 -17
  98. package/dist/esm/index197.js +46 -3
  99. package/dist/esm/index198.js +188 -13
  100. package/dist/esm/index199.js +4 -24
  101. package/dist/esm/index200.js +73 -11
  102. package/dist/esm/index201.js +18 -16
  103. package/dist/esm/index202.js +3 -35
  104. package/dist/esm/index203.js +17 -3
  105. package/dist/esm/index204.js +23 -18
  106. package/dist/esm/index205.js +11 -27
  107. package/dist/esm/index206.js +17 -34
  108. package/dist/esm/index207.js +34 -8
  109. package/dist/esm/index208.js +3 -8
  110. package/dist/esm/index209.js +18 -25
  111. package/dist/esm/index210.js +26 -27
  112. package/dist/esm/index211.js +35 -3
  113. package/dist/esm/index212.js +8 -79
  114. package/dist/esm/index213.js +7 -9
  115. package/dist/esm/index214.js +23 -10
  116. package/dist/esm/index215.js +27 -20
  117. package/dist/esm/index216.js +3 -8
  118. package/dist/esm/index217.js +78 -9
  119. package/dist/esm/index218.js +9 -11
  120. package/dist/esm/index219.js +12 -6
  121. package/dist/esm/index220.js +21 -6
  122. package/dist/esm/index221.js +8 -13
  123. package/dist/esm/index222.js +9 -31
  124. package/dist/esm/index223.js +12 -5
  125. package/dist/esm/index224.js +6 -37
  126. package/dist/esm/index225.js +6 -110
  127. package/dist/esm/index226.js +12 -47
  128. package/dist/esm/index227.js +31 -31
  129. package/dist/esm/index228.js +5 -18
  130. package/dist/esm/index229.js +35 -17
  131. package/dist/esm/index230.js +108 -40
  132. package/dist/esm/index231.js +46 -40
  133. package/dist/esm/index232.js +32 -8
  134. package/dist/esm/index233.js +17 -7
  135. package/dist/esm/index234.js +19 -16
  136. package/dist/esm/index235.js +42 -22
  137. package/dist/esm/index236.js +40 -22
  138. package/dist/esm/index237.js +8 -16
  139. package/dist/esm/index238.js +7 -54
  140. package/dist/esm/index239.js +16 -27
  141. package/dist/esm/index240.js +22 -24
  142. package/dist/esm/index241.js +24 -104
  143. package/dist/esm/index242.js +17 -3
  144. package/dist/esm/index243.js +54 -5
  145. package/dist/esm/index244.js +26 -30
  146. package/dist/esm/index245.js +24 -20
  147. package/dist/esm/index246.js +104 -3
  148. package/dist/esm/index247.js +3 -18
  149. package/dist/esm/index248.js +5 -5
  150. package/dist/esm/index249.js +31 -8
  151. package/dist/esm/index250.js +19 -102
  152. package/dist/esm/index251.js +3 -64
  153. package/dist/esm/index252.js +17 -5
  154. package/dist/esm/index253.js +5 -6
  155. package/dist/esm/index254.js +8 -27
  156. package/dist/esm/index255.js +103 -33
  157. package/dist/esm/index256.js +64 -13
  158. package/dist/esm/index257.js +5 -16
  159. package/dist/esm/index258.js +6 -78
  160. package/dist/esm/index259.js +28 -2
  161. package/dist/esm/index260.js +33 -14
  162. package/dist/esm/index261.js +13 -18
  163. package/dist/esm/index262.js +16 -171
  164. package/dist/esm/index263.js +77 -16
  165. package/dist/esm/index264.js +2 -11
  166. package/dist/esm/index265.js +15 -10
  167. package/dist/esm/index266.js +18 -38
  168. package/dist/esm/index267.js +172 -2
  169. package/dist/esm/index268.js +17 -69
  170. package/dist/esm/index269.js +10 -34
  171. package/dist/esm/index270.js +10 -15
  172. package/dist/esm/index271.js +2 -41
  173. package/dist/esm/index272.js +41 -2
  174. package/dist/esm/index273.js +2 -5
  175. package/dist/esm/index274.js +4 -10
  176. package/dist/esm/index275.js +9 -18
  177. package/dist/esm/index276.js +19 -7
  178. package/dist/esm/index277.js +7 -11
  179. package/dist/esm/index278.js +11 -72
  180. package/dist/esm/index279.js +71 -64
  181. package/dist/esm/index280.js +60 -182
  182. package/dist/esm/index281.js +185 -20
  183. package/dist/esm/index282.js +21 -41
  184. package/dist/esm/index283.js +41 -24
  185. package/dist/esm/index284.js +24 -89
  186. package/dist/esm/index285.js +68 -18
  187. package/dist/esm/index286.js +34 -10
  188. package/dist/esm/index287.js +10 -7
  189. package/dist/esm/index288.js +13 -7
  190. package/dist/esm/index289.js +7 -6
  191. package/dist/esm/index290.js +6 -36
  192. package/dist/esm/index291.js +35 -14
  193. package/dist/esm/index292.js +15 -8
  194. package/dist/esm/index293.js +8 -8
  195. package/dist/esm/index294.js +8 -16
  196. package/dist/esm/index295.js +15 -21
  197. package/dist/esm/index296.js +22 -30
  198. package/dist/esm/index297.js +31 -2
  199. package/dist/esm/index298.js +2 -14
  200. package/dist/esm/index299.js +13 -12
  201. package/dist/esm/index3.js +1 -1
  202. package/dist/esm/index300.js +10 -45
  203. package/dist/esm/index301.js +47 -9
  204. package/dist/esm/index302.js +8 -12
  205. package/dist/esm/index303.js +10 -10
  206. package/dist/esm/index304.js +13 -14
  207. package/dist/esm/index305.js +14 -8
  208. package/dist/esm/index306.js +6 -13
  209. package/dist/esm/index307.js +15 -24
  210. package/dist/esm/index308.js +24 -24
  211. package/dist/esm/index309.js +20 -27
  212. package/dist/esm/index310.js +31 -9
  213. package/dist/esm/index311.js +9 -51
  214. package/dist/esm/index312.js +38 -24
  215. package/dist/esm/index313.js +37 -17
  216. package/dist/esm/index314.js +17 -14
  217. package/dist/esm/index315.js +14 -11
  218. package/dist/esm/index316.js +11 -12
  219. package/dist/esm/index317.js +12 -19
  220. package/dist/esm/index318.js +18 -106
  221. package/dist/esm/index319.js +105 -101
  222. package/dist/esm/index320.js +103 -6
  223. package/dist/esm/index321.js +7 -7
  224. package/dist/esm/index322.js +7 -27
  225. package/dist/esm/index323.js +26 -15
  226. package/dist/esm/index324.js +13 -211
  227. package/dist/esm/index325.js +213 -12
  228. package/dist/esm/index326.js +12 -35
  229. package/dist/esm/index327.js +35 -41
  230. package/dist/esm/index328.js +42 -2
  231. package/dist/esm/index329.js +3 -68
  232. package/dist/esm/index330.js +68 -3
  233. package/dist/esm/index331.js +3 -136
  234. package/dist/esm/index332.js +125 -163
  235. package/dist/esm/index333.js +174 -9
  236. package/dist/esm/index334.js +9 -16
  237. package/dist/esm/index335.js +16 -133
  238. package/dist/esm/index336.js +112 -172
  239. package/dist/esm/index337.js +194 -2
  240. package/dist/esm/index338.js +2 -79
  241. package/dist/esm/index339.js +77 -13
  242. package/dist/esm/index340.js +13 -89
  243. package/dist/esm/index341.js +70 -143
  244. package/dist/esm/index342.js +157 -36
  245. package/dist/esm/index343.js +41 -654
  246. package/dist/esm/index344.js +646 -196
  247. package/dist/esm/index345.js +201 -172
  248. package/dist/esm/index346.js +176 -3
  249. package/dist/esm/index347.js +1 -1
  250. package/dist/esm/index349.js +2 -2
  251. package/dist/esm/index350.js +1 -1
  252. package/dist/esm/index351.js +1 -1
  253. package/dist/esm/index352.js +2 -2
  254. package/dist/esm/index353.js +3 -3
  255. package/dist/esm/index354.js +1 -1
  256. package/dist/esm/index73.js +2 -2
  257. package/dist/esm/index74.js +1 -1
  258. package/dist/esm/index75.js +2 -2
  259. package/dist/esm/index76.js +1 -1
  260. package/dist/esm/index77.js +1 -1
  261. package/dist/esm/index78.js +1 -1
  262. package/dist/esm/index79.js +1 -1
  263. package/dist/esm/index80.js +2 -2
  264. package/dist/esm/index81.js +2 -2
  265. package/dist/esm/index82.js +5 -5
  266. package/dist/esm/index83.js +2 -2
  267. package/dist/esm/index85.js +37 -33
  268. package/dist/esm/index86.js +2 -4
  269. package/dist/esm/index87.js +69 -9
  270. package/dist/esm/index88.js +33 -117
  271. package/dist/esm/index89.js +13 -60
  272. package/dist/esm/index90.js +33 -23
  273. package/dist/esm/index91.js +3 -36
  274. package/dist/esm/index92.js +9 -41
  275. package/dist/esm/index93.js +118 -58
  276. package/dist/esm/index94.js +58 -165
  277. package/dist/esm/index95.js +21 -36
  278. package/dist/esm/index96.js +36 -9
  279. package/dist/esm/index97.js +38 -28
  280. package/dist/esm/index98.js +58 -36
  281. package/dist/esm/index99.js +167 -8
  282. package/package.json +3 -3
@@ -1,179 +1,208 @@
1
- import { validateField as M, nLength as z } from "./index324.js";
2
- import { validateObject as O, bitLen as k, bitMask as x } from "./index344.js";
3
- const E = BigInt(0), F = BigInt(1);
4
- function m(e, a) {
5
- const t = a.negate();
6
- return e ? t : a;
7
- }
8
- function y(e, a) {
9
- if (!Number.isSafeInteger(e) || e <= 0 || e > a)
10
- throw new Error("invalid window size, expected [1.." + a + "], got W=" + e);
11
- }
12
- function N(e, a) {
13
- y(e, a);
14
- const t = Math.ceil(a / e) + 1, n = 2 ** (e - 1), i = 2 ** e, o = x(e), r = BigInt(e);
15
- return { windows: t, windowSize: n, mask: o, maxNumber: i, shiftBy: r };
16
- }
17
- function B(e, a, t) {
18
- const { windowSize: n, mask: i, maxNumber: o, shiftBy: r } = t;
19
- let f = Number(e & i), s = e >> r;
20
- f > n && (f -= o, s += F);
21
- const c = a * n, d = c + Math.abs(f) - 1, g = f === 0, l = f < 0, u = a % 2 !== 0;
22
- return { nextN: s, offset: d, isZero: g, isNeg: l, isNegF: u, offsetF: c };
23
- }
24
- function L(e, a) {
25
- if (!Array.isArray(e))
26
- throw new Error("array expected");
27
- e.forEach((t, n) => {
28
- if (!(t instanceof a))
29
- throw new Error("invalid point at index " + n);
30
- });
31
- }
32
- function Z(e, a) {
33
- if (!Array.isArray(e))
34
- throw new Error("array of scalars expected");
35
- e.forEach((t, n) => {
36
- if (!a.isValid(t))
37
- throw new Error("invalid scalar at index " + n);
38
- });
39
- }
40
- const b = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap();
41
- function S(e) {
42
- return I.get(e) || 1;
43
- }
44
- function v(e, a) {
45
- return {
46
- constTimeNegate: m,
47
- hasPrecomputes(t) {
48
- return S(t) !== 1;
49
- },
50
- // non-const time multiplication ladder
51
- unsafeLadder(t, n, i = e.ZERO) {
52
- let o = t;
53
- for (; n > E; )
54
- n & F && (i = i.add(o)), o = o.double(), n >>= F;
55
- return i;
56
- },
57
- /**
58
- * Creates a wNAF precomputation window. Used for caching.
59
- * Default window size is set by `utils.precompute()` and is equal to 8.
60
- * Number of precomputed points depends on the curve size:
61
- * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
62
- * - 𝑊 is the window size
63
- * - 𝑛 is the bitlength of the curve order.
64
- * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
65
- * @param elm Point instance
66
- * @param W window size
67
- * @returns precomputed point tables flattened to a single array
68
- */
69
- precomputeWindow(t, n) {
70
- const { windows: i, windowSize: o } = N(n, a), r = [];
71
- let f = t, s = f;
72
- for (let c = 0; c < i; c++) {
73
- s = f, r.push(s);
74
- for (let d = 1; d < o; d++)
75
- s = s.add(f), r.push(s);
76
- f = s.double();
77
- }
78
- return r;
79
- },
80
- /**
81
- * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
82
- * @param W window size
83
- * @param precomputes precomputed tables
84
- * @param n scalar (we don't check here, but should be less than curve order)
85
- * @returns real and fake (for const-time) points
86
- */
87
- wNAF(t, n, i) {
88
- let o = e.ZERO, r = e.BASE;
89
- const f = N(t, a);
90
- for (let s = 0; s < f.windows; s++) {
91
- const { nextN: c, offset: d, isZero: g, isNeg: l, isNegF: u, offsetF: h } = B(i, s, f);
92
- i = c, g ? r = r.add(m(u, n[h])) : o = o.add(m(l, n[d]));
93
- }
94
- return { p: o, f: r };
95
- },
96
- /**
97
- * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
98
- * @param W window size
99
- * @param precomputes precomputed tables
100
- * @param n scalar (we don't check here, but should be less than curve order)
101
- * @param acc accumulator point to add result of multiplication
102
- * @returns point
103
- */
104
- wNAFUnsafe(t, n, i, o = e.ZERO) {
105
- const r = N(t, a);
106
- for (let f = 0; f < r.windows && i !== E; f++) {
107
- const { nextN: s, offset: c, isZero: d, isNeg: g } = B(i, f, r);
108
- if (i = s, !d) {
109
- const l = n[c];
110
- o = o.add(g ? l.negate() : l);
111
- }
112
- }
113
- return o;
114
- },
115
- getPrecomputes(t, n, i) {
116
- let o = b.get(n);
117
- return o || (o = this.precomputeWindow(n, t), t !== 1 && b.set(n, i(o))), o;
118
- },
119
- wNAFCached(t, n, i) {
120
- const o = S(t);
121
- return this.wNAF(o, this.getPrecomputes(o, t, i), n);
122
- },
123
- wNAFCachedUnsafe(t, n, i, o) {
124
- const r = S(t);
125
- return r === 1 ? this.unsafeLadder(t, n, o) : this.wNAFUnsafe(r, this.getPrecomputes(r, t, i), n, o);
126
- },
127
- // We calculate precomputes for elliptic curve point multiplication
128
- // using windowed method. This specifies window size and
129
- // stores precomputed values. Usually only base point would be precomputed.
130
- setWindowSize(t, n) {
131
- y(n, a), I.set(t, n), b.delete(t);
1
+ const w = /* @__PURE__ */ BigInt(0), p = /* @__PURE__ */ BigInt(1);
2
+ function b(t) {
3
+ return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
4
+ }
5
+ function h(t) {
6
+ if (!b(t))
7
+ throw new Error("Uint8Array expected");
8
+ }
9
+ function k(t, n) {
10
+ if (typeof n != "boolean")
11
+ throw new Error(t + " boolean expected, got " + n);
12
+ }
13
+ function F(t) {
14
+ const n = t.toString(16);
15
+ return n.length & 1 ? "0" + n : n;
16
+ }
17
+ function E(t) {
18
+ if (typeof t != "string")
19
+ throw new Error("hex string expected, got " + typeof t);
20
+ return t === "" ? w : BigInt("0x" + t);
21
+ }
22
+ const U = (
23
+ // @ts-ignore
24
+ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function"
25
+ ), S = /* @__PURE__ */ Array.from({ length: 256 }, (t, n) => n.toString(16).padStart(2, "0"));
26
+ function x(t) {
27
+ if (h(t), U)
28
+ return t.toHex();
29
+ let n = "";
30
+ for (let e = 0; e < t.length; e++)
31
+ n += S[t[e]];
32
+ return n;
33
+ }
34
+ const u = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
35
+ function m(t) {
36
+ if (t >= u._0 && t <= u._9)
37
+ return t - u._0;
38
+ if (t >= u.A && t <= u.F)
39
+ return t - (u.A - 10);
40
+ if (t >= u.a && t <= u.f)
41
+ return t - (u.a - 10);
42
+ }
43
+ function B(t) {
44
+ if (typeof t != "string")
45
+ throw new Error("hex string expected, got " + typeof t);
46
+ if (U)
47
+ return Uint8Array.fromHex(t);
48
+ const n = t.length, e = n / 2;
49
+ if (n % 2)
50
+ throw new Error("hex string expected, got unpadded hex of length " + n);
51
+ const r = new Uint8Array(e);
52
+ for (let o = 0, i = 0; o < e; o++, i += 2) {
53
+ const a = m(t.charCodeAt(i)), f = m(t.charCodeAt(i + 1));
54
+ if (a === void 0 || f === void 0) {
55
+ const c = t[i] + t[i + 1];
56
+ throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
132
57
  }
133
- };
58
+ r[o] = a * 16 + f;
59
+ }
60
+ return r;
61
+ }
62
+ function O(t) {
63
+ return E(x(t));
64
+ }
65
+ function V(t) {
66
+ return h(t), E(x(Uint8Array.from(t).reverse()));
134
67
  }
135
- function U(e, a, t, n) {
136
- L(t, e), Z(n, a);
137
- const i = t.length, o = n.length;
138
- if (i !== o)
139
- throw new Error("arrays of points and scalars must have equal length");
140
- const r = e.ZERO, f = k(BigInt(i));
141
- let s = 1;
142
- f > 12 ? s = f - 3 : f > 4 ? s = f - 2 : f > 0 && (s = 2);
143
- const c = x(s), d = new Array(Number(c) + 1).fill(r), g = Math.floor((a.BITS - 1) / s) * s;
144
- let l = r;
145
- for (let u = g; u >= 0; u -= s) {
146
- d.fill(r);
147
- for (let w = 0; w < o; w++) {
148
- const p = n[w], A = Number(p >> BigInt(u) & c);
149
- d[A] = d[A].add(t[w]);
68
+ function T(t, n) {
69
+ return B(t.toString(16).padStart(n * 2, "0"));
70
+ }
71
+ function C(t, n) {
72
+ return T(t, n).reverse();
73
+ }
74
+ function M(t, n, e) {
75
+ let r;
76
+ if (typeof n == "string")
77
+ try {
78
+ r = B(n);
79
+ } catch (i) {
80
+ throw new Error(t + " must be hex string or Uint8Array, cause: " + i);
150
81
  }
151
- let h = r;
152
- for (let w = d.length - 1, p = r; w > 0; w--)
153
- p = p.add(d[w]), h = h.add(p);
154
- if (l = l.add(h), u !== 0)
155
- for (let w = 0; w < s; w++)
156
- l = l.double();
82
+ else if (b(n))
83
+ r = Uint8Array.from(n);
84
+ else
85
+ throw new Error(t + " must be hex string or Uint8Array");
86
+ const o = r.length;
87
+ if (typeof e == "number" && o !== e)
88
+ throw new Error(t + " of length " + e + " expected, got " + o);
89
+ return r;
90
+ }
91
+ function H(...t) {
92
+ let n = 0;
93
+ for (let r = 0; r < t.length; r++) {
94
+ const o = t[r];
95
+ h(o), n += o.length;
157
96
  }
158
- return l;
159
- }
160
- function C(e) {
161
- return M(e.Fp), O(e, {
162
- n: "bigint",
163
- h: "bigint",
164
- Gx: "field",
165
- Gy: "field"
166
- }, {
167
- nBitLength: "isSafeInteger",
168
- nByteLength: "isSafeInteger"
169
- }), Object.freeze({
170
- ...z(e.n, e.nBitLength),
171
- ...e,
172
- p: e.Fp.ORDER
173
- });
97
+ const e = new Uint8Array(n);
98
+ for (let r = 0, o = 0; r < t.length; r++) {
99
+ const i = t[r];
100
+ e.set(i, o), o += i.length;
101
+ }
102
+ return e;
103
+ }
104
+ const y = (t) => typeof t == "bigint" && w <= t;
105
+ function I(t, n, e) {
106
+ return y(t) && y(n) && y(e) && n <= t && t < e;
107
+ }
108
+ function R(t, n, e, r) {
109
+ if (!I(n, e, r))
110
+ throw new Error("expected valid " + t + ": " + e + " <= n < " + r + ", got " + n);
111
+ }
112
+ function j(t) {
113
+ let n;
114
+ for (n = 0; t > w; t >>= p, n += 1)
115
+ ;
116
+ return n;
117
+ }
118
+ const z = (t) => (p << BigInt(t)) - p, d = (t) => new Uint8Array(t), A = (t) => Uint8Array.from(t);
119
+ function D(t, n, e) {
120
+ if (typeof t != "number" || t < 2)
121
+ throw new Error("hashLen must be a number");
122
+ if (typeof n != "number" || n < 2)
123
+ throw new Error("qByteLen must be a number");
124
+ if (typeof e != "function")
125
+ throw new Error("hmacFn must be a function");
126
+ let r = d(t), o = d(t), i = 0;
127
+ const a = () => {
128
+ r.fill(1), o.fill(0), i = 0;
129
+ }, f = (...s) => e(o, r, ...s), c = (s = d(0)) => {
130
+ o = f(A([0]), s), r = f(), s.length !== 0 && (o = f(A([1]), s), r = f());
131
+ }, v = () => {
132
+ if (i++ >= 1e3)
133
+ throw new Error("drbg: tried 1000 values");
134
+ let s = 0;
135
+ const l = [];
136
+ for (; s < n; ) {
137
+ r = f();
138
+ const g = r.slice();
139
+ l.push(g), s += r.length;
140
+ }
141
+ return H(...l);
142
+ };
143
+ return (s, l) => {
144
+ a(), c(s);
145
+ let g;
146
+ for (; !(g = l(v())); )
147
+ c();
148
+ return a(), g;
149
+ };
150
+ }
151
+ const _ = {
152
+ bigint: (t) => typeof t == "bigint",
153
+ function: (t) => typeof t == "function",
154
+ boolean: (t) => typeof t == "boolean",
155
+ string: (t) => typeof t == "string",
156
+ stringOrUint8Array: (t) => typeof t == "string" || b(t),
157
+ isSafeInteger: (t) => Number.isSafeInteger(t),
158
+ array: (t) => Array.isArray(t),
159
+ field: (t, n) => n.Fp.isValid(t),
160
+ hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
161
+ };
162
+ function P(t, n, e = {}) {
163
+ const r = (o, i, a) => {
164
+ const f = _[i];
165
+ if (typeof f != "function")
166
+ throw new Error("invalid validator function");
167
+ const c = t[o];
168
+ if (!(a && c === void 0) && !f(c, t))
169
+ throw new Error("param " + String(o) + " is invalid. Expected " + i + ", got " + c);
170
+ };
171
+ for (const [o, i] of Object.entries(n))
172
+ r(o, i, !1);
173
+ for (const [o, i] of Object.entries(e))
174
+ r(o, i, !0);
175
+ return t;
176
+ }
177
+ function W(t) {
178
+ const n = /* @__PURE__ */ new WeakMap();
179
+ return (e, ...r) => {
180
+ const o = n.get(e);
181
+ if (o !== void 0)
182
+ return o;
183
+ const i = t(e, ...r);
184
+ return n.set(e, i), i;
185
+ };
174
186
  }
175
187
  export {
176
- U as pippenger,
177
- C as validateBasic,
178
- v as wNAF
188
+ R as aInRange,
189
+ k as abool,
190
+ h as abytes,
191
+ j as bitLen,
192
+ z as bitMask,
193
+ x as bytesToHex,
194
+ O as bytesToNumberBE,
195
+ V as bytesToNumberLE,
196
+ H as concatBytes,
197
+ D as createHmacDrbg,
198
+ M as ensureBytes,
199
+ B as hexToBytes,
200
+ E as hexToNumber,
201
+ I as inRange,
202
+ b as isBytes,
203
+ W as memoized,
204
+ T as numberToBytesBE,
205
+ C as numberToBytesLE,
206
+ F as numberToHexUnpadded,
207
+ P as validateObject
179
208
  };
@@ -1,6 +1,179 @@
1
- function e(t) {
2
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1
+ import { validateField as M, nLength as z } from "./index325.js";
2
+ import { validateObject as O, bitLen as k, bitMask as x } from "./index345.js";
3
+ const E = BigInt(0), F = BigInt(1);
4
+ function m(e, a) {
5
+ const t = a.negate();
6
+ return e ? t : a;
7
+ }
8
+ function y(e, a) {
9
+ if (!Number.isSafeInteger(e) || e <= 0 || e > a)
10
+ throw new Error("invalid window size, expected [1.." + a + "], got W=" + e);
11
+ }
12
+ function N(e, a) {
13
+ y(e, a);
14
+ const t = Math.ceil(a / e) + 1, n = 2 ** (e - 1), i = 2 ** e, o = x(e), r = BigInt(e);
15
+ return { windows: t, windowSize: n, mask: o, maxNumber: i, shiftBy: r };
16
+ }
17
+ function B(e, a, t) {
18
+ const { windowSize: n, mask: i, maxNumber: o, shiftBy: r } = t;
19
+ let f = Number(e & i), s = e >> r;
20
+ f > n && (f -= o, s += F);
21
+ const c = a * n, d = c + Math.abs(f) - 1, g = f === 0, l = f < 0, u = a % 2 !== 0;
22
+ return { nextN: s, offset: d, isZero: g, isNeg: l, isNegF: u, offsetF: c };
23
+ }
24
+ function L(e, a) {
25
+ if (!Array.isArray(e))
26
+ throw new Error("array expected");
27
+ e.forEach((t, n) => {
28
+ if (!(t instanceof a))
29
+ throw new Error("invalid point at index " + n);
30
+ });
31
+ }
32
+ function Z(e, a) {
33
+ if (!Array.isArray(e))
34
+ throw new Error("array of scalars expected");
35
+ e.forEach((t, n) => {
36
+ if (!a.isValid(t))
37
+ throw new Error("invalid scalar at index " + n);
38
+ });
39
+ }
40
+ const b = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap();
41
+ function S(e) {
42
+ return I.get(e) || 1;
43
+ }
44
+ function v(e, a) {
45
+ return {
46
+ constTimeNegate: m,
47
+ hasPrecomputes(t) {
48
+ return S(t) !== 1;
49
+ },
50
+ // non-const time multiplication ladder
51
+ unsafeLadder(t, n, i = e.ZERO) {
52
+ let o = t;
53
+ for (; n > E; )
54
+ n & F && (i = i.add(o)), o = o.double(), n >>= F;
55
+ return i;
56
+ },
57
+ /**
58
+ * Creates a wNAF precomputation window. Used for caching.
59
+ * Default window size is set by `utils.precompute()` and is equal to 8.
60
+ * Number of precomputed points depends on the curve size:
61
+ * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
62
+ * - 𝑊 is the window size
63
+ * - 𝑛 is the bitlength of the curve order.
64
+ * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
65
+ * @param elm Point instance
66
+ * @param W window size
67
+ * @returns precomputed point tables flattened to a single array
68
+ */
69
+ precomputeWindow(t, n) {
70
+ const { windows: i, windowSize: o } = N(n, a), r = [];
71
+ let f = t, s = f;
72
+ for (let c = 0; c < i; c++) {
73
+ s = f, r.push(s);
74
+ for (let d = 1; d < o; d++)
75
+ s = s.add(f), r.push(s);
76
+ f = s.double();
77
+ }
78
+ return r;
79
+ },
80
+ /**
81
+ * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
82
+ * @param W window size
83
+ * @param precomputes precomputed tables
84
+ * @param n scalar (we don't check here, but should be less than curve order)
85
+ * @returns real and fake (for const-time) points
86
+ */
87
+ wNAF(t, n, i) {
88
+ let o = e.ZERO, r = e.BASE;
89
+ const f = N(t, a);
90
+ for (let s = 0; s < f.windows; s++) {
91
+ const { nextN: c, offset: d, isZero: g, isNeg: l, isNegF: u, offsetF: h } = B(i, s, f);
92
+ i = c, g ? r = r.add(m(u, n[h])) : o = o.add(m(l, n[d]));
93
+ }
94
+ return { p: o, f: r };
95
+ },
96
+ /**
97
+ * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
98
+ * @param W window size
99
+ * @param precomputes precomputed tables
100
+ * @param n scalar (we don't check here, but should be less than curve order)
101
+ * @param acc accumulator point to add result of multiplication
102
+ * @returns point
103
+ */
104
+ wNAFUnsafe(t, n, i, o = e.ZERO) {
105
+ const r = N(t, a);
106
+ for (let f = 0; f < r.windows && i !== E; f++) {
107
+ const { nextN: s, offset: c, isZero: d, isNeg: g } = B(i, f, r);
108
+ if (i = s, !d) {
109
+ const l = n[c];
110
+ o = o.add(g ? l.negate() : l);
111
+ }
112
+ }
113
+ return o;
114
+ },
115
+ getPrecomputes(t, n, i) {
116
+ let o = b.get(n);
117
+ return o || (o = this.precomputeWindow(n, t), t !== 1 && b.set(n, i(o))), o;
118
+ },
119
+ wNAFCached(t, n, i) {
120
+ const o = S(t);
121
+ return this.wNAF(o, this.getPrecomputes(o, t, i), n);
122
+ },
123
+ wNAFCachedUnsafe(t, n, i, o) {
124
+ const r = S(t);
125
+ return r === 1 ? this.unsafeLadder(t, n, o) : this.wNAFUnsafe(r, this.getPrecomputes(r, t, i), n, o);
126
+ },
127
+ // We calculate precomputes for elliptic curve point multiplication
128
+ // using windowed method. This specifies window size and
129
+ // stores precomputed values. Usually only base point would be precomputed.
130
+ setWindowSize(t, n) {
131
+ y(n, a), I.set(t, n), b.delete(t);
132
+ }
133
+ };
134
+ }
135
+ function U(e, a, t, n) {
136
+ L(t, e), Z(n, a);
137
+ const i = t.length, o = n.length;
138
+ if (i !== o)
139
+ throw new Error("arrays of points and scalars must have equal length");
140
+ const r = e.ZERO, f = k(BigInt(i));
141
+ let s = 1;
142
+ f > 12 ? s = f - 3 : f > 4 ? s = f - 2 : f > 0 && (s = 2);
143
+ const c = x(s), d = new Array(Number(c) + 1).fill(r), g = Math.floor((a.BITS - 1) / s) * s;
144
+ let l = r;
145
+ for (let u = g; u >= 0; u -= s) {
146
+ d.fill(r);
147
+ for (let w = 0; w < o; w++) {
148
+ const p = n[w], A = Number(p >> BigInt(u) & c);
149
+ d[A] = d[A].add(t[w]);
150
+ }
151
+ let h = r;
152
+ for (let w = d.length - 1, p = r; w > 0; w--)
153
+ p = p.add(d[w]), h = h.add(p);
154
+ if (l = l.add(h), u !== 0)
155
+ for (let w = 0; w < s; w++)
156
+ l = l.double();
157
+ }
158
+ return l;
159
+ }
160
+ function C(e) {
161
+ return M(e.Fp), O(e, {
162
+ n: "bigint",
163
+ h: "bigint",
164
+ Gx: "field",
165
+ Gy: "field"
166
+ }, {
167
+ nBitLength: "isSafeInteger",
168
+ nByteLength: "isSafeInteger"
169
+ }), Object.freeze({
170
+ ...z(e.n, e.nBitLength),
171
+ ...e,
172
+ p: e.Fp.ORDER
173
+ });
3
174
  }
4
175
  export {
5
- e as getDefaultExportFromCjs
176
+ U as pippenger,
177
+ C as validateBasic,
178
+ v as wNAF
6
179
  };
@@ -1,4 +1,4 @@
1
- import { size as i, SliceOffsetOutOfBoundsError as f, SizeExceedsPaddingSizeError as s, SizeOverflowError as p } from "./index332.js";
1
+ import { size as i, SliceOffsetOutOfBoundsError as f, SizeExceedsPaddingSizeError as s, SizeOverflowError as p } from "./index333.js";
2
2
  function c(t, e) {
3
3
  if (i(t) > e)
4
4
  throw new p({
@@ -1,6 +1,6 @@
1
- import { keccak_256 as f } from "./index241.js";
1
+ import { keccak_256 as f } from "./index246.js";
2
2
  import { from as m } from "./index352.js";
3
- import { fromBytes as s } from "./index332.js";
3
+ import { fromBytes as s } from "./index333.js";
4
4
  function p(t, o = {}) {
5
5
  const { as: e = typeof t == "string" ? "Hex" : "Bytes" } = o, r = f(m(t));
6
6
  return e === "Bytes" ? r : s(r);
@@ -1,5 +1,5 @@
1
1
  import { validate as c } from "./index351.js";
2
- import { BaseError as f } from "./index340.js";
2
+ import { BaseError as f } from "./index341.js";
3
3
  function y(r) {
4
4
  let i = !0, t = "", e = 0, n = "", o = !1;
5
5
  for (let s = 0; s < r.length; s++) {
@@ -1,6 +1,6 @@
1
1
  import { fromString as d } from "./index352.js";
2
2
  import { checksum as o } from "./index358.js";
3
- import { BaseError as c } from "./index340.js";
3
+ import { BaseError as c } from "./index341.js";
4
4
  import { keccak256 as f } from "./index349.js";
5
5
  const l = /^0x[a-fA-F0-9]{40}$/;
6
6
  function u(r, t = {}) {
@@ -1,5 +1,5 @@
1
- import { BaseError as c } from "./index340.js";
2
- import { padRight as g, fromBytes as m, toNumber as h, toBigInt as z } from "./index332.js";
1
+ import { BaseError as c } from "./index341.js";
2
+ import { padRight as g, fromBytes as m, toNumber as h, toBigInt as z } from "./index333.js";
3
3
  import { charCodeToBase16 as b, assertSize as o, trim as y, pad as p } from "./index357.js";
4
4
  import { assertSize as x } from "./index347.js";
5
5
  const B = /* @__PURE__ */ new TextDecoder(), $ = /* @__PURE__ */ new TextEncoder();
@@ -1,8 +1,8 @@
1
- import { InvalidTypeError as C, InvalidArrayError as _, ArrayLengthMismatchError as $, BytesSizeMismatchError as O } from "./index336.js";
1
+ import { InvalidTypeError as C, InvalidArrayError as _, ArrayLengthMismatchError as $, BytesSizeMismatchError as O } from "./index337.js";
2
2
  import { assert as M, checksum as R } from "./index351.js";
3
3
  import { toNumber as u, slice as T, toBoolean as D, toBigInt as U, toString as V, trimLeft as j } from "./index352.js";
4
- import { BaseError as q } from "./index340.js";
5
- import { size as h, fromNumber as B, concat as m, fromBytes as w, padLeft as S, fromBoolean as F, IntegerOutOfRangeError as G, padRight as b, fromString as H, slice as J } from "./index332.js";
4
+ import { BaseError as q } from "./index341.js";
5
+ import { size as h, fromNumber as B, concat as m, fromBytes as w, padLeft as S, fromBoolean as F, IntegerOutOfRangeError as G, padRight as b, fromString as H, slice as J } from "./index333.js";
6
6
  import { integerRegex as K } from "./index355.js";
7
7
  function l(t, e, s) {
8
8
  const { checksumAddress: n, staticPosition: o } = s, i = I(e.type);
@@ -1,4 +1,4 @@
1
- import { BaseError as e } from "./index340.js";
1
+ import { BaseError as e } from "./index341.js";
2
2
  const n = {
3
3
  bytes: new Uint8Array(),
4
4
  dataView: new DataView(new ArrayBuffer(0)),
@@ -1,5 +1,5 @@
1
- import { createClient as n } from "./index85.js";
2
- import { publicActions as c } from "./index88.js";
1
+ import { createClient as n } from "./index90.js";
2
+ import { publicActions as c } from "./index93.js";
3
3
  function u(t) {
4
4
  const { key: e = "public", name: i = "Public Client" } = t;
5
5
  return n({
@@ -1,4 +1,4 @@
1
- import { defineChain as a } from "./index228.js";
1
+ import { defineChain as a } from "./index233.js";
2
2
  const t = /* @__PURE__ */ a({
3
3
  id: 42161,
4
4
  name: "Arbitrum One",
@@ -1,5 +1,5 @@
1
- import { chainConfig as t } from "./index265.js";
2
- import { defineChain as a } from "./index228.js";
1
+ import { chainConfig as t } from "./index270.js";
2
+ import { defineChain as a } from "./index233.js";
3
3
  const e = 1, s = /* @__PURE__ */ a({
4
4
  ...t,
5
5
  id: 10,
@@ -1,4 +1,4 @@
1
- import { defineChain as o } from "./index228.js";
1
+ import { defineChain as o } from "./index233.js";
2
2
  const e = /* @__PURE__ */ o({
3
3
  id: 137,
4
4
  name: "Polygon",
@@ -1,4 +1,4 @@
1
- import { defineChain as a } from "./index228.js";
1
+ import { defineChain as a } from "./index233.js";
2
2
  const t = /* @__PURE__ */ a({
3
3
  id: 43114,
4
4
  name: "Avalanche",