@gardenfi/utils 3.1.1-beta.4 → 3.1.1-beta.6

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 (431) hide show
  1. package/dist/index10.cjs +1 -1
  2. package/dist/index10.js +4 -4
  3. package/dist/index100.cjs +2 -1
  4. package/dist/index100.js +114 -119
  5. package/dist/index101.cjs +1 -1
  6. package/dist/index101.js +14 -5
  7. package/dist/index102.cjs +1 -1
  8. package/dist/index102.js +24 -21
  9. package/dist/index103.cjs +1 -1
  10. package/dist/index103.js +31 -43
  11. package/dist/index104.cjs +1 -1
  12. package/dist/index104.js +43 -37
  13. package/dist/index105.cjs +1 -1
  14. package/dist/index105.js +6 -6
  15. package/dist/index106.cjs +1 -1
  16. package/dist/index106.js +101 -88
  17. package/dist/index107.cjs +1 -1
  18. package/dist/index107.js +37 -14
  19. package/dist/index108.cjs +1 -1
  20. package/dist/index108.js +8 -3
  21. package/dist/index109.cjs +1 -1
  22. package/dist/index109.js +20 -26
  23. package/dist/index110.cjs +1 -2
  24. package/dist/index110.js +2 -25
  25. package/dist/index111.cjs +1 -1
  26. package/dist/index111.js +75 -9
  27. package/dist/index112.cjs +1 -1
  28. package/dist/index112.js +15 -8
  29. package/dist/index113.cjs +1 -1
  30. package/dist/index113.js +151 -10
  31. package/dist/index114.cjs +20 -1
  32. package/dist/index114.js +326 -11
  33. package/dist/index115.cjs +3 -1
  34. package/dist/index115.js +451 -13
  35. package/dist/index116.cjs +1 -1
  36. package/dist/index116.js +71 -19
  37. package/dist/index117.cjs +1 -1
  38. package/dist/index117.js +16 -14
  39. package/dist/index118.cjs +1 -1
  40. package/dist/index118.js +10 -4
  41. package/dist/index119.cjs +1 -1
  42. package/dist/index119.js +125 -6
  43. package/dist/index120.cjs +1 -1
  44. package/dist/index120.js +5 -18
  45. package/dist/index121.cjs +1 -1
  46. package/dist/index121.js +45 -10
  47. package/dist/index122.cjs +1 -1
  48. package/dist/index122.js +36 -56
  49. package/dist/index123.cjs +1 -1
  50. package/dist/index123.js +6 -6
  51. package/dist/index124.cjs +1 -1
  52. package/dist/index124.js +90 -13
  53. package/dist/index125.cjs +1 -1
  54. package/dist/index125.js +14 -7
  55. package/dist/index126.cjs +1 -1
  56. package/dist/index126.js +3 -138
  57. package/dist/index127.cjs +1 -1
  58. package/dist/index127.js +26 -7
  59. package/dist/index128.cjs +2 -1
  60. package/dist/index128.js +22 -19
  61. package/dist/index129.cjs +1 -1
  62. package/dist/index129.js +9 -17
  63. package/dist/index130.cjs +1 -1
  64. package/dist/index130.js +8 -43
  65. package/dist/index131.cjs +1 -1
  66. package/dist/index131.js +10 -21
  67. package/dist/index132.cjs +1 -1
  68. package/dist/index132.js +11 -80
  69. package/dist/index133.cjs +1 -1
  70. package/dist/index133.js +13 -11
  71. package/dist/index134.cjs +1 -1
  72. package/dist/index134.js +15 -7
  73. package/dist/index135.cjs +1 -1
  74. package/dist/index135.js +14 -6
  75. package/dist/index136.cjs +1 -1
  76. package/dist/index136.js +4 -41
  77. package/dist/index137.cjs +1 -1
  78. package/dist/index137.js +6 -5
  79. package/dist/index138.cjs +1 -1
  80. package/dist/index138.js +18 -13
  81. package/dist/index139.cjs +1 -1
  82. package/dist/index139.js +10 -34
  83. package/dist/index140.cjs +1 -1
  84. package/dist/index140.js +56 -53
  85. package/dist/index141.cjs +1 -1
  86. package/dist/index141.js +6 -25
  87. package/dist/index142.cjs +1 -1
  88. package/dist/index142.js +13 -6
  89. package/dist/index143.cjs +1 -1
  90. package/dist/index143.js +7 -18
  91. package/dist/index144.cjs +1 -1
  92. package/dist/index144.js +138 -15
  93. package/dist/index145.cjs +1 -1
  94. package/dist/index145.js +7 -5
  95. package/dist/index146.cjs +1 -1
  96. package/dist/index146.js +21 -13
  97. package/dist/index147.cjs +1 -1
  98. package/dist/index147.js +17 -10
  99. package/dist/index148.cjs +1 -1
  100. package/dist/index148.js +42 -11
  101. package/dist/index149.cjs +1 -1
  102. package/dist/index149.js +21 -11
  103. package/dist/index150.cjs +1 -1
  104. package/dist/index150.js +80 -8
  105. package/dist/index151.cjs +1 -1
  106. package/dist/index151.js +11 -3
  107. package/dist/index152.cjs +1 -1
  108. package/dist/index152.js +13 -16
  109. package/dist/index153.cjs +1 -1
  110. package/dist/index153.js +6 -5
  111. package/dist/index154.cjs +1 -1
  112. package/dist/index154.js +38 -168
  113. package/dist/index155.cjs +1 -1
  114. package/dist/index155.js +5 -103
  115. package/dist/index156.cjs +1 -1
  116. package/dist/index156.js +1 -1
  117. package/dist/index158.cjs +1 -1
  118. package/dist/index158.js +28 -28
  119. package/dist/index160.cjs +1 -1
  120. package/dist/index160.js +5 -5
  121. package/dist/index161.cjs +1 -1
  122. package/dist/index161.js +2 -2
  123. package/dist/index162.cjs +1 -1
  124. package/dist/index162.js +1 -1
  125. package/dist/index163.cjs +1 -1
  126. package/dist/index163.js +1 -1
  127. package/dist/index166.cjs +1 -1
  128. package/dist/index166.js +1 -1
  129. package/dist/index167.cjs +1 -1
  130. package/dist/index167.js +1 -1
  131. package/dist/index17.cjs +1 -1
  132. package/dist/index17.js +26 -16
  133. package/dist/index170.cjs +1 -1
  134. package/dist/index170.js +2 -2
  135. package/dist/index171.cjs +1 -1
  136. package/dist/index171.js +1 -1
  137. package/dist/index174.cjs +1 -1
  138. package/dist/index174.js +1 -1
  139. package/dist/index176.cjs +1 -1
  140. package/dist/index176.js +1 -1
  141. package/dist/index177.cjs +1 -1
  142. package/dist/index177.js +1 -1
  143. package/dist/index178.cjs +1 -1
  144. package/dist/index178.js +2 -2
  145. package/dist/index179.cjs +1 -1
  146. package/dist/index179.js +1 -1
  147. package/dist/index18.cjs +1 -1
  148. package/dist/index18.js +8 -8
  149. package/dist/index180.cjs +1 -1
  150. package/dist/index180.js +1 -1
  151. package/dist/index181.cjs +1 -1
  152. package/dist/index181.js +2 -2
  153. package/dist/index182.cjs +1 -1
  154. package/dist/index182.js +6 -6
  155. package/dist/index184.cjs +1 -1
  156. package/dist/index184.js +3 -3
  157. package/dist/index185.cjs +1 -1
  158. package/dist/index185.js +7 -7
  159. package/dist/index186.cjs +1 -1
  160. package/dist/index186.js +1 -1
  161. package/dist/index187.cjs +1 -1
  162. package/dist/index187.js +1 -1
  163. package/dist/index189.cjs +1 -1
  164. package/dist/index189.js +2 -2
  165. package/dist/index192.cjs +1 -1
  166. package/dist/index192.js +3 -3
  167. package/dist/index193.cjs +1 -1
  168. package/dist/index193.js +2 -2
  169. package/dist/index194.cjs +1 -1
  170. package/dist/index194.js +2 -2
  171. package/dist/index195.cjs +1 -1
  172. package/dist/index195.js +1 -1
  173. package/dist/index196.cjs +1 -1
  174. package/dist/index196.js +2 -2
  175. package/dist/index197.cjs +1 -1
  176. package/dist/index197.js +2 -2
  177. package/dist/index199.cjs +1 -1
  178. package/dist/index199.js +1 -1
  179. package/dist/index20.cjs +1 -1
  180. package/dist/index20.js +2 -2
  181. package/dist/index200.cjs +1 -1
  182. package/dist/index200.js +2 -2
  183. package/dist/index203.cjs +1 -1
  184. package/dist/index203.js +3 -3
  185. package/dist/index204.cjs +1 -1
  186. package/dist/index204.js +2 -2
  187. package/dist/index205.cjs +1 -1
  188. package/dist/index205.js +1 -1
  189. package/dist/index206.cjs +1 -1
  190. package/dist/index206.js +2 -2
  191. package/dist/index209.cjs +1 -1
  192. package/dist/index209.js +2 -2
  193. package/dist/index210.cjs +1 -1
  194. package/dist/index210.js +1 -1
  195. package/dist/index211.cjs +1 -1
  196. package/dist/index211.js +4 -4
  197. package/dist/index212.cjs +1 -1
  198. package/dist/index212.js +6 -6
  199. package/dist/index214.cjs +1 -1
  200. package/dist/index214.js +3 -3
  201. package/dist/index215.cjs +1 -1
  202. package/dist/index215.js +2 -2
  203. package/dist/index217.cjs +1 -1
  204. package/dist/index217.js +103 -24
  205. package/dist/index218.cjs +1 -1
  206. package/dist/index218.js +15 -45
  207. package/dist/index219.cjs +1 -1
  208. package/dist/index219.js +213 -8
  209. package/dist/index22.cjs +1 -1
  210. package/dist/index22.js +9 -9
  211. package/dist/index220.cjs +1 -1
  212. package/dist/index220.js +106 -101
  213. package/dist/index221.cjs +1 -1
  214. package/dist/index221.js +203 -13
  215. package/dist/index222.cjs +1 -1
  216. package/dist/index222.js +41 -213
  217. package/dist/index223.cjs +1 -2
  218. package/dist/index223.js +77 -40
  219. package/dist/index224.cjs +1 -1
  220. package/dist/index224.js +2 -2
  221. package/dist/index225.cjs +1 -1
  222. package/dist/index225.js +24 -5
  223. package/dist/index226.cjs +1 -1
  224. package/dist/index226.js +45 -9
  225. package/dist/index227.cjs +1 -1
  226. package/dist/index227.js +9 -19
  227. package/dist/index228.cjs +2 -1
  228. package/dist/index228.js +41 -8
  229. package/dist/index229.cjs +1 -1
  230. package/dist/index229.js +2 -67
  231. package/dist/index23.cjs +1 -1
  232. package/dist/index23.js +29 -12
  233. package/dist/index230.cjs +1 -1
  234. package/dist/index230.js +5 -65
  235. package/dist/index231.cjs +1 -1
  236. package/dist/index231.js +9 -187
  237. package/dist/index232.cjs +1 -1
  238. package/dist/index232.js +17 -26
  239. package/dist/index233.cjs +1 -1
  240. package/dist/index233.js +8 -76
  241. package/dist/index234.cjs +1 -1
  242. package/dist/index234.js +66 -40
  243. package/dist/index235.cjs +1 -1
  244. package/dist/index235.js +64 -15
  245. package/dist/index236.cjs +1 -1
  246. package/dist/index236.js +187 -12
  247. package/dist/index237.cjs +1 -1
  248. package/dist/index237.js +26 -106
  249. package/dist/index238.cjs +1 -1
  250. package/dist/index238.js +70 -200
  251. package/dist/index239.cjs +1 -1
  252. package/dist/index239.js +37 -39
  253. package/dist/index24.cjs +1 -1
  254. package/dist/index24.js +8 -59
  255. package/dist/index240.cjs +1 -1
  256. package/dist/index240.js +15 -77
  257. package/dist/index241.cjs +1 -1
  258. package/dist/index241.js +14 -2
  259. package/dist/index242.cjs +1 -1
  260. package/dist/index242.js +1 -1
  261. package/dist/index244.cjs +1 -1
  262. package/dist/index244.js +6 -19
  263. package/dist/index245.cjs +1 -1
  264. package/dist/index245.js +7 -7
  265. package/dist/index246.cjs +1 -1
  266. package/dist/index246.js +20 -7
  267. package/dist/index247.cjs +1 -1
  268. package/dist/index247.js +1 -1
  269. package/dist/index248.cjs +1 -1
  270. package/dist/index248.js +1 -1
  271. package/dist/index25.cjs +1 -16
  272. package/dist/index25.js +12 -113
  273. package/dist/index250.cjs +1 -2
  274. package/dist/index250.js +654 -88
  275. package/dist/index251.cjs +1 -1
  276. package/dist/index251.js +177 -14
  277. package/dist/index252.cjs +2 -1
  278. package/dist/index252.js +88 -654
  279. package/dist/index253.cjs +1 -1
  280. package/dist/index253.js +14 -177
  281. package/dist/index26.cjs +1 -1
  282. package/dist/index26.js +59 -30
  283. package/dist/index27.cjs +16 -1
  284. package/dist/index27.js +111 -24
  285. package/dist/index28.cjs +1 -1
  286. package/dist/index28.js +29 -7
  287. package/dist/index29.cjs +1 -1
  288. package/dist/index29.js +13 -171
  289. package/dist/index30.cjs +1 -1
  290. package/dist/index30.js +32 -109
  291. package/dist/index31.cjs +1 -1
  292. package/dist/index31.js +32 -30
  293. package/dist/index32.cjs +1 -1
  294. package/dist/index32.js +55 -3
  295. package/dist/index33.cjs +1 -1
  296. package/dist/index33.js +46 -2
  297. package/dist/index34.cjs +1 -1
  298. package/dist/index34.js +26 -4
  299. package/dist/index35.cjs +1 -2
  300. package/dist/index35.js +6 -59
  301. package/dist/index36.cjs +1 -2
  302. package/dist/index36.js +18 -54
  303. package/dist/index37.cjs +1 -3
  304. package/dist/index37.js +15 -215
  305. package/dist/index38.cjs +1 -1
  306. package/dist/index38.js +5 -23
  307. package/dist/index39.cjs +1 -1
  308. package/dist/index39.js +13 -18
  309. package/dist/index40.cjs +1 -1
  310. package/dist/index40.js +10 -10
  311. package/dist/index41.cjs +1 -1
  312. package/dist/index41.js +11 -19
  313. package/dist/index42.cjs +1 -1
  314. package/dist/index42.js +11 -45
  315. package/dist/index43.cjs +1 -1
  316. package/dist/index43.js +3 -13
  317. package/dist/index44.cjs +1 -1
  318. package/dist/index44.js +21 -12
  319. package/dist/index45.cjs +1 -1
  320. package/dist/index45.js +8 -24
  321. package/dist/index46.cjs +1 -1
  322. package/dist/index46.js +3 -28
  323. package/dist/index47.cjs +1 -1
  324. package/dist/index47.js +16 -47
  325. package/dist/index48.cjs +1 -1
  326. package/dist/index48.js +5 -16
  327. package/dist/index49.cjs +1 -1
  328. package/dist/index49.js +170 -10
  329. package/dist/index50.cjs +1 -1
  330. package/dist/index50.js +102 -30
  331. package/dist/index51.cjs +1 -1
  332. package/dist/index51.js +169 -34
  333. package/dist/index52.cjs +1 -1
  334. package/dist/index52.js +111 -7
  335. package/dist/index53.cjs +1 -1
  336. package/dist/index53.js +30 -29
  337. package/dist/index54.cjs +1 -1
  338. package/dist/index54.js +2 -23
  339. package/dist/index55.cjs +1 -1
  340. package/dist/index55.js +4 -8
  341. package/dist/index56.cjs +2 -1
  342. package/dist/index56.js +58 -69
  343. package/dist/index57.cjs +2 -1
  344. package/dist/index57.js +51 -43
  345. package/dist/index58.cjs +3 -1
  346. package/dist/index58.js +208 -16
  347. package/dist/index59.cjs +1 -1
  348. package/dist/index59.js +22 -36
  349. package/dist/index60.cjs +1 -1
  350. package/dist/index60.js +18 -17
  351. package/dist/index61.cjs +1 -1
  352. package/dist/index61.js +10 -6
  353. package/dist/index62.cjs +1 -1
  354. package/dist/index62.js +20 -9
  355. package/dist/index63.cjs +1 -1
  356. package/dist/index63.js +10 -10
  357. package/dist/index64.cjs +1 -1
  358. package/dist/index64.js +12 -164
  359. package/dist/index65.cjs +1 -1
  360. package/dist/index65.js +23 -31
  361. package/dist/index66.cjs +1 -1
  362. package/dist/index66.js +25 -74
  363. package/dist/index67.cjs +1 -1
  364. package/dist/index67.js +47 -13
  365. package/dist/index68.cjs +1 -1
  366. package/dist/index68.js +16 -51
  367. package/dist/index69.cjs +1 -1
  368. package/dist/index69.js +11 -7
  369. package/dist/index70.cjs +1 -1
  370. package/dist/index70.js +31 -7
  371. package/dist/index71.cjs +1 -1
  372. package/dist/index71.js +36 -21
  373. package/dist/index72.cjs +1 -1
  374. package/dist/index72.js +7 -8
  375. package/dist/index73.cjs +1 -1
  376. package/dist/index73.js +27 -29
  377. package/dist/index74.cjs +1 -1
  378. package/dist/index74.js +21 -15
  379. package/dist/index75.cjs +1 -1
  380. package/dist/index75.js +7 -73
  381. package/dist/index76.cjs +1 -1
  382. package/dist/index76.js +70 -35
  383. package/dist/index77.cjs +1 -1
  384. package/dist/index77.js +46 -16
  385. package/dist/index78.cjs +1 -1
  386. package/dist/index78.js +21 -73
  387. package/dist/index79.cjs +1 -1
  388. package/dist/index79.js +37 -12
  389. package/dist/index80.cjs +1 -1
  390. package/dist/index80.js +17 -29
  391. package/dist/index81.cjs +1 -2
  392. package/dist/index81.js +6 -120
  393. package/dist/index82.cjs +1 -1
  394. package/dist/index82.js +8 -13
  395. package/dist/index83.cjs +1 -1
  396. package/dist/index83.js +13 -24
  397. package/dist/index84.cjs +1 -1
  398. package/dist/index84.js +162 -31
  399. package/dist/index85.cjs +1 -1
  400. package/dist/index85.js +72 -39
  401. package/dist/index86.cjs +1 -1
  402. package/dist/index86.js +12 -5
  403. package/dist/index87.cjs +1 -1
  404. package/dist/index87.js +50 -102
  405. package/dist/index88.cjs +1 -1
  406. package/dist/index88.js +7 -37
  407. package/dist/index89.cjs +1 -1
  408. package/dist/index89.js +7 -8
  409. package/dist/index90.cjs +1 -1
  410. package/dist/index90.js +21 -20
  411. package/dist/index91.cjs +1 -1
  412. package/dist/index91.js +9 -2
  413. package/dist/index92.cjs +1 -1
  414. package/dist/index92.js +31 -75
  415. package/dist/index93.cjs +1 -1
  416. package/dist/index93.js +16 -15
  417. package/dist/index94.cjs +1 -1
  418. package/dist/index94.js +72 -150
  419. package/dist/index95.cjs +1 -20
  420. package/dist/index95.js +35 -326
  421. package/dist/index96.cjs +1 -3
  422. package/dist/index96.js +16 -451
  423. package/dist/index97.cjs +1 -1
  424. package/dist/index97.js +72 -70
  425. package/dist/index98.cjs +1 -1
  426. package/dist/index98.js +12 -16
  427. package/dist/index99.cjs +1 -1
  428. package/dist/index99.js +29 -10
  429. package/dist/src/lib/fetcher/fetcher.d.ts +1 -0
  430. package/dist/src/lib/retry.d.ts +3 -1
  431. package/package.json +1 -1
