@gardenfi/core 0.2.0-beta.70 → 0.2.0-beta.71

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 (299) hide show
  1. package/dist/index.cjs +1 -31
  2. package/dist/index.js +27 -7808
  3. package/dist/index10.cjs +1 -0
  4. package/dist/index10.js +101 -0
  5. package/dist/index100.cjs +1 -0
  6. package/dist/index100.js +37 -0
  7. package/dist/index101.cjs +1 -0
  8. package/dist/index101.js +369 -0
  9. package/dist/index102.cjs +1 -0
  10. package/dist/index102.js +23 -0
  11. package/dist/index103.cjs +1 -0
  12. package/dist/index103.js +58 -0
  13. package/dist/index104.cjs +1 -0
  14. package/dist/index104.js +5 -0
  15. package/dist/index105.cjs +1 -0
  16. package/dist/index105.js +51 -0
  17. package/dist/index106.cjs +1 -0
  18. package/dist/index106.js +28 -0
  19. package/dist/index107.cjs +1 -0
  20. package/dist/index107.js +4 -0
  21. package/dist/index108.cjs +1 -0
  22. package/dist/index108.js +4 -0
  23. package/dist/index109.cjs +1 -0
  24. package/dist/index109.js +64 -0
  25. package/dist/index11.cjs +20 -0
  26. package/dist/index11.js +380 -0
  27. package/dist/index110.cjs +1 -0
  28. package/dist/index110.js +37 -0
  29. package/dist/index111.cjs +1 -0
  30. package/dist/index111.js +4 -0
  31. package/dist/index112.cjs +1 -0
  32. package/dist/index112.js +60 -0
  33. package/dist/index113.cjs +1 -0
  34. package/dist/index113.js +4 -0
  35. package/dist/index114.cjs +1 -0
  36. package/dist/index114.js +42 -0
  37. package/dist/index115.cjs +1 -0
  38. package/dist/index115.js +45 -0
  39. package/dist/index116.cjs +1 -0
  40. package/dist/index116.js +20 -0
  41. package/dist/index117.cjs +1 -0
  42. package/dist/index117.js +111 -0
  43. package/dist/index118.cjs +1 -0
  44. package/dist/index118.js +23 -0
  45. package/dist/index119.cjs +1 -0
  46. package/dist/index119.js +228 -0
  47. package/dist/index12.cjs +1 -0
  48. package/dist/index12.js +22 -0
  49. package/dist/index120.cjs +1 -0
  50. package/dist/index120.js +6 -0
  51. package/dist/index121.cjs +1 -0
  52. package/dist/index121.js +160 -0
  53. package/dist/index122.cjs +1 -0
  54. package/dist/index122.js +4 -0
  55. package/dist/index123.cjs +1 -0
  56. package/dist/index123.js +75 -0
  57. package/dist/index124.cjs +1 -0
  58. package/dist/index124.js +7 -0
  59. package/dist/index125.cjs +1 -0
  60. package/dist/index125.js +107 -0
  61. package/dist/index126.cjs +1 -0
  62. package/dist/index126.js +15 -0
  63. package/dist/index127.cjs +1 -0
  64. package/dist/index127.js +35 -0
  65. package/dist/index128.cjs +1 -0
  66. package/dist/index128.js +32 -0
  67. package/dist/index129.cjs +1 -0
  68. package/dist/index129.js +4 -0
  69. package/dist/index13.cjs +1 -0
  70. package/dist/index13.js +396 -0
  71. package/dist/index130.cjs +1 -0
  72. package/dist/index130.js +21 -0
  73. package/dist/index131.cjs +1 -0
  74. package/dist/index131.js +4 -0
  75. package/dist/index132.cjs +1 -0
  76. package/dist/index132.js +358 -0
  77. package/dist/index133.cjs +1 -0
  78. package/dist/index133.js +241 -0
  79. package/dist/index134.cjs +1 -0
  80. package/dist/index134.js +70 -0
  81. package/dist/index135.cjs +1 -0
  82. package/dist/index135.js +64 -0
  83. package/dist/index136.cjs +1 -0
  84. package/dist/index136.js +14 -0
  85. package/dist/index137.cjs +1 -0
  86. package/dist/index137.js +47 -0
  87. package/dist/index138.cjs +1 -0
  88. package/dist/index138.js +65 -0
  89. package/dist/index139.cjs +1 -0
  90. package/dist/index139.js +228 -0
  91. package/dist/index14.cjs +1 -0
  92. package/dist/index14.js +23 -0
  93. package/dist/index140.cjs +1 -0
  94. package/dist/index140.js +5 -0
  95. package/dist/index141.cjs +1 -0
  96. package/dist/index141.js +171 -0
  97. package/dist/index142.cjs +1 -0
  98. package/dist/index142.js +30 -0
  99. package/dist/index143.cjs +1 -0
  100. package/dist/index143.js +23 -0
  101. package/dist/index144.cjs +1 -0
  102. package/dist/index144.js +72 -0
  103. package/dist/index145.cjs +1 -0
  104. package/dist/index145.js +130 -0
  105. package/dist/index146.cjs +1 -0
  106. package/dist/index146.js +9 -0
  107. package/dist/index147.cjs +1 -0
  108. package/dist/index147.js +4 -0
  109. package/dist/index148.cjs +1 -0
  110. package/dist/index148.js +28 -0
  111. package/dist/index149.cjs +1 -0
  112. package/dist/index149.js +4 -0
  113. package/dist/index15.cjs +1 -0
  114. package/dist/index15.js +4 -0
  115. package/dist/index16.cjs +1 -0
  116. package/dist/index16.js +34 -0
  117. package/dist/index17.cjs +1 -0
  118. package/dist/index17.js +27 -0
  119. package/dist/index18.cjs +1 -0
  120. package/dist/index18.js +33 -0
  121. package/dist/index19.cjs +1 -0
  122. package/dist/index19.js +32 -0
  123. package/dist/index2.cjs +1 -0
  124. package/dist/index2.js +412 -0
  125. package/dist/index20.cjs +1 -0
  126. package/dist/index20.js +55 -0
  127. package/dist/index21.cjs +1 -0
  128. package/dist/index21.js +30 -0
  129. package/dist/index22.cjs +1 -0
  130. package/dist/index22.js +17 -0
  131. package/dist/index23.cjs +1 -0
  132. package/dist/index23.js +11 -0
  133. package/dist/index24.cjs +1 -0
  134. package/dist/index24.js +11 -0
  135. package/dist/index25.cjs +1 -0
  136. package/dist/index25.js +140 -0
  137. package/dist/index26.cjs +1 -0
  138. package/dist/index26.js +4 -0
  139. package/dist/index27.cjs +1 -0
  140. package/dist/index27.js +15 -0
  141. package/dist/index28.cjs +1 -0
  142. package/dist/index28.js +39 -0
  143. package/dist/index29.cjs +1 -0
  144. package/dist/index29.js +44 -0
  145. package/dist/index3.cjs +1 -0
  146. package/dist/index3.js +5 -0
  147. package/dist/index30.cjs +1 -0
  148. package/dist/index30.js +26 -0
  149. package/dist/index31.cjs +1 -0
  150. package/dist/index31.js +28 -0
  151. package/dist/index32.cjs +1 -0
  152. package/dist/index32.js +57 -0
  153. package/dist/index33.cjs +1 -0
  154. package/dist/index33.js +30 -0
  155. package/dist/index34.cjs +3 -0
  156. package/dist/index34.js +30 -0
  157. package/dist/index35.cjs +1 -0
  158. package/dist/index35.js +17 -0
  159. package/dist/index36.cjs +2 -0
  160. package/dist/index36.js +27 -0
  161. package/dist/index37.cjs +1 -0
  162. package/dist/index37.js +43 -0
  163. package/dist/index38.cjs +1 -0
  164. package/dist/index38.js +201 -0
  165. package/dist/index39.cjs +1 -0
  166. package/dist/index39.js +4 -0
  167. package/dist/index4.cjs +1 -0
  168. package/dist/index4.js +18 -0
  169. package/dist/index40.cjs +1 -0
  170. package/dist/index40.js +4 -0
  171. package/dist/index41.cjs +1 -0
  172. package/dist/index41.js +4 -0
  173. package/dist/index42.cjs +1 -0
  174. package/dist/index42.js +15 -0
  175. package/dist/index43.cjs +1 -0
  176. package/dist/index43.js +14 -0
  177. package/dist/index44.cjs +1 -0
  178. package/dist/index44.js +6 -0
  179. package/dist/index45.cjs +1 -0
  180. package/dist/index45.js +48 -0
  181. package/dist/index46.cjs +1 -0
  182. package/dist/index46.js +45 -0
  183. package/dist/index47.cjs +1 -0
  184. package/dist/index47.js +174 -0
  185. package/dist/index48.cjs +1 -0
  186. package/dist/index48.js +15 -0
  187. package/dist/index49.cjs +1 -0
  188. package/dist/index49.js +7 -0
  189. package/dist/index5.cjs +1 -0
  190. package/dist/index5.js +110 -0
  191. package/dist/index50.cjs +1 -0
  192. package/dist/index50.js +19 -0
  193. package/dist/index51.cjs +1 -0
  194. package/dist/index51.js +14 -0
  195. package/dist/index52.cjs +1 -0
  196. package/dist/index52.js +177 -0
  197. package/dist/index53.cjs +1 -0
  198. package/dist/index53.js +24 -0
  199. package/dist/index54.cjs +1 -0
  200. package/dist/index54.js +4 -0
  201. package/dist/index55.cjs +1 -0
  202. package/dist/index55.js +37 -0
  203. package/dist/index56.cjs +1 -0
  204. package/dist/index56.js +11 -0
  205. package/dist/index57.cjs +1 -0
  206. package/dist/index57.js +37 -0
  207. package/dist/index58.cjs +1 -0
  208. package/dist/index58.js +58 -0
  209. package/dist/index59.cjs +2 -0
  210. package/dist/index59.js +62 -0
  211. package/dist/index6.cjs +1 -0
  212. package/dist/index6.js +5 -0
  213. package/dist/index60.cjs +1 -0
  214. package/dist/index60.js +6 -0
  215. package/dist/index61.cjs +1 -0
  216. package/dist/index61.js +130 -0
  217. package/dist/index62.cjs +2 -0
  218. package/dist/index62.js +45 -0
  219. package/dist/index63.cjs +1 -0
  220. package/dist/index63.js +11 -0
  221. package/dist/index64.cjs +1 -0
  222. package/dist/index64.js +13 -0
  223. package/dist/index65.cjs +1 -0
  224. package/dist/index65.js +14 -0
  225. package/dist/index66.cjs +1 -0
  226. package/dist/index66.js +16 -0
  227. package/dist/index67.cjs +1 -0
  228. package/dist/index67.js +9 -0
  229. package/dist/index68.cjs +1 -0
  230. package/dist/index68.js +20 -0
  231. package/dist/index69.cjs +1 -0
  232. package/dist/index69.js +81 -0
  233. package/dist/index7.cjs +1 -0
  234. package/dist/index7.js +76 -0
  235. package/dist/index70.cjs +1 -0
  236. package/dist/index70.js +17 -0
  237. package/dist/index71.cjs +1 -0
  238. package/dist/index71.js +21 -0
  239. package/dist/index72.cjs +1 -0
  240. package/dist/index72.js +24 -0
  241. package/dist/index73.cjs +1 -0
  242. package/dist/index73.js +16 -0
  243. package/dist/index74.cjs +1 -0
  244. package/dist/index74.js +4 -0
  245. package/dist/index75.cjs +1 -0
  246. package/dist/index75.js +4 -0
  247. package/dist/index76.cjs +1 -0
  248. package/dist/index76.js +9 -0
  249. package/dist/index77.cjs +2 -0
  250. package/dist/index77.js +37 -0
  251. package/dist/index78.cjs +1 -0
  252. package/dist/index78.js +8 -0
  253. package/dist/index79.cjs +1 -0
  254. package/dist/index79.js +22 -0
  255. package/dist/index8.cjs +1 -0
  256. package/dist/index8.js +62 -0
  257. package/dist/index80.cjs +1 -0
  258. package/dist/index80.js +34 -0
  259. package/dist/index81.cjs +1 -0
  260. package/dist/index81.js +4 -0
  261. package/dist/index82.cjs +6 -0
  262. package/dist/index82.js +949 -0
  263. package/dist/index83.cjs +1 -0
  264. package/dist/index83.js +4 -0
  265. package/dist/index84.cjs +1 -0
  266. package/dist/index84.js +64 -0
  267. package/dist/index85.cjs +1 -0
  268. package/dist/index85.js +35 -0
  269. package/dist/index86.cjs +1 -0
  270. package/dist/index86.js +89 -0
  271. package/dist/index87.cjs +1 -0
  272. package/dist/index87.js +15 -0
  273. package/dist/index88.cjs +1 -0
  274. package/dist/index88.js +9 -0
  275. package/dist/index89.cjs +1 -0
  276. package/dist/index89.js +115 -0
  277. package/dist/index9.cjs +1 -0
  278. package/dist/index9.js +63 -0
  279. package/dist/index90.cjs +1 -0
  280. package/dist/index90.js +9 -0
  281. package/dist/index91.cjs +1 -0
  282. package/dist/index91.js +35 -0
  283. package/dist/index92.cjs +1 -0
  284. package/dist/index92.js +4 -0
  285. package/dist/index93.cjs +1 -0
  286. package/dist/index93.js +40 -0
  287. package/dist/index94.cjs +1 -0
  288. package/dist/index94.js +31 -0
  289. package/dist/index95.cjs +1 -0
  290. package/dist/index95.js +23 -0
  291. package/dist/index96.cjs +1 -0
  292. package/dist/index96.js +9 -0
  293. package/dist/index97.cjs +1 -0
  294. package/dist/index97.js +7 -0
  295. package/dist/index98.cjs +1 -0
  296. package/dist/index98.js +13 -0
  297. package/dist/index99.cjs +1 -0
  298. package/dist/index99.js +22 -0
  299. package/package.json +2 -2
