@gardenfi/utils 3.0.0-beta.1 → 3.0.0-beta.2

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 (458) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +36 -35
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +4 -4
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +125 -3
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +5 -26
  9. package/dist/index102.cjs +1 -2
  10. package/dist/index102.js +20 -23
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +45 -9
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +38 -8
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +6 -10
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +90 -11
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +14 -13
  21. package/dist/index108.cjs +1 -1
  22. package/dist/index108.js +3 -14
  23. package/dist/index109.cjs +1 -1
  24. package/dist/index109.js +26 -4
  25. package/dist/index110.cjs +2 -1
  26. package/dist/index110.js +24 -6
  27. package/dist/index111.cjs +1 -1
  28. package/dist/index111.js +9 -18
  29. package/dist/index112.cjs +1 -1
  30. package/dist/index112.js +8 -13
  31. package/dist/index113.cjs +1 -1
  32. package/dist/index113.js +10 -6
  33. package/dist/index114.cjs +1 -1
  34. package/dist/index114.js +11 -7
  35. package/dist/index115.cjs +1 -1
  36. package/dist/index115.js +13 -21
  37. package/dist/index116.cjs +1 -1
  38. package/dist/index116.js +21 -7
  39. package/dist/index117.cjs +1 -1
  40. package/dist/index117.js +14 -21
  41. package/dist/index118.cjs +1 -1
  42. package/dist/index118.js +4 -17
  43. package/dist/index119.cjs +1 -1
  44. package/dist/index119.js +5 -39
  45. package/dist/index120.cjs +1 -1
  46. package/dist/index120.js +18 -21
  47. package/dist/index121.cjs +1 -1
  48. package/dist/index121.js +10 -80
  49. package/dist/index122.cjs +1 -1
  50. package/dist/index122.js +57 -10
  51. package/dist/index123.cjs +1 -1
  52. package/dist/index123.js +6 -58
  53. package/dist/index124.cjs +1 -1
  54. package/dist/index124.js +13 -13
  55. package/dist/index125.cjs +1 -1
  56. package/dist/index125.js +7 -8
  57. package/dist/index126.cjs +1 -1
  58. package/dist/index126.js +137 -20
  59. package/dist/index127.cjs +1 -1
  60. package/dist/index127.js +7 -6
  61. package/dist/index128.cjs +1 -1
  62. package/dist/index128.js +19 -33
  63. package/dist/index129.cjs +1 -1
  64. package/dist/index129.js +17 -32
  65. package/dist/index130.cjs +1 -1
  66. package/dist/index130.js +43 -9
  67. package/dist/index131.cjs +1 -1
  68. package/dist/index131.js +20 -49
  69. package/dist/index132.cjs +1 -1
  70. package/dist/index132.js +79 -18
  71. package/dist/index133.cjs +1 -1
  72. package/dist/index133.js +10 -105
  73. package/dist/index134.cjs +1 -1
  74. package/dist/index134.js +8 -63
  75. package/dist/index135.cjs +1 -1
  76. package/dist/index135.js +6 -9
  77. package/dist/index136.cjs +1 -1
  78. package/dist/index136.js +41 -71
  79. package/dist/index137.cjs +1 -2
  80. package/dist/index137.js +6 -3
  81. package/dist/index138.cjs +1 -1
  82. package/dist/index138.js +14 -9
  83. package/dist/index139.cjs +1 -1
  84. package/dist/index139.js +34 -13
  85. package/dist/index140.cjs +1 -1
  86. package/dist/index140.js +55 -4
  87. package/dist/index141.cjs +1 -1
  88. package/dist/index141.js +24 -11
  89. package/dist/index142.cjs +1 -1
  90. package/dist/index142.js +7 -2
  91. package/dist/index143.cjs +1 -1
  92. package/dist/index143.js +19 -32
  93. package/dist/index144.cjs +1 -1
  94. package/dist/index144.js +15 -21
  95. package/dist/index145.cjs +1 -1
  96. package/dist/index145.js +5 -5
  97. package/dist/index146.cjs +1 -1
  98. package/dist/index146.js +13 -5
  99. package/dist/index147.cjs +1 -1
  100. package/dist/index147.js +10 -5
  101. package/dist/index148.cjs +1 -9
  102. package/dist/index148.js +10 -33
  103. package/dist/index149.cjs +1 -1
  104. package/dist/index149.js +12 -3
  105. package/dist/index150.cjs +1 -1
  106. package/dist/index150.js +8 -18
  107. package/dist/index151.cjs +1 -1
  108. package/dist/index151.js +3 -20
  109. package/dist/index152.cjs +1 -1
  110. package/dist/index152.js +16 -35
  111. package/dist/index153.cjs +1 -1
  112. package/dist/index153.js +5 -8
  113. package/dist/index154.cjs +1 -4
  114. package/dist/index154.js +163 -186
  115. package/dist/index155.cjs +1 -1
  116. package/dist/index155.js +98 -22
  117. package/dist/index156.cjs +1 -1
  118. package/dist/index156.js +33 -161
  119. package/dist/index157.cjs +1 -1
  120. package/dist/index157.js +8 -126
  121. package/dist/index158.cjs +1 -1
  122. package/dist/index158.js +60 -27
  123. package/dist/index159.cjs +1 -1
  124. package/dist/index159.js +19 -55
  125. package/dist/index160.cjs +1 -1
  126. package/dist/index160.js +103 -188
  127. package/dist/index161.cjs +1 -1
  128. package/dist/index161.js +79 -4
  129. package/dist/index162.cjs +1 -1
  130. package/dist/index162.js +7 -18
  131. package/dist/index163.cjs +1 -1
  132. package/dist/index163.js +72 -3
  133. package/dist/index164.cjs +2 -1
  134. package/dist/index164.js +3 -17
  135. package/dist/index165.cjs +1 -1
  136. package/dist/index165.js +9 -12
  137. package/dist/index166.cjs +1 -1
  138. package/dist/index166.js +11 -32
  139. package/dist/index167.cjs +1 -1
  140. package/dist/index167.js +5 -3
  141. package/dist/index168.cjs +1 -1
  142. package/dist/index168.js +2 -28
  143. package/dist/index169.cjs +1 -1
  144. package/dist/index169.js +32 -9
  145. package/dist/index17.cjs +1 -1
  146. package/dist/index17.js +2 -2
  147. package/dist/index170.cjs +1 -1
  148. package/dist/index170.js +18 -22
  149. package/dist/index171.cjs +1 -1
  150. package/dist/index171.js +5 -28
  151. package/dist/index172.cjs +1 -1
  152. package/dist/index172.js +5 -3
  153. package/dist/index173.cjs +1 -1
  154. package/dist/index173.js +5 -6
  155. package/dist/index174.cjs +9 -1
  156. package/dist/index174.js +35 -6
  157. package/dist/index175.cjs +1 -1
  158. package/dist/index175.js +3 -33
  159. package/dist/index176.cjs +1 -1
  160. package/dist/index176.js +19 -5
  161. package/dist/index177.cjs +1 -1
  162. package/dist/index177.js +14 -31
  163. package/dist/index178.cjs +1 -1
  164. package/dist/index178.js +32 -46
  165. package/dist/index179.cjs +1 -1
  166. package/dist/index179.js +8 -32
  167. package/dist/index18.cjs +1 -1
  168. package/dist/index18.js +5 -5
  169. package/dist/index180.cjs +4 -1
  170. package/dist/index180.js +194 -8
  171. package/dist/index181.cjs +1 -1
  172. package/dist/index181.js +25 -40
  173. package/dist/index182.cjs +1 -1
  174. package/dist/index182.js +160 -50
  175. package/dist/index183.cjs +1 -1
  176. package/dist/index183.js +125 -102
  177. package/dist/index184.cjs +1 -1
  178. package/dist/index184.js +28 -3
  179. package/dist/index185.cjs +1 -1
  180. package/dist/index185.js +191 -5
  181. package/dist/index186.cjs +1 -1
  182. package/dist/index186.js +4 -4
  183. package/dist/index187.cjs +1 -1
  184. package/dist/index187.js +20 -17
  185. package/dist/index188.cjs +1 -1
  186. package/dist/index188.js +3 -6
  187. package/dist/index189.cjs +1 -1
  188. package/dist/index189.js +16 -8
  189. package/dist/index190.cjs +1 -1
  190. package/dist/index190.js +31 -100
  191. package/dist/index191.cjs +1 -1
  192. package/dist/index191.js +3 -6
  193. package/dist/index192.cjs +1 -1
  194. package/dist/index192.js +27 -6
  195. package/dist/index193.cjs +1 -1
  196. package/dist/index193.js +25 -27
  197. package/dist/index194.cjs +1 -1
  198. package/dist/index194.js +28 -34
  199. package/dist/index195.cjs +1 -1
  200. package/dist/index195.js +6 -13
  201. package/dist/index196.cjs +1 -1
  202. package/dist/index196.js +6 -78
  203. package/dist/index197.cjs +1 -1
  204. package/dist/index197.js +33 -2
  205. package/dist/index198.cjs +1 -1
  206. package/dist/index198.js +5 -19
  207. package/dist/index199.cjs +1 -1
  208. package/dist/index199.js +32 -166
  209. package/dist/index20.cjs +1 -1
  210. package/dist/index20.js +8 -8
  211. package/dist/index200.cjs +1 -1
  212. package/dist/index200.js +48 -16
  213. package/dist/index201.cjs +1 -1
  214. package/dist/index201.js +32 -10
  215. package/dist/index202.cjs +1 -1
  216. package/dist/index202.js +15 -23
  217. package/dist/index203.cjs +1 -1
  218. package/dist/index203.js +41 -17
  219. package/dist/index204.cjs +1 -1
  220. package/dist/index204.js +104 -15
  221. package/dist/index205.cjs +1 -1
  222. package/dist/index205.js +3 -6
  223. package/dist/index206.cjs +1 -1
  224. package/dist/index206.js +5 -13
  225. package/dist/index207.cjs +1 -1
  226. package/dist/index207.js +3 -10
  227. package/dist/index208.cjs +1 -1
  228. package/dist/index208.js +17 -16
  229. package/dist/index209.cjs +1 -1
  230. package/dist/index209.js +8 -24
  231. package/dist/index210.cjs +1 -1
  232. package/dist/index210.js +5 -46
  233. package/dist/index211.cjs +1 -1
  234. package/dist/index211.js +27 -9
  235. package/dist/index212.cjs +1 -2
  236. package/dist/index212.js +77 -40
  237. package/dist/index213.cjs +1 -1
  238. package/dist/index213.js +2 -2
  239. package/dist/index214.cjs +1 -1
  240. package/dist/index214.js +18 -5
  241. package/dist/index215.cjs +1 -1
  242. package/dist/index215.js +16 -9
  243. package/dist/index216.cjs +1 -1
  244. package/dist/index216.js +10 -19
  245. package/dist/index217.cjs +1 -1
  246. package/dist/index217.js +24 -8
  247. package/dist/index218.cjs +1 -1
  248. package/dist/index218.js +46 -66
  249. package/dist/index219.cjs +1 -1
  250. package/dist/index219.js +9 -65
  251. package/dist/index22.cjs +1 -1
  252. package/dist/index22.js +8 -8
  253. package/dist/index220.cjs +1 -1
  254. package/dist/index220.js +99 -184
  255. package/dist/index221.cjs +1 -1
  256. package/dist/index221.js +15 -27
  257. package/dist/index222.cjs +1 -1
  258. package/dist/index222.js +209 -71
  259. package/dist/index223.cjs +1 -1
  260. package/dist/index223.js +105 -37
  261. package/dist/index224.cjs +1 -1
  262. package/dist/index224.js +205 -15
  263. package/dist/index225.cjs +1 -1
  264. package/dist/index225.js +41 -12
  265. package/dist/index226.cjs +1 -1
  266. package/dist/index226.js +78 -11
  267. package/dist/index227.cjs +1 -1
  268. package/dist/index227.js +2 -13
  269. package/dist/index228.cjs +2 -1
  270. package/dist/index228.js +40 -18
  271. package/dist/index229.cjs +1 -1
  272. package/dist/index229.js +2 -109
  273. package/dist/index23.cjs +1 -1
  274. package/dist/index23.js +26 -12
  275. package/dist/index230.cjs +1 -1
  276. package/dist/index230.js +5 -6
  277. package/dist/index231.cjs +1 -1
  278. package/dist/index231.js +11 -7
  279. package/dist/index232.cjs +1 -1
  280. package/dist/index232.js +17 -101
  281. package/dist/index233.cjs +1 -1
  282. package/dist/index233.js +8 -26
  283. package/dist/index234.cjs +1 -1
  284. package/dist/index234.js +66 -16
  285. package/dist/index235.cjs +1 -1
  286. package/dist/index235.js +63 -212
  287. package/dist/index236.cjs +1 -1
  288. package/dist/index236.js +185 -39
  289. package/dist/index237.cjs +1 -1
  290. package/dist/index237.js +26 -76
  291. package/dist/index238.cjs +1 -1
  292. package/dist/index238.js +77 -2
  293. package/dist/index239.cjs +1 -1
  294. package/dist/index239.js +38 -9
  295. package/dist/index24.cjs +1 -1
  296. package/dist/index24.js +8 -59
  297. package/dist/index240.cjs +1 -1
  298. package/dist/index240.js +16 -19
  299. package/dist/index241.cjs +1 -2
  300. package/dist/index241.js +8 -61
  301. package/dist/index242.cjs +1 -1
  302. package/dist/index242.js +11 -14
  303. package/dist/index243.cjs +1 -1
  304. package/dist/index243.js +11 -67
  305. package/dist/index244.cjs +1 -1
  306. package/dist/index244.js +6 -657
  307. package/dist/index245.cjs +1 -1
  308. package/dist/index245.js +6 -206
  309. package/dist/index246.cjs +1 -1
  310. package/dist/index246.js +22 -173
  311. package/dist/index247.cjs +1 -1
  312. package/dist/index247.js +19 -4
  313. package/dist/index248.cjs +1 -1
  314. package/dist/index248.js +12 -2
  315. package/dist/index249.cjs +1 -0
  316. package/dist/index249.js +22 -0
  317. package/dist/index25.cjs +1 -16
  318. package/dist/index25.js +12 -113
  319. package/dist/index250.cjs +2 -0
  320. package/dist/index250.js +94 -0
  321. package/dist/index251.cjs +1 -0
  322. package/dist/index251.js +17 -0
  323. package/dist/index252.cjs +1 -0
  324. package/dist/index252.js +660 -0
  325. package/dist/index253.cjs +1 -0
  326. package/dist/index253.js +180 -0
  327. package/dist/index254.cjs +1 -0
  328. package/dist/index254.js +71 -0
  329. package/dist/index255.cjs +1 -0
  330. package/dist/index255.js +7 -0
  331. package/dist/index256.cjs +1 -0
  332. package/dist/index256.js +4 -0
  333. package/dist/index26.cjs +1 -1
  334. package/dist/index26.js +59 -30
  335. package/dist/index27.cjs +16 -1
  336. package/dist/index27.js +111 -24
  337. package/dist/index28.cjs +1 -1
  338. package/dist/index28.js +29 -7
  339. package/dist/index29.cjs +1 -1
  340. package/dist/index29.js +35 -35
  341. package/dist/index3.cjs +1 -1
  342. package/dist/index3.js +41 -24
  343. package/dist/index30.cjs +1 -1
  344. package/dist/index30.js +9 -9
  345. package/dist/index31.cjs +1 -1
  346. package/dist/index31.js +2 -2
  347. package/dist/index35.cjs +1 -1
  348. package/dist/index35.js +1 -1
  349. package/dist/index37.cjs +1 -1
  350. package/dist/index37.js +11 -11
  351. package/dist/index38.cjs +1 -1
  352. package/dist/index38.js +3 -3
  353. package/dist/index39.cjs +1 -1
  354. package/dist/index39.js +3 -3
  355. package/dist/index40.cjs +1 -1
  356. package/dist/index40.js +3 -3
  357. package/dist/index42.cjs +1 -1
  358. package/dist/index42.js +2 -2
  359. package/dist/index43.cjs +1 -1
  360. package/dist/index43.js +2 -2
  361. package/dist/index45.cjs +1 -1
  362. package/dist/index45.js +15 -15
  363. package/dist/index46.cjs +1 -1
  364. package/dist/index46.js +1 -1
  365. package/dist/index47.cjs +1 -1
  366. package/dist/index47.js +4 -4
  367. package/dist/index48.cjs +1 -1
  368. package/dist/index48.js +14 -17
  369. package/dist/index49.cjs +1 -1
  370. package/dist/index49.js +3 -3
  371. package/dist/index51.cjs +1 -1
  372. package/dist/index51.js +8 -8
  373. package/dist/index54.cjs +1 -1
  374. package/dist/index54.js +14 -14
  375. package/dist/index56.cjs +1 -1
  376. package/dist/index56.js +60 -56
  377. package/dist/index58.cjs +1 -1
  378. package/dist/index58.js +1 -1
  379. package/dist/index60.cjs +1 -1
  380. package/dist/index60.js +8 -8
  381. package/dist/index62.cjs +1 -1
  382. package/dist/index62.js +2 -2
  383. package/dist/index63.cjs +1 -1
  384. package/dist/index63.js +3 -3
  385. package/dist/index64.cjs +1 -1
  386. package/dist/index64.js +131 -76
  387. package/dist/index65.cjs +1 -1
  388. package/dist/index65.js +2 -2
  389. package/dist/index66.cjs +1 -1
  390. package/dist/index66.js +76 -6
  391. package/dist/index67.cjs +1 -1
  392. package/dist/index67.js +13 -21
  393. package/dist/index68.cjs +1 -1
  394. package/dist/index68.js +51 -8
  395. package/dist/index69.cjs +1 -1
  396. package/dist/index69.js +7 -31
  397. package/dist/index70.cjs +1 -1
  398. package/dist/index70.js +7 -7
  399. package/dist/index71.cjs +1 -1
  400. package/dist/index71.js +21 -16
  401. package/dist/index72.cjs +1 -1
  402. package/dist/index72.js +8 -73
  403. package/dist/index73.cjs +1 -1
  404. package/dist/index73.js +31 -35
  405. package/dist/index74.cjs +1 -1
  406. package/dist/index74.js +15 -15
  407. package/dist/index75.cjs +1 -1
  408. package/dist/index75.js +69 -61
  409. package/dist/index76.cjs +1 -1
  410. package/dist/index76.js +35 -11
  411. package/dist/index77.cjs +1 -1
  412. package/dist/index77.js +15 -13
  413. package/dist/index78.cjs +1 -3
  414. package/dist/index78.js +72 -92
  415. package/dist/index79.cjs +1 -1
  416. package/dist/index79.js +11 -23
  417. package/dist/index80.cjs +1 -1
  418. package/dist/index80.js +28 -32
  419. package/dist/index81.cjs +2 -1
  420. package/dist/index81.js +118 -42
  421. package/dist/index82.cjs +1 -1
  422. package/dist/index82.js +13 -5
  423. package/dist/index83.cjs +1 -1
  424. package/dist/index83.js +24 -151
  425. package/dist/index84.cjs +1 -20
  426. package/dist/index84.js +31 -324
  427. package/dist/index85.cjs +1 -3
  428. package/dist/index85.js +42 -449
  429. package/dist/index86.cjs +1 -1
  430. package/dist/index86.js +6 -64
  431. package/dist/index87.cjs +1 -1
  432. package/dist/index87.js +101 -35
  433. package/dist/index88.cjs +1 -1
  434. package/dist/index88.js +36 -14
  435. package/dist/index89.cjs +1 -1
  436. package/dist/index89.js +9 -2
  437. package/dist/index90.cjs +1 -1
  438. package/dist/index90.js +19 -15
  439. package/dist/index91.cjs +1 -1
  440. package/dist/index91.js +2 -11
  441. package/dist/index92.cjs +1 -1
  442. package/dist/index92.js +72 -122
  443. package/dist/index93.cjs +1 -1
  444. package/dist/index93.js +15 -5
  445. package/dist/index94.cjs +1 -1
  446. package/dist/index94.js +151 -21
  447. package/dist/index95.cjs +20 -1
  448. package/dist/index95.js +326 -45
  449. package/dist/index96.cjs +3 -1
  450. package/dist/index96.js +451 -38
  451. package/dist/index97.cjs +1 -1
  452. package/dist/index97.js +64 -6
  453. package/dist/index98.cjs +1 -1
  454. package/dist/index98.js +15 -87
  455. package/dist/index99.cjs +1 -1
  456. package/dist/index99.js +10 -14
  457. package/dist/src/lib/utils.d.ts +15 -0
  458. package/package.json +3 -3