package/dist/index106.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./index32.cjs"),h=require("./index35.cjs"),g=require("./index96.cjs"),L=require("./index40.cjs"),w=require("./index120.cjs"),N=require("./index65.cjs"),c=require("./index42.cjs"),M=require("./index67.cjs"),S=require("./index100.cjs"),C="0x5792579257925792579257925792579257925792579257925792579257925792",T=c.numberToHex(0,{size:32});async function _(s,i){const{account:p=s.account,capabilities:l,chain:u=s.chain,experimental_fallback:v,experimental_fallbackDelay:m=32,forceAtomic:b=!1,id:q,version:x="2.0.0"}=i,r=p?k.parseAccount(p):null,d=i.calls.map(o=>{const e=o,a=e.abi?L.encodeFunctionData({abi:e.abi,functionName:e.functionName,args:e.args}):e.data;return{data:e.dataSuffix&&a?w.concat([a,e.dataSuffix]):a,to:e.to,value:e.value?c.numberToHex(e.value):void 0}});try{const o=await s.request({method:"wallet_sendCalls",params:[{atomicRequired:b,calls:d,capabilities:l,chainId:c.numberToHex(u.id),from:r==null?void 0:r.address,id:q,version:x}]},{retryCount:0});return typeof o=="string"?{id:o}:o}catch(o){const e=o;if(v&&(e.name==="MethodNotFoundRpcError"||e.name==="MethodNotSupportedRpcError"||e.name==="UnknownRpcError"||e.details.toLowerCase().includes("does not exist / is not available")||e.details.toLowerCase().includes("missing or invalid. request()")||e.details.toLowerCase().includes("did not match any variant of untagged enum")||e.details.toLowerCase().includes("account upgraded to unsupported contract")||e.details.toLowerCase().includes("eip-7702 not supported")||e.details.toLowerCase().includes("unsupported wc_ method")||e.details.toLowerCase().includes("feature toggled misconfigured")||e.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(l&&Object.values(l).some(n=>!n.optional)){const n="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new g.UnsupportedNonOptionalCapabilityError(new h.BaseError(n,{details:n}))}if(b&&d.length>1){const t="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new g.AtomicityNotSupportedError(new h.BaseError(t,{details:t}))}const a=[];for(const t of d){const n=S.sendTransaction(s,{account:r,chain:u,data:t.data,to:t.to,value:t.value?N.hexToBigInt(t.value):void 0});a.push(n),m>0&&await new Promise(E=>setTimeout(E,m))}const f=await Promise.allSettled(a);if(f.every(t=>t.status==="rejected"))throw f[0].reason;const y=f.map(t=>t.status==="fulfilled"?t.value:T);return{id:w.concat([...y,c.numberToHex(u.id,{size:32}),C])}}throw M.getTransactionError(o,{...i,account:r,chain:i.chain})}}exports.fallbackMagicIdentifier=C;exports.fallbackTransactionErrorMagicIdentifier=T;exports.sendCalls=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index89.cjs"),k=require("./index100.cjs"),f=require("./index75.cjs"),$=require("./index107.cjs"),C=require("./index108.cjs"),B=require("./index109.cjs"),D=require("./index110.cjs"),P=require("./index80.cjs"),W=require("./index99.cjs"),y=require("./index20.cjs"),z=require("./index111.cjs");async function G(r,b){const{checkReplacement:A=!0,confirmations:c=1,hash:p,onReplaced:F,retryCount:h=6,retryDelay:N=({count:t})=>~~(1<<t)*200,timeout:w=18e4}=b,I=D.stringify(["waitForTransactionReceipt",r.uid,p]),j=(()=>{var t;return b.pollingInterval?b.pollingInterval:(t=r.chain)!=null&&t.experimental_preconfirmationTime?r.chain.experimental_preconfirmationTime:r.pollingInterval})();let s,i,e,l=!1,n,a;const{promise:E,resolve:x,reject:v}=C.withResolvers(),q=w?setTimeout(()=>{a==null||a(),n==null||n(),v(new k.WaitForTransactionReceiptTimeoutError({hash:p}))},w):void 0;return n=$.observe(I,{onReplaced:F,resolve:x,reject:v},async t=>{if(e=await f.getAction(r,y.getTransactionReceipt,"getTransactionReceipt")({hash:p}).catch(()=>{}),e&&c<=1){clearTimeout(q),t.resolve(e),n==null||n();return}a=f.getAction(r,z.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:j,async onBlockNumber(M){const g=d=>{clearTimeout(q),a==null||a(),d(),n==null||n()};let T=M;if(!l)try{if(e){if(c>1&&(!e.blockNumber||T-e.blockNumber+1n<c))return;g(()=>t.resolve(e));return}if(A&&!s&&(l=!0,await B.withRetry(async()=>{s=await f.getAction(r,W.getTransaction,"getTransaction")({hash:p}),s.blockNumber&&(T=s.blockNumber)},{delay:N,retryCount:h}),l=!1),e=await f.getAction(r,y.getTransactionReceipt,"getTransactionReceipt")({hash:p}),c>1&&(!e.blockNumber||T-e.blockNumber+1n<c))return;g(()=>t.resolve(e))}catch(d){if(d instanceof k.TransactionNotFoundError||d instanceof k.TransactionReceiptNotFoundError){if(!s){l=!1;return}try{i=s,l=!0;const m=await B.withRetry(()=>f.getAction(r,P.getBlock,"getBlock")({blockNumber:T,includeTransactions:!0}),{delay:N,retryCount:h,shouldRetry:({error:u})=>u instanceof S.BlockNotFoundError});l=!1;const o=m.transactions.find(({from:u,nonce:O})=>u===i.from&&O===i.nonce);if(!o||(e=await f.getAction(r,y.getTransactionReceipt,"getTransactionReceipt")({hash:o.hash}),c>1&&(!e.blockNumber||T-e.blockNumber+1n<c)))return;let R="replaced";o.to===i.to&&o.value===i.value&&o.input===i.input?R="repriced":o.from===o.to&&o.value===0n&&(R="cancelled"),g(()=>{var u;(u=t.onReplaced)==null||u.call(t,{reason:R,replacedTransaction:i,transaction:o,transactionReceipt:e}),t.resolve(e)})}catch(m){g(()=>t.reject(m))}}else g(()=>t.reject(d))}}})}),E}exports.waitForTransactionReceipt=G;
package/dist/index106.js CHANGED
@@ -1,93 +1,106 @@
1
- import { parseAccount as E } from "./index32.js";
2
- import { BaseError as w } from "./index35.js";
3
- import { UnsupportedNonOptionalCapabilityError as L, AtomicityNotSupportedError as N } from "./index96.js";
4
- import { encodeFunctionData as T } from "./index40.js";
5
- import { concat as g } from "./index120.js";
6
- import { hexToBigInt as k } from "./index65.js";
7
- import { numberToHex as c } from "./index42.js";
8
- import { getTransactionError as _ } from "./index67.js";
9
- import { sendTransaction as S } from "./index100.js";
10
- const q = "0x5792579257925792579257925792579257925792579257925792579257925792", A = c(0, {
11
- size: 32
12
- });
13
- async function P(i, s) {
14
- const { account: f = i.account, capabilities: l, chain: d = i.chain, experimental_fallback: b, experimental_fallbackDelay: m = 32, forceAtomic: h = !1, id: C, version: v = "2.0.0" } = s, r = f ? E(f) : null, u = s.calls.map((t) => {
15
- const e = t, a = e.abi ? T({
16
- abi: e.abi,
17
- functionName: e.functionName,
18
- args: e.args
19
- }) : e.data;
20
- return {
21
- data: e.dataSuffix && a ? g([a, e.dataSuffix]) : a,
22
- to: e.to,
23
- value: e.value ? c(e.value) : void 0
24
- };
25
- });
26
- try {
27
- const t = await i.request({
28
- method: "wallet_sendCalls",
29
- params: [
30
- {
31
- atomicRequired: h,
32
- calls: u,
33
- capabilities: l,
34
- chainId: c(d.id),
35
- from: r == null ? void 0 : r.address,
36
- id: C,
37
- version: v
38
- }
39
- ]
40
- }, { retryCount: 0 });
41
- return typeof t == "string" ? { id: t } : t;
42
- } catch (t) {
43
- const e = t;
44
- if (b && (e.name === "MethodNotFoundRpcError" || e.name === "MethodNotSupportedRpcError" || e.name === "UnknownRpcError" || e.details.toLowerCase().includes("does not exist / is not available") || e.details.toLowerCase().includes("missing or invalid. request()") || e.details.toLowerCase().includes("did not match any variant of untagged enum") || e.details.toLowerCase().includes("account upgraded to unsupported contract") || e.details.toLowerCase().includes("eip-7702 not supported") || e.details.toLowerCase().includes("unsupported wc_ method") || // magic.link
45
- e.details.toLowerCase().includes("feature toggled misconfigured") || // Trust Wallet
46
- e.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))) {
47
- if (l && Object.values(l).some((n) => !n.optional)) {
48
- const n = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
49
- throw new L(new w(n, {
50
- details: n
51
- }));
52
- }
53
- if (h && u.length > 1) {
54
- const o = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
55
- throw new N(new w(o, {
56
- details: o
57
- }));
58
- }
59
- const a = [];
60
- for (const o of u) {
61
- const n = S(i, {
62
- account: r,
63
- chain: d,
64
- data: o.data,
65
- to: o.to,
66
- value: o.value ? k(o.value) : void 0
67
- });
68
- a.push(n), m > 0 && await new Promise((x) => setTimeout(x, m));
69
- }
70
- const p = await Promise.allSettled(a);
71
- if (p.every((o) => o.status === "rejected"))
72
- throw p[0].reason;
73
- const y = p.map((o) => o.status === "fulfilled" ? o.value : A);
74
- return {
75
- id: g([
76
- ...y,
77
- c(d.id, { size: 32 }),
78
- q
79
- ])
80
- };
1
+ import { BlockNotFoundError as M } from "./index89.js";
2
+ import { WaitForTransactionReceiptTimeoutError as O, TransactionNotFoundError as W, TransactionReceiptNotFoundError as q } from "./index100.js";
3
+ import { getAction as u } from "./index75.js";
4
+ import { observe as z } from "./index107.js";
5
+ import { withResolvers as G } from "./index108.js";
6
+ import { withRetry as B } from "./index109.js";
7
+ import { stringify as H } from "./index110.js";
8
+ import { getBlock as J } from "./index80.js";
9
+ import { getTransaction as K } from "./index99.js";
10
+ import { getTransactionReceipt as y } from "./index20.js";
11
+ import { watchBlockNumber as L } from "./index111.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();
34
+ return;
81
35
  }
82
- throw _(t, {
83
- ...s,
84
- account: r,
85
- chain: s.chain
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
+ }
86
101
  });
