@coinbase/cdp-hooks 0.0.65 → 0.0.67

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 (297) hide show
  1. package/README.md +152 -1
  2. package/dist/esm/index.js +24 -18
  3. package/dist/esm/index10.js +1 -1
  4. package/dist/esm/index100.js +29 -188
  5. package/dist/esm/index101.js +2 -32
  6. package/dist/esm/index102.js +7 -21
  7. package/dist/esm/index103.js +214 -5
  8. package/dist/esm/index104.js +30 -72
  9. package/dist/esm/index105.js +21 -5
  10. package/dist/esm/index106.js +5 -5
  11. package/dist/esm/index107.js +69 -31
  12. package/dist/esm/index108.js +5 -75
  13. package/dist/esm/index109.js +6 -3
  14. package/dist/esm/index11.js +1 -1
  15. package/dist/esm/index110.js +28 -16
  16. package/dist/esm/index111.js +57 -433
  17. package/dist/esm/index112.js +3 -31
  18. package/dist/esm/index113.js +17 -20
  19. package/dist/esm/index114.js +439 -21
  20. package/dist/esm/index115.js +28 -32
  21. package/dist/esm/index116.js +18 -185
  22. package/dist/esm/index117.js +31 -6
  23. package/dist/esm/index118.js +35 -2
  24. package/dist/esm/index119.js +189 -8
  25. package/dist/esm/index12.js +1 -1
  26. package/dist/esm/index120.js +7 -17
  27. package/dist/esm/index121.js +2 -28
  28. package/dist/esm/index122.js +12 -8
  29. package/dist/esm/index123.js +15 -52
  30. package/dist/esm/index124.js +23 -41
  31. package/dist/esm/index125.js +8 -8
  32. package/dist/esm/index126.js +55 -7
  33. package/dist/esm/index127.js +44 -15
  34. package/dist/esm/index128.js +8 -18
  35. package/dist/esm/index129.js +7 -24
  36. package/dist/esm/index13.js +1 -1
  37. package/dist/esm/index130.js +16 -16
  38. package/dist/esm/index131.js +17 -53
  39. package/dist/esm/index132.js +22 -9
  40. package/dist/esm/index133.js +15 -159
  41. package/dist/esm/index134.js +53 -20
  42. package/dist/esm/index135.js +11 -127
  43. package/dist/esm/index136.js +153 -31
  44. package/dist/esm/index137.js +21 -6
  45. package/dist/esm/index138.js +127 -27
  46. package/dist/esm/index139.js +31 -184
  47. package/dist/esm/index14.js +7 -4
  48. package/dist/esm/index140.js +7 -4
  49. package/dist/esm/index141.js +26 -63
  50. package/dist/esm/index142.js +192 -3
  51. package/dist/esm/index143.js +4 -21
  52. package/dist/esm/index144.js +61 -13
  53. package/dist/esm/index145.js +3 -24
  54. package/dist/esm/index146.js +20 -11
  55. package/dist/esm/index147.js +15 -33
  56. package/dist/esm/index148.js +24 -3
  57. package/dist/esm/index149.js +11 -18
  58. package/dist/esm/index15.js +7 -8
  59. package/dist/esm/index150.js +33 -26
  60. package/dist/esm/index151.js +3 -36
  61. package/dist/esm/index152.js +18 -7
  62. package/dist/esm/index153.js +26 -24
  63. package/dist/esm/index154.js +34 -27
  64. package/dist/esm/index155.js +7 -64
  65. package/dist/esm/index156.js +25 -9
  66. package/dist/esm/index157.js +28 -33
  67. package/dist/esm/index158.js +64 -27
  68. package/dist/esm/index159.js +9 -24
  69. package/dist/esm/index16.js +8 -34
  70. package/dist/esm/index160.js +33 -3
  71. package/dist/esm/index161.js +27 -14
  72. package/dist/esm/index162.js +24 -103
  73. package/dist/esm/index163.js +3 -64
  74. package/dist/esm/index164.js +14 -5
  75. package/dist/esm/index165.js +103 -6
  76. package/dist/esm/index166.js +62 -25
  77. package/dist/esm/index167.js +5 -38
  78. package/dist/esm/index168.js +6 -13
  79. package/dist/esm/index169.js +24 -39
  80. package/dist/esm/index17.js +5 -18
  81. package/dist/esm/index170.js +38 -5
  82. package/dist/esm/index171.js +13 -11
  83. package/dist/esm/index172.js +42 -19
  84. package/dist/esm/index173.js +5 -78
  85. package/dist/esm/index174.js +12 -2
  86. package/dist/esm/index175.js +19 -37
  87. package/dist/esm/index176.js +73 -105
  88. package/dist/esm/index177.js +2 -49
  89. package/dist/esm/index178.js +36 -31
  90. package/dist/esm/index179.js +110 -8
  91. package/dist/esm/index18.js +8 -11
  92. package/dist/esm/index180.js +48 -6
  93. package/dist/esm/index181.js +32 -6
  94. package/dist/esm/index182.js +8 -11
  95. package/dist/esm/index183.js +6 -10
  96. package/dist/esm/index184.js +6 -13
  97. package/dist/esm/index185.js +11 -32
  98. package/dist/esm/index186.js +11 -5
  99. package/dist/esm/index187.js +13 -8
  100. package/dist/esm/index188.js +30 -17
  101. package/dist/esm/index189.js +5 -32
  102. package/dist/esm/index19.js +34 -12
  103. package/dist/esm/index190.js +8 -20
  104. package/dist/esm/index191.js +19 -3
  105. package/dist/esm/index192.js +31 -17
  106. package/dist/esm/index193.js +20 -10
  107. package/dist/esm/index194.js +3 -21
  108. package/dist/esm/index195.js +16 -21
  109. package/dist/esm/index196.js +10 -5
  110. package/dist/esm/index197.js +21 -5
  111. package/dist/esm/index198.js +22 -8
  112. package/dist/esm/index199.js +5 -104
  113. package/dist/esm/index2.js +2 -2
  114. package/dist/esm/index20.js +18 -54
  115. package/dist/esm/index200.js +6 -3
  116. package/dist/esm/index201.js +8 -18
  117. package/dist/esm/index202.js +99 -166
  118. package/dist/esm/index203.js +3 -18
  119. package/dist/esm/index204.js +19 -10
  120. package/dist/esm/index205.js +171 -38
  121. package/dist/esm/index206.js +18 -2
  122. package/dist/esm/index207.js +10 -70
  123. package/dist/esm/index208.js +37 -33
  124. package/dist/esm/index209.js +2 -15
  125. package/dist/esm/index21.js +11 -57
  126. package/dist/esm/index210.js +69 -40
  127. package/dist/esm/index211.js +35 -2
  128. package/dist/esm/index212.js +14 -4
  129. package/dist/esm/index213.js +39 -9
  130. package/dist/esm/index214.js +2 -20
  131. package/dist/esm/index215.js +4 -7
  132. package/dist/esm/index216.js +9 -10
  133. package/dist/esm/index217.js +19 -66
  134. package/dist/esm/index218.js +7 -65
  135. package/dist/esm/index219.js +10 -184
  136. package/dist/esm/index22.js +12 -56
  137. package/dist/esm/index220.js +66 -22
  138. package/dist/esm/index221.js +61 -38
  139. package/dist/esm/index222.js +178 -69
  140. package/dist/esm/index223.js +21 -39
  141. package/dist/esm/index224.js +35 -9
  142. package/dist/esm/index225.js +70 -7
  143. package/dist/esm/index226.js +40 -7
  144. package/dist/esm/index227.js +16 -6
  145. package/dist/esm/index228.js +13 -36
  146. package/dist/esm/index229.js +7 -15
  147. package/dist/esm/index23.js +54 -5
  148. package/dist/esm/index230.js +6 -8
  149. package/dist/esm/index231.js +35 -11
  150. package/dist/esm/index232.js +15 -9
  151. package/dist/esm/index233.js +8 -16
  152. package/dist/esm/index234.js +12 -22
  153. package/dist/esm/index235.js +9 -30
  154. package/dist/esm/index236.js +17 -2
  155. package/dist/esm/index237.js +21 -12
  156. package/dist/esm/index238.js +30 -12
  157. package/dist/esm/index239.js +2 -48
  158. package/dist/esm/index24.js +57 -47
  159. package/dist/esm/index240.js +12 -8
  160. package/dist/esm/index241.js +12 -13
  161. package/dist/esm/index242.js +46 -13
  162. package/dist/esm/index243.js +9 -8
  163. package/dist/esm/index244.js +13 -15
  164. package/dist/esm/index245.js +14 -24
  165. package/dist/esm/index246.js +8 -11
  166. package/dist/esm/index247.js +14 -23
  167. package/dist/esm/index248.js +24 -51
  168. package/dist/esm/index249.js +11 -17
  169. package/dist/esm/index25.js +56 -33
  170. package/dist/esm/index250.js +24 -14
  171. package/dist/esm/index251.js +51 -11
  172. package/dist/esm/index252.js +17 -103
  173. package/dist/esm/index253.js +14 -5
  174. package/dist/esm/index254.js +11 -223
  175. package/dist/esm/index255.js +103 -6
  176. package/dist/esm/index256.js +6 -7
  177. package/dist/esm/index257.js +222 -25
  178. package/dist/esm/index258.js +6 -19
  179. package/dist/esm/index259.js +7 -146
  180. package/dist/esm/index26.js +5 -4
  181. package/dist/esm/index260.js +27 -2
  182. package/dist/esm/index261.js +19 -12
  183. package/dist/esm/index262.js +145 -35
  184. package/dist/esm/index263.js +12 -41
  185. package/dist/esm/index264.js +35 -68
  186. package/dist/esm/index265.js +41 -3
  187. package/dist/esm/index266.js +2 -137
  188. package/dist/esm/index267.js +69 -156
  189. package/dist/esm/index268.js +3 -9
  190. package/dist/esm/index269.js +136 -16
  191. package/dist/esm/index27.js +46 -8
  192. package/dist/esm/index270.js +140 -98
  193. package/dist/esm/index271.js +9 -134
  194. package/dist/esm/index272.js +16 -78
  195. package/dist/esm/index273.js +114 -2
  196. package/dist/esm/index274.js +124 -687
  197. package/dist/esm/index275.js +73 -133
  198. package/dist/esm/index276.js +2 -43
  199. package/dist/esm/index277.js +675 -178
  200. package/dist/esm/index278.js +138 -3
  201. package/dist/esm/index279.js +40 -63
  202. package/dist/esm/index28.js +31 -67
  203. package/dist/esm/index280.js +200 -4
  204. package/dist/esm/index281.js +3 -40
  205. package/dist/esm/index282.js +65 -7
  206. package/dist/esm/index283.js +4 -62
  207. package/dist/esm/index284.js +33 -70
  208. package/dist/esm/index285.js +8 -4
  209. package/dist/esm/index286.js +55 -187
  210. package/dist/esm/index287.js +61 -47
  211. package/dist/esm/index288.js +4 -45
  212. package/dist/esm/index289.js +194 -4
  213. package/dist/esm/index29.js +3 -9
  214. package/dist/esm/index290.js +64 -5
  215. package/dist/esm/index291.js +45 -2
  216. package/dist/esm/index292.js +4 -21
  217. package/dist/esm/index293.js +7 -0
  218. package/dist/esm/index294.js +4 -0
  219. package/dist/esm/index295.js +24 -0
  220. package/dist/esm/index3.js +1 -1
  221. package/dist/esm/index30.js +9 -28
  222. package/dist/esm/index31.js +68 -70
  223. package/dist/esm/index32.js +9 -19
  224. package/dist/esm/index33.js +26 -108
  225. package/dist/esm/index34.js +70 -60
  226. package/dist/esm/index35.js +19 -24
  227. package/dist/esm/index36.js +110 -40
  228. package/dist/esm/index37.js +57 -34
  229. package/dist/esm/index38.js +20 -54
  230. package/dist/esm/index39.js +37 -160
  231. package/dist/esm/index40.js +36 -38
  232. package/dist/esm/index41.js +58 -9
  233. package/dist/esm/index42.js +161 -29
  234. package/dist/esm/index43.js +39 -36
  235. package/dist/esm/index44.js +7 -7
  236. package/dist/esm/index45.js +30 -28
  237. package/dist/esm/index46.js +34 -44
  238. package/dist/esm/index47.js +9 -88
  239. package/dist/esm/index48.js +26 -37
  240. package/dist/esm/index49.js +46 -8
  241. package/dist/esm/index5.js +3 -3
  242. package/dist/esm/index50.js +88 -6
  243. package/dist/esm/index51.js +40 -16
  244. package/dist/esm/index52.js +8 -8
  245. package/dist/esm/index53.js +6 -13
  246. package/dist/esm/index54.js +16 -7
  247. package/dist/esm/index55.js +8 -9
  248. package/dist/esm/index56.js +13 -16
  249. package/dist/esm/index57.js +7 -46
  250. package/dist/esm/index58.js +9 -13
  251. package/dist/esm/index59.js +15 -15
  252. package/dist/esm/index6.js +2 -2
  253. package/dist/esm/index60.js +46 -13
  254. package/dist/esm/index61.js +13 -6
  255. package/dist/esm/index62.js +15 -34
  256. package/dist/esm/index63.js +13 -9
  257. package/dist/esm/index64.js +5 -7
  258. package/dist/esm/index65.js +35 -25
  259. package/dist/esm/index66.js +9 -10
  260. package/dist/esm/index67.js +7 -13
  261. package/dist/esm/index68.js +25 -11
  262. package/dist/esm/index69.js +10 -116
  263. package/dist/esm/index7.js +1 -1
  264. package/dist/esm/index70.js +13 -32
  265. package/dist/esm/index71.js +11 -79
  266. package/dist/esm/index72.js +108 -169
  267. package/dist/esm/index73.js +26 -37
  268. package/dist/esm/index74.js +79 -6
  269. package/dist/esm/index75.js +177 -13
  270. package/dist/esm/index76.js +44 -13
  271. package/dist/esm/index77.js +6 -99
  272. package/dist/esm/index78.js +13 -72
  273. package/dist/esm/index79.js +13 -87
  274. package/dist/esm/index8.js +2 -2
  275. package/dist/esm/index80.js +93 -142
  276. package/dist/esm/index81.js +65 -129
  277. package/dist/esm/index82.js +73 -54
  278. package/dist/esm/index83.js +148 -23
  279. package/dist/esm/index84.js +133 -102
  280. package/dist/esm/index85.js +68 -6
  281. package/dist/esm/index86.js +23 -131
  282. package/dist/esm/index87.js +101 -271
  283. package/dist/esm/index88.js +7 -3
  284. package/dist/esm/index89.js +132 -4
  285. package/dist/esm/index9.js +1 -1
  286. package/dist/esm/index90.js +276 -9
  287. package/dist/esm/index91.js +3 -2
  288. package/dist/esm/index92.js +4 -2
  289. package/dist/esm/index93.js +9 -3
  290. package/dist/esm/index94.js +2 -327
  291. package/dist/esm/index95.js +2 -14
  292. package/dist/esm/index96.js +3 -5
  293. package/dist/esm/index97.js +299 -28
  294. package/dist/esm/index98.js +14 -2
  295. package/dist/esm/index99.js +4 -7
  296. package/dist/types/index.d.ts +18 -0
  297. package/package.json +3 -3