package/dist/index201.js CHANGED
@@ -1,13 +1,35 @@
1
- function a(r, n) {
2
- let t = r.toString();
3
- const i = t.startsWith("-");
4
- i && (t = t.slice(1)), t = t.padStart(n, "0");
5
- let [l, e] = [
6
- t.slice(0, t.length - n),
7
- t.slice(t.length - n)
8
- ];
9
- return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
1
+ import { batchGatewayAbi as o } from "./index21.js";
2
+ import { solidityError as l } from "./index169.js";
3
+ import { decodeFunctionData as f } from "./index189.js";
4
+ import { encodeErrorResult as n } from "./index192.js";
5
+ import { encodeFunctionResult as p } from "./index194.js";
6
+ const d = "x-batch-gateway:true";
7
+ async function g(t) {
8
+ const { data: i, ccipRequest: c } = t, { args: [u] } = f({ abi: o, data: i }), e = [], s = [];
9
+ return await Promise.all(u.map(async (r, a) => {
10
+ try {
11
+ s[a] = r.urls.includes(d) ? await g({ data: r.data, ccipRequest: c }) : await c(r), e[a] = !1;
12
+ } catch (m) {
13
+ e[a] = !0, s[a] = h(m);
14
+ }
15
+ })), p({
16
+ abi: o,
17
+ functionName: "query",
18
+ result: [e, s]
19
+ });
20
+ }
21
+ function h(t) {
22
+ return t.name === "HttpRequestError" && t.status ? n({
23
+ abi: o,
24
+ errorName: "HttpError",
25
+ args: [t.status, t.shortMessage]
26
+ }) : n({
27
+ abi: [l],
28
+ errorName: "Error",
29
+ args: ["shortMessage" in t ? t.shortMessage : t.message]
30
+ });
10
31
  }
11
32
  export {
12
- a as formatUnits
33
+ g as localBatchGatewayRequest,
34
+ d as localBatchGatewayUrl
13
35
  };
package/dist/index202.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index141.cjs"),t=require("./index165.cjs");function i(s){if(typeof s=="string"){if(!t.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!t.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,signAuthorization:s.signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(r){const n={formatters:void 0,fees:void 0,serializers:void 0,...r};function t(i){return e=>{const s=typeof e=="function"?e(i):e,o={...i,...s};return Object.assign(o,{extend:t(o)})}}return Object.assign(n,{extend:t(n)})}exports.defineChain=c;
package/dist/index202.js CHANGED
@@ -1,28 +1,20 @@
1
- import { InvalidAddressError as s } from "./index141.js";
2
- import { isAddress as a } from "./index165.js";
3
- function r(n) {
4
- if (typeof n == "string") {
5
- if (!a(n, { strict: !1 }))
6
- throw new s({ address: n });
7
- return {
8
- address: n,
9
- type: "json-rpc"
1
+ function r(c) {
2
+ const n = {
3
+ formatters: void 0,
4
+ fees: void 0,
5
+ serializers: void 0,
6
+ ...c
7
+ };
8
+ function t(i) {
9
+ return (e) => {
10
+ const o = typeof e == "function" ? e(i) : e, s = { ...i, ...o };
11
+ return Object.assign(s, { extend: t(s) });
10
12
  };
11
13
  }
12
- if (!a(n.address, { strict: !1 }))
13
- throw new s({ address: n.address });
14
- return {
15
- address: n.address,
16
- nonceManager: n.nonceManager,
17
- sign: n.sign,
18
- signAuthorization: n.signAuthorization,
19
- signMessage: n.signMessage,
20
- signTransaction: n.signTransaction,
21
- signTypedData: n.signTypedData,
22
- source: "custom",
23
- type: "local"
24
- };
14
+ return Object.assign(n, {
15
+ extend: t(n)
16
+ });
25
17
  }
26
18
  export {
27
- r as toAccount
19
+ r as defineChain
28
20
  };
package/dist/index203.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index194.cjs"),l=require("./index172.cjs"),y=require("./index159.cjs"),i=require("./index42.cjs"),x=require("./index195.cjs");let r=!1;async function g({hash:n,privateKey:o,to:e="object"}){const{r:c,s:u,recovery:t}=a.secp256k1.sign(n.slice(2),o.slice(2),{lowS:!0,extraEntropy:l.isHex(r,{strict:!1})?y.hexToBytes(r):r}),s={r:i.numberToHex(c,{size:32}),s:i.numberToHex(u,{size:32}),v:t?28n:27n,yParity:t};return e==="bytes"||e==="hex"?x.serializeSignature({...s,to:e}):s}exports.sign=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index35.cjs"),u=require("./index183.cjs"),f=require("./index140.cjs"),g=require("./index42.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;
package/dist/index203.js CHANGED
@@ -1,21 +1,45 @@
1
- import { secp256k1 as a } from "./index194.js";
2
- import { isHex as f } from "./index172.js";
3
- import { hexToBytes as p } from "./index159.js";
4
- import { numberToHex as s } from "./index42.js";
5
- import { serializeSignature as u } from "./index195.js";
6
- let e = !1;
7
- async function z({ hash: o, privateKey: n, to: r = "object" }) {
8
- const { r: m, s: c, recovery: t } = a.sign(o.slice(2), n.slice(2), {
9
- lowS: !0,
10
- extraEntropy: f(e, { strict: !1 }) ? p(e) : e
11
- }), i = {
12
- r: s(m, { size: 32 }),
13
- s: s(c, { size: 32 }),
14
- v: t ? 28n : 27n,
15
- yParity: t
1
+ import { BaseError as l } from "./index35.js";
2
+ import { createCursor as r } from "./index183.js";
3
+ import { hexToBytes as g } from "./index140.js";
4
+ import { bytesToHex as u } from "./index42.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
+ }
16
21
  };
17
- return r === "bytes" || r === "hex" ? u({ ...i, to: r }) : i;
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.");
18
42
  }
19
43
  export {
20
- z as sign
44
+ m as toRlp
21
45
  };
package/dist/index204.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index208.cjs"),a=require("./index203.cjs");async function u(t){const{chainId:n,nonce:i,privateKey:r,to:o="object"}=t,s=t.contractAddress??t.address,e=await a.sign({hash:c.hashAuthorization({address:s,chainId:n,nonce:i}),privateKey:r,to:o});return o==="object"?{address:s,chainId:n,nonce:i,...e}:e}exports.signAuthorization=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index247.cjs"),c=require("./index223.cjs"),A=BigInt(0),u=BigInt(1),H=BigInt(2),L=BigInt(7),S=BigInt(256),T=BigInt(113),O=[],y=[],w=[];for(let n=0,t=u,s=1,i=0;n<24;n++){[s,i]=[i,(2*s+3*i)%5],O.push(2*(5*i+s)),y.push((n+1)*(n+2)/2%64);let o=A;for(let r=0;r<7;r++)t=(t<<u^(t>>L)*T)%S,t&H&&(o^=u<<(u<<BigInt(r))-u);w.push(o)}const _=f.split(w,!0),F=_[0],X=_[1],I=(n,t,s)=>s>32?f.rotlBH(n,t,s):f.rotlSH(n,t,s),x=(n,t,s)=>s>32?f.rotlBL(n,t,s):f.rotlSL(n,t,s);function b(n,t=24){const s=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let e=0;e<10;e++)s[e]=n[e]^n[e+10]^n[e+20]^n[e+30]^n[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,l=(e+2)%10,p=s[l],a=s[l+1],g=I(p,a,1)^s[h],B=x(p,a,1)^s[h+1];for(let d=0;d<50;d+=10)n[e+d]^=g,n[e+d+1]^=B}let o=n[2],r=n[3];for(let e=0;e<24;e++){const h=y[e],l=I(o,r,h),p=x(o,r,h),a=O[e];o=n[a],r=n[a+1],n[a]=l,n[a+1]=p}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=n[e+h];for(let h=0;h<10;h++)n[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}n[0]^=F[i],n[1]^=X[i]}c.clean(s)}class k extends c.Hash{constructor(t,s,i,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=s,this.outputLen=i,this.enableXOF=o,this.rounds=r,c.anumber(i),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}clone(){return this._cloneInto()}keccak(){c.swap32IfBE(this.state32),b(this.state32,this.rounds),c.swap32IfBE(this.state32),this.posOut=0,this.pos=0}update(t){c.aexists(this),t=c.toBytes(t),c.abytes(t);const{blockLen:s,state:i}=this,o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)i[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:i,blockLen:o}=this;t[i]^=s,s&128&&i===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){c.aexists(this,!1),c.abytes(t),this.finish();const s=this.state,{blockLen:i}=this;for(let o=0,r=t.length;o<r;){this.posOut>=i&&this.keccak();const e=Math.min(i-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return c.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(c.aoutput(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,c.clean(this.state)}_cloneInto(t){const{blockLen:s,suffix:i,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new k(s,i,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=i,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const m=(n,t,s)=>c.createHasher(()=>new k(t,n,s)),E=m(1,136,256/8);exports.Keccak=k;exports.keccakP=b;exports.keccak_256=E;
package/dist/index204.js CHANGED
@@ -1,18 +1,107 @@
1
- import { hashAuthorization as a } from "./index208.js";
2
- import { sign as e } from "./index203.js";
3
- async function u(t) {
4
- const { chainId: o, nonce: n, privateKey: c, to: i = "object" } = t, r = t.contractAddress ?? t.address, s = await e({
5
- hash: a({ address: r, chainId: o, nonce: n }),
6
- privateKey: c,
7
- to: i
8
- });
9
- return i === "object" ? {
10
- address: r,
11
- chainId: o,
12
- nonce: n,
13
- ...s
14
- } : s;
1
+ import { split as L, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./index247.js";
2
+ import { createHasher as X, Hash as E, anumber as d, u32 as U, swap32IfBE as I, aexists as x, toBytes as P, abytes as k, aoutput as M, clean as y } from "./index223.js";
3
+ const R = BigInt(0), f = BigInt(1), j = BigInt(2), q = BigInt(7), v = BigInt(256), z = BigInt(113), _ = [], g = [], B = [];
4
+ for (let n = 0, t = f, s = 1, i = 0; n < 24; n++) {
5
+ [s, i] = [i, (2 * s + 3 * i) % 5], _.push(2 * (5 * i + s)), g.push((n + 1) * (n + 2) / 2 % 64);
6
+ let o = R;
7
+ for (let r = 0; r < 7; r++)
8
+ t = (t << f ^ (t >> q) * z) % v, t & j && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
9
+ B.push(o);
15
10
  }
11
+ const A = L(B, !0), C = A[0], D = A[1], O = (n, t, s) => s > 32 ? m(n, t, s) : T(n, t, s), w = (n, t, s) => s > 32 ? F(n, t, s) : S(n, t, s);
12
+ function G(n, t = 24) {
13
+ const s = new Uint32Array(10);
14
+ for (let i = 24 - t; i < 24; i++) {
15
+ for (let e = 0; e < 10; e++)
16
+ s[e] = n[e] ^ n[e + 10] ^ n[e + 20] ^ n[e + 30] ^ n[e + 40];
17
+ for (let e = 0; e < 10; e += 2) {
18
+ const h = (e + 8) % 10, l = (e + 2) % 10, u = s[l], c = s[l + 1], b = O(u, c, 1) ^ s[h], H = w(u, c, 1) ^ s[h + 1];
19
+ for (let a = 0; a < 50; a += 10)
20
+ n[e + a] ^= b, n[e + a + 1] ^= H;
21
+ }
22
+ let o = n[2], r = n[3];
23
+ for (let e = 0; e < 24; e++) {
24
+ const h = g[e], l = O(o, r, h), u = w(o, r, h), c = _[e];
25
+ o = n[c], r = n[c + 1], n[c] = l, n[c + 1] = u;
26
+ }
27
+ for (let e = 0; e < 50; e += 10) {
28
+ for (let h = 0; h < 10; h++)
29
+ s[h] = n[e + h];
30
+ for (let h = 0; h < 10; h++)
31
+ n[e + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
32
+ }
33
+ n[0] ^= C[i], n[1] ^= D[i];
34
+ }
35
+ y(s);
36
+ }
37
+ class p extends E {
38
+ // NOTE: we accept arguments in bytes instead of bits here.
39
+ constructor(t, s, i, o = !1, r = 24) {
40
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = s, this.outputLen = i, this.enableXOF = o, this.rounds = r, d(i), !(0 < t && t < 200))
41
+ throw new Error("only keccak-f1600 function is supported");
42
+ this.state = new Uint8Array(200), this.state32 = U(this.state);
43
+ }
44
+ clone() {
45
+ return this._cloneInto();
46
+ }
47
+ keccak() {
48
+ I(this.state32), G(this.state32, this.rounds), I(this.state32), this.posOut = 0, this.pos = 0;
49
+ }
50
+ update(t) {
51
+ x(this), t = P(t), k(t);
52
+ const { blockLen: s, state: i } = this, o = t.length;
53
+ for (let r = 0; r < o; ) {
54
+ const e = Math.min(s - this.pos, o - r);
55
+ for (let h = 0; h < e; h++)
56
+ i[this.pos++] ^= t[r++];
57
+ this.pos === s && this.keccak();
58
+ }
59
+ return this;
60
+ }
61
+ finish() {
62
+ if (this.finished)
63
+ return;
64
+ this.finished = !0;
65
+ const { state: t, suffix: s, pos: i, blockLen: o } = this;
66
+ t[i] ^= s, s & 128 && i === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
67
+ }
68
+ writeInto(t) {
69
+ x(this, !1), k(t), this.finish();
70
+ const s = this.state, { blockLen: i } = this;
71
+ for (let o = 0, r = t.length; o < r; ) {
72
+ this.posOut >= i && this.keccak();
73
+ const e = Math.min(i - this.posOut, r - o);
74
+ t.set(s.subarray(this.posOut, this.posOut + e), o), this.posOut += e, o += e;
75
+ }
76
+ return t;
77
+ }
78
+ xofInto(t) {
79
+ if (!this.enableXOF)
80
+ throw new Error("XOF is not possible for this instance");
81
+ return this.writeInto(t);
82
+ }
83
+ xof(t) {
84
+ return d(t), this.xofInto(new Uint8Array(t));
85
+ }
86
+ digestInto(t) {
87
+ if (M(t, this), this.finished)
88
+ throw new Error("digest() was already called");
89
+ return this.writeInto(t), this.destroy(), t;
90
+ }
91
+ digest() {
92
+ return this.digestInto(new Uint8Array(this.outputLen));
93
+ }
94
+ destroy() {
95
+ this.destroyed = !0, y(this.state);
96
+ }
97
+ _cloneInto(t) {
98
+ const { blockLen: s, suffix: i, outputLen: o, rounds: r, enableXOF: e } = this;
99
+ return t || (t = new p(s, i, o, e, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = i, t.outputLen = o, t.enableXOF = e, t.destroyed = this.destroyed, t;
100
+ }
101
+ }
102
+ const J = (n, t, s) => X(() => new p(t, n, s)), Q = J(1, 136, 256 / 8);
16
103
  export {
17
- u as signAuthorization
104
+ p as Keccak,
105
+ G as keccakP,
106
+ Q as keccak_256
18
107
  };
package/dist/index205.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index188.cjs"),n=require("./index203.cjs");async function t({message:e,privateKey:s}){return await n.sign({hash:a.hashMessage(e),privateKey:s,to:"hex"})}exports.signMessage=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index220.cjs"),s=e.sha256;exports.sha256=s;
package/dist/index205.js CHANGED
@@ -1,8 +1,5 @@
1
- import { hashMessage as e } from "./index188.js";
2
- import { sign as o } from "./index203.js";
3
- async function i({ message: s, privateKey: a }) {
4
- return await o({ hash: e(s), privateKey: a, to: "hex" });
5
- }
1
+ import { sha256 as s } from "./index220.js";
2
+ const o = s;
6
3
  export {
7
- i as signMessage
4
+ o as sha256
8
5
  };
package/dist/index206.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index169.cjs"),c=require("./index199.cjs"),o=require("./index203.cjs");async function u(i){const{privateKey:r,transaction:e,serializer:n=c.serializeTransaction}=i,a=e.type==="eip4844"?{...e,sidecars:!1}:e,s=await o.sign({hash:t.keccak256(n(a)),privateKey:r});return n(e,s)}exports.signTransaction=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index244.cjs"),r=require("./index245.cjs");function n(t){return e.hashSignature(r.toSignature(t))}exports.toSignatureHash=n;
package/dist/index206.js CHANGED
@@ -1,16 +1,8 @@
1
- import { keccak256 as e } from "./index169.js";
2
- import { serializeTransaction as o } from "./index199.js";
3
- import { sign as c } from "./index203.js";
4
- async function u(n) {
5
- const { privateKey: a, transaction: r, serializer: i = o } = n, t = r.type === "eip4844" ? {
6
- ...r,
7
- sidecars: !1
8
- } : r, s = await c({
9
- hash: e(i(t)),
10
- privateKey: a
11
- });
12
- return i(r, s);
1
+ import { hashSignature as t } from "./index244.js";
2
+ import { toSignature as o } from "./index245.js";
3
+ function a(r) {
4
+ return t(o(r));
13
5
  }
14
6
  export {
15
- u as signTransaction
7
+ a as toSignatureHash
16
8
  };
package/dist/index207.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index190.cjs"),s=require("./index203.cjs");async function i(e){const{privateKey:t,...a}=e;return await s.sign({hash:n.hashTypedData(a),privateKey:t,to:"hex"})}exports.signTypedData=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function i(e){return new Promise(t=>setTimeout(t,e))}exports.wait=i;
package/dist/index207.js CHANGED
@@ -1,13 +1,6 @@
1
- import { hashTypedData as o } from "./index190.js";
2
- import { sign as r } from "./index203.js";
3
- async function p(t) {
4
- const { privateKey: a, ...e } = t;
5
- return await r({
6
- hash: o(e),
7
- privateKey: a,
8
- to: "hex"
9
- });
1
+ async function n(e) {
2
+ return new Promise((t) => setTimeout(t, e));
10
3
  }
11
4
  export {
12
- p as signTypedData
5
+ n as wait
13
6
  };
package/dist/index208.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index111.cjs"),u=require("./index159.cjs"),c=require("./index42.cjs"),a=require("./index181.cjs"),h=require("./index169.cjs");function d(e){const{chainId:t,nonce:o,to:r}=e,s=e.contractAddress??e.address,n=h.keccak256(i.concatHex(["0x05",a.toRlp([t?c.numberToHex(t):"0x",s,o?c.numberToHex(o):"0x"])]));return r==="bytes"?u.hexToBytes(n):n}exports.hashAuthorization=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u(n,{errorInstance:r=new Error("timed out"),timeout:i,signal:a}){return new Promise((l,e)=>{(async()=>{let o;try{const t=new AbortController;i>0&&(o=setTimeout(()=>{a&&t.abort()},i)),l(await n({signal:(t==null?void 0:t.signal)||null}))}catch(t){(t==null?void 0:t.name)==="AbortError"&&e(r),e(t)}finally{clearTimeout(o)}})()})}exports.withTimeout=u;
package/dist/index208.js CHANGED
@@ -1,19 +1,20 @@
1
- import { concatHex as i } from "./index111.js";
2
- import { hexToBytes as m } from "./index159.js";
3
- import { numberToHex as c } from "./index42.js";
4
- import { toRlp as d } from "./index181.js";
5
- import { keccak256 as f } from "./index169.js";
6
- function b(o) {
7
- const { chainId: t, nonce: r, to: s } = o, e = o.contractAddress ?? o.address, n = f(i([
8
- "0x05",
9
- d([
10
- t ? c(t) : "0x",
11
- e,
12
- r ? c(r) : "0x"
13
- ])
14
- ]));
15
- return s === "bytes" ? m(n) : n;
1
+ function u(r, { errorInstance: e = new Error("timed out"), timeout: i, signal: a }) {
2
+ return new Promise((l, n) => {
3
+ (async () => {
4
+ let o;
5
+ try {
6
+ const t = new AbortController();
7
+ i > 0 && (o = setTimeout(() => {
8
+ a && t.abort();
9
+ }, i)), l(await r({ signal: (t == null ? void 0 : t.signal) || null }));
10
+ } catch (t) {
11
+ (t == null ? void 0 : t.name) === "AbortError" && n(e), n(t);
12
+ } finally {
13
+ clearTimeout(o);
14
+ }
15
+ })();
16
+ });
16
17
  }
17
18
  export {
18
- b as hashAuthorization
19
+ u as withTimeout
19
20
  };
package/dist/index209.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index35.cjs"),o=require("./index154.cjs");function s(n,e){const t=(n.details||"").toLowerCase(),i=n instanceof c.BaseError?n.walk(r=>(r==null?void 0:r.code)===o.ExecutionRevertedError.code):n;return i instanceof c.BaseError?new o.ExecutionRevertedError({cause:n,message:i.details}):o.ExecutionRevertedError.nodeMessage.test(t)?new o.ExecutionRevertedError({cause:n,message:n.details}):o.FeeCapTooHighError.nodeMessage.test(t)?new o.FeeCapTooHighError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):o.FeeCapTooLowError.nodeMessage.test(t)?new o.FeeCapTooLowError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):o.NonceTooHighError.nodeMessage.test(t)?new o.NonceTooHighError({cause:n,nonce:e==null?void 0:e.nonce}):o.NonceTooLowError.nodeMessage.test(t)?new o.NonceTooLowError({cause:n,nonce:e==null?void 0:e.nonce}):o.NonceMaxValueError.nodeMessage.test(t)?new o.NonceMaxValueError({cause:n,nonce:e==null?void 0:e.nonce}):o.InsufficientFundsError.nodeMessage.test(t)?new o.InsufficientFundsError({cause:n}):o.IntrinsicGasTooHighError.nodeMessage.test(t)?new o.IntrinsicGasTooHighError({cause:n,gas:e==null?void 0:e.gas}):o.IntrinsicGasTooLowError.nodeMessage.test(t)?new o.IntrinsicGasTooLowError({cause:n,gas:e==null?void 0:e.gas}):o.TransactionTypeNotSupportedError.nodeMessage.test(t)?new o.TransactionTypeNotSupportedError({cause:n}):o.TipAboveFeeCapError.nodeMessage.test(t)?new o.TipAboveFeeCapError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new o.UnknownNodeError({cause:n})}exports.getNodeError=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index164.cjs"),o=require("./index120.cjs"),s=require("./index167.cjs"),r=require("./index42.cjs");function c(e){const t=typeof e=="string"?r.stringToHex(e):typeof e.raw=="string"?e.raw:r.bytesToHex(e.raw),i=r.stringToHex(`${n.presignMessagePrefix}${s.size(t)}`);return o.concat([i,t])}exports.toPrefixedMessage=c;
package/dist/index209.js CHANGED
@@ -1,27 +1,11 @@
1
- import { BaseError as c } from "./index35.js";
2
- import { ExecutionRevertedError as t, FeeCapTooHighError as u, FeeCapTooLowError as d, NonceTooHighError as a, NonceTooLowError as f, NonceMaxValueError as w, InsufficientFundsError as r, IntrinsicGasTooHighError as E, IntrinsicGasTooLowError as m, TransactionTypeNotSupportedError as x, TipAboveFeeCapError as F, UnknownNodeError as M } from "./index154.js";
3
- function P(o, e) {
4
- const n = (o.details || "").toLowerCase(), s = o instanceof c ? o.walk((i) => (i == null ? void 0 : i.code) === t.code) : o;
5
- return s instanceof c ? new t({
6
- cause: o,
7
- message: s.details
8
- }) : t.nodeMessage.test(n) ? new t({
9
- cause: o,
10
- message: o.details
11
- }) : u.nodeMessage.test(n) ? new u({
12
- cause: o,
13
- maxFeePerGas: e == null ? void 0 : e.maxFeePerGas
14
- }) : d.nodeMessage.test(n) ? new d({
15
- cause: o,
16
- maxFeePerGas: e == null ? void 0 : e.maxFeePerGas
17
- }) : a.nodeMessage.test(n) ? new a({ cause: o, nonce: e == null ? void 0 : e.nonce }) : f.nodeMessage.test(n) ? new f({ cause: o, nonce: e == null ? void 0 : e.nonce }) : w.nodeMessage.test(n) ? new w({ cause: o, nonce: e == null ? void 0 : e.nonce }) : r.nodeMessage.test(n) ? new r({ cause: o }) : E.nodeMessage.test(n) ? new E({ cause: o, gas: e == null ? void 0 : e.gas }) : m.nodeMessage.test(n) ? new m({ cause: o, gas: e == null ? void 0 : e.gas }) : x.nodeMessage.test(n) ? new x({ cause: o }) : F.nodeMessage.test(n) ? new F({
18
- cause: o,
19
- maxFeePerGas: e == null ? void 0 : e.maxFeePerGas,
20
- maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas
21
- }) : new M({
22
- cause: o
23
- });
1
+ import { presignMessagePrefix as e } from "./index164.js";
2
+ import { concat as n } from "./index120.js";
3
+ import { size as f } from "./index167.js";
4
+ import { stringToHex as o, bytesToHex as p } from "./index42.js";
5
+ function u(r) {
6
+ const t = typeof r == "string" ? o(r) : typeof r.raw == "string" ? r.raw : p(r.raw), i = o(`${e}${f(t)}`);
7
+ return n([i, t]);
24
8
  }
25
9
  export {
26
- P as getNodeError
10
+ u as toPrefixedMessage
27
11
  };
package/dist/index210.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index241.cjs"),f=require("./index242.cjs");function l(t,i={}){const{signed:n,size:e}=i,o=BigInt(t);let r;e?n?r=(1n<<BigInt(e)*8n-1n)-1n:r=2n**(BigInt(e)*8n)-1n:typeof t=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const u=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<u){const s=typeof t=="bigint"?"n":"";throw new d({max:r?`${r}${s}`:void 0,min:`${u}${s}`,signed:n,size:e,value:`${t}${s}`})}const a=`0x${(n&&o<0?(1n<<BigInt(e*8))+BigInt(o):o).toString(16)}`;return e?c(a,e):a}function c(t,i){return f.pad(t,{dir:"left",size:i})}class d extends g.BaseError{constructor({max:i,min:n,signed:e,size:o,value:r}){super(`Number \`${r}\` is not in safe${o?` ${o*8}-bit`:""}${e?" signed":" unsigned"} integer range ${i?`(\`${n}\` to \`${i}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class b extends g.BaseError{constructor({size:i,targetSize:n,type:e}){super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (\`${i}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}exports.IntegerOutOfRangeError=d;exports.SizeExceedsPaddingSizeError=b;exports.fromNumber=l;exports.padLeft=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index142.cjs"),o=require("./index211.cjs");async function s({hash:e,signature:r}){return c.publicKeyToAddress(await o.recoverPublicKey({hash:e,signature:r}))}exports.recoverAddress=s;
package/dist/index210.js CHANGED
@@ -1,49 +1,8 @@
1
- import { BaseError as f } from "./index241.js";
2
- import { pad as g } from "./index242.js";
3
- function m(t, i = {}) {
4
- const { signed: r, size: e } = i, o = BigInt(t);
5
- let n;
6
- e ? r ? n = (1n << BigInt(e) * 8n - 1n) - 1n : n = 2n ** (BigInt(e) * 8n) - 1n : typeof t == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
7
- const u = typeof n == "bigint" && r ? -n - 1n : 0;
8
- if (n && o > n || o < u) {
9
- const s = typeof t == "bigint" ? "n" : "";
10
- throw new d({
11
- max: n ? `${n}${s}` : void 0,
12
- min: `${u}${s}`,
13
- signed: r,
14
- size: e,
15
- value: `${t}${s}`
16
- });
17
- }
18
- const a = `0x${(r && o < 0 ? (1n << BigInt(e * 8)) + BigInt(o) : o).toString(16)}`;
19
- return e ? c(a, e) : a;
20
- }
21
- function c(t, i) {
22
- return g(t, { dir: "left", size: i });
23
- }
24
- class d extends f {
25
- constructor({ max: i, min: r, signed: e, size: o, value: n }) {
26
- super(`Number \`${n}\` is not in safe${o ? ` ${o * 8}-bit` : ""}${e ? " signed" : " unsigned"} integer range ${i ? `(\`${r}\` to \`${i}\`)` : `(above \`${r}\`)`}`), Object.defineProperty(this, "name", {
27
- enumerable: !0,
28
- configurable: !0,
29
- writable: !0,
30
- value: "Hex.IntegerOutOfRangeError"
31
- });
32
- }
33
- }
34
- class p extends f {
35
- constructor({ size: i, targetSize: r, type: e }) {
36
- super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (\`${i}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
37
- enumerable: !0,
38
- configurable: !0,
39
- writable: !0,
40
- value: "Hex.SizeExceedsPaddingSizeError"
41
- });
42
- }
1
+ import { publicKeyToAddress as o } from "./index142.js";
2
+ import { recoverPublicKey as c } from "./index211.js";
3
+ async function s({ hash: r, signature: e }) {
4
+ return o(await c({ hash: r, signature: e }));
43
5
  }
44
6
  export {
45
- d as IntegerOutOfRangeError,
46
- p as SizeExceedsPaddingSizeError,
47
- m as fromNumber,
48
- c as padLeft
7
+ s as recoverAddress
49
8
  };
package/dist/index211.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index210.cjs");function r(e){return{address:e.address,amount:o.fromNumber(e.amount),index:o.fromNumber(e.index),validatorIndex:o.fromNumber(e.validatorIndex)}}exports.toRpc=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index151.cjs"),d=require("./index167.cjs"),o=require("./index65.cjs"),c=require("./index42.cjs");async function g({hash:e,signature:r}){const u=n.isHex(e)?e:c.toHex(e),{secp256k1:i}=await Promise.resolve().then(()=>require("./index139.cjs"));return`0x${(()=>{if(typeof r=="object"&&"r"in r&&"s"in r){const{r:v,s:y,v:b,yParity:f}=r,a=Number(f??b),H=s(a);return new i.Signature(o.hexToBigInt(v),o.hexToBigInt(y)).addRecoveryBit(H)}const t=n.isHex(r)?r:c.toHex(r);if(d.size(t)!==65)throw new Error("invalid signature length");const l=o.hexToNumber(`0x${t.slice(130)}`),x=s(l);return i.Signature.fromCompact(t.substring(2,130)).addRecoveryBit(x)})().recoverPublicKey(u.substring(2)).toHex(!1)}`}function s(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}exports.recoverPublicKey=g;
package/dist/index211.js CHANGED
@@ -1,12 +1,30 @@
1
- import { fromNumber as e } from "./index210.js";
2
- function r(o) {
3
- return {
4
- address: o.address,
5
- amount: e(o.amount),
6
- index: e(o.index),
7
- validatorIndex: e(o.validatorIndex)
8
- };
1
+ import { isHex as i } from "./index151.js";
2
+ import { size as b } from "./index167.js";
3
+ import { hexToBigInt as n, hexToNumber as d } from "./index65.js";
4
+ import { toHex as c } from "./index42.js";
5
+ async function R({ hash: r, signature: e }) {
6
+ const u = i(r) ? r : c(r), { secp256k1: t } = await import("./index139.js");
7
+ return `0x${(() => {
8
+ if (typeof e == "object" && "r" in e && "s" in e) {
9
+ const { r: p, s: v, v: y, yParity: l } = e, x = Number(l ?? y), a = s(x);
10
+ return new t.Signature(n(p), n(v)).addRecoveryBit(a);
11
+ }
12
+ const o = i(e) ? e : c(e);
13
+ if (b(o) !== 65)
14
+ throw new Error("invalid signature length");
15
+ const f = d(`0x${o.slice(130)}`), m = s(f);
16
+ return t.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(m);
17
+ })().recoverPublicKey(u.substring(2)).toHex(!1)}`;
18
+ }
19
+ function s(r) {
20
+ if (r === 0 || r === 1)
21
+ return r;
22
+ if (r === 27)
23
+ return 0;
24
+ if (r === 28)
25
+ return 1;
26
+ throw new Error("Invalid yParityOrV value");
9
27
  }
10
28
  export {
11
- r as toRpc
29
+ R as recoverPublicKey
12
30
  };
package/dist/index212.cjs CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index213.cjs");class t extends Error{constructor(a,e={}){var i;const s=e.cause instanceof t?e.cause.details:(i=e.cause)!=null&&i.message?e.cause.message:e.details,r=e.cause instanceof t&&e.cause.docsPath||e.docsPath,u=[a||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${o.version}`].join(`
2
- `);super(u),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),e.cause&&(this.cause=e.cause),this.details=s,this.docsPath=r,this.metaMessages=e.metaMessages,this.shortMessage=a}}exports.BaseError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./index213.cjs"),w=require("./index19.cjs"),t=require("./index148.cjs"),P=require("./index35.cjs"),h=require("./index199.cjs"),d=require("./index36.cjs"),n=require("./index180.cjs"),c=require("./index149.cjs"),I=require("./index167.cjs"),u=require("./index104.cjs"),l=require("./index65.cjs");function m(o){const{authorizationList:e}=o;if(e)for(const s of e){const{chainId:r}=s,i=s.address;if(!c.isAddress(i))throw new t.InvalidAddressError({address:i});if(r<0)throw new d.InvalidChainIdError({chainId:r})}f(o)}function T(o){const{blobVersionedHashes:e}=o;if(e){if(e.length===0)throw new h.EmptyBlobError;for(const s of e){const r=I.size(s),i=l.hexToNumber(u.slice(s,0,1));if(r!==32)throw new h.InvalidVersionedHashSizeError({hash:s,size:r});if(i!==E.versionedHashVersionKzg)throw new h.InvalidVersionedHashVersionError({hash:s,version:i})}}f(o)}function f(o){const{chainId:e,maxPriorityFeePerGas:s,maxFeePerGas:r,to:i}=o;if(e<=0)throw new d.InvalidChainIdError({chainId:e});if(i&&!c.isAddress(i))throw new t.InvalidAddressError({address:i});if(r&&r>w.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:r});if(s&&r&&s>r)throw new n.TipAboveFeeCapError({maxFeePerGas:r,maxPriorityFeePerGas:s})}function x(o){const{chainId:e,maxPriorityFeePerGas:s,gasPrice:r,maxFeePerGas:i,to:a}=o;if(e<=0)throw new d.InvalidChainIdError({chainId:e});if(a&&!c.isAddress(a))throw new t.InvalidAddressError({address:a});if(s||i)throw new P.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>w.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:r})}function v(o){const{chainId:e,maxPriorityFeePerGas:s,gasPrice:r,maxFeePerGas:i,to:a}=o;if(a&&!c.isAddress(a))throw new t.InvalidAddressError({address:a});if(typeof e<"u"&&e<=0)throw new d.InvalidChainIdError({chainId:e});if(s||i)throw new P.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>w.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:r})}exports.assertTransactionEIP1559=f;exports.assertTransactionEIP2930=x;exports.assertTransactionEIP4844=T;exports.assertTransactionEIP7702=m;exports.assertTransactionLegacy=v;