87
- }
102
+ }), x;
88
103
  }
89
104
  export {
90
- q as fallbackMagicIdentifier,
91
- A as fallbackTransactionErrorMagicIdentifier,
92
- P as sendCalls
105
+ er as waitForTransactionReceipt
93
106
  };
package/dist/index107.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index32.cjs"),p=require("./index42.cjs");async function f(s,c={}){const{account:n=s.account,chainId:t}=c,e=n?l.parseAccount(n):void 0,o=t?[e==null?void 0:e.address,[p.numberToHex(t)]]:[e==null?void 0:e.address],u=await s.request({method:"wallet_getCapabilities",params:o}),a={};for(const[r,b]of Object.entries(u)){a[Number(r)]={};for(let[i,d]of Object.entries(b))i==="addSubAccount"&&(i="unstable_addSubAccount"),a[Number(r)][i]=d}return typeof t=="number"?a[t]:a}exports.getCapabilities=f;
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/index107.js CHANGED
@@ -1,17 +1,40 @@
1
- import { parseAccount as p } from "./index32.js";
2
- import { numberToHex as f } from "./index42.js";
3
- async function h(s, n = {}) {
4
- const { account: o = s.account, chainId: t } = n, e = o ? p(o) : void 0, c = t ? [e == null ? void 0 : e.address, [f(t)]] : [e == null ? void 0 : e.address], b = await s.request({
5
- method: "wallet_getCapabilities",
6
- params: c
7
- }), a = {};
8
- for (const [r, u] of Object.entries(b)) {
9
- a[Number(r)] = {};
10
- for (let [i, d] of Object.entries(u))
11
- i === "addSubAccount" && (i = "unstable_addSubAccount"), a[Number(r)][i] = d;
12
- }
13
- return typeof t == "number" ? a[t] : a;
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);
32
+ };
33
+ const a = m(u);
34
+ return typeof a == "function" && g.set(s, a), r;
14
35
  }
