@coinbase/cdp-hooks 0.0.85 → 0.0.87

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 (343) hide show
  1. package/dist/esm/index.js +127 -90
  2. package/dist/esm/index10.js +4 -11
  3. package/dist/esm/index100.js +6 -105
  4. package/dist/esm/index101.js +16 -6
  5. package/dist/esm/index102.js +8 -131
  6. package/dist/esm/index103.js +14 -276
  7. package/dist/esm/index104.js +8 -3
  8. package/dist/esm/index105.js +10 -4
  9. package/dist/esm/index106.js +17 -9
  10. package/dist/esm/index107.js +47 -2
  11. package/dist/esm/index108.js +14 -2
  12. package/dist/esm/index109.js +17 -3
  13. package/dist/esm/index11.js +4 -6
  14. package/dist/esm/index110.js +13 -326
  15. package/dist/esm/index111.js +6 -13
  16. package/dist/esm/index112.js +35 -4
  17. package/dist/esm/index113.js +9 -55
  18. package/dist/esm/index114.js +9 -2
  19. package/dist/esm/index115.js +25 -7
  20. package/dist/esm/index116.js +10 -214
  21. package/dist/esm/index117.js +15 -32
  22. package/dist/esm/index118.js +11 -21
  23. package/dist/esm/index119.js +116 -5
  24. package/dist/esm/index12.js +9 -6
  25. package/dist/esm/index120.js +32 -72
  26. package/dist/esm/index121.js +79 -5
  27. package/dist/esm/index122.js +177 -5
  28. package/dist/esm/index123.js +42 -33
  29. package/dist/esm/index124.js +6 -75
  30. package/dist/esm/index125.js +14 -3
  31. package/dist/esm/index126.js +13 -23
  32. package/dist/esm/index127.js +99 -451
  33. package/dist/esm/index128.js +71 -29
  34. package/dist/esm/index129.js +87 -26
  35. package/dist/esm/index13.js +7 -11
  36. package/dist/esm/index130.js +147 -32
  37. package/dist/esm/index131.js +135 -33
  38. package/dist/esm/index132.js +67 -192
  39. package/dist/esm/index133.js +23 -8
  40. package/dist/esm/index134.js +106 -2
  41. package/dist/esm/index135.js +6 -12
  42. package/dist/esm/index136.js +130 -17
  43. package/dist/esm/index137.js +276 -28
  44. package/dist/esm/index138.js +3 -9
  45. package/dist/esm/index139.js +4 -56
  46. package/dist/esm/index14.js +8 -6
  47. package/dist/esm/index140.js +9 -46
  48. package/dist/esm/index141.js +2 -9
  49. package/dist/esm/index142.js +2 -8
  50. package/dist/esm/index143.js +3 -17
  51. package/dist/esm/index144.js +326 -18
  52. package/dist/esm/index145.js +13 -24
  53. package/dist/esm/index146.js +4 -16
  54. package/dist/esm/index147.js +53 -52
  55. package/dist/esm/index148.js +2 -12
  56. package/dist/esm/index149.js +6 -159
  57. package/dist/esm/index15.js +8 -6
  58. package/dist/esm/index150.js +213 -20
  59. package/dist/esm/index151.js +31 -127
  60. package/dist/esm/index152.js +20 -37
  61. package/dist/esm/index153.js +5 -6
  62. package/dist/esm/index154.js +71 -25
  63. package/dist/esm/index155.js +5 -191
  64. package/dist/esm/index156.js +6 -4
  65. package/dist/esm/index157.js +31 -60
  66. package/dist/esm/index158.js +76 -3
  67. package/dist/esm/index159.js +3 -21
  68. package/dist/esm/index16.js +5 -6
  69. package/dist/esm/index160.js +22 -15
  70. package/dist/esm/index161.js +451 -23
  71. package/dist/esm/index162.js +30 -11
  72. package/dist/esm/index163.js +22 -30
  73. package/dist/esm/index164.js +34 -3
  74. package/dist/esm/index165.js +34 -18
  75. package/dist/esm/index166.js +193 -27
  76. package/dist/esm/index167.js +7 -34
  77. package/dist/esm/index168.js +2 -8
  78. package/dist/esm/index169.js +10 -23
  79. package/dist/esm/index17.js +5 -35
  80. package/dist/esm/index170.js +17 -27
  81. package/dist/esm/index171.js +25 -62
  82. package/dist/esm/index172.js +8 -9
  83. package/dist/esm/index173.js +52 -30
  84. package/dist/esm/index174.js +45 -27
  85. package/dist/esm/index175.js +8 -24
  86. package/dist/esm/index176.js +7 -3
  87. package/dist/esm/index177.js +16 -14
  88. package/dist/esm/index178.js +18 -103
  89. package/dist/esm/index179.js +23 -63
  90. package/dist/esm/index18.js +8 -25
  91. package/dist/esm/index180.js +16 -5
  92. package/dist/esm/index181.js +54 -6
  93. package/dist/esm/index182.js +11 -27
  94. package/dist/esm/index183.js +159 -37
  95. package/dist/esm/index184.js +21 -13
  96. package/dist/esm/index185.js +127 -42
  97. package/dist/esm/index186.js +38 -5
  98. package/dist/esm/index187.js +6 -11
  99. package/dist/esm/index188.js +27 -19
  100. package/dist/esm/index189.js +185 -72
  101. package/dist/esm/index19.js +10 -7
  102. package/dist/esm/index190.js +4 -2
  103. package/dist/esm/index191.js +60 -33
  104. package/dist/esm/index192.js +3 -111
  105. package/dist/esm/index193.js +14 -42
  106. package/dist/esm/index194.js +16 -32
  107. package/dist/esm/index195.js +23 -8
  108. package/dist/esm/index196.js +11 -6
  109. package/dist/esm/index197.js +34 -6
  110. package/dist/esm/index198.js +3 -12
  111. package/dist/esm/index199.js +18 -10
  112. package/dist/esm/index2.js +2 -2
  113. package/dist/esm/index20.js +8 -92
  114. package/dist/esm/index200.js +27 -13
  115. package/dist/esm/index201.js +34 -31
  116. package/dist/esm/index202.js +8 -5
  117. package/dist/esm/index203.js +23 -6
  118. package/dist/esm/index204.js +28 -19
  119. package/dist/esm/index205.js +62 -29
  120. package/dist/esm/index206.js +9 -20
  121. package/dist/esm/index207.js +33 -3
  122. package/dist/esm/index208.js +27 -17
  123. package/dist/esm/index209.js +24 -10
  124. package/dist/esm/index21.js +12 -5
  125. package/dist/esm/index210.js +3 -21
  126. package/dist/esm/index211.js +14 -22
  127. package/dist/esm/index212.js +103 -5
  128. package/dist/esm/index213.js +64 -5
  129. package/dist/esm/index214.js +5 -8
  130. package/dist/esm/index215.js +6 -104
  131. package/dist/esm/index216.js +28 -3
  132. package/dist/esm/index217.js +38 -18
  133. package/dist/esm/index218.js +13 -171
  134. package/dist/esm/index219.js +42 -17
  135. package/dist/esm/index22.js +10 -6
  136. package/dist/esm/index220.js +6 -10
  137. package/dist/esm/index221.js +11 -40
  138. package/dist/esm/index222.js +20 -2
  139. package/dist/esm/index223.js +78 -4
  140. package/dist/esm/index224.js +2 -11
  141. package/dist/esm/index225.js +35 -17
  142. package/dist/esm/index226.js +110 -7
  143. package/dist/esm/index227.js +47 -10
  144. package/dist/esm/index228.js +32 -66
  145. package/dist/esm/index229.js +8 -65
  146. package/dist/esm/index23.js +5 -6
  147. package/dist/esm/index230.js +6 -185
  148. package/dist/esm/index231.js +6 -22
  149. package/dist/esm/index232.js +11 -42
  150. package/dist/esm/index233.js +9 -75
  151. package/dist/esm/index234.js +12 -39
  152. package/dist/esm/index235.js +30 -14
  153. package/dist/esm/index236.js +5 -14
  154. package/dist/esm/index237.js +8 -7
  155. package/dist/esm/index238.js +19 -6
  156. package/dist/esm/index239.js +31 -36
  157. package/dist/esm/index24.js +5 -6
  158. package/dist/esm/index240.js +19 -14
  159. package/dist/esm/index241.js +3 -8
  160. package/dist/esm/index242.js +17 -12
  161. package/dist/esm/index243.js +10 -9
  162. package/dist/esm/index244.js +20 -15
  163. package/dist/esm/index245.js +21 -21
  164. package/dist/esm/index246.js +5 -30
  165. package/dist/esm/index247.js +6 -2
  166. package/dist/esm/index248.js +8 -13
  167. package/dist/esm/index249.js +104 -12
  168. package/dist/esm/index25.js +34 -7
  169. package/dist/esm/index250.js +3 -48
  170. package/dist/esm/index251.js +18 -9
  171. package/dist/esm/index252.js +171 -13
  172. package/dist/esm/index253.js +16 -13
  173. package/dist/esm/index254.js +10 -9
  174. package/dist/esm/index255.js +40 -15
  175. package/dist/esm/index256.js +2 -25
  176. package/dist/esm/index257.js +4 -11
  177. package/dist/esm/index258.js +10 -24
  178. package/dist/esm/index259.js +17 -49
  179. package/dist/esm/index26.js +5 -6
  180. package/dist/esm/index260.js +7 -17
  181. package/dist/esm/index261.js +10 -13
  182. package/dist/esm/index262.js +66 -11
  183. package/dist/esm/index263.js +61 -99
  184. package/dist/esm/index264.js +185 -5
  185. package/dist/esm/index265.js +20 -221
  186. package/dist/esm/index266.js +42 -6
  187. package/dist/esm/index267.js +77 -7
  188. package/dist/esm/index268.js +39 -25
  189. package/dist/esm/index269.js +15 -18
  190. package/dist/esm/index27.js +5 -6
  191. package/dist/esm/index270.js +12 -144
  192. package/dist/esm/index271.js +8 -13
  193. package/dist/esm/index272.js +7 -36
  194. package/dist/esm/index273.js +36 -41
  195. package/dist/esm/index274.js +14 -37
  196. package/dist/esm/index275.js +9 -2
  197. package/dist/esm/index276.js +12 -69
  198. package/dist/esm/index277.js +9 -34
  199. package/dist/esm/index278.js +15 -13
  200. package/dist/esm/index279.js +23 -2
  201. package/dist/esm/index28.js +5 -6
  202. package/dist/esm/index280.js +29 -67
  203. package/dist/esm/index281.js +2 -4
  204. package/dist/esm/index282.js +13 -136
  205. package/dist/esm/index283.js +12 -155
  206. package/dist/esm/index284.js +47 -9
  207. package/dist/esm/index285.js +9 -16
  208. package/dist/esm/index286.js +12 -112
  209. package/dist/esm/index287.js +12 -132
  210. package/dist/esm/index288.js +8 -78
  211. package/dist/esm/index289.js +16 -2
  212. package/dist/esm/index29.js +6 -21
  213. package/dist/esm/index290.js +23 -696
  214. package/dist/esm/index291.js +10 -137
  215. package/dist/esm/index292.js +24 -42
  216. package/dist/esm/index293.js +49 -198
  217. package/dist/esm/index294.js +17 -65
  218. package/dist/esm/index295.js +14 -4
  219. package/dist/esm/index296.js +11 -40
  220. package/dist/esm/index297.js +103 -7
  221. package/dist/esm/index298.js +5 -62
  222. package/dist/esm/index299.js +218 -72
  223. package/dist/esm/index3.js +1 -1
  224. package/dist/esm/index30.js +6 -60
  225. package/dist/esm/index300.js +7 -4
  226. package/dist/esm/index301.js +7 -195
  227. package/dist/esm/index302.js +26 -3
  228. package/dist/esm/index303.js +18 -62
  229. package/dist/esm/index304.js +144 -43
  230. package/dist/esm/index305.js +13 -5
  231. package/dist/esm/index306.js +36 -5
  232. package/dist/esm/index307.js +42 -2
  233. package/dist/esm/index308.js +38 -21
  234. package/dist/esm/index309.js +4 -0
  235. package/dist/esm/index31.js +7 -9
  236. package/dist/esm/index310.js +72 -0
  237. package/dist/esm/index311.js +37 -0
  238. package/dist/esm/index312.js +17 -0
  239. package/dist/esm/index313.js +71 -0
  240. package/dist/esm/index314.js +6 -0
  241. package/dist/esm/index315.js +139 -0
  242. package/dist/esm/index316.js +158 -0
  243. package/dist/esm/index317.js +12 -0
  244. package/dist/esm/index318.js +19 -0
  245. package/dist/esm/index319.js +116 -0
  246. package/dist/esm/index32.js +9 -34
  247. package/dist/esm/index320.js +137 -0
  248. package/dist/esm/index321.js +4 -0
  249. package/dist/esm/index322.js +81 -0
  250. package/dist/esm/index323.js +4 -0
  251. package/dist/esm/index324.js +700 -0
  252. package/dist/esm/index325.js +141 -0
  253. package/dist/esm/index326.js +45 -0
  254. package/dist/esm/index327.js +203 -0
  255. package/dist/esm/index328.js +68 -0
  256. package/dist/esm/index329.js +7 -0
  257. package/dist/esm/index33.js +13 -17
  258. package/dist/esm/index330.js +43 -0
  259. package/dist/esm/index331.js +10 -0
  260. package/dist/esm/index332.js +65 -0
  261. package/dist/esm/index333.js +80 -0
  262. package/dist/esm/index334.js +6 -0
  263. package/dist/esm/index335.js +197 -0
  264. package/dist/esm/index336.js +6 -0
  265. package/dist/esm/index337.js +66 -0
  266. package/dist/esm/index338.js +47 -0
  267. package/dist/esm/index339.js +7 -0
  268. package/dist/esm/index34.js +14 -12
  269. package/dist/esm/index340.js +7 -0
  270. package/dist/esm/index341.js +4 -0
  271. package/dist/esm/index342.js +24 -0
  272. package/dist/esm/index35.js +26 -12
  273. package/dist/esm/index36.js +43 -52
  274. package/dist/esm/index37.js +27 -58
  275. package/dist/esm/index38.js +54 -54
  276. package/dist/esm/index39.js +27 -5
  277. package/dist/esm/index40.js +12 -47
  278. package/dist/esm/index41.js +11 -31
  279. package/dist/esm/index42.js +7 -3
  280. package/dist/esm/index43.js +7 -9
  281. package/dist/esm/index44.js +14 -68
  282. package/dist/esm/index45.js +7 -9
  283. package/dist/esm/index46.js +7 -28
  284. package/dist/esm/index47.js +7 -70
  285. package/dist/esm/index48.js +34 -18
  286. package/dist/esm/index49.js +29 -109
  287. package/dist/esm/index5.js +8 -195
  288. package/dist/esm/index50.js +10 -61
  289. package/dist/esm/index51.js +95 -23
  290. package/dist/esm/index52.js +4 -40
  291. package/dist/esm/index53.js +7 -37
  292. package/dist/esm/index54.js +7 -58
  293. package/dist/esm/index55.js +10 -163
  294. package/dist/esm/index56.js +10 -39
  295. package/dist/esm/index57.js +7 -9
  296. package/dist/esm/index58.js +7 -31
  297. package/dist/esm/index59.js +7 -36
  298. package/dist/esm/index6.js +8 -23
  299. package/dist/esm/index60.js +7 -9
  300. package/dist/esm/index61.js +7 -29
  301. package/dist/esm/index62.js +7 -46
  302. package/dist/esm/index63.js +21 -88
  303. package/dist/esm/index64.js +59 -39
  304. package/dist/esm/index65.js +8 -8
  305. package/dist/esm/index66.js +11 -6
  306. package/dist/esm/index67.js +18 -17
  307. package/dist/esm/index68.js +34 -9
  308. package/dist/esm/index69.js +11 -13
  309. package/dist/esm/index7.js +6 -53
  310. package/dist/esm/index70.js +54 -8
  311. package/dist/esm/index71.js +57 -9
  312. package/dist/esm/index72.js +56 -17
  313. package/dist/esm/index73.js +5 -47
  314. package/dist/esm/index74.js +47 -13
  315. package/dist/esm/index75.js +32 -16
  316. package/dist/esm/index76.js +3 -13
  317. package/dist/esm/index77.js +9 -6
  318. package/dist/esm/index78.js +68 -35
  319. package/dist/esm/index79.js +9 -9
  320. package/dist/esm/index8.js +6 -24
  321. package/dist/esm/index80.js +28 -8
  322. package/dist/esm/index81.js +70 -25
  323. package/dist/esm/index82.js +19 -10
  324. package/dist/esm/index83.js +110 -14
  325. package/dist/esm/index84.js +60 -11
  326. package/dist/esm/index85.js +22 -114
  327. package/dist/esm/index86.js +38 -31
  328. package/dist/esm/index87.js +37 -79
  329. package/dist/esm/index88.js +55 -174
  330. package/dist/esm/index89.js +159 -40
  331. package/dist/esm/index9.js +4 -11
  332. package/dist/esm/index90.js +39 -6
  333. package/dist/esm/index91.js +8 -12
  334. package/dist/esm/index92.js +30 -12
  335. package/dist/esm/index93.js +35 -98
  336. package/dist/esm/index94.js +9 -72
  337. package/dist/esm/index95.js +29 -87
  338. package/dist/esm/index96.js +45 -147
  339. package/dist/esm/index97.js +85 -133
  340. package/dist/esm/index98.js +38 -66
  341. package/dist/esm/index99.js +7 -22
  342. package/dist/types/index.d.ts +34 -5
  343. package/package.json +3 -3