@@ -1,700 +1,137 @@
1
- import { hmac as dt } from "./index276.js";
2
- import { _validateObject as at, bitMask as ft, abool as Q, ensureBytes as z, memoized as nt, createHmacDrbg as ht, bytesToNumberBE as ct, numberToHexUnpadded as M, aInRange as mt } from "./index275.js";
3
- import { _createCurveFields as wt, wNAF as yt, normalizeZ as pt, pippenger as gt, mulEndoUnsafe as Et, negateCt as ot } from "./index277.js";
4
- import { Field as bt, mapHashToField as vt, getMinHashLength as Bt } from "./index254.js";
5
- import { concatBytes as I, abytes as it, bytesToHex as rt, hexToBytes as xt, randomBytes as St, isBytes as Rt } from "./index259.js";
6
- function st(e) {
7
- e.lowS !== void 0 && Q("lowS", e.lowS), e.prehash !== void 0 && Q("prehash", e.prehash);
1
+ import { assert as p } from "./index287.js";
2
+ import { BaseError as u } from "./index282.js";
3
+ import { size as y, padLeft as f, fromString as x, fromBoolean as w, fromNumber as E, padRight as P, concat as g } from "./index270.js";
4
+ import { integerRegex as A, bytesRegex as $, arrayRegex as L } from "./index288.js";
5
+ import { prepareParameters as z, encode as I } from "./index289.js";
6
+ function N(n, e, t) {
7
+ const { checksumAddress: r = !1 } = {};
8
+ if (n.length !== e.length)
9
+ throw new b({
10
+ expectedLength: n.length,
11
+ givenLength: e.length
12
+ });
13
+ const a = z({
14
+ checksumAddress: r,
15
+ parameters: n,
16
+ values: e
17
+ }), s = I(a);
18
+ return s.length === 0 ? "0x" : s;
8
19
  }
9
- class Ot extends Error {
10
- constructor(i = "") {
11
- super(i);
12
- }
20
+ function m(n, e) {
21
+ if (n.length !== e.length)
22
+ throw new b({
23
+ expectedLength: n.length,
24
+ givenLength: e.length
25
+ });
26
+ const t = [];
27
+ for (let r = 0; r < n.length; r++) {
28
+ const a = n[r], s = e[r];
29
+ t.push(m.encode(a, s));
30
+ }
31
+ return g(...t);
13
32
  }
14
- const F = {
15
- // asn.1 DER encoding utils
16
- Err: Ot,
17
- // Basic building block is TLV (Tag-Length-Value)
18
- _tlv: {
19
- encode: (e, i) => {
20
- const { Err: t } = F;
21
- if (e < 0 || e > 256)
22
- throw new t("tlv.encode: wrong tag");
23
- if (i.length & 1)
24
- throw new t("tlv.encode: unpadded data");
25
- const w = i.length / 2, p = M(w);
26
- if (p.length / 2 & 128)
27
- throw new t("tlv.encode: long form length too big");
28
- const b = w > 127 ? M(p.length / 2 | 128) : "";
29
- return M(e) + b + p + i;
30
- },
31
- // v - value, l - left bytes (unparsed)
32
- decode(e, i) {
33
- const { Err: t } = F;
34
- let w = 0;
35
- if (e < 0 || e > 256)
36
- throw new t("tlv.encode: wrong tag");
37
- if (i.length < 2 || i[w++] !== e)
38
- throw new t("tlv.decode: wrong tlv");
39
- const p = i[w++], b = !!(p & 128);
40
- let u = 0;
41
- if (!b)
42
- u = p;
43
- else {
44
- const S = p & 127;
45
- if (!S)
46
- throw new t("tlv.decode(long): indefinite length not supported");
47
- if (S > 4)
48
- throw new t("tlv.decode(long): byte length is too big");
49
- const N = i.subarray(w, w + S);
50
- if (N.length !== S)
51
- throw new t("tlv.decode: length bytes not complete");
52
- if (N[0] === 0)
53
- throw new t("tlv.decode(long): zero leftmost byte");
54
- for (const q of N)
55
- u = u << 8 | q;
56
- if (w += S, u < 128)
57
- throw new t("tlv.decode(long): not minimal encoding");
58
- }
59
- const x = i.subarray(w, w + u);
60
- if (x.length !== u)
61
- throw new t("tlv.decode: wrong value length");
62
- return { v: x, l: i.subarray(w + u) };
63
- }
64
- },
65
- // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
66
- // since we always use positive integers here. It must always be empty:
67
- // - add zero byte if exists
68
- // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
69
- _int: {
70
- encode(e) {
71
- const { Err: i } = F;
72
- if (e < U)
73
- throw new i("integer: negative integers are not allowed");
74
- let t = M(e);
75
- if (Number.parseInt(t[0], 16) & 8 && (t = "00" + t), t.length & 1)
76
- throw new i("unexpected DER parsing assertion: unpadded hex");
77
- return t;
78
- },
79
- decode(e) {
80
- const { Err: i } = F;
81
- if (e[0] & 128)
82
- throw new i("invalid signature integer: negative");
83
- if (e[0] === 0 && !(e[1] & 128))
84
- throw new i("invalid signature integer: unnecessary leading zero");
85
- return ct(e);
86
- }
87
- },
88
- toSig(e) {
89
- const { Err: i, _int: t, _tlv: w } = F, p = z("signature", e), { v: b, l: u } = w.decode(48, p);
90
- if (u.length)
91
- throw new i("invalid signature: left bytes after parsing");
92
- const { v: x, l: S } = w.decode(2, b), { v: N, l: q } = w.decode(2, S);
93
- if (q.length)
94
- throw new i("invalid signature: left bytes after parsing");
95
- return { r: t.decode(x), s: t.decode(N) };
96
- },
97
- hexFromSig(e) {
98
- const { _tlv: i, _int: t } = F, w = i.encode(2, t.encode(e.r)), p = i.encode(2, t.encode(e.s)), b = w + p;
99
- return i.encode(48, b);
33
+ (function(n) {
34
+ function e(t, r, a = !1) {
35
+ if (t === "address") {
36
+ const i = r;
37
+ return p(i), f(i.toLowerCase(), a ? 32 : 0);
38
+ }
39
+ if (t === "string")
40
+ return x(r);
41
+ if (t === "bytes")
42
+ return r;
43
+ if (t === "bool")
44
+ return f(w(r), a ? 32 : 1);
45
+ const s = t.match(A);
46
+ if (s) {
47
+ const [i, o, c = "256"] = s, h = Number.parseInt(c) / 8;
48
+ return E(r, {
49
+ size: a ? 32 : h,
50
+ signed: o === "int"
51
+ });
52
+ }
53
+ const d = t.match($);
54
+ if (d) {
55
+ const [i, o] = d;
56
+ if (Number.parseInt(o) !== (r.length - 2) / 2)
57
+ throw new M({
58
+ expectedSize: Number.parseInt(o),
59
+ value: r
60
+ });
61
+ return P(r, a ? 32 : 0);
62
+ }
63
+ const l = t.match(L);
64
+ if (l && Array.isArray(r)) {
65
+ const [i, o] = l, c = [];
66
+ for (let h = 0; h < r.length; h++)
67
+ c.push(e(o, r[h], !0));
68
+ return c.length === 0 ? "0x" : g(...c);
69
+ }
70
+ throw new j(t);
71
+ }
72
+ n.encode = e;
73
+ })(m || (m = {}));
74
+ class R extends u {
75
+ constructor({ expectedLength: e, givenLength: t, type: r }) {
76
+ super(`Array length mismatch for type \`${r}\`. Expected: \`${e}\`. Given: \`${t}\`.`), Object.defineProperty(this, "name", {
77
+ enumerable: !0,
78
+ configurable: !0,
79
+ writable: !0,
80
+ value: "AbiParameters.ArrayLengthMismatchError"
81
+ });
100
82
  }
101
- }, U = BigInt(0), k = BigInt(1), At = BigInt(2), W = BigInt(3), Zt = BigInt(4);
102
- function Tt(e, i, t) {
103
- function w(p) {
104
- const b = e.sqr(p), u = e.mul(b, p);
105
- return e.add(e.add(u, e.mul(p, i)), t);
106
- }
107
- return w;
108
83
  }
109
- function lt(e, i, t) {
110
- const { BYTES: w } = e;
111
- function p(b) {
112
- let u;
113
- if (typeof b == "bigint")
114
- u = b;
115
- else {
116
- let x = z("private key", b);
117
- if (i) {
118
- if (!i.includes(x.length * 2))
119
- throw new Error("invalid private key");
120
- const S = new Uint8Array(w);
121
- S.set(x, S.length - x.length), x = S;
122
- }
123
- try {
124
- u = e.fromBytes(x);
125
- } catch {
126
- throw new Error(`invalid private key: expected ui8a of size ${w}, got ${typeof b}`);
127
- }
128
- }
129
- if (t && (u = e.create(u)), !e.isValidNot0(u))
130
- throw new Error("invalid private key: out of range [1..N-1]");
131
- return u;
84
+ class M extends u {
85
+ constructor({ expectedSize: e, value: t }) {
86
+ super(`Size of bytes "${t}" (bytes${y(t)}) does not match expected size (bytes${e}).`), Object.defineProperty(this, "name", {
87
+ enumerable: !0,
88
+ configurable: !0,
89
+ writable: !0,
90
+ value: "AbiParameters.BytesSizeMismatchError"
91
+ });
132
92
  }
133
- return p;
134
93
  }
135
- function zt(e, i = {}) {
136
- const { Fp: t, Fn: w } = wt("weierstrass", e, i), { h: p, n: b } = e;
137
- at(i, {}, {
138
- allowInfinityPoint: "boolean",
139
- clearCofactor: "function",
140
- isTorsionFree: "function",
141
- fromBytes: "function",
142
- toBytes: "function",
143
- endo: "object",
144
- wrapPrivateKey: "boolean"
145
- });
146
- const { endo: u } = i;
147
- if (u && (!t.is0(e.a) || typeof u.beta != "bigint" || typeof u.splitScalar != "function"))
148
- throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
149
- function x() {
150
- if (!t.isOdd)
151
- throw new Error("compression is not supported: Field does not have .isOdd()");
152
- }
153
- function S(v, r, s) {
154
- const { x: n, y: o } = r.toAffine(), a = t.toBytes(n);
155
- if (Q("isCompressed", s), s) {
156
- x();
157
- const d = !t.isOdd(o);
158
- return I(ut(d), a);
159
- } else
160
- return I(Uint8Array.of(4), a, t.toBytes(o));
161
- }
162
- function N(v) {
163
- it(v);
164
- const r = t.BYTES, s = r + 1, n = 2 * r + 1, o = v.length, a = v[0], d = v.subarray(1);
165
- if (o === s && (a === 2 || a === 3)) {
166
- const c = t.fromBytes(d);
167
- if (!t.isValid(c))
168
- throw new Error("bad point: is not on curve, wrong x");
169
- const l = T(c);
170
- let h;
171
- try {
172
- h = t.sqrt(l);
173
- } catch (g) {
174
- const m = g instanceof Error ? ": " + g.message : "";
175
- throw new Error("bad point: is not on curve, sqrt error" + m);
176
- }
177
- x();
178
- const f = t.isOdd(h);
179
- return (a & 1) === 1 !== f && (h = t.neg(h)), { x: c, y: h };
180
- } else if (o === n && a === 4) {
181
- const c = t.fromBytes(d.subarray(r * 0, r * 1)), l = t.fromBytes(d.subarray(r * 1, r * 2));
182
- if (!L(c, l))
183
- throw new Error("bad point: is not on curve");
184
- return { x: c, y: l };
185
- } else
186
- throw new Error(`bad point: got length ${o}, expected compressed=${s} or uncompressed=${n}`);
187
- }
188
- const q = i.toBytes || S, C = i.fromBytes || N, T = Tt(t, e.a, e.b);
189
- function L(v, r) {
190
- const s = t.sqr(r), n = T(v);
191
- return t.eql(s, n);
192
- }
193
- if (!L(e.Gx, e.Gy))
194
- throw new Error("bad curve params: generator point");
195
- const J = t.mul(t.pow(e.a, W), Zt), tt = t.mul(t.sqr(e.b), BigInt(27));
196
- if (t.is0(t.add(J, tt)))
197
- throw new Error("bad curve params: a or b");
198
- function K(v, r, s = !1) {
199
- if (!t.isValid(r) || s && t.is0(r))
200
- throw new Error(`bad point coordinate ${v}`);
201
- return r;
202
- }
203
- function G(v) {
204
- if (!(v instanceof y))
205
- throw new Error("ProjectivePoint expected");
206
- }
207
- const X = nt((v, r) => {
208
- const { px: s, py: n, pz: o } = v;
209
- if (t.eql(o, t.ONE))
210
- return { x: s, y: n };
211
- const a = v.is0();
212
- r == null && (r = a ? t.ONE : t.inv(o));
213
- const d = t.mul(s, r), c = t.mul(n, r), l = t.mul(o, r);
214
- if (a)
215
- return { x: t.ZERO, y: t.ZERO };
216
- if (!t.eql(l, t.ONE))
217
- throw new Error("invZ was invalid");
218
- return { x: d, y: c };
219
- }), V = nt((v) => {
220
- if (v.is0()) {
221
- if (i.allowInfinityPoint && !t.is0(v.py))
222
- return;
223
- throw new Error("bad point: ZERO");
224
- }
225
- const { x: r, y: s } = v.toAffine();
226
- if (!t.isValid(r) || !t.isValid(s))
227
- throw new Error("bad point: x or y not field elements");
228
- if (!L(r, s))
229
- throw new Error("bad point: equation left != right");
230
- if (!v.isTorsionFree())
231
- throw new Error("bad point: not in prime-order subgroup");
232
- return !0;
233
- });
234
- function $(v, r, s, n, o) {
235
- return s = new y(t.mul(s.px, v), s.py, s.pz), r = ot(n, r), s = ot(o, s), r.add(s);
236
- }
237
- class y {
238
- /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
239
- constructor(r, s, n) {
240
- this.px = K("x", r), this.py = K("y", s, !0), this.pz = K("z", n), Object.freeze(this);
241
- }
242
- /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
243
- static fromAffine(r) {
244
- const { x: s, y: n } = r || {};
245
- if (!r || !t.isValid(s) || !t.isValid(n))
246
- throw new Error("invalid affine point");
247
- if (r instanceof y)
248
- throw new Error("projective point not allowed");
249
- return t.is0(s) && t.is0(n) ? y.ZERO : new y(s, n, t.ONE);
250
- }
251
- get x() {
252
- return this.toAffine().x;
253
- }
254
- get y() {
255
- return this.toAffine().y;
256
- }
257
- static normalizeZ(r) {
258
- return pt(y, "pz", r);
259
- }
260
- static fromBytes(r) {
261
- return it(r), y.fromHex(r);
262
- }
263
- /** Converts hash string or Uint8Array to Point. */
264
- static fromHex(r) {
265
- const s = y.fromAffine(C(z("pointHex", r)));
266
- return s.assertValidity(), s;
267
- }
268
- /** Multiplies generator point by privateKey. */
269
- static fromPrivateKey(r) {
270
- const s = lt(w, i.allowedPrivateKeyLengths, i.wrapPrivateKey);
271
- return y.BASE.multiply(s(r));
272
- }
273
- /** Multiscalar Multiplication */
274
- static msm(r, s) {
275
- return gt(y, w, r, s);
276
- }
277
- /**
278
- *
279
- * @param windowSize
280
- * @param isLazy true will defer table computation until the first multiplication
281
- * @returns
282
- */
283
- precompute(r = 8, s = !0) {
284
- return _.setWindowSize(this, r), s || this.multiply(W), this;
285
- }
286
- /** "Private method", don't use it directly */
287
- _setWindowSize(r) {
288
- this.precompute(r);
289
- }
290
- // TODO: return `this`
291
- /** A point on curve is valid if it conforms to equation. */
292
- assertValidity() {
293
- V(this);
294
- }
295
- hasEvenY() {
296
- const { y: r } = this.toAffine();
297
- if (!t.isOdd)
298
- throw new Error("Field doesn't support isOdd");
299
- return !t.isOdd(r);
300
- }
301
- /** Compare one point to another. */
302
- equals(r) {
303
- G(r);
304
- const { px: s, py: n, pz: o } = this, { px: a, py: d, pz: c } = r, l = t.eql(t.mul(s, c), t.mul(a, o)), h = t.eql(t.mul(n, c), t.mul(d, o));
305
- return l && h;
306
- }
307
- /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
308
- negate() {
309
- return new y(this.px, t.neg(this.py), this.pz);
310
- }
311
- // Renes-Costello-Batina exception-free doubling formula.
312
- // There is 30% faster Jacobian formula, but it is not complete.
313
- // https://eprint.iacr.org/2015/1060, algorithm 3
314
- // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
315
- double() {
316
- const { a: r, b: s } = e, n = t.mul(s, W), { px: o, py: a, pz: d } = this;
317
- let c = t.ZERO, l = t.ZERO, h = t.ZERO, f = t.mul(o, o), B = t.mul(a, a), g = t.mul(d, d), m = t.mul(o, a);
318
- return m = t.add(m, m), h = t.mul(o, d), h = t.add(h, h), c = t.mul(r, h), l = t.mul(n, g), l = t.add(c, l), c = t.sub(B, l), l = t.add(B, l), l = t.mul(c, l), c = t.mul(m, c), h = t.mul(n, h), g = t.mul(r, g), m = t.sub(f, g), m = t.mul(r, m), m = t.add(m, h), h = t.add(f, f), f = t.add(h, f), f = t.add(f, g), f = t.mul(f, m), l = t.add(l, f), g = t.mul(a, d), g = t.add(g, g), f = t.mul(g, m), c = t.sub(c, f), h = t.mul(g, B), h = t.add(h, h), h = t.add(h, h), new y(c, l, h);
319
- }
320
- // Renes-Costello-Batina exception-free addition formula.
321
- // There is 30% faster Jacobian formula, but it is not complete.
322
- // https://eprint.iacr.org/2015/1060, algorithm 1
323
- // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
324
- add(r) {
325
- G(r);
326
- const { px: s, py: n, pz: o } = this, { px: a, py: d, pz: c } = r;
327
- let l = t.ZERO, h = t.ZERO, f = t.ZERO;
328
- const B = e.a, g = t.mul(e.b, W);
329
- let m = t.mul(s, a), R = t.mul(n, d), O = t.mul(o, c), A = t.add(s, n), E = t.add(a, d);
330
- A = t.mul(A, E), E = t.add(m, R), A = t.sub(A, E), E = t.add(s, o);
331
- let Z = t.add(a, c);
332
- return E = t.mul(E, Z), Z = t.add(m, O), E = t.sub(E, Z), Z = t.add(n, o), l = t.add(d, c), Z = t.mul(Z, l), l = t.add(R, O), Z = t.sub(Z, l), f = t.mul(B, E), l = t.mul(g, O), f = t.add(l, f), l = t.sub(R, f), f = t.add(R, f), h = t.mul(l, f), R = t.add(m, m), R = t.add(R, m), O = t.mul(B, O), E = t.mul(g, E), R = t.add(R, O), O = t.sub(m, O), O = t.mul(B, O), E = t.add(E, O), m = t.mul(R, E), h = t.add(h, m), m = t.mul(Z, E), l = t.mul(A, l), l = t.sub(l, m), m = t.mul(A, R), f = t.mul(Z, f), f = t.add(f, m), new y(l, h, f);
333
- }
334
- subtract(r) {
335
- return this.add(r.negate());
336
- }
337
- is0() {
338
- return this.equals(y.ZERO);
339
- }
340
- /**
341
- * Constant time multiplication.
342
- * Uses wNAF method. Windowed method may be 10% faster,
343
- * but takes 2x longer to generate and consumes 2x memory.
344
- * Uses precomputes when available.
345
- * Uses endomorphism for Koblitz curves.
346
- * @param scalar by which the point would be multiplied
347
- * @returns New point
348
- */
349
- multiply(r) {
350
- const { endo: s } = i;
351
- if (!w.isValidNot0(r))
352
- throw new Error("invalid scalar: out of range");
353
- let n, o;
354
- const a = (d) => _.wNAFCached(this, d, y.normalizeZ);
355
- if (s) {
356
- const { k1neg: d, k1: c, k2neg: l, k2: h } = s.splitScalar(r), { p: f, f: B } = a(c), { p: g, f: m } = a(h);
357
- o = B.add(m), n = $(s.beta, f, g, d, l);
358
- } else {
359
- const { p: d, f: c } = a(r);
360
- n = d, o = c;
361
- }
362
- return y.normalizeZ([n, o])[0];
363
- }
364
- /**
365
- * Non-constant-time multiplication. Uses double-and-add algorithm.
366
- * It's faster, but should only be used when you don't care about
367
- * an exposed private key e.g. sig verification, which works over *public* keys.
368
- */
369
- multiplyUnsafe(r) {
370
- const { endo: s } = i, n = this;
371
- if (!w.isValid(r))
372
- throw new Error("invalid scalar: out of range");
373
- if (r === U || n.is0())
374
- return y.ZERO;
375
- if (r === k)
376
- return n;
377
- if (_.hasPrecomputes(this))
378
- return this.multiply(r);
379
- if (s) {
380
- const { k1neg: o, k1: a, k2neg: d, k2: c } = s.splitScalar(r), { p1: l, p2: h } = Et(y, n, a, c);
381
- return $(s.beta, l, h, o, d);
382
- } else
383
- return _.wNAFCachedUnsafe(n, r);
384
- }
385
- multiplyAndAddUnsafe(r, s, n) {
386
- const o = this.multiplyUnsafe(s).add(r.multiplyUnsafe(n));
387
- return o.is0() ? void 0 : o;
388
- }
389
- /**
390
- * Converts Projective point to affine (x, y) coordinates.
391
- * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
392
- */
393
- toAffine(r) {
394
- return X(this, r);
395
- }
396
- /**
397
- * Checks whether Point is free of torsion elements (is in prime subgroup).
398
- * Always torsion-free for cofactor=1 curves.
399
- */
400
- isTorsionFree() {
401
- const { isTorsionFree: r } = i;
402
- return p === k ? !0 : r ? r(y, this) : _.wNAFCachedUnsafe(this, b).is0();
403
- }
404
- clearCofactor() {
405
- const { clearCofactor: r } = i;
406
- return p === k ? this : r ? r(y, this) : this.multiplyUnsafe(p);
407
- }
408
- toBytes(r = !0) {
409
- return Q("isCompressed", r), this.assertValidity(), q(y, this, r);
410
- }
411
- /** @deprecated use `toBytes` */
412
- toRawBytes(r = !0) {
413
- return this.toBytes(r);
414
- }
415
- toHex(r = !0) {
416
- return rt(this.toBytes(r));
417
- }
418
- toString() {
419
- return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
420
- }
94
+ class b extends u {
95
+ constructor({ expectedLength: e, givenLength: t }) {
96
+ super([
97
+ "ABI encoding parameters/values length mismatch.",
98
+ `Expected length (parameters): ${e}`,
99
+ `Given length (values): ${t}`
100
+ ].join(`
101
+ `)), Object.defineProperty(this, "name", {
102
+ enumerable: !0,
103
+ configurable: !0,
104
+ writable: !0,
105
+ value: "AbiParameters.LengthMismatchError"
106
+ });
421
107
  }
422
- y.BASE = new y(e.Gx, e.Gy, t.ONE), y.ZERO = new y(t.ZERO, t.ONE, t.ZERO), y.Fp = t, y.Fn = w;
423
- const P = w.BITS, _ = yt(y, i.endo ? Math.ceil(P / 2) : P);
424
- return y;
425
108
  }
426
- function ut(e) {
427
- return Uint8Array.of(e ? 2 : 3);
428
- }
429
- function Nt(e, i, t = {}) {
430
- at(i, { hash: "function" }, {
431
- hmac: "function",
432
- lowS: "boolean",
433
- randomBytes: "function",
434
- bits2int: "function",
435
- bits2int_modN: "function"
436
- });
437
- const w = i.randomBytes || St, p = i.hmac || ((n, ...o) => dt(i.hash, n, I(...o))), { Fp: b, Fn: u } = e, { ORDER: x, BITS: S } = u;
438
- function N(n) {
439
- const o = x >> k;
440
- return n > o;
441
- }
442
- function q(n) {
443
- return N(n) ? u.neg(n) : n;
444
- }
445
- function C(n, o) {
446
- if (!u.isValidNot0(o))
447
- throw new Error(`invalid signature ${n}: out of range 1..CURVE.n`);
109
+ class _ extends u {
110
+ constructor(e) {
111
+ super(`Value \`${e}\` is not a valid array.`), Object.defineProperty(this, "name", {
112
+ enumerable: !0,
113
+ configurable: !0,
114
+ writable: !0,
115
+ value: "AbiParameters.InvalidArrayError"
116
+ });
448
117
  }
449
- class T {
450
- constructor(o, a, d) {
451
- C("r", o), C("s", a), this.r = o, this.s = a, d != null && (this.recovery = d), Object.freeze(this);
452
- }
453
- // pair (bytes of r, bytes of s)
454
- static fromCompact(o) {
455
- const a = u.BYTES, d = z("compactSignature", o, a * 2);
456
- return new T(u.fromBytes(d.subarray(0, a)), u.fromBytes(d.subarray(a, a * 2)));
457
- }
458
- // DER encoded ECDSA signature
459
- // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
460
- static fromDER(o) {
461
- const { r: a, s: d } = F.toSig(z("DER", o));
462
- return new T(a, d);
463
- }
464
- /**
465
- * @todo remove
466
- * @deprecated
467
- */
468
- assertValidity() {
469
- }
470
- addRecoveryBit(o) {
471
- return new T(this.r, this.s, o);
472
- }
473
- // ProjPointType<bigint>
474
- recoverPublicKey(o) {
475
- const a = b.ORDER, { r: d, s: c, recovery: l } = this;
476
- if (l == null || ![0, 1, 2, 3].includes(l))
477
- throw new Error("recovery id invalid");
478
- if (x * At < a && l > 1)
479
- throw new Error("recovery id is ambiguous for h>1 curve");
480
- const f = l === 2 || l === 3 ? d + x : d;
481
- if (!b.isValid(f))
482
- throw new Error("recovery id 2 or 3 invalid");
483
- const B = b.toBytes(f), g = e.fromHex(I(ut((l & 1) === 0), B)), m = u.inv(f), R = V(z("msgHash", o)), O = u.create(-R * m), A = u.create(c * m), E = e.BASE.multiplyUnsafe(O).add(g.multiplyUnsafe(A));
484
- if (E.is0())
485
- throw new Error("point at infinify");
486
- return E.assertValidity(), E;
487
- }
488
- // Signatures should be low-s, to prevent malleability.
489
- hasHighS() {
490
- return N(this.s);
491
- }
492
- normalizeS() {
493
- return this.hasHighS() ? new T(this.r, u.neg(this.s), this.recovery) : this;
494
- }
495
- toBytes(o) {
496
- if (o === "compact")
497
- return I(u.toBytes(this.r), u.toBytes(this.s));
498
- if (o === "der")
499
- return xt(F.hexFromSig(this));
500
- throw new Error("invalid format");
501
- }
502
- // DER-encoded
503
- toDERRawBytes() {
504
- return this.toBytes("der");
505
- }
506
- toDERHex() {
507
- return rt(this.toBytes("der"));
508
- }
509
- // padded bytes of r, then padded bytes of s
510
- toCompactRawBytes() {
511
- return this.toBytes("compact");
512
- }
513
- toCompactHex() {
514
- return rt(this.toBytes("compact"));
515
- }
516
- }
517
- const L = lt(u, t.allowedPrivateKeyLengths, t.wrapPrivateKey), J = {
518
- isValidPrivateKey(n) {
519
- try {
520
- return L(n), !0;
521
- } catch {
522
- return !1;
523
- }
524
- },
525
- normPrivateKeyToScalar: L,
526
- /**
527
- * Produces cryptographically secure private key from random of size
528
- * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
529
- */
530
- randomPrivateKey: () => {
531
- const n = x;
532
- return vt(w(Bt(n)), n);
533
- },
534
- precompute(n = 8, o = e.BASE) {
535
- return o.precompute(n, !1);
536
- }
537
- };
538
- function tt(n, o = !0) {
539
- return e.fromPrivateKey(n).toBytes(o);
540
- }
541
- function K(n) {
542
- if (typeof n == "bigint")
543
- return !1;
544
- if (n instanceof e)
545
- return !0;
546
- const a = z("key", n).length, d = b.BYTES, c = d + 1, l = 2 * d + 1;
547
- if (!(t.allowedPrivateKeyLengths || u.BYTES === c))
548
- return a === c || a === l;
549
- }
550
- function G(n, o, a = !0) {
551
- if (K(n) === !0)
552
- throw new Error("first arg must be private key");
553
- if (K(o) === !1)
554
- throw new Error("second arg must be public key");
555
- return e.fromHex(o).multiply(L(n)).toBytes(a);
556
- }
557
- const X = i.bits2int || function(n) {
558
- if (n.length > 8192)
559
- throw new Error("input is too large");
560
- const o = ct(n), a = n.length * 8 - S;
561
- return a > 0 ? o >> BigInt(a) : o;
562
- }, V = i.bits2int_modN || function(n) {
563
- return u.create(X(n));
564
- }, $ = ft(S);
565
- function y(n) {
566
- return mt("num < 2^" + S, n, U, $), u.toBytes(n);
567
- }
568
- function P(n, o, a = _) {
569
- if (["recovered", "canonical"].some((A) => A in a))
570
- throw new Error("sign() legacy options not supported");
571
- const { hash: d } = i;
572
- let { lowS: c, prehash: l, extraEntropy: h } = a;
573
- c == null && (c = !0), n = z("msgHash", n), st(a), l && (n = z("prehashed msgHash", d(n)));
574
- const f = V(n), B = L(o), g = [y(B), y(f)];
575
- if (h != null && h !== !1) {
576
- const A = h === !0 ? w(b.BYTES) : h;
577
- g.push(z("extraEntropy", A));
578
- }
579
- const m = I(...g), R = f;
580
- function O(A) {
581
- const E = X(A);
582
- if (!u.isValidNot0(E))
583
- return;
584
- const Z = u.inv(E), j = e.BASE.multiply(E).toAffine(), Y = u.create(j.x);
585
- if (Y === U)
586
- return;
587
- const H = u.create(Z * u.create(R + Y * B));
588
- if (H === U)
589
- return;
590
- let et = (j.x === Y ? 0 : 2) | Number(j.y & k), D = H;
591
- return c && N(H) && (D = q(H), et ^= 1), new T(Y, D, et);
592
- }
593
- return { seed: m, k2sig: O };
594
- }
595
- const _ = { lowS: i.lowS, prehash: !1 }, v = { lowS: i.lowS, prehash: !1 };
596
- function r(n, o, a = _) {
597
- const { seed: d, k2sig: c } = P(n, o, a);
598
- return ht(i.hash.outputLen, u.BYTES, p)(d, c);
599
- }
600
- e.BASE.precompute(8);
601
- function s(n, o, a, d = v) {
602
- const c = n;
603
- o = z("msgHash", o), a = z("publicKey", a), st(d);
604
- const { lowS: l, prehash: h, format: f } = d;
605
- if ("strict" in d)
606
- throw new Error("options.strict was renamed to lowS");
607
- if (f !== void 0 && !["compact", "der", "js"].includes(f))
608
- throw new Error('format must be "compact", "der" or "js"');
609
- const B = typeof c == "string" || Rt(c), g = !B && !f && typeof c == "object" && c !== null && typeof c.r == "bigint" && typeof c.s == "bigint";
610
- if (!B && !g)
611
- throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
612
- let m, R;
613
- try {
614
- if (g)
615
- if (f === void 0 || f === "js")
616
- m = new T(c.r, c.s);
617
- else
618
- throw new Error("invalid format");
619
- if (B) {
620
- try {
621
- f !== "compact" && (m = T.fromDER(c));
622
- } catch (D) {
623
- if (!(D instanceof F.Err))
624
- throw D;
625
- }
626
- !m && f !== "der" && (m = T.fromCompact(c));
627
- }
628
- R = e.fromHex(a);
629
- } catch {
630
- return !1;
631
- }
632
- if (!m || l && m.hasHighS())
633
- return !1;
634
- h && (o = i.hash(o));
635
- const { r: O, s: A } = m, E = V(o), Z = u.inv(A), j = u.create(E * Z), Y = u.create(O * Z), H = e.BASE.multiplyUnsafe(j).add(R.multiplyUnsafe(Y));
636
- return H.is0() ? !1 : u.create(H.x) === O;
637
- }
638
- return Object.freeze({
639
- getPublicKey: tt,
640
- getSharedSecret: G,
641
- sign: r,
642
- verify: s,
643
- utils: J,
644
- Point: e,
645
- Signature: T
646
- });
647
118
  }
648
- function Ft(e) {
649
- const i = {
650
- a: e.a,
651
- b: e.b,
652
- p: e.Fp.ORDER,
653
- n: e.n,
654
- h: e.h,
655
- Gx: e.Gx,
656
- Gy: e.Gy
657
- }, t = e.Fp, w = bt(i.n, e.nBitLength), p = {
658
- Fp: t,
659
- Fn: w,
660
- allowedPrivateKeyLengths: e.allowedPrivateKeyLengths,
661
- allowInfinityPoint: e.allowInfinityPoint,
662
- endo: e.endo,
663
- wrapPrivateKey: e.wrapPrivateKey,
664
- isTorsionFree: e.isTorsionFree,
665
- clearCofactor: e.clearCofactor,
666
- fromBytes: e.fromBytes,
667
- toBytes: e.toBytes
668
- };
669
- return { CURVE: i, curveOpts: p };
670
- }
671
- function Lt(e) {
672
- const { CURVE: i, curveOpts: t } = Ft(e), w = {
673
- hash: e.hash,
674
- hmac: e.hmac,
675
- randomBytes: e.randomBytes,
676
- lowS: e.lowS,
677
- bits2int: e.bits2int,
678
- bits2int_modN: e.bits2int_modN
679
- };
680
- return { CURVE: i, curveOpts: t, ecdsaOpts: w };
681
- }
682
- function _t(e, i) {
683
- return Object.assign({}, i, {
684
- ProjectivePoint: i.Point,
685
- CURVE: e
686
- });
687
- }
688
- function It(e) {
689
- const { CURVE: i, curveOpts: t, ecdsaOpts: w } = Lt(e), p = zt(i, t), b = Nt(p, w, t);
690
- return _t(e, b);
119
+ class j extends u {
120
+ constructor(e) {
121
+ super(`Type \`${e}\` is not a valid ABI Type.`), Object.defineProperty(this, "name", {
122
+ enumerable: !0,
123
+ configurable: !0,
124
+ writable: !0,
125
+ value: "AbiParameters.InvalidTypeError"
126
+ });
127
+ }
691
128
  }
692
129
  export {
693
- F as DER,
694
- Ot as DERErr,
695
- Tt as _legacyHelperEquat,
696
- lt as _legacyHelperNormPriv,
697
- Nt as ecdsa,
698
- It as weierstrass,
699
- zt as weierstrassN
130
+ R as ArrayLengthMismatchError,
131
+ M as BytesSizeMismatchError,
132
+ _ as InvalidArrayError,
133
+ j as InvalidTypeError,
134
+ b as LengthMismatchError,
135
+ N as encode,
136
+ m as encodePacked
700
137
  };