15
36
  export {
16
- h as getCapabilities
37
+ g as cleanupCache,
38
+ f as listenersCache,
39
+ y as observe
17
40
  };
package/dist/index108.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function s(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}exports.getPermissions=s;
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/index108.js CHANGED
@@ -1,6 +1,11 @@
1
- async function t(e) {
2
- return await e.request({ method: "wallet_getPermissions" }, { dedupe: !0 });
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 };
3
8
  }
4
9
  export {
5
- t as getPermissions
10
+ i as withResolvers
6
11
  };
package/dist/index109.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index32.cjs"),f=require("./index110.cjs"),g=require("./index111.cjs"),s=require("./index55.cjs"),h=require("./index69.cjs"),A=require("./index82.cjs");async function p(o,n){var i;const{account:c=o.account,chainId:u,nonce:a}=n;if(!c)throw new f.AccountNotFoundError({docsPath:"/docs/eip7702/prepareAuthorization"});const r=d.parseAccount(c),t=(()=>{if(n.executor)return n.executor==="self"?n.executor:d.parseAccount(n.executor)})(),e={address:n.contractAddress??n.address,chainId:u,nonce:a};return typeof e.chainId>"u"&&(e.chainId=((i=o.chain)==null?void 0:i.id)??await s.getAction(o,h.getChainId,"getChainId")({})),typeof e.nonce>"u"&&(e.nonce=await s.getAction(o,A.getTransactionCount,"getTransactionCount")({address:r.address,blockTag:"pending"}),(t==="self"||t!=null&&t.address&&g.isAddressEqual(t.address,r.address))&&(e.nonce+=1)),e}exports.prepareAuthorization=p;
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/index109.js CHANGED
@@ -1,29 +1,23 @@
1
- import { parseAccount as e } from "./index32.js";
2
- import { AccountNotFoundError as f } from "./index110.js";
3
- import { isAddressEqual as h } from "./index111.js";
4
- import { getAction as a } from "./index55.js";
5
- import { getChainId as p } from "./index69.js";
6
- import { getTransactionCount as g } from "./index82.js";
7
- async function y(r, o) {
8
- var i;
9
- const { account: c = r.account, chainId: s, nonce: u } = o;
10
- if (!c)
11
- throw new f({
12
- docsPath: "/docs/eip7702/prepareAuthorization"
13
- });
14
- const d = e(c), t = (() => {
15
- if (o.executor)
16
- return o.executor === "self" ? o.executor : e(o.executor);
17
- })(), n = {
18
- address: o.contractAddress ?? o.address,
19
- chainId: s,
20
- nonce: u
21
- };
22
- return typeof n.chainId > "u" && (n.chainId = ((i = r.chain) == null ? void 0 : i.id) ?? await a(r, p, "getChainId")({})), typeof n.nonce > "u" && (n.nonce = await a(r, g, "getTransactionCount")({
23
- address: d.address,
24
- blockTag: "pending"
25
- }), (t === "self" || t != null && t.address && h(t.address, d.address)) && (n.nonce += 1)), n;
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);
16
+ }
17
+ };
18
+ a();
19
+ });
26
20
  }