@@ -0,0 +1,201 @@
1
+ import { __exports as d } from "./index41.js";
2
+ Object.defineProperty(d, "__esModule", { value: !0 });
3
+ d.testEcc = void 0;
4
+ const f = (b) => Buffer.from(b, "hex");
5
+ function c(b) {
6
+ a(
7
+ b.isPoint(
8
+ f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
9
+ )
10
+ ), a(
11
+ !b.isPoint(
12
+ f("030000000000000000000000000000000000000000000000000000000000000005")
13
+ )
14
+ ), a(
15
+ b.isPrivate(
16
+ f("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
17
+ )
18
+ ), a(
19
+ b.isPrivate(
20
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
21
+ )
22
+ ), a(
23
+ !b.isPrivate(
24
+ f("0000000000000000000000000000000000000000000000000000000000000000")
25
+ )
26
+ ), a(
27
+ !b.isPrivate(
28
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")
29
+ )
30
+ ), a(
31
+ !b.isPrivate(
32
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142")
33
+ )
34
+ ), a(
35
+ Buffer.from(
36
+ b.privateAdd(
37
+ f("0000000000000000000000000000000000000000000000000000000000000001"),
38
+ f("0000000000000000000000000000000000000000000000000000000000000000")
39
+ )
40
+ ).equals(
41
+ f("0000000000000000000000000000000000000000000000000000000000000001")
42
+ )
43
+ ), a(
44
+ b.privateAdd(
45
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),
46
+ f("0000000000000000000000000000000000000000000000000000000000000003")
47
+ ) === null
48
+ ), a(
49
+ Buffer.from(
50
+ b.privateAdd(
51
+ f("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),
52
+ f("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665")
53
+ )
54
+ ).equals(
55
+ f("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24")
56
+ )
57
+ ), a(
58
+ Buffer.from(
59
+ b.privateNegate(
60
+ f("0000000000000000000000000000000000000000000000000000000000000001")
61
+ )
62
+ ).equals(
63
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
64
+ )
65
+ ), a(
66
+ Buffer.from(
67
+ b.privateNegate(
68
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e")
69
+ )
70
+ ).equals(
71
+ f("0000000000000000000000000000000000000000000000000000000000000003")
72
+ )
73
+ ), a(
74
+ Buffer.from(
75
+ b.privateNegate(
76
+ f("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")
77
+ )
78
+ ).equals(
79
+ f("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")
80
+ )
81
+ ), a(
82
+ Buffer.from(
83
+ b.pointCompress(
84
+ f(
85
+ "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
86
+ ),
87
+ !0
88
+ )
89
+ ).equals(
90
+ f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
91
+ )
92
+ ), a(
93
+ Buffer.from(
94
+ b.pointCompress(
95
+ f(
96
+ "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
97
+ ),
98
+ !1
99
+ )
100
+ ).equals(
101
+ f(
102
+ "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
103
+ )
104
+ )
105
+ ), a(
106
+ Buffer.from(
107
+ b.pointCompress(
108
+ f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
109
+ !0
110
+ )
111
+ ).equals(
112
+ f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
113
+ )
114
+ ), a(
115
+ Buffer.from(
116
+ b.pointCompress(
117
+ f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
118
+ !1
119
+ )
120
+ ).equals(
121
+ f(
122
+ "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
123
+ )
124
+ )
125
+ ), a(
126
+ Buffer.from(
127
+ b.pointFromScalar(
128
+ f("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")
129
+ )
130
+ ).equals(
131
+ f("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99")
132
+ )
133
+ ), a(
134
+ b.xOnlyPointAddTweak(
135
+ f("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
136
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
137
+ ) === null
138
+ );
139
+ let e = b.xOnlyPointAddTweak(
140
+ f("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),
141
+ f("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac")
142
+ );
143
+ a(
144
+ Buffer.from(e.xOnlyPubkey).equals(
145
+ f("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf")
146
+ ) && e.parity === 1
147
+ ), e = b.xOnlyPointAddTweak(
148
+ f("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),
149
+ f("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")
150
+ ), a(
151
+ Buffer.from(e.xOnlyPubkey).equals(
152
+ f("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c")
153
+ ) && e.parity === 0
154
+ ), a(
155
+ Buffer.from(
156
+ b.sign(
157
+ f("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),
158
+ f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
159
+ )
160
+ ).equals(
161
+ f(
162
+ "54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"
163
+ )
164
+ )
165
+ ), a(
166
+ b.verify(
167
+ f("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),
168
+ f("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
169
+ f(
170
+ "54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"
171
+ )
172
+ )
173
+ ), b.signSchnorr && a(
174
+ Buffer.from(
175
+ b.signSchnorr(
176
+ f("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),
177
+ f("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),
178
+ f("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906")
179
+ )
180
+ ).equals(
181
+ f(
182
+ "5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"
183
+ )
184
+ )
185
+ ), b.verifySchnorr && a(
186
+ b.verifySchnorr(
187
+ f("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),
188
+ f("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),
189
+ f(
190
+ "5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"
191
+ )
192
+ )
193
+ );
194
+ }
195
+ d.testEcc = c;
196
+ function a(b) {
197
+ if (!b) throw new Error("ecc library invalid");
198
+ }
199
+ export {
200
+ d as default
201
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
@@ -0,0 +1,4 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@catalogfi/utils"),c=require("@gardenfi/utils");class u{constructor(r,t){this.url=new c.Url("/blocknumber/"+t,r)}async fetchBlockNumbers(){try{const r=await e.Fetcher.get(this.url);return e.Ok(r)}catch(r){return e.Err("Failed to fetch block numbers",r)}}}exports.BlockNumberFetcher=u;
package/dist/index4.js ADDED
@@ -0,0 +1,18 @@
1
+ import { Fetcher as e, Ok as c, Err as o } from "@catalogfi/utils";
2
+ import { Url as s } from "@gardenfi/utils";
3
+ class n {
4
+ constructor(r, t) {
5
+ this.url = new s("/blocknumber/" + t, r);
6
+ }
7
+ async fetchBlockNumbers() {
8
+ try {
9
+ const r = await e.get(this.url);
10
+ return c(r);
11
+ } catch (r) {
12
+ return o("Failed to fetch block numbers", r);
13
+ }
14
+ }
15
+ }
16
+ export {
17
+ n as BlockNumberFetcher
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index59.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
@@ -0,0 +1,15 @@
1
+ import { BaseError as r } from "./index59.js";
2
+ class d extends r {
3
+ constructor({ address: s }) {
4
+ super(`Address "${s}" is invalid.`, {
5
+ metaMessages: [
6
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
7
+ "- Address must match its checksum counterpart."
8
+ ],
9
+ name: "InvalidAddressError"
10
+ });
11
+ }
12
+ }
13
+ export {
14
+ d as InvalidAddressError
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index72.cjs"),i=require("./index73.cjs"),o=/^0x[a-fA-F0-9]{40}$/,t=new c.LruMap(8192);function f(e,n){const{strict:s=!0}=n??{},r=`${e}.${s}`;if(t.has(r))return t.get(r);const u=o.test(e)?e.toLowerCase()===e?!0:s?i.checksumAddress(e)===e:!0:!1;return t.set(r,u),u}exports.isAddress=f;exports.isAddressCache=t;
@@ -0,0 +1,14 @@
1
+ import { LruMap as u } from "./index72.js";
2
+ import { checksumAddress as c } from "./index73.js";
3
+ const i = /^0x[a-fA-F0-9]{40}$/, r = /* @__PURE__ */ new u(8192);
4
+ function h(t, s) {
5
+ const { strict: n = !0 } = s ?? {}, e = `${t}.${n}`;
6
+ if (r.has(e))
7
+ return r.get(e);
8
+ const o = i.test(t) ? t.toLowerCase() === t ? !0 : n ? c(t) === t : !0 : !1;
9
+ return r.set(e, o), o;
10
+ }
11
+ export {
12
+ h as isAddress,
13
+ r as isAddressCache
14
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){return`0x${e.reduce((t,c)=>t+c.replace("0x",""),"")}`}exports.concatHex=r;
@@ -0,0 +1,6 @@
1
+ function n(e) {
2
+ return `0x${e.reduce((c, r) => c + r.replace("0x", ""), "")}`;
3
+ }
4
+ export {
5
+ n as concatHex
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index48.cjs"),f=require("./index57.cjs"),x=require("./index30.cjs"),z=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function H(e,n={}){return typeof e=="number"||typeof e=="bigint"?d(e,n):typeof e=="string"?m(e,n):typeof e=="boolean"?b(e,n):u(e,n)}function b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(x.assertSize(t,{size:n.size}),f.pad(t,{size:n.size})):t}function u(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=z[e[i]];const r=`0x${t}`;return typeof n.size=="number"?(x.assertSize(r,{size:n.size}),f.pad(r,{dir:"right",size:n.size})):r}function d(e,n={}){const{signed:t,size:r}=n,i=BigInt(e);let o;r?t?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof o=="bigint"&&t?-o-1n:0;if(o&&i>o||i<c){const s=typeof e=="bigint"?"n":"";throw new y.IntegerOutOfRangeError({max:o?`${o}${s}`:void 0,min:`${c}${s}`,signed:t,size:r,value:`${e}${s}`})}const g=`0x${(t&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?f.pad(g,{size:r}):g}const T=new TextEncoder;function m(e,n={}){const t=T.encode(e);return u(t,n)}exports.boolToHex=b;exports.bytesToHex=u;exports.numberToHex=d;exports.stringToHex=m;exports.toHex=H;
@@ -0,0 +1,48 @@
1
+ import { IntegerOutOfRangeError as x } from "./index48.js";
2
+ import { pad as s } from "./index57.js";
3
+ import { assertSize as c } from "./index30.js";
4
+ const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
5
+ function B(n, e = {}) {
6
+ return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
7
+ }
8
+ function z(n, e = {}) {
9
+ const t = `0x${Number(n)}`;
10
+ return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
11
+ }
12
+ function m(n, e = {}) {
13
+ let t = "";
14
+ for (let i = 0; i < n.length; i++)
15
+ t += b[n[i]];
16
+ const r = `0x${t}`;
17
+ return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
18
+ }
19
+ function y(n, e = {}) {
20
+ const { signed: t, size: r } = e, i = BigInt(n);
21
+ let o;
22
+ r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
23
+ const g = typeof o == "bigint" && t ? -o - 1n : 0;
24
+ if (o && i > o || i < g) {
25
+ const f = typeof n == "bigint" ? "n" : "";
26
+ throw new x({
27
+ max: o ? `${o}${f}` : void 0,
28
+ min: `${g}${f}`,
29
+ signed: t,
30
+ size: r,
31
+ value: `${n}${f}`
32
+ });
33
+ }
34
+ const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
35
+ return r ? s(u, { size: r }) : u;
36
+ }
37
+ const d = /* @__PURE__ */ new TextEncoder();
38
+ function $(n, e = {}) {
39
+ const t = d.encode(n);
40
+ return m(t, e);
41
+ }
42
+ export {
43
+ z as boolToHex,
44
+ m as bytesToHex,
45
+ y as numberToHex,
46
+ $ as stringToHex,
47
+ B as toHex
48
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index59.cjs"),u=require("./index61.cjs"),f=require("./index58.cjs"),g=require("./index45.cjs");function c(n,e="hex"){const i=o(n),s=u.createCursor(new Uint8Array(i.length));return i.encode(s),e==="hex"?g.bytesToHex(s.bytes):s.bytes}function o(n){return Array.isArray(n)?p(n.map(e=>o(e))):y(n)}function p(n){const e=n.reduce((t,h)=>t+h.length,0),i=l(e);return{length:e<=55?1+e:1+i+e,encode(t){e<=55?t.pushByte(192+e):(t.pushByte(247+i),i===1?t.pushUint8(e):i===2?t.pushUint16(e):i===3?t.pushUint24(e):t.pushUint32(e));for(const{encode:h}of n)h(t)}}}function y(n){const e=typeof n=="string"?f.hexToBytes(n):n,i=l(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+i+e.length,encode(t){e.length===1&&e[0]<128?t.pushBytes(e):e.length<=55?(t.pushByte(128+e.length),t.pushBytes(e)):(t.pushByte(183+i),i===1?t.pushUint8(e.length):i===2?t.pushUint16(e.length):i===3?t.pushUint24(e.length):t.pushUint32(e.length),t.pushBytes(e))}}}function l(n){if(n<2**8)return 1;if(n<2**16)return 2;if(n<2**24)return 3;if(n<2**32)return 4;throw new r.BaseError("Length is too large.")}exports.toRlp=c;
@@ -0,0 +1,45 @@
1
+ import { BaseError as l } from "./index59.js";
2
+ import { createCursor as r } from "./index61.js";
3
+ import { hexToBytes as g } from "./index58.js";
4
+ import { bytesToHex as u } from "./index45.js";
5
+ function m(n, e = "hex") {
6
+ const i = s(n), h = r(new Uint8Array(i.length));
7
+ return i.encode(h), e === "hex" ? u(h.bytes) : h.bytes;
8
+ }
9
+ function s(n) {
10
+ return Array.isArray(n) ? p(n.map((e) => s(e))) : y(n);
11
+ }
12
+ function p(n) {
13
+ const e = n.reduce((t, f) => t + f.length, 0), i = o(e);
14
+ return {
15
+ length: e <= 55 ? 1 + e : 1 + i + e,
16
+ encode(t) {
17
+ e <= 55 ? t.pushByte(192 + e) : (t.pushByte(247 + i), i === 1 ? t.pushUint8(e) : i === 2 ? t.pushUint16(e) : i === 3 ? t.pushUint24(e) : t.pushUint32(e));
18
+ for (const { encode: f } of n)
19
+ f(t);
20
+ }
21
+ };
22
+ }
23
+ function y(n) {
24
+ const e = typeof n == "string" ? g(n) : n, i = o(e.length);
25
+ return {
26
+ length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
27
+ encode(t) {
28
+ e.length === 1 && e[0] < 128 ? t.pushBytes(e) : e.length <= 55 ? (t.pushByte(128 + e.length), t.pushBytes(e)) : (t.pushByte(183 + i), i === 1 ? t.pushUint8(e.length) : i === 2 ? t.pushUint16(e.length) : i === 3 ? t.pushUint24(e.length) : t.pushUint32(e.length), t.pushBytes(e));
29
+ }
30
+ };
31
+ }
32
+ function o(n) {
33
+ if (n < 2 ** 8)
34
+ return 1;
35
+ if (n < 2 ** 16)
36
+ return 2;
37
+ if (n < 2 ** 24)
38
+ return 3;
39
+ if (n < 2 ** 32)
40
+ return 4;
41
+ throw new l("Length is too large.");
42
+ }
43
+ export {
44
+ m as toRlp
45
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index62.cjs"),G=require("./index63.cjs"),R=require("./index64.cjs"),S=require("./index65.cjs"),B=require("./index66.cjs"),L=require("./index44.cjs"),h=require("./index67.cjs"),t=require("./index45.cjs"),b=require("./index46.cjs"),V=require("./index68.cjs"),z=require("./index69.cjs"),C=require("./index70.cjs"),v=require("./index71.cjs");function k(e,o){const s=C.getTransactionType(e);return s==="eip1559"?_(e,o):s==="eip2930"?j(e,o):s==="eip4844"?Y(e,o):s==="eip7702"?w(e,o):M(e,o)}function w(e,o){const{authorizationList:s,chainId:i,gas:r,nonce:c,to:a,value:x,maxFeePerGas:l,maxPriorityFeePerGas:n,accessList:H,data:d}=e;z.assertTransactionEIP7702(e);const f=v.serializeAccessList(H),u=V.serializeAuthorizationList(s);return L.concatHex(["0x04",b.toRlp([t.toHex(i),c?t.toHex(c):"0x",n?t.toHex(n):"0x",l?t.toHex(l):"0x",r?t.toHex(r):"0x",a??"0x",x?t.toHex(x):"0x",d??"0x",f,u,...T(e,o)])])}function Y(e,o){const{chainId:s,gas:i,nonce:r,to:c,value:a,maxFeePerBlobGas:x,maxFeePerGas:l,maxPriorityFeePerGas:n,accessList:H,data:d}=e;z.assertTransactionEIP4844(e);let f=e.blobVersionedHashes,u=e.sidecars;if(e.blobs&&(typeof f>"u"||typeof u>"u")){const m=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(y=>t.bytesToHex(y)),P=e.kzg,p=G.blobsToCommitments({blobs:m,kzg:P});if(typeof f>"u"&&(f=S.commitmentsToVersionedHashes({commitments:p})),typeof u>"u"){const y=R.blobsToProofs({blobs:m,commitments:p,kzg:P});u=B.toBlobSidecars({blobs:m,commitments:p,proofs:y})}}const I=v.serializeAccessList(H),A=[t.toHex(s),r?t.toHex(r):"0x",n?t.toHex(n):"0x",l?t.toHex(l):"0x",i?t.toHex(i):"0x",c??"0x",a?t.toHex(a):"0x",d??"0x",I,x?t.toHex(x):"0x",f??[],...T(e,o)],q=[],g=[],E=[];if(u)for(let m=0;m<u.length;m++){const{blob:P,commitment:p,proof:y}=u[m];q.push(P),g.push(p),E.push(y)}return L.concatHex(["0x03",u?b.toRlp([A,q,g,E]):b.toRlp(A)])}function _(e,o){const{chainId:s,gas:i,nonce:r,to:c,value:a,maxFeePerGas:x,maxPriorityFeePerGas:l,accessList:n,data:H}=e;z.assertTransactionEIP1559(e);const d=v.serializeAccessList(n),f=[t.toHex(s),r?t.toHex(r):"0x",l?t.toHex(l):"0x",x?t.toHex(x):"0x",i?t.toHex(i):"0x",c??"0x",a?t.toHex(a):"0x",H??"0x",d,...T(e,o)];return L.concatHex(["0x02",b.toRlp(f)])}function j(e,o){const{chainId:s,gas:i,data:r,nonce:c,to:a,value:x,accessList:l,gasPrice:n}=e;z.assertTransactionEIP2930(e);const H=v.serializeAccessList(l),d=[t.toHex(s),c?t.toHex(c):"0x",n?t.toHex(n):"0x",i?t.toHex(i):"0x",a??"0x",x?t.toHex(x):"0x",r??"0x",H,...T(e,o)];return L.concatHex(["0x01",b.toRlp(d)])}function M(e,o){const{chainId:s=0,gas:i,data:r,nonce:c,to:a,value:x,gasPrice:l}=e;z.assertTransactionLegacy(e);let n=[c?t.toHex(c):"0x",l?t.toHex(l):"0x",i?t.toHex(i):"0x",a??"0x",x?t.toHex(x):"0x",r??"0x"];if(o){const H=(()=>{if(o.v>=35n)return(o.v-35n)/2n>0?o.v:27n+(o.v===35n?0n:1n);if(s>0)return BigInt(s*2)+BigInt(35n+o.v-27n);const u=27n+(o.v===27n?0n:1n);if(o.v!==u)throw new F.InvalidLegacyVError({v:o.v});return u})(),d=h.trim(o.r),f=h.trim(o.s);n=[...n,t.toHex(H),d==="0x00"?"0x":d,f==="0x00"?"0x":f]}else s>0&&(n=[...n,t.toHex(s),"0x","0x"]);return b.toRlp(n)}function T(e,o){const s=o??e,{v:i,yParity:r}=s;if(typeof s.r>"u")return[];if(typeof s.s>"u")return[];if(typeof i>"u"&&typeof r>"u")return[];const c=h.trim(s.r),a=h.trim(s.s);return[typeof r=="number"?r?t.toHex(1):"0x":i===0n?"0x":i===1n?t.toHex(1):i===27n?"0x":t.toHex(1),c==="0x00"?"0x":c,a==="0x00"?"0x":a]}exports.serializeTransaction=k;exports.toYParitySignatureArray=T;
@@ -0,0 +1,174 @@
1
+ import { InvalidLegacyVError as H } from "./index62.js";
2
+ import { blobsToCommitments as g } from "./index63.js";
3
+ import { blobsToProofs as B } from "./index64.js";
4
+ import { commitmentsToVersionedHashes as V } from "./index65.js";
5
+ import { toBlobSidecars as C } from "./index66.js";
6
+ import { concatHex as h } from "./index44.js";
7
+ import { trim as T } from "./index67.js";
8
+ import { toHex as o, bytesToHex as k } from "./index45.js";
9
+ import { toRlp as y } from "./index46.js";
10
+ import { serializeAuthorizationList as w } from "./index68.js";
11
+ import { assertTransactionEIP7702 as S, assertTransactionEIP4844 as _, assertTransactionEIP1559 as R, assertTransactionEIP2930 as Y, assertTransactionLegacy as j } from "./index69.js";
12
+ import { getTransactionType as q } from "./index70.js";
13
+ import { serializeAccessList as v } from "./index71.js";
14
+ function te(e, r) {
15
+ const i = q(e);
16
+ return i === "eip1559" ? K(e, r) : i === "eip2930" ? M(e, r) : i === "eip4844" ? J(e, r) : i === "eip7702" ? D(e, r) : N(e, r);
17
+ }
18
+ function D(e, r) {
19
+ const { authorizationList: i, chainId: s, gas: n, nonce: c, to: f, value: a, maxFeePerGas: x, maxPriorityFeePerGas: t, accessList: p, data: l } = e;
20
+ S(e);
21
+ const d = v(p), m = w(i);
22
+ return h([
23
+ "0x04",
24
+ y([
25
+ o(s),
26
+ c ? o(c) : "0x",
27
+ t ? o(t) : "0x",
28
+ x ? o(x) : "0x",
29
+ n ? o(n) : "0x",
30
+ f ?? "0x",
31
+ a ? o(a) : "0x",
32
+ l ?? "0x",
33
+ d,
34
+ m,
35
+ ...I(e, r)
36
+ ])
37
+ ]);
38
+ }
39
+ function J(e, r) {
40
+ const { chainId: i, gas: s, nonce: n, to: c, value: f, maxFeePerBlobGas: a, maxFeePerGas: x, maxPriorityFeePerGas: t, accessList: p, data: l } = e;
41
+ _(e);
42
+ let d = e.blobVersionedHashes, m = e.sidecars;
43
+ if (e.blobs && (typeof d > "u" || typeof m > "u")) {
44
+ const u = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((P) => k(P)), z = e.kzg, b = g({
45
+ blobs: u,
46
+ kzg: z
47
+ });
48
+ if (typeof d > "u" && (d = V({
49
+ commitments: b
50
+ })), typeof m > "u") {
51
+ const P = B({ blobs: u, commitments: b, kzg: z });
52
+ m = C({ blobs: u, commitments: b, proofs: P });
53
+ }
54
+ }
55
+ const L = v(p), E = [
56
+ o(i),
57
+ n ? o(n) : "0x",
58
+ t ? o(t) : "0x",
59
+ x ? o(x) : "0x",
60
+ s ? o(s) : "0x",
61
+ c ?? "0x",
62
+ f ? o(f) : "0x",
63
+ l ?? "0x",
64
+ L,
65
+ a ? o(a) : "0x",
66
+ d ?? [],
67
+ ...I(e, r)
68
+ ], A = [], F = [], G = [];
69
+ if (m)
70
+ for (let u = 0; u < m.length; u++) {
71
+ const { blob: z, commitment: b, proof: P } = m[u];
72
+ A.push(z), F.push(b), G.push(P);
73
+ }
74
+ return h([
75
+ "0x03",
76
+ m ? (
77
+ // If sidecars are enabled, envelope turns into a "wrapper":
78
+ y([E, A, F, G])
79
+ ) : (
80
+ // If sidecars are disabled, standard envelope is used:
81
+ y(E)
82
+ )
83
+ ]);
84
+ }
85
+ function K(e, r) {
86
+ const { chainId: i, gas: s, nonce: n, to: c, value: f, maxFeePerGas: a, maxPriorityFeePerGas: x, accessList: t, data: p } = e;
87
+ R(e);
88
+ const l = v(t), d = [
89
+ o(i),
90
+ n ? o(n) : "0x",
91
+ x ? o(x) : "0x",
92
+ a ? o(a) : "0x",
93
+ s ? o(s) : "0x",
94
+ c ?? "0x",
95
+ f ? o(f) : "0x",
96
+ p ?? "0x",
97
+ l,
98
+ ...I(e, r)
99
+ ];
100
+ return h([
101
+ "0x02",
102
+ y(d)
103
+ ]);
104
+ }
105
+ function M(e, r) {
106
+ const { chainId: i, gas: s, data: n, nonce: c, to: f, value: a, accessList: x, gasPrice: t } = e;
107
+ Y(e);
108
+ const p = v(x), l = [
109
+ o(i),
110
+ c ? o(c) : "0x",
111
+ t ? o(t) : "0x",
112
+ s ? o(s) : "0x",
113
+ f ?? "0x",
114
+ a ? o(a) : "0x",
115
+ n ?? "0x",
116
+ p,
117
+ ...I(e, r)
118
+ ];
119
+ return h([
120
+ "0x01",
121
+ y(l)
122
+ ]);
123
+ }
124
+ function N(e, r) {
125
+ const { chainId: i = 0, gas: s, data: n, nonce: c, to: f, value: a, gasPrice: x } = e;
126
+ j(e);
127
+ let t = [
128
+ c ? o(c) : "0x",
129
+ x ? o(x) : "0x",
130
+ s ? o(s) : "0x",
131
+ f ?? "0x",
132
+ a ? o(a) : "0x",
133
+ n ?? "0x"
134
+ ];
135
+ if (r) {
136
+ const p = (() => {
137
+ if (r.v >= 35n)
138
+ return (r.v - 35n) / 2n > 0 ? r.v : 27n + (r.v === 35n ? 0n : 1n);
139
+ if (i > 0)
140
+ return BigInt(i * 2) + BigInt(35n + r.v - 27n);
141
+ const m = 27n + (r.v === 27n ? 0n : 1n);
142
+ if (r.v !== m)
143
+ throw new H({ v: r.v });
144
+ return m;
145
+ })(), l = T(r.r), d = T(r.s);
146
+ t = [
147
+ ...t,
148
+ o(p),
149
+ l === "0x00" ? "0x" : l,
150
+ d === "0x00" ? "0x" : d
151
+ ];
152
+ } else i > 0 && (t = [
153
+ ...t,
154
+ o(i),
155
+ "0x",
156
+ "0x"
157
+ ]);
158
+ return y(t);
159
+ }
160
+ function I(e, r) {
161
+ const i = r ?? e, { v: s, yParity: n } = i;
162
+ if (typeof i.r > "u")
163
+ return [];
164
+ if (typeof i.s > "u")
165
+ return [];
166
+ if (typeof s > "u" && typeof n > "u")
167
+ return [];
168
+ const c = T(i.r), f = T(i.s);
169
+ return [typeof n == "number" ? n ? o(1) : "0x" : s === 0n ? "0x" : s === 1n ? o(1) : s === 27n ? "0x" : o(1), c === "0x00" ? "0x" : c, f === "0x00" ? "0x" : f];
170
+ }
171
+ export {
172
+ te as serializeTransaction,
173
+ I as toYParitySignatureArray
174
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index59.cjs");class i extends n.BaseError{constructor({max:e,min:r,signed:s,size:t,value:a}){super(`Number "${a}" is not in safe ${t?`${t*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}class u extends n.BaseError{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}exports.IntegerOutOfRangeError=i;exports.SizeOverflowError=u;
@@ -0,0 +1,15 @@
1
+ import { BaseError as t } from "./index59.js";
2
+ class $ extends t {
3
+ constructor({ max: e, min: r, signed: s, size: n, value: a }) {
4
+ super(`Number "${a}" is not in safe ${n ? `${n * 8}-bit ${s ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" });
5
+ }
6
+ }
7
+ class c extends t {
8
+ constructor({ givenSize: e, maxSize: r }) {
9
+ super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
10
+ }
11
+ }
12
+ export {
13
+ $ as IntegerOutOfRangeError,
14
+ c as SizeOverflowError
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index60.cjs");function i(e){return t.isHex(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}exports.size=i;
@@ -0,0 +1,7 @@
1
+ import { isHex as r } from "./index60.js";
2
+ function i(t) {
3
+ return r(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
4
+ }
5
+ export {
6
+ i as size
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@gardenfi/utils"),E=require("viem"),r=require("@catalogfi/utils"),S=require("./index7.cjs"),g=require("./index13.cjs"),v=require("./index6.cjs");class _{constructor(e,i,a){this.url=new s.Url("/relayer",i),this.auth=a,this.order=e}async init(e,i){if(!e.account)return r.Err("No account found");if(e.account.address.toLowerCase()!==this.order.source_swap.initiator.toLowerCase())return r.Err("Account address and order initiator mismatch");if(!i){const o=await s.fetchEVMBlockNumber(e);if(o.error)return r.Err(o.error);i=o.val}if(S.ParseSwapStatus(this.order.source_swap,i)!==v.SwapStatus.Idle)return r.Err("Invalid swap status");const{create_order:t,source_swap:n}=this.order;if(!n.amount||!n.redeemer||!t.timelock||!t.secret_hash)return r.Err("Invalid order");const p=s.with0x(t.secret_hash),y=BigInt(t.timelock),w=s.with0x(n.redeemer),d=BigInt(n.amount);try{const o=await this.auth.getToken();if(o.error)return r.Err(o.error);const h=E.getContract({address:s.with0x(this.order.source_swap.asset),abi:g.AtomicSwapABI,client:e}),f=await h.read.token(),m=await s.checkAllowanceAndApprove(Number(d),f,this.order.source_swap.asset,e);if(m.error)return r.Err(m.error);const c=await h.read.eip712Domain(),l=await e.signTypedData({account:e.account,domain:{name:c[1],version:c[2],chainId:Number(c[3]),verifyingContract:c[4]},types:{Initiate:[{name:"redeemer",type:"address"},{name:"timelock",type:"uint256"},{name:"amount",type:"uint256"},{name:"secretHash",type:"bytes32"}]},primaryType:"Initiate",message:{redeemer:w,timelock:y,amount:d,secretHash:p}}),u=await r.Fetcher.post(this.url.endpoint("initiate"),{body:JSON.stringify({order_id:t.create_id,signature:l,perform_on:"Source"}),headers:{Authorization:s.Authorization(o.val),"Content-Type":"application/json"}});return u.error?r.Err(u.error):u.result?r.Ok(u.result):r.Err("Init: No result found")}catch(o){return console.log("init error :",o),r.Err(String(o))}}async redeem(e,i){try{const a=await this.auth.getToken();if(a.error)return r.Err(a.error);const t=await r.Fetcher.post(this.url.endpoint("redeem"),{body:JSON.stringify({order_id:e,secret:r.trim0x(i),perform_on:"Destination"}),headers:{Authorization:s.Authorization(a.val),"Content-Type":"application/json"}});return t.error?r.Err(t.error):t.result?r.Ok(t.result):r.Err("Redeem: No result found")}catch(a){return r.Err(String(a))}}}exports.EvmRelay=_;