@@ -1,700 +1,27 @@
1
- import { hmac as dt } from "./index292.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 "./index291.js";
3
- import { _createCurveFields as wt, wNAF as yt, normalizeZ as pt, pippenger as gt, mulEndoUnsafe as Et, negateCt as ot } from "./index293.js";
4
- import { Field as bt, mapHashToField as vt, getMinHashLength as Bt } from "./index265.js";
5
- import { concatBytes as I, abytes as it, bytesToHex as rt, hexToBytes as xt, randomBytes as St, isBytes as Rt } from "./index270.js";
6
- function st(e) {
7
- e.lowS !== void 0 && Q("lowS", e.lowS), e.prehash !== void 0 && Q("prehash", e.prehash);
8
- }
9
- class Ot extends Error {
10
- constructor(i = "") {
11
- super(i);
12
- }
13
- }
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);
100
- }
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
- }
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;
132
- }
133
- return p;
134
- }
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
- }
421
- }
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
- }
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`);
448
- }
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
1
+ import { BaseError as a } from "./index147.js";
2
+ import { ExecutionRevertedError as s, FeeCapTooHighError as r, FeeCapTooLowError as i, NonceTooHighError as c, NonceTooLowError as u, NonceMaxValueError as d, InsufficientFundsError as f, IntrinsicGasTooHighError as w, IntrinsicGasTooLowError as E, TransactionTypeNotSupportedError as m, TipAboveFeeCapError as g, UnknownNodeError as F } from "./index166.js";
3
+ function G(e, n) {
4
+ const o = (e.details || "").toLowerCase(), t = e instanceof a ? e.walk((x) => x?.code === s.code) : e;
5
+ return t instanceof a ? new s({
6
+ cause: e,
7
+ message: t.details
8
+ }) : s.nodeMessage.test(o) ? new s({
9
+ cause: e,
10
+ message: e.details
11
+ }) : r.nodeMessage.test(o) ? new r({
12
+ cause: e,
13
+ maxFeePerGas: n?.maxFeePerGas
14
+ }) : i.nodeMessage.test(o) ? new i({
15
+ cause: e,
16
+ maxFeePerGas: n?.maxFeePerGas
17
+ }) : c.nodeMessage.test(o) ? new c({ cause: e, nonce: n?.nonce }) : u.nodeMessage.test(o) ? new u({ cause: e, nonce: n?.nonce }) : d.nodeMessage.test(o) ? new d({ cause: e, nonce: n?.nonce }) : f.nodeMessage.test(o) ? new f({ cause: e }) : w.nodeMessage.test(o) ? new w({ cause: e, gas: n?.gas }) : E.nodeMessage.test(o) ? new E({ cause: e, gas: n?.gas }) : m.nodeMessage.test(o) ? new m({ cause: e }) : g.nodeMessage.test(o) ? new g({
18
+ cause: e,
19
+ maxFeePerGas: n?.maxFeePerGas,
20
+ maxPriorityFeePerGas: n?.maxPriorityFeePerGas
21
+ }) : new F({
22
+ cause: e
646
23
  });
647
24
  }
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);
691
- }
692
25
  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
26
+ G as getNodeError
700
27
  };