@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/index87.js CHANGED
@@ -1,40 +1,106 @@
1
- const f = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
2
- let k = 0;
3
- function y(s, l, m) {
4
- const i = ++k, c = () => f.get(s) || [], w = () => {
5
- const n = c();
6
- f.set(s, n.filter((e) => e.id !== i));
7
- }, r = () => {
8
- const n = c();
9
- if (!n.some((t) => t.id === i))
1
+ import { BlockNotFoundError as M } from "./index70.js";
2
+ import { WaitForTransactionReceiptTimeoutError as O, TransactionNotFoundError as W, TransactionReceiptNotFoundError as q } from "./index81.js";
3
+ import { getAction as u } from "./index55.js";
4
+ import { observe as z } from "./index88.js";
5
+ import { withResolvers as G } from "./index89.js";
6
+ import { withRetry as B } from "./index90.js";
7
+ import { stringify as H } from "./index91.js";
8
+ import { getBlock as J } from "./index60.js";
9
+ import { getTransaction as K } from "./index80.js";
10
+ import { getTransactionReceipt as y } from "./index20.js";
11
+ import { watchBlockNumber as L } from "./index92.js";
12
+ async function er(t, b) {
13
+ const {
14
+ checkReplacement: F = !0,
15
+ confirmations: a = 1,
16
+ hash: m,
17
+ onReplaced: I,
18
+ retryCount: N = 6,
19
+ retryDelay: R = ({ count: e }) => ~~(1 << e) * 200,
20
+ // exponential backoff
21
+ timeout: h = 18e4
22
+ } = b, E = H(["waitForTransactionReceipt", t.uid, m]), j = (() => {
23
+ var e;
24
+ return b.pollingInterval ? b.pollingInterval : (e = t.chain) != null && e.experimental_preconfirmationTime ? t.chain.experimental_preconfirmationTime : t.pollingInterval;
25
+ })();
26
+ let l, i, r, s = !1, o, c;
27
+ const { promise: x, resolve: A, reject: v } = G(), w = h ? setTimeout(() => {
28
+ c == null || c(), o == null || o(), v(new O({ hash: m }));
29
+ }, h) : void 0;
30
+ return o = z(E, { onReplaced: I, resolve: A, reject: v }, async (e) => {
31
+ if (r = await u(t, y, "getTransactionReceipt")({ hash: m }).catch(() => {
32
+ }), r && a <= 1) {
33
+ clearTimeout(w), e.resolve(r), o == null || o();
10
34
  return;
11
- const e = g.get(s);
12
- if (n.length === 1 && e) {
13
- const t = e();
14
- t instanceof Promise && t.catch(() => {
15
- });
16
35
  }
17
- w();
18
- }, o = c();
19
- if (f.set(s, [
20
- ...o,
21
- { id: i, fns: l }
22
- ]), o && o.length > 0)
23
- return r;
24
- const u = {};
25
- for (const n in l)
26
- u[n] = (...e) => {
27
- var p, h;
28
- const t = c();
29
- if (t.length !== 0)
30
- for (const C of t)
31
- (h = (p = C.fns)[n]) == null || h.call(p, ...e);
32
- };
33
- const a = m(u);
34
- return typeof a == "function" && g.set(s, a), r;
36
+ c = u(t, L, "watchBlockNumber")({
37
+ emitMissed: !0,
38
+ emitOnBegin: !0,
39
+ poll: !0,
40
+ pollingInterval: j,
41
+ async onBlockNumber(C) {
42
+ const p = (T) => {
43
+ clearTimeout(w), c == null || c(), T(), o == null || o();
44
+ };
45
+ let d = C;
46
+ if (!s)
47
+ try {
48
+ if (r) {
49
+ if (a > 1 && (!r.blockNumber || d - r.blockNumber + 1n < a))
50
+ return;
51
+ p(() => e.resolve(r));
52
+ return;
53
+ }
54
+ if (F && !l && (s = !0, await B(async () => {
55
+ l = await u(t, K, "getTransaction")({ hash: m }), l.blockNumber && (d = l.blockNumber);
56
+ }, {
57
+ delay: R,
58
+ retryCount: N
59
+ }), s = !1), r = await u(t, y, "getTransactionReceipt")({ hash: m }), a > 1 && (!r.blockNumber || d - r.blockNumber + 1n < a))
60
+ return;
61
+ p(() => e.resolve(r));
62
+ } catch (T) {
63
+ if (T instanceof W || T instanceof q) {
64
+ if (!l) {
65
+ s = !1;
66
+ return;
67
+ }
68
+ try {
69
+ i = l, s = !0;
70
+ const k = await B(() => u(t, J, "getBlock")({
71
+ blockNumber: d,
72
+ includeTransactions: !0
73
+ }), {
74
+ delay: R,
75
+ retryCount: N,
76
+ shouldRetry: ({ error: f }) => f instanceof M
77
+ });
78
+ s = !1;
79
+ const n = k.transactions.find(({ from: f, nonce: D }) => f === i.from && D === i.nonce);
80
+ if (!n || (r = await u(t, y, "getTransactionReceipt")({
81
+ hash: n.hash
82
+ }), a > 1 && (!r.blockNumber || d - r.blockNumber + 1n < a)))
83
+ return;
84
+ let g = "replaced";
85
+ n.to === i.to && n.value === i.value && n.input === i.input ? g = "repriced" : n.from === n.to && n.value === 0n && (g = "cancelled"), p(() => {
86
+ var f;
87
+ (f = e.onReplaced) == null || f.call(e, {
88
+ reason: g,
89
+ replacedTransaction: i,
90
+ transaction: n,
91
+ transactionReceipt: r
92
+ }), e.resolve(r);
93
+ });
94
+ } catch (k) {
95
+ p(() => e.reject(k));
96
+ }
97
+ } else
98
+ p(() => e.reject(T));
99
+ }
100
+ }
101
+ });
102
+ }), x;
35
103
  }
36
104
  export {
37
- g as cleanupCache,
38
- f as listenersCache,
39
- y as observe
105
+ er as waitForTransactionReceipt
40
106
  };
package/dist/index88.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index186.cjs");function r(o,{emitOnBegin:s,initialWaitTime:t,interval:c}){let e=!0;const a=()=>e=!1;return(async()=>{let n;n=await o({unpoll:a});const w=await(t==null?void 0:t(n))??c;await u.wait(w);const l=async()=>{e&&(await o({unpoll:a}),await u.wait(c),l())};l()})(),a}exports.poll=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=new Map,r=new Map;let b=0;function w(s,a,C){const o=++b,c=()=>i.get(s)||[],m=()=>{const t=c();i.set(s,t.filter(n=>n.id!==o))},f=()=>{const t=c();if(!t.some(e=>e.id===o))return;const n=r.get(s);if(t.length===1&&n){const e=n();e instanceof Promise&&e.catch(()=>{})}m()},l=c();if(i.set(s,[...l,{id:o,fns:a}]),l&&l.length>0)return f;const u={};for(const t in a)u[t]=(...n)=>{var p,g;const e=c();if(e.length!==0)for(const y of e)(g=(p=y.fns)[t])==null||g.call(p,...n)};const h=C(u);return typeof h=="function"&&r.set(s,h),f}exports.cleanupCache=r;exports.listenersCache=i;exports.observe=w;
package/dist/index88.js CHANGED
@@ -1,18 +1,40 @@
1
- import { wait as r } from "./index186.js";
2
- function f(o, { emitOnBegin: u, initialWaitTime: t, interval: c }) {
3
- let n = !0;
4
- const a = () => n = !1;
5
- return (async () => {
6
- let w;
7
- w = await o({ unpoll: a });
8
- const s = await (t == null ? void 0 : t(w)) ?? c;
9
- await r(s);
10
- const l = async () => {
11
- n && (await o({ unpoll: a }), await r(c), l());
1
+ const f = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
2
+ let k = 0;
3
+ function y(s, l, m) {
4
+ const i = ++k, c = () => f.get(s) || [], w = () => {
5
+ const n = c();
6
+ f.set(s, n.filter((e) => e.id !== i));
7
+ }, r = () => {
8
+ const n = c();
9
+ if (!n.some((t) => t.id === i))
10
+ return;
11
+ const e = g.get(s);
12
+ if (n.length === 1 && e) {
13
+ const t = e();
14
+ t instanceof Promise && t.catch(() => {
15
+ });
16
+ }
17
+ w();
18
+ }, o = c();
19
+ if (f.set(s, [
20
+ ...o,
21
+ { id: i, fns: l }
22
+ ]), o && o.length > 0)
23
+ return r;
24
+ const u = {};
25
+ for (const n in l)
26
+ u[n] = (...e) => {
27
+ var p, h;
28
+ const t = c();
29
+ if (t.length !== 0)
30
+ for (const C of t)
31
+ (h = (p = C.fns)[n]) == null || h.call(p, ...e);
12
32
  };
13
- l();
14
- })(), a;
33
+ const a = m(u);
34
+ return typeof a == "function" && g.set(s, a), r;
15
35
  }
16
36
  export {
17
- f as poll
37
+ g as cleanupCache,
38
+ f as listenersCache,
39
+ y as observe
18
40
  };
package/dist/index89.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(e,n,i)=>JSON.stringify(e,(o,t)=>typeof t=="bigint"?t.toString():t,i);exports.stringify=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}exports.withResolvers=i;
package/dist/index89.js CHANGED
@@ -1,4 +1,11 @@
1
- const g = (r, n, i) => JSON.stringify(r, (e, t) => typeof t == "bigint" ? t.toString() : t, i);
1
+ function i() {
2
+ let e = () => {
3
+ }, n = () => {
4
+ };
5
+ return { promise: new Promise((r, o) => {
6
+ e = r, n = o;
7
+ }), resolve: e, reject: n };
8
+ }
2
9
  export {
3
- g as stringify
10
+ i as withResolvers
4
11
  };
package/dist/index90.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index42.cjs");async function i(r,{chain:t}){const{id:a,name:n,nativeCurrency:d,rpcUrls:o,blockExplorers:e}=t;await r.request({method:"wallet_addEthereumChain",params:[{chainId:c.numberToHex(a),chainName:n,nativeCurrency:d,rpcUrls:o.default.http,blockExplorerUrls:e?Object.values(e).map(({url:u})=>u):void 0}]},{dedupe:!0,retryCount:0})}exports.addChain=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index207.cjs");function f(n,{delay:e=100,retryCount:o=2,shouldRetry:c=()=>!0}={}){return new Promise((s,y)=>{const a=async({count:r=0}={})=>{const w=async({error:t})=>{const i=typeof e=="function"?e({count:r,error:t}):e;i&&await u.wait(i),a({count:r+1})};try{const t=await n();s(t)}catch(t){if(r<o&&await c({count:r,error:t}))return w({error:t});y(t)}};a()})}exports.withRetry=f;
package/dist/index90.js CHANGED
@@ -1,19 +1,23 @@
1
- import { numberToHex as l } from "./index42.js";
2
- async function i(r, { chain: a }) {
3
- const { id: t, name: n, nativeCurrency: d, rpcUrls: o, blockExplorers: e } = a;
4
- await r.request({
5
- method: "wallet_addEthereumChain",
6
- params: [
7
- {
8
- chainId: l(t),
9
- chainName: n,
10
- nativeCurrency: d,
11
- rpcUrls: o.default.http,
12
- blockExplorerUrls: e ? Object.values(e).map(({ url: c }) => c) : void 0
1
+ import { wait as w } from "./index207.js";
2
+ function p(n, { delay: e = 100, retryCount: o = 2, shouldRetry: c = () => !0 } = {}) {
3
+ return new Promise((s, y) => {
4
+ const a = async ({ count: r = 0 } = {}) => {
5
+ const f = async ({ error: t }) => {
6
+ const i = typeof e == "function" ? e({ count: r, error: t }) : e;
7
+ i && await w(i), a({ count: r + 1 });
8
+ };
9
+ try {
10
+ const t = await n();
11
+ s(t);
12
+ } catch (t) {
13
+ if (r < o && await c({ count: r, error: t }))
14
+ return f({ error: t });
15
+ y(t);
13
16
  }
14
- ]
15
- }, { dedupe: !0, retryCount: 0 });
17
+ };
18
+ a();
19
+ });
16
20
  }
17
21
  export {
18
- i as addChain
22
+ p as withRetry
19
23
  };
package/dist/index91.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index39.cjs"),i=require("./index92.cjs");function d(e,o){const{abi:a,args:n,bytecode:r,...t}=o,c=s.encodeDeployData({abi:a,args:n,bytecode:r});return i.sendTransaction(e,{...t,...t.authorizationList?{to:null}:{},data:c})}exports.deployContract=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=(e,n,i)=>JSON.stringify(e,(o,t)=>typeof t=="bigint"?t.toString():t,i);exports.stringify=r;
package/dist/index91.js CHANGED
@@ -1,13 +1,4 @@
1
- import { encodeDeployData as i } from "./index39.js";
2
- import { sendTransaction as s } from "./index92.js";
3
- function p(o, a) {
4
- const { abi: n, args: r, bytecode: e, ...t } = a, c = i({ abi: n, args: r, bytecode: e });
5
- return s(o, {
6
- ...t,
7
- ...t.authorizationList ? { to: null } : {},
8
- data: c
9
- });
10
- }
1
+ const g = (r, n, i) => JSON.stringify(r, (e, t) => typeof t == "bigint" ? t.toString() : t, i);
11
2
  export {
12
- p as deployContract
3
+ g as stringify
13
4
  };
package/dist/index92.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index32.cjs"),u=require("./index102.cjs"),O=require("./index35.cjs"),j=require("./index62.cjs"),B=require("./index114.cjs"),U=require("./index112.cjs"),W=require("./index44.cjs"),k=require("./index45.cjs"),l=require("./index55.cjs"),D=require("./index115.cjs"),H=require("./index48.cjs"),J=require("./index70.cjs"),L=require("./index64.cjs"),K=require("./index113.cjs"),f=new D.LruMap(128);async function Q(r,e){var M,z,I,S;const{account:d=r.account,chain:n=r.chain,accessList:w,authorizationList:s,blobs:q,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,type:C,value:N,...P}=e;if(typeof d>"u")throw new u.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const t=d?G.parseAccount(d):null;try{H.assertRequest(e);const a=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await j.recoverAuthorizationAddress({authorization:s[0]}).catch(()=>{throw new O.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((t==null?void 0:t.type)==="json-rpc"||t===null){let i;n!==null&&(i=await l.getAction(r,J.getChainId,"getChainId")({}),B.assertCurrentChain({currentChainId:i,chain:n}));const c=(I=(z=(M=r.chain)==null?void 0:M.formatters)==null?void 0:z.transactionRequest)==null?void 0:I.format,F=(c||k.formatTransactionRequest)({...W.extract(P,{format:c}),accessList:w,authorizationList:s,blobs:q,chainId:i,data:m,from:t==null?void 0:t.address,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,to:a,type:C,value:N}),v=f.get(r.uid),_=v?"wallet_sendTransaction":"eth_sendTransaction";try{return await r.request({method:_,params:[F]},{retryCount:0})}catch(x){if(v===!1)throw x;const o=x;if(o.name==="InvalidInputRpcError"||o.name==="InvalidParamsRpcError"||o.name==="MethodNotFoundRpcError"||o.name==="MethodNotSupportedRpcError")return await r.request({method:"wallet_sendTransaction",params:[F]},{retryCount:0}).then(p=>(f.set(r.uid,!0),p)).catch(p=>{const h=p;throw h.name==="MethodNotFoundRpcError"||h.name==="MethodNotSupportedRpcError"?(f.set(r.uid,!1),o):h});throw o}}if((t==null?void 0:t.type)==="local"){const i=await l.getAction(r,L.prepareTransactionRequest,"prepareTransactionRequest")({account:t,accessList:w,authorizationList:s,blobs:q,chain:n,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,nonceManager:t.nonceManager,parameters:[...L.defaultParameters,"sidecars"],type:C,value:N,...P,to:a}),c=(S=n==null?void 0:n.serializers)==null?void 0:S.transaction,b=await t.signTransaction(i,{serializer:c});return await l.getAction(r,K.sendRawTransaction,"sendRawTransaction")({serializedTransaction:b})}throw(t==null?void 0:t.type)==="smart"?new u.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new u.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:t==null?void 0:t.type})}catch(a){throw a instanceof u.AccountTypeNotSupportedError?a:U.getTransactionError(a,{...e,account:t,chain:e.chain||void 0})}}exports.sendTransaction=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index65.cjs"),w=require("./index55.cjs"),N=require("./index88.cjs"),h=require("./index93.cjs"),g=require("./index91.cjs"),m=require("./index72.cjs");function q(r,{emitOnBegin:b=!1,emitMissed:f=!1,onBlockNumber:p,onError:a,poll:i,pollingInterval:k=r.pollingInterval}){const B=typeof i<"u"?i:!(r.transport.type==="webSocket"||r.transport.type==="ipc"||r.transport.type==="fallback"&&(r.transport.transports[0].config.type==="webSocket"||r.transport.transports[0].config.type==="ipc"));let e;return B?(()=>{const l=g.stringify(["watchBlockNumber",r.uid,b,f,k]);return N.observe(l,{onBlockNumber:p,onError:a},o=>h.poll(async()=>{var u;try{const t=await w.getAction(r,m.getBlockNumber,"getBlockNumber")({cacheTime:0});if(e!==void 0){if(t===e)return;if(t-e>1&&f)for(let s=e+1n;s<t;s++)o.onBlockNumber(s,e),e=s}(e===void 0||t>e)&&(o.onBlockNumber(t,e),e=t)}catch(t){(u=o.onError)==null||u.call(o,t)}},{emitOnBegin:b,interval:k}))})():(()=>{const l=g.stringify(["watchBlockNumber",r.uid,b,f]);return N.observe(l,{onBlockNumber:p,onError:a},o=>{let u=!0,t=()=>u=!1;return(async()=>{try{const s=(()=>{if(r.transport.type==="fallback"){const c=r.transport.transports.find(n=>n.config.type==="webSocket"||n.config.type==="ipc");return c?c.value:r.transport}return r.transport})(),{unsubscribe:d}=await s.subscribe({params:["newHeads"],onData(c){var y;if(!u)return;const n=v.hexToBigInt((y=c.result)==null?void 0:y.number);o.onBlockNumber(n,e),e=n},onError(c){var n;(n=o.onError)==null||n.call(o,c)}});t=d,u||t()}catch(s){a==null||a(s)}})(),()=>t()})})()}exports.watchBlockNumber=q;
package/dist/index92.js CHANGED
@@ -1,128 +1,78 @@
1
- import { parseAccount as _ } from "./index32.js";
2
- import { AccountNotFoundError as G, AccountTypeNotSupportedError as p } from "./index102.js";
3
- import { BaseError as B } from "./index35.js";
4
- import { recoverAuthorizationAddress as O } from "./index62.js";
5
- import { assertCurrentChain as U } from "./index114.js";
6
- import { getTransactionError as W } from "./index112.js";
7
- import { extract as j } from "./index44.js";
8
- import { formatTransactionRequest as k } from "./index45.js";
9
- import { getAction as f } from "./index55.js";
10
- import { LruMap as D } from "./index115.js";
11
- import { assertRequest as H } from "./index48.js";
12
- import { getChainId as J } from "./index70.js";
13
- import { prepareTransactionRequest as K, defaultParameters as Q } from "./index64.js";
14
- import { sendRawTransaction as V } from "./index113.js";
15
- const h = new D(128);
16
- async function mr(t, o) {
17
- var z, A, F, I;
18
- const { account: d = t.account, chain: e = t.chain, accessList: w, authorizationList: s, blobs: l, data: y, gas: T, gasPrice: g, maxFeePerBlobGas: R, maxFeePerGas: E, maxPriorityFeePerGas: q, nonce: P, type: C, value: N, ...M } = o;
19
- if (typeof d > "u")
20
- throw new G({
21
- docsPath: "/docs/actions/wallet/sendTransaction"
22
- });
23
- const r = d ? _(d) : null;
24
- try {
25
- H(o);
26
- const a = await (async () => {
27
- if (o.to)
28
- return o.to;
29
- if (o.to !== null && s && s.length > 0)
30
- return await O({
31
- authorization: s[0]
32
- }).catch(() => {
33
- throw new B("`to` is required. Could not infer from `authorizationList`.");
34
- });
35
- })();
36
- if ((r == null ? void 0 : r.type) === "json-rpc" || r === null) {
37
- let i;
38
- e !== null && (i = await f(t, J, "getChainId")({}), U({
39
- currentChainId: i,
40
- chain: e
41
- }));
42
- const c = (F = (A = (z = t.chain) == null ? void 0 : z.formatters) == null ? void 0 : A.transactionRequest) == null ? void 0 : F.format, b = (c || k)({
43
- // Pick out extra data that might exist on the chain's transaction request type.
44
- ...j(M, { format: c }),
45
- accessList: w,
46
- authorizationList: s,
47
- blobs: l,
48
- chainId: i,
49
- data: y,
50
- from: r == null ? void 0 : r.address,
51
- gas: T,
52
- gasPrice: g,
53
- maxFeePerBlobGas: R,
54
- maxFeePerGas: E,
55
- maxPriorityFeePerGas: q,
56
- nonce: P,
57
- to: a,
58
- type: C,
59
- value: N
60
- }), v = h.get(t.uid), S = v ? "wallet_sendTransaction" : "eth_sendTransaction";
1
+ import { hexToBigInt as w } from "./index65.js";
2
+ import { getAction as g } from "./index55.js";
3
+ import { observe as y } from "./index88.js";
4
+ import { poll as h } from "./index93.js";
5
+ import { stringify as N } from "./index91.js";
6
+ import { getBlockNumber as v } from "./index72.js";
7
+ function j(r, { emitOnBegin: b = !1, emitMissed: p = !1, onBlockNumber: l, onError: a, poll: k, pollingInterval: i = r.pollingInterval }) {
8
+ const B = typeof k < "u" ? k : !(r.transport.type === "webSocket" || r.transport.type === "ipc" || r.transport.type === "fallback" && (r.transport.transports[0].config.type === "webSocket" || r.transport.transports[0].config.type === "ipc"));
9
+ let t;
10
+ return B ? (() => {
11
+ const f = N([
12
+ "watchBlockNumber",
13
+ r.uid,
14
+ b,
15
+ p,
16
+ i
17
+ ]);
18
+ return y(f, { onBlockNumber: l, onError: a }, (e) => h(async () => {
19
+ var u;
61
20
  try {
62
- return await t.request({
63
- method: S,
64
- params: [b]
65
- }, { retryCount: 0 });
66
- } catch (L) {
67
- if (v === !1)
68
- throw L;
69
- const n = L;
70
- if (n.name === "InvalidInputRpcError" || n.name === "InvalidParamsRpcError" || n.name === "MethodNotFoundRpcError" || n.name === "MethodNotSupportedRpcError")
71
- return await t.request({
72
- method: "wallet_sendTransaction",
73
- params: [b]
74
- }, { retryCount: 0 }).then((m) => (h.set(t.uid, !0), m)).catch((m) => {
75
- const u = m;
76
- throw u.name === "MethodNotFoundRpcError" || u.name === "MethodNotSupportedRpcError" ? (h.set(t.uid, !1), n) : u;
77
- });
78
- throw n;
21
+ const o = await g(r, v, "getBlockNumber")({ cacheTime: 0 });
22
+ if (t !== void 0) {
23
+ if (o === t)
24
+ return;
25
+ if (o - t > 1 && p)
26
+ for (let s = t + 1n; s < o; s++)
27
+ e.onBlockNumber(s, t), t = s;
28
+ }
29
+ (t === void 0 || o > t) && (e.onBlockNumber(o, t), t = o);
30
+ } catch (o) {
31
+ (u = e.onError) == null || u.call(e, o);
79
32
  }
80
- }
81
- if ((r == null ? void 0 : r.type) === "local") {
82
- const i = await f(t, K, "prepareTransactionRequest")({
83
- account: r,
84
- accessList: w,
85
- authorizationList: s,
86
- blobs: l,
87
- chain: e,
88
- data: y,
89
- gas: T,
90
- gasPrice: g,
91
- maxFeePerBlobGas: R,
92
- maxFeePerGas: E,
93
- maxPriorityFeePerGas: q,
94
- nonce: P,
95
- nonceManager: r.nonceManager,
96
- parameters: [...Q, "sidecars"],
97
- type: C,
98
- value: N,
99
- ...M,
100
- to: a
101
- }), c = (I = e == null ? void 0 : e.serializers) == null ? void 0 : I.transaction, x = await r.signTransaction(i, {
102
- serializer: c
103
- });
104
- return await f(t, V, "sendRawTransaction")({
105
- serializedTransaction: x
106
- });
107
- }
108
- throw (r == null ? void 0 : r.type) === "smart" ? new p({
109
- metaMessages: [
110
- "Consider using the `sendUserOperation` Action instead."
111
- ],
112
- docsPath: "/docs/actions/bundler/sendUserOperation",
113
- type: "smart"
114
- }) : new p({
115
- docsPath: "/docs/actions/wallet/sendTransaction",
116
- type: r == null ? void 0 : r.type
117
- });
118
- } catch (a) {
119
- throw a instanceof p ? a : W(a, {
120
- ...o,
121
- account: r,
122
- chain: o.chain || void 0
33
+ }, {
34
+ emitOnBegin: b,
35
+ interval: i
36
+ }));
37
+ })() : (() => {
38
+ const f = N([
39
+ "watchBlockNumber",
40
+ r.uid,
41
+ b,
42
+ p
43
+ ]);
44
+ return y(f, { onBlockNumber: l, onError: a }, (e) => {
45
+ let u = !0, o = () => u = !1;
46
+ return (async () => {
47
+ try {
48
+ const s = (() => {
49
+ if (r.transport.type === "fallback") {
50
+ const c = r.transport.transports.find((n) => n.config.type === "webSocket" || n.config.type === "ipc");
51
+ return c ? c.value : r.transport;
52
+ }
53
+ return r.transport;
54
+ })(), { unsubscribe: d } = await s.subscribe({
55
+ params: ["newHeads"],
56
+ onData(c) {
57
+ var m;
58
+ if (!u)
59
+ return;
60
+ const n = w((m = c.result) == null ? void 0 : m.number);
61
+ e.onBlockNumber(n, t), t = n;
62
+ },
63
+ onError(c) {
64
+ var n;
65
+ (n = e.onError) == null || n.call(e, c);
66
+ }
67
+ });
68
+ o = d, u || o();
69
+ } catch (s) {
70
+ a == null || a(s);
71
+ }
72
+ })(), () => o();
123
73
  });
124
- }
74
+ })();
125
75
  }
126
76
  export {
127
- mr as sendTransaction
77
+ j as watchBlockNumber
128
78
  };
package/dist/index93.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index94.cjs");async function r(e){var s;return((s=e.account)==null?void 0:s.type)==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(t=>d.checksumAddress(t))}exports.getAddresses=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index207.cjs");function s(o,{emitOnBegin:w,initialWaitTime:t,interval:c}){let l=!0;const a=()=>l=!1;return(async()=>{let e;w&&(e=await o({unpoll:a}));const r=await(t==null?void 0:t(e))??c;await u.wait(r);const n=async()=>{l&&(await o({unpoll:a}),await u.wait(c),n())};n()})(),a}exports.poll=s;
package/dist/index93.js CHANGED
@@ -1,8 +1,18 @@
1
- import { checksumAddress as t } from "./index94.js";
2
- async function c(e) {
3
- var s;
4
- return ((s = e.account) == null ? void 0 : s.type) === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((r) => t(r));
1
+ import { wait as r } from "./index207.js";
2
+ function e(o, { emitOnBegin: s, initialWaitTime: t, interval: c }) {
3
+ let w = !0;
4
+ const a = () => w = !1;
5
+ return (async () => {
6
+ let n;
7
+ s && (n = await o({ unpoll: a }));
8
+ const u = await (t == null ? void 0 : t(n)) ?? c;
9
+ await r(u);
10
+ const l = async () => {
11
+ w && (await o({ unpoll: a }), await r(c), l());
12
+ };
13
+ l();
14
+ })(), a;
5
15
  }
6
16
  export {
7
- c as getAddresses
17
+ e as poll
8
18
  };
package/dist/index94.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index141.cjs"),f=require("./index159.cjs"),a=require("./index169.cjs"),l=require("./index115.cjs"),A=require("./index165.cjs"),o=new l.LruMap(8192);function u(s,t){if(o.has(`${s}.${t}`))return o.get(`${s}.${t}`);const c=s.substring(2).toLowerCase(),n=a.keccak256(f.stringToBytes(c),"bytes"),r=c.split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&r[e]&&(r[e]=r[e].toUpperCase()),(n[e>>1]&15)>=8&&r[e+1]&&(r[e+1]=r[e+1].toUpperCase());const i=`0x${r.join("")}`;return o.set(`${s}.${t}`,i),i}function g(s,t){if(!A.isAddress(s,{strict:!1}))throw new d.InvalidAddressError({address:s});return u(s,t)}exports.checksumAddress=u;exports.getAddress=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index95.cjs"),M=require("./index96.cjs"),P=require("./index97.cjs"),_=require("./index51.cjs"),I=require("./index79.cjs"),b=require("./index55.cjs"),A=require("./index88.cjs"),O=require("./index93.cjs"),S=require("./index91.cjs"),$=require("./index50.cjs"),j=require("./index72.cjs"),z=require("./index74.cjs"),R=require("./index77.cjs"),U=require("./index86.cjs");function G(t,D){const{abi:v,address:l,args:u,batch:C=!0,eventName:c,fromBlock:g,onError:f,onLogs:k,poll:L,pollingInterval:h=t.pollingInterval,strict:d}=D;return(typeof L<"u"?L:typeof g=="bigint"?!0:!(t.transport.type==="webSocket"||t.transport.type==="ipc"||t.transport.type==="fallback"&&(t.transport.transports[0].config.type==="webSocket"||t.transport.transports[0].config.type==="ipc")))?(()=>{const p=d??!1,q=S.stringify(["watchContractEvent",l,u,C,t.uid,c,h,p,g]);return A.observe(q,{onLogs:k,onError:f},o=>{let s;g!==void 0&&(s=g-1n);let n,a=!1;const w=O.poll(async()=>{var y;if(!a){try{n=await b.getAction(t,$.createContractEventFilter,"createContractEventFilter")({abi:v,address:l,args:u,eventName:c,strict:p,fromBlock:g})}catch{}a=!0;return}try{let e;if(n)e=await b.getAction(t,R.getFilterChanges,"getFilterChanges")({filter:n});else{const r=await b.getAction(t,j.getBlockNumber,"getBlockNumber")({});s&&s<r?e=await b.getAction(t,z.getContractEvents,"getContractEvents")({abi:v,address:l,args:u,eventName:c,fromBlock:s+1n,toBlock:r,strict:p}):e=[],s=r}if(e.length===0)return;if(C)o.onLogs(e);else for(const r of e)o.onLogs([r])}catch(e){n&&e instanceof M.InvalidInputRpcError&&(a=!1),(y=o.onError)==null||y.call(o,e)}},{emitOnBegin:!0,interval:h});return async()=>{n&&await b.getAction(t,U.uninstallFilter,"uninstallFilter")({filter:n}),w()}})})():(()=>{const p=d??!1,q=S.stringify(["watchContractEvent",l,u,C,t.uid,c,h,p]);let o=!0,s=()=>o=!1;return A.observe(q,{onLogs:k,onError:f},n=>((async()=>{try{const a=(()=>{if(t.transport.type==="fallback"){const e=t.transport.transports.find(r=>r.config.type==="webSocket"||r.config.type==="ipc");return e?e.value:t.transport}return t.transport})(),w=c?_.encodeEventTopics({abi:v,eventName:c,args:u}):[],{unsubscribe:y}=await a.subscribe({params:["logs",{address:l,topics:w}],onData(e){var N;if(!o)return;const r=e.result;try{const{eventName:i,args:E}=P.decodeEventLog({abi:v,data:r.data,topics:r.topics,strict:d}),m=I.formatLog(r,{args:E,eventName:i});n.onLogs([m])}catch(i){let E,m;if(i instanceof B.DecodeLogDataMismatch||i instanceof B.DecodeLogTopicsMismatch){if(d)return;E=i.abiItem.name,m=(N=i.abiItem.inputs)==null?void 0:N.some(F=>!("name"in F&&F.name))}const T=I.formatLog(r,{args:m?[]:{},eventName:E});n.onLogs([T])}},onError(e){var r;(r=n.onError)==null||r.call(n,e)}});s=y,o||s()}catch(a){f==null||f(a)}})(),()=>s()))})()}exports.watchContractEvent=G;