@coinbase/cdp-hooks 0.0.94 → 0.0.96

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 (293) hide show
  1. package/dist/esm/index100.js +27 -44
  2. package/dist/esm/index101.js +44 -86
  3. package/dist/esm/index102.js +66 -37
  4. package/dist/esm/index103.js +40 -8
  5. package/dist/esm/index104.js +75 -6
  6. package/dist/esm/index105.js +31 -16
  7. package/dist/esm/index106.js +6 -8
  8. package/dist/esm/index107.js +16 -13
  9. package/dist/esm/index108.js +8 -7
  10. package/dist/esm/index109.js +13 -9
  11. package/dist/esm/index110.js +7 -16
  12. package/dist/esm/index111.js +9 -46
  13. package/dist/esm/index112.js +16 -13
  14. package/dist/esm/index113.js +11 -15
  15. package/dist/esm/index114.js +46 -13
  16. package/dist/esm/index115.js +13 -6
  17. package/dist/esm/index116.js +15 -34
  18. package/dist/esm/index117.js +13 -9
  19. package/dist/esm/index118.js +5 -7
  20. package/dist/esm/index119.js +35 -25
  21. package/dist/esm/index120.js +9 -10
  22. package/dist/esm/index121.js +7 -13
  23. package/dist/esm/index122.js +28 -11
  24. package/dist/esm/index123.js +10 -116
  25. package/dist/esm/index124.js +13 -32
  26. package/dist/esm/index125.js +11 -79
  27. package/dist/esm/index126.js +113 -170
  28. package/dist/esm/index127.js +26 -37
  29. package/dist/esm/index128.js +80 -6
  30. package/dist/esm/index129.js +177 -13
  31. package/dist/esm/index130.js +44 -13
  32. package/dist/esm/index131.js +6 -99
  33. package/dist/esm/index132.js +153 -71
  34. package/dist/esm/index133.js +14 -87
  35. package/dist/esm/index134.js +14 -148
  36. package/dist/esm/index135.js +93 -130
  37. package/dist/esm/index136.js +65 -61
  38. package/dist/esm/index137.js +87 -23
  39. package/dist/esm/index138.js +145 -102
  40. package/dist/esm/index139.js +136 -6
  41. package/dist/esm/index140.js +65 -128
  42. package/dist/esm/index141.js +24 -276
  43. package/dist/esm/index142.js +159 -3
  44. package/dist/esm/index143.js +7 -4
  45. package/dist/esm/index144.js +12 -9
  46. package/dist/esm/index145.js +20 -2
  47. package/dist/esm/index146.js +136 -2
  48. package/dist/esm/index147.js +79 -3
  49. package/dist/esm/index148.js +6 -323
  50. package/dist/esm/index149.js +28 -13
  51. package/dist/esm/index150.js +89 -4
  52. package/dist/esm/index151.js +351 -56
  53. package/dist/esm/index152.js +3 -2
  54. package/dist/esm/index153.js +5 -8
  55. package/dist/esm/index154.js +2 -215
  56. package/dist/esm/index155.js +3 -32
  57. package/dist/esm/index156.js +9 -22
  58. package/dist/esm/index157.js +326 -5
  59. package/dist/esm/index158.js +11 -71
  60. package/dist/esm/index159.js +4 -5
  61. package/dist/esm/index160.js +55 -5
  62. package/dist/esm/index161.js +10 -33
  63. package/dist/esm/index162.js +2 -76
  64. package/dist/esm/index163.js +8 -3
  65. package/dist/esm/index164.js +22 -15
  66. package/dist/esm/index165.js +193 -430
  67. package/dist/esm/index166.js +32 -31
  68. package/dist/esm/index167.js +20 -25
  69. package/dist/esm/index168.js +5 -33
  70. package/dist/esm/index169.js +72 -33
  71. package/dist/esm/index170.js +5 -193
  72. package/dist/esm/index171.js +5 -8
  73. package/dist/esm/index172.js +36 -2
  74. package/dist/esm/index173.js +115 -8
  75. package/dist/esm/index174.js +3 -19
  76. package/dist/esm/index175.js +13 -22
  77. package/dist/esm/index176.js +26 -8
  78. package/dist/esm/index177.js +29 -51
  79. package/dist/esm/index178.js +32 -43
  80. package/dist/esm/index179.js +23 -8
  81. package/dist/esm/index180.js +8 -7
  82. package/dist/esm/index181.js +193 -16
  83. package/dist/esm/index182.js +2 -19
  84. package/dist/esm/index183.js +468 -25
  85. package/dist/esm/index184.js +27 -16
  86. package/dist/esm/index185.js +159 -53
  87. package/dist/esm/index186.js +21 -11
  88. package/dist/esm/index187.js +124 -157
  89. package/dist/esm/index188.js +37 -20
  90. package/dist/esm/index189.js +6 -127
  91. package/dist/esm/index190.js +24 -35
  92. package/dist/esm/index191.js +55 -6
  93. package/dist/esm/index192.js +42 -24
  94. package/dist/esm/index193.js +12 -12
  95. package/dist/esm/index194.js +2 -2
  96. package/dist/esm/index195.js +57 -48
  97. package/dist/esm/index196.js +21 -3
  98. package/dist/esm/index197.js +3 -21
  99. package/dist/esm/index198.js +4 -4
  100. package/dist/esm/index199.js +3 -3
  101. package/dist/esm/index2.js +2 -2
  102. package/dist/esm/index200.js +2 -2
  103. package/dist/esm/index201.js +16 -32
  104. package/dist/esm/index202.js +35 -3
  105. package/dist/esm/index203.js +3 -19
  106. package/dist/esm/index204.js +18 -27
  107. package/dist/esm/index205.js +25 -33
  108. package/dist/esm/index206.js +35 -7
  109. package/dist/esm/index207.js +8 -25
  110. package/dist/esm/index208.js +7 -28
  111. package/dist/esm/index209.js +24 -63
  112. package/dist/esm/index210.js +28 -9
  113. package/dist/esm/index211.js +3 -33
  114. package/dist/esm/index212.js +79 -27
  115. package/dist/esm/index213.js +9 -24
  116. package/dist/esm/index214.js +12 -3
  117. package/dist/esm/index215.js +21 -14
  118. package/dist/esm/index216.js +8 -103
  119. package/dist/esm/index217.js +9 -63
  120. package/dist/esm/index218.js +11 -5
  121. package/dist/esm/index219.js +6 -6
  122. package/dist/esm/index220.js +6 -27
  123. package/dist/esm/index221.js +13 -38
  124. package/dist/esm/index222.js +32 -13
  125. package/dist/esm/index223.js +5 -43
  126. package/dist/esm/index224.js +37 -5
  127. package/dist/esm/index225.js +110 -11
  128. package/dist/esm/index226.js +48 -19
  129. package/dist/esm/index227.js +30 -76
  130. package/dist/esm/index228.js +18 -2
  131. package/dist/esm/index229.js +17 -35
  132. package/dist/esm/index230.js +40 -108
  133. package/dist/esm/index231.js +40 -46
  134. package/dist/esm/index232.js +8 -32
  135. package/dist/esm/index233.js +7 -8
  136. package/dist/esm/index234.js +16 -6
  137. package/dist/esm/index235.js +22 -6
  138. package/dist/esm/index236.js +24 -11
  139. package/dist/esm/index237.js +16 -10
  140. package/dist/esm/index238.js +54 -13
  141. package/dist/esm/index239.js +27 -32
  142. package/dist/esm/index240.js +25 -5
  143. package/dist/esm/index241.js +104 -8
  144. package/dist/esm/index242.js +3 -20
  145. package/dist/esm/index243.js +5 -31
  146. package/dist/esm/index244.js +31 -20
  147. package/dist/esm/index245.js +20 -3
  148. package/dist/esm/index246.js +3 -17
  149. package/dist/esm/index247.js +17 -10
  150. package/dist/esm/index248.js +5 -21
  151. package/dist/esm/index249.js +8 -22
  152. package/dist/esm/index250.js +103 -5
  153. package/dist/esm/index251.js +64 -5
  154. package/dist/esm/index252.js +5 -8
  155. package/dist/esm/index253.js +6 -104
  156. package/dist/esm/index254.js +28 -3
  157. package/dist/esm/index255.js +33 -18
  158. package/dist/esm/index256.js +13 -171
  159. package/dist/esm/index257.js +16 -17
  160. package/dist/esm/index258.js +79 -10
  161. package/dist/esm/index259.js +2 -39
  162. package/dist/esm/index260.js +15 -2
  163. package/dist/esm/index261.js +18 -69
  164. package/dist/esm/index262.js +170 -33
  165. package/dist/esm/index263.js +16 -13
  166. package/dist/esm/index264.js +10 -40
  167. package/dist/esm/index265.js +10 -2
  168. package/dist/esm/index266.js +38 -4
  169. package/dist/esm/index267.js +2 -11
  170. package/dist/esm/index268.js +69 -19
  171. package/dist/esm/index269.js +34 -7
  172. package/dist/esm/index270.js +13 -10
  173. package/dist/esm/index271.js +40 -66
  174. package/dist/esm/index272.js +2 -66
  175. package/dist/esm/index273.js +4 -185
  176. package/dist/esm/index274.js +8 -20
  177. package/dist/esm/index275.js +17 -40
  178. package/dist/esm/index276.js +7 -76
  179. package/dist/esm/index277.js +10 -39
  180. package/dist/esm/index278.js +72 -16
  181. package/dist/esm/index279.js +64 -12
  182. package/dist/esm/index280.js +187 -7
  183. package/dist/esm/index281.js +22 -6
  184. package/dist/esm/index282.js +42 -36
  185. package/dist/esm/index283.js +25 -15
  186. package/dist/esm/index284.js +90 -8
  187. package/dist/esm/index285.js +40 -12
  188. package/dist/esm/index286.js +16 -9
  189. package/dist/esm/index287.js +12 -15
  190. package/dist/esm/index288.js +7 -22
  191. package/dist/esm/index289.js +6 -30
  192. package/dist/esm/index290.js +37 -2
  193. package/dist/esm/index291.js +15 -13
  194. package/dist/esm/index292.js +8 -12
  195. package/dist/esm/index293.js +8 -47
  196. package/dist/esm/index294.js +16 -9
  197. package/dist/esm/index295.js +21 -12
  198. package/dist/esm/index296.js +30 -14
  199. package/dist/esm/index297.js +2 -9
  200. package/dist/esm/index298.js +13 -15
  201. package/dist/esm/index299.js +12 -24
  202. package/dist/esm/index3.js +1 -1
  203. package/dist/esm/index300.js +46 -10
  204. package/dist/esm/index301.js +9 -24
  205. package/dist/esm/index302.js +13 -51
  206. package/dist/esm/index303.js +13 -17
  207. package/dist/esm/index304.js +13 -13
  208. package/dist/esm/index305.js +8 -11
  209. package/dist/esm/index306.js +15 -103
  210. package/dist/esm/index307.js +24 -5
  211. package/dist/esm/index308.js +21 -220
  212. package/dist/esm/index309.js +31 -6
  213. package/dist/esm/index310.js +10 -7
  214. package/dist/esm/index311.js +49 -24
  215. package/dist/esm/index312.js +35 -17
  216. package/dist/esm/index313.js +18 -146
  217. package/dist/esm/index314.js +14 -12
  218. package/dist/esm/index315.js +12 -36
  219. package/dist/esm/index316.js +13 -42
  220. package/dist/esm/index317.js +20 -2
  221. package/dist/esm/index318.js +108 -69
  222. package/dist/esm/index319.js +103 -3
  223. package/dist/esm/index320.js +6 -136
  224. package/dist/esm/index321.js +7 -156
  225. package/dist/esm/index322.js +26 -9
  226. package/dist/esm/index323.js +15 -16
  227. package/dist/esm/index324.js +208 -108
  228. package/dist/esm/index325.js +12 -134
  229. package/dist/esm/index326.js +35 -78
  230. package/dist/esm/index327.js +42 -2
  231. package/dist/esm/index328.js +2 -698
  232. package/dist/esm/index329.js +67 -137
  233. package/dist/esm/index330.js +3 -42
  234. package/dist/esm/index331.js +127 -191
  235. package/dist/esm/index332.js +174 -3
  236. package/dist/esm/index333.js +9 -65
  237. package/dist/esm/index334.js +16 -4
  238. package/dist/esm/index335.js +128 -35
  239. package/dist/esm/index336.js +193 -7
  240. package/dist/esm/index337.js +2 -63
  241. package/dist/esm/index338.js +72 -71
  242. package/dist/esm/index339.js +15 -4
  243. package/dist/esm/index340.js +85 -189
  244. package/dist/esm/index341.js +144 -44
  245. package/dist/esm/index342.js +41 -43
  246. package/dist/esm/index343.js +655 -4
  247. package/dist/esm/index344.js +206 -5
  248. package/dist/esm/index345.js +177 -2
  249. package/dist/esm/index346.js +3 -21
  250. package/dist/esm/index347.js +43 -0
  251. package/dist/esm/index348.js +7 -0
  252. package/dist/esm/index349.js +10 -0
  253. package/dist/esm/index350.js +65 -0
  254. package/dist/esm/index351.js +80 -0
  255. package/dist/esm/index352.js +122 -0
  256. package/dist/esm/index353.js +345 -0
  257. package/dist/esm/index354.js +163 -0
  258. package/dist/esm/index355.js +7 -0
  259. package/dist/esm/index356.js +7 -0
  260. package/dist/esm/index357.js +55 -0
  261. package/dist/esm/index358.js +7 -0
  262. package/dist/esm/index359.js +4 -0
  263. package/dist/esm/index360.js +24 -0
  264. package/dist/esm/index71.js +26 -17
  265. package/dist/esm/index73.js +2 -2
  266. package/dist/esm/index74.js +12 -40
  267. package/dist/esm/index75.js +49 -58
  268. package/dist/esm/index76.js +13 -43
  269. package/dist/esm/index77.js +28 -5
  270. package/dist/esm/index78.js +30 -48
  271. package/dist/esm/index79.js +29 -32
  272. package/dist/esm/index80.js +56 -4
  273. package/dist/esm/index81.js +54 -10
  274. package/dist/esm/index82.js +57 -67
  275. package/dist/esm/index83.js +5 -10
  276. package/dist/esm/index84.js +47 -28
  277. package/dist/esm/index85.js +33 -69
  278. package/dist/esm/index86.js +3 -19
  279. package/dist/esm/index87.js +9 -110
  280. package/dist/esm/index88.js +118 -60
  281. package/dist/esm/index89.js +57 -20
  282. package/dist/esm/index90.js +22 -38
  283. package/dist/esm/index91.js +33 -34
  284. package/dist/esm/index92.js +38 -55
  285. package/dist/esm/index93.js +55 -160
  286. package/dist/esm/index94.js +162 -33
  287. package/dist/esm/index95.js +39 -9
  288. package/dist/esm/index96.js +8 -30
  289. package/dist/esm/index97.js +21 -26
  290. package/dist/esm/index98.js +35 -8
  291. package/dist/esm/index99.js +8 -28
  292. package/dist/types/index.d.ts +1 -3
  293. package/package.json +4 -4