27
21
  export {
28
- y as prepareAuthorization
22
+ p as withRetry
29
23
  };
package/dist/index110.cjs CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index35.cjs");class c extends t.BaseError{constructor({docsPath:o}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
2
- `),{docsPath:o,docsSlug:"account",name:"AccountNotFoundError"})}}class u extends t.BaseError{constructor({docsPath:o,metaMessages:e,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:o,metaMessages:e,name:"AccountTypeNotSupportedError"})}}exports.AccountNotFoundError=c;exports.AccountTypeNotSupportedError=u;
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/index110.js CHANGED
@@ -1,27 +1,4 @@
1
- import { BaseError as t } from "./index35.js";
2
- class u extends t {
3
- constructor({ docsPath: o } = {}) {
4
- super([
5
- "Could not find an Account to execute with this Action.",
6
- "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
7
- ].join(`
8
- `), {
9
- docsPath: o,
10
- docsSlug: "account",
11
- name: "AccountNotFoundError"
12
- });
13
- }
14
- }
15
- class s extends t {
16
- constructor({ docsPath: o, metaMessages: c, type: r }) {
17
- super(`Account type "${r}" is not supported.`, {
18
- docsPath: o,
19
- metaMessages: c,
20
- name: "AccountTypeNotSupportedError"
21
- });
22
- }
23
- }
1
+ const g = (r, n, i) => JSON.stringify(r, (e, t) => typeof t == "bigint" ? t.toString() : t, i);
24
2
  export {
25
- u as AccountNotFoundError,
26
- s as AccountTypeNotSupportedError
3
+ g as stringify
27
4
  };
package/dist/index111.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index148.cjs"),d=require("./index149.cjs");function t(s,r){if(!d.isAddress(s,{strict:!1}))throw new e.InvalidAddressError({address:s});if(!d.isAddress(r,{strict:!1}))throw new e.InvalidAddressError({address:r});return s.toLowerCase()===r.toLowerCase()}exports.isAddressEqual=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index31.cjs"),w=require("./index75.cjs"),N=require("./index107.cjs"),h=require("./index112.cjs"),g=require("./index110.cjs"),m=require("./index91.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/index111.js CHANGED
@@ -1,12 +1,78 @@
1
- import { InvalidAddressError as e } from "./index148.js";
2
- import { isAddress as o } from "./index149.js";
3
- function i(r, s) {
4
- if (!o(r, { strict: !1 }))
5
- throw new e({ address: r });
6
- if (!o(s, { strict: !1 }))
7
- throw new e({ address: s });
8
- return r.toLowerCase() === s.toLowerCase();
1
+ import { hexToBigInt as w } from "./index31.js";
2
+ import { getAction as g } from "./index75.js";
3
+ import { observe as y } from "./index107.js";
4
+ import { poll as h } from "./index112.js";
5
+ import { stringify as N } from "./index110.js";
6
+ import { getBlockNumber as v } from "./index91.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;
20
+ try {
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);
32
+ }
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();
73
+ });
74
+ })();
9
75
  }
10
76
  export {
11
- i as isAddressEqual
77
+ j as watchBlockNumber
12
78
  };
package/dist/index112.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index140.cjs"),l=require("./index42.cjs");function c(o){const{kzg:s}=o,n=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),e=typeof o.blobs[0]=="string"?o.blobs.map(t=>i.hexToBytes(t)):o.blobs,b=[];for(const t of e)b.push(Uint8Array.from(s.blobToKzgCommitment(t)));return n==="bytes"?b:b.map(t=>l.bytesToHex(t))}exports.blobsToCommitments=c;
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/index112.js CHANGED
@@ -1,11 +1,18 @@
1
- import { hexToBytes as i } from "./index140.js";
2
- import { bytesToHex as f } from "./index42.js";
3
- function y(o) {
4
- const { kzg: s } = o, n = o.to ?? (typeof o.blobs[0] == "string" ? "hex" : "bytes"), m = typeof o.blobs[0] == "string" ? o.blobs.map((t) => i(t)) : o.blobs, b = [];
5
- for (const t of m)
6
- b.push(Uint8Array.from(s.blobToKzgCommitment(t)));
7
- return n === "bytes" ? b : b.map((t) => f(t));
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;
8
15
  }
9
16
  export {
10
- y as blobsToCommitments
17
+ e as poll
11
18
  };
package/dist/index113.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index140.cjs"),y=require("./index42.cjs");function f(t){const{kzg:c}=t,e=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>b.hexToBytes(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>b.hexToBytes(o)):t.commitments,s=[];for(let o=0;o<n.length;o++){const l=n[o],m=i[o];s.push(Uint8Array.from(c.computeBlobKzgProof(l,m)))}return e==="bytes"?s:s.map(o=>y.bytesToHex(o))}exports.blobsToProofs=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index114.cjs"),M=require("./index115.cjs"),P=require("./index116.cjs"),_=require("./index71.cjs"),I=require("./index98.cjs"),b=require("./index75.cjs"),A=require("./index107.cjs"),O=require("./index112.cjs"),S=require("./index110.cjs"),$=require("./index70.cjs"),j=require("./index91.cjs"),z=require("./index93.cjs"),R=require("./index96.cjs"),U=require("./index105.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;