@@ -1,7 +1,208 @@
1
- import { LruMap as c } from "./index346.js";
2
- const e = {
3
- checksum: /* @__PURE__ */ new c(8192)
4
- }, m = e.checksum;
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);
57
+ }
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()));
67
+ }
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);
81
+ }
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;
96
+ }
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
+ };
186
+ }
5
187
  export {
6
- m as checksum
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
7
208
  };
@@ -1,4 +1,179 @@
1
- const o = "0.1.1";
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);
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
+ });
174
+ }
2
175
  export {
3
- o as version
176
+ U as pippenger,
177
+ C as validateBasic,
178
+ v as wNAF
4
179
  };
@@ -1,24 +1,6 @@
1
- class r extends Map {
2
- constructor(e) {
3
- super(), Object.defineProperty(this, "maxSize", {
4
- enumerable: !0,
5
- configurable: !0,
6
- writable: !0,
7
- value: void 0
8
- }), this.maxSize = e;
9
- }
10
- get(e) {
11
- const t = super.get(e);
12
- return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
13
- }
14
- set(e, t) {
15
- if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
16
- const s = this.keys().next().value;
17
- s && this.delete(s);
18
- }
19
- return this;
20
- }
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
21
3
  }
22
4
  export {
23
- r as LruMap
5
+ e as getDefaultExportFromCjs
24
6
  };
@@ -0,0 +1,43 @@
1
+ import { size as i, SliceOffsetOutOfBoundsError as f, SizeExceedsPaddingSizeError as s, SizeOverflowError as p } from "./index332.js";
2
+ function c(t, e) {
3
+ if (i(t) > e)
4
+ throw new p({
5
+ givenSize: i(t),
6
+ maxSize: e
7
+ });
8
+ }
9
+ function S(t, e) {
10
+ if (typeof e == "number" && e > 0 && e > i(t) - 1)
11
+ throw new f({
12
+ offset: e,
13
+ position: "start",
14
+ size: i(t)
15
+ });
16
+ }
17
+ function d(t, e, r) {
18
+ if (typeof e == "number" && typeof r == "number" && i(t) !== r - e)
19
+ throw new f({
20
+ offset: r,
21
+ position: "end",
22
+ size: i(t)
23
+ });
24
+ }
25
+ function u(t, e = {}) {
26
+ const { dir: r, size: n = 32 } = e;
27
+ if (n === 0)
28
+ return t;
29
+ const o = t.replace("0x", "");
30
+ if (o.length > n * 2)
31
+ throw new s({
32
+ size: Math.ceil(o.length / 2),
33
+ targetSize: n,
34
+ type: "Hex"
35
+ });
36
+ return `0x${o[r === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
37
+ }
38
+ export {
39
+ d as assertEndOffset,
40
+ c as assertSize,
41
+ S as assertStartOffset,
42
+ u as pad
43
+ };
@@ -0,0 +1,7 @@
1
+ const r = "#__bigint";
2
+ function g(i, f, n) {
3
+ return JSON.stringify(i, (e, t) => typeof t == "bigint" ? t.toString() + r : t, n);
4
+ }
5
+ export {
6
+ g as stringify
7
+ };
@@ -0,0 +1,10 @@
1
+ import { keccak_256 as f } from "./index241.js";
2
+ import { from as m } from "./index352.js";
3
+ import { fromBytes as s } from "./index332.js";
4
+ function p(t, o = {}) {
5
+ const { as: e = typeof t == "string" ? "Hex" : "Bytes" } = o, r = f(m(t));
6
+ return e === "Bytes" ? r : s(r);
7
+ }
8
+ export {
9
+ p as keccak256
10
+ };
@@ -0,0 +1,65 @@
1
+ import { validate as c } from "./index351.js";
2
+ import { BaseError as f } from "./index340.js";
3
+ function y(r) {
4
+ let i = !0, t = "", e = 0, n = "", o = !1;
5
+ for (let s = 0; s < r.length; s++) {
6
+ const u = r[s];
7
+ if (["(", ")", ","].includes(u) && (i = !0), u === "(" && e++, u === ")" && e--, !!i) {
8
+ if (e === 0) {
9
+ if (u === " " && ["event", "function", "error", ""].includes(n))
10
+ n = "";
11
+ else if (n += u, u === ")") {
12
+ o = !0;
13
+ break;
14
+ }
15
+ continue;
16
+ }
17
+ if (u === " ") {
18
+ r[s - 1] !== "," && t !== "," && t !== ",(" && (t = "", i = !1);
19
+ continue;
20
+ }
21
+ n += u, t += u;
22
+ }
23
+ }
24
+ if (!o)
25
+ throw new f("Unable to normalize signature.");
26
+ return n;
27
+ }
28
+ function l(r, i) {
29
+ const t = typeof r, e = i.type;
30
+ switch (e) {
31
+ case "address":
32
+ return c(r, { strict: !1 });
33
+ case "bool":
34
+ return t === "boolean";
35
+ case "function":
36
+ return t === "string";
37
+ case "string":
38
+ return t === "string";
39
+ default:
40
+ return e === "tuple" && "components" in i ? Object.values(i.components).every((n, o) => l(Object.values(r)[o], n)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(e) ? t === "number" || t === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(e) ? t === "string" || r instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(e) ? Array.isArray(r) && r.every((n) => l(n, {
41
+ ...i,
42
+ // Pop off `[]` or `[M]` from end of type
43
+ type: e.replace(/(\[[0-9]{0,}\])$/, "")
44
+ })) : !1;
45
+ }
46
+ }
47
+ function a(r, i, t) {
48
+ for (const e in r) {
49
+ const n = r[e], o = i[e];
50
+ if (n.type === "tuple" && o.type === "tuple" && "components" in n && "components" in o)
51
+ return a(n.components, o.components, t[e]);
52
+ const s = [n.type, o.type];
53
+ if (s.includes("address") && s.includes("bytes20") ? !0 : s.includes("address") && s.includes("string") ? c(t[e], {
54
+ strict: !1
55
+ }) : s.includes("address") && s.includes("bytes") ? c(t[e], {
56
+ strict: !1
57
+ }) : !1)
58
+ return s;
59
+ }
60
+ }
61
+ export {
62
+ a as getAmbiguousTypes,
63
+ l as isArgOfType,
64
+ y as normalizeSignature
65
+ };
@@ -0,0 +1,80 @@
1
+ import { fromString as d } from "./index352.js";
2
+ import { checksum as o } from "./index358.js";
3
+ import { BaseError as c } from "./index340.js";
4
+ import { keccak256 as f } from "./index349.js";
5
+ const l = /^0x[a-fA-F0-9]{40}$/;
6
+ function u(r, t = {}) {
7
+ const { strict: s = !0 } = t;
8
+ if (!l.test(r))
9
+ throw new i({
10
+ address: r,
11
+ cause: new h()
12
+ });
13
+ if (s) {
14
+ if (r.toLowerCase() === r)
15
+ return;
16
+ if (m(r) !== r)
17
+ throw new i({
18
+ address: r,
19
+ cause: new p()
20
+ });
21
+ }
22
+ }
23
+ function m(r) {
24
+ if (o.has(r))
25
+ return o.get(r);
26
+ u(r, { strict: !1 });
27
+ const t = r.substring(2).toLowerCase(), s = f(d(t), { as: "Bytes" }), n = t.split("");
28
+ for (let e = 0; e < 40; e += 2)
29
+ s[e >> 1] >> 4 >= 8 && n[e] && (n[e] = n[e].toUpperCase()), (s[e >> 1] & 15) >= 8 && n[e + 1] && (n[e + 1] = n[e + 1].toUpperCase());
30
+ const a = `0x${n.join("")}`;
31
+ return o.set(r, a), a;
32
+ }
33
+ function k(r, t = {}) {
34
+ const { strict: s = !0 } = t ?? {};
35
+ try {
36
+ return u(r, { strict: s }), !0;
37
+ } catch {
38
+ return !1;
39
+ }
40
+ }
41
+ class i extends c {
42
+ constructor({ address: t, cause: s }) {
43
+ super(`Address "${t}" is invalid.`, {
44
+ cause: s
45
+ }), Object.defineProperty(this, "name", {
46
+ enumerable: !0,
47
+ configurable: !0,
48
+ writable: !0,
49
+ value: "Address.InvalidAddressError"
50
+ });
51
+ }
52
+ }
53
+ class h extends c {
54
+ constructor() {
55
+ super("Address is not a 20 byte (40 hexadecimal character) value."), Object.defineProperty(this, "name", {
56
+ enumerable: !0,
57
+ configurable: !0,
58
+ writable: !0,
59
+ value: "Address.InvalidInputError"
60
+ });
61
+ }
62
+ }
63
+ class p extends c {
64
+ constructor() {
65
+ super("Address does not match its checksum counterpart."), Object.defineProperty(this, "name", {
66
+ enumerable: !0,
67
+ configurable: !0,
68
+ writable: !0,
69
+ value: "Address.InvalidChecksumError"
70
+ });
71
+ }
72
+ }
73
+ export {
74
+ i as InvalidAddressError,
75
+ p as InvalidChecksumError,
76
+ h as InvalidInputError,
77
+ u as assert,
78
+ m as checksum,
79
+ k as validate
80
+ };