@gardenfi/utils 2.5.3-beta.7 → 2.5.3-beta.9

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 (443) hide show
  1. package/dist/index100.cjs +1 -1
  2. package/dist/index100.js +8 -3
  3. package/dist/index101.cjs +4 -1
  4. package/dist/index101.js +194 -26
  5. package/dist/index102.cjs +3 -2
  6. package/dist/index102.js +446 -19
  7. package/dist/index103.cjs +1 -1
  8. package/dist/index103.js +27 -9
  9. package/dist/index104.cjs +1 -1
  10. package/dist/index104.js +161 -8
  11. package/dist/index105.cjs +1 -1
  12. package/dist/index105.js +21 -10
  13. package/dist/index106.cjs +1 -1
  14. package/dist/index106.js +127 -11
  15. package/dist/index107.cjs +1 -1
  16. package/dist/index107.js +37 -12
  17. package/dist/index108.cjs +1 -1
  18. package/dist/index108.js +6 -14
  19. package/dist/index109.cjs +1 -1
  20. package/dist/index109.js +27 -4
  21. package/dist/index110.cjs +1 -1
  22. package/dist/index110.js +55 -6
  23. package/dist/index111.cjs +1 -1
  24. package/dist/index111.js +43 -16
  25. package/dist/index112.cjs +1 -1
  26. package/dist/index112.js +190 -12
  27. package/dist/index113.cjs +1 -1
  28. package/dist/index113.js +4 -7
  29. package/dist/index114.cjs +1 -1
  30. package/dist/index114.js +64 -7
  31. package/dist/index115.cjs +1 -1
  32. package/dist/index115.js +17 -18
  33. package/dist/index116.cjs +1 -1
  34. package/dist/index116.js +3 -8
  35. package/dist/index117.cjs +1 -1
  36. package/dist/index117.js +15 -20
  37. package/dist/index118.cjs +1 -1
  38. package/dist/index118.js +23 -17
  39. package/dist/index119.cjs +1 -1
  40. package/dist/index119.js +11 -40
  41. package/dist/index120.cjs +1 -1
  42. package/dist/index120.js +18 -21
  43. package/dist/index121.cjs +1 -1
  44. package/dist/index121.js +32 -78
  45. package/dist/index122.cjs +1 -1
  46. package/dist/index122.js +3 -12
  47. package/dist/index123.cjs +1 -1
  48. package/dist/index123.js +18 -58
  49. package/dist/index124.cjs +1 -1
  50. package/dist/index124.js +26 -12
  51. package/dist/index125.cjs +1 -1
  52. package/dist/index125.js +36 -8
  53. package/dist/index126.cjs +1 -1
  54. package/dist/index126.js +8 -20
  55. package/dist/index127.cjs +1 -1
  56. package/dist/index127.js +10 -6
  57. package/dist/index128.cjs +1 -1
  58. package/dist/index128.js +22 -32
  59. package/dist/index129.cjs +1 -1
  60. package/dist/index129.js +27 -31
  61. package/dist/index130.cjs +1 -1
  62. package/dist/index130.js +3 -9
  63. package/dist/index131.cjs +1 -1
  64. package/dist/index131.js +65 -50
  65. package/dist/index132.cjs +1 -1
  66. package/dist/index132.js +9 -19
  67. package/dist/index133.cjs +1 -1
  68. package/dist/index133.js +21 -106
  69. package/dist/index134.cjs +1 -1
  70. package/dist/index134.js +8 -68
  71. package/dist/index135.cjs +1 -1
  72. package/dist/index135.js +9 -8
  73. package/dist/index136.cjs +1 -1
  74. package/dist/index136.js +11 -71
  75. package/dist/index137.cjs +1 -2
  76. package/dist/index137.js +7 -3
  77. package/dist/index138.cjs +1 -1
  78. package/dist/index138.js +7 -9
  79. package/dist/index139.cjs +1 -1
  80. package/dist/index139.js +13 -13
  81. package/dist/index140.cjs +1 -1
  82. package/dist/index140.js +32 -4
  83. package/dist/index141.cjs +1 -1
  84. package/dist/index141.js +5 -13
  85. package/dist/index142.cjs +1 -1
  86. package/dist/index142.js +38 -2
  87. package/dist/index143.cjs +1 -1
  88. package/dist/index143.js +107 -27
  89. package/dist/index144.cjs +1 -1
  90. package/dist/index144.js +170 -20
  91. package/dist/index145.cjs +1 -1
  92. package/dist/index145.js +49 -5
  93. package/dist/index146.cjs +1 -1
  94. package/dist/index146.js +32 -5
  95. package/dist/index147.cjs +1 -1
  96. package/dist/index147.js +7 -5
  97. package/dist/index148.cjs +1 -9
  98. package/dist/index148.js +8 -35
  99. package/dist/index149.cjs +1 -1
  100. package/dist/index149.js +21 -3
  101. package/dist/index150.cjs +1 -1
  102. package/dist/index150.js +21 -16
  103. package/dist/index151.cjs +1 -1
  104. package/dist/index151.js +40 -18
  105. package/dist/index152.cjs +1 -1
  106. package/dist/index152.js +22 -35
  107. package/dist/index153.cjs +1 -1
  108. package/dist/index153.js +21 -8
  109. package/dist/index154.cjs +1 -4
  110. package/dist/index154.js +51 -194
  111. package/dist/index155.cjs +1 -1
  112. package/dist/index155.js +11 -27
  113. package/dist/index156.cjs +1 -1
  114. package/dist/index156.js +24 -161
  115. package/dist/index157.cjs +1 -1
  116. package/dist/index157.js +23 -126
  117. package/dist/index158.cjs +1 -1
  118. package/dist/index158.js +102 -25
  119. package/dist/index159.cjs +1 -1
  120. package/dist/index159.js +3 -56
  121. package/dist/index160.cjs +1 -1
  122. package/dist/index160.js +5 -191
  123. package/dist/index161.cjs +1 -1
  124. package/dist/index161.js +32 -4
  125. package/dist/index162.cjs +1 -1
  126. package/dist/index162.js +3 -20
  127. package/dist/index163.cjs +1 -1
  128. package/dist/index163.js +18 -3
  129. package/dist/index164.cjs +1 -1
  130. package/dist/index164.js +5 -16
  131. package/dist/index165.cjs +1 -1
  132. package/dist/index165.js +8 -11
  133. package/dist/index166.cjs +1 -1
  134. package/dist/index166.js +100 -31
  135. package/dist/index167.cjs +1 -1
  136. package/dist/index167.js +81 -3
  137. package/dist/index168.cjs +1 -1
  138. package/dist/index168.js +5 -27
  139. package/dist/index169.cjs +1 -1
  140. package/dist/index169.js +6 -8
  141. package/dist/index170.cjs +1 -1
  142. package/dist/index170.js +27 -25
  143. package/dist/index171.cjs +1 -1
  144. package/dist/index171.js +34 -28
  145. package/dist/index172.cjs +1 -1
  146. package/dist/index172.js +13 -3
  147. package/dist/index173.cjs +1 -1
  148. package/dist/index173.js +19 -6
  149. package/dist/index174.cjs +1 -1
  150. package/dist/index174.js +78 -6
  151. package/dist/index175.cjs +1 -1
  152. package/dist/index175.js +2 -33
  153. package/dist/index176.cjs +1 -1
  154. package/dist/index176.js +15 -5
  155. package/dist/index177.cjs +1 -1
  156. package/dist/index177.js +17 -36
  157. package/dist/index178.cjs +1 -1
  158. package/dist/index178.js +167 -45
  159. package/dist/index179.cjs +1 -1
  160. package/dist/index179.js +17 -32
  161. package/dist/index18.cjs +1 -1
  162. package/dist/index18.js +8 -8
  163. package/dist/index180.cjs +1 -1
  164. package/dist/index180.js +10 -8
  165. package/dist/index181.cjs +1 -1
  166. package/dist/index181.js +27 -39
  167. package/dist/index182.cjs +1 -1
  168. package/dist/index182.js +2 -52
  169. package/dist/index183.cjs +1 -1
  170. package/dist/index183.js +13 -104
  171. package/dist/index184.cjs +1 -1
  172. package/dist/index184.js +13 -3
  173. package/dist/index185.cjs +1 -1
  174. package/dist/index185.js +47 -5
  175. package/dist/index186.cjs +1 -1
  176. package/dist/index186.js +11 -3
  177. package/dist/index187.cjs +1 -1
  178. package/dist/index187.js +7 -17
  179. package/dist/index188.cjs +1 -1
  180. package/dist/index188.js +66 -5
  181. package/dist/index189.cjs +1 -1
  182. package/dist/index189.js +46 -8
  183. package/dist/index190.cjs +1 -1
  184. package/dist/index190.js +35 -101
  185. package/dist/index191.cjs +1 -1
  186. package/dist/index191.js +17 -5
  187. package/dist/index192.cjs +1 -1
  188. package/dist/index192.js +6 -6
  189. package/dist/index193.cjs +1 -1
  190. package/dist/index193.js +9 -27
  191. package/dist/index194.cjs +1 -1
  192. package/dist/index194.js +13 -34
  193. package/dist/index195.cjs +1 -1
  194. package/dist/index195.js +8 -13
  195. package/dist/index196.cjs +1 -1
  196. package/dist/index196.js +35 -78
  197. package/dist/index197.cjs +1 -1
  198. package/dist/index197.js +17 -2
  199. package/dist/index198.cjs +1 -1
  200. package/dist/index198.js +14 -18
  201. package/dist/index199.cjs +1 -1
  202. package/dist/index199.js +6 -171
  203. package/dist/index20.cjs +1 -1
  204. package/dist/index20.js +2 -2
  205. package/dist/index200.cjs +2 -1
  206. package/dist/index200.js +23 -16
  207. package/dist/index201.cjs +1 -1
  208. package/dist/index201.js +13 -10
  209. package/dist/index202.cjs +1 -1
  210. package/dist/index202.js +2 -2
  211. package/dist/index203.cjs +1 -1
  212. package/dist/index203.js +5 -5
  213. package/dist/index205.cjs +1 -1
  214. package/dist/index205.js +1 -1
  215. package/dist/index206.cjs +1 -1
  216. package/dist/index206.js +2 -2
  217. package/dist/index207.cjs +1 -1
  218. package/dist/index207.js +1 -1
  219. package/dist/index208.cjs +1 -1
  220. package/dist/index208.js +5 -5
  221. package/dist/index209.cjs +2 -1
  222. package/dist/index209.js +34 -39
  223. package/dist/index210.cjs +1 -1
  224. package/dist/index210.js +2 -10
  225. package/dist/index211.cjs +1 -1
  226. package/dist/index211.js +5 -24
  227. package/dist/index212.cjs +1 -2
  228. package/dist/index212.js +9 -40
  229. package/dist/index213.cjs +1 -1
  230. package/dist/index213.js +20 -2
  231. package/dist/index214.cjs +1 -1
  232. package/dist/index214.js +8 -5
  233. package/dist/index215.cjs +1 -1
  234. package/dist/index215.js +65 -9
  235. package/dist/index216.cjs +1 -1
  236. package/dist/index216.js +63 -17
  237. package/dist/index217.cjs +1 -1
  238. package/dist/index217.js +188 -8
  239. package/dist/index218.cjs +1 -1
  240. package/dist/index218.js +28 -66
  241. package/dist/index219.cjs +1 -1
  242. package/dist/index219.js +72 -61
  243. package/dist/index22.cjs +1 -1
  244. package/dist/index22.js +3 -3
  245. package/dist/index220.cjs +1 -1
  246. package/dist/index220.js +35 -183
  247. package/dist/index221.cjs +1 -1
  248. package/dist/index221.js +9 -21
  249. package/dist/index222.cjs +1 -1
  250. package/dist/index222.js +7 -70
  251. package/dist/index223.cjs +1 -1
  252. package/dist/index223.js +11 -40
  253. package/dist/index224.cjs +1 -1
  254. package/dist/index224.js +12 -16
  255. package/dist/index225.cjs +1 -1
  256. package/dist/index225.js +18 -12
  257. package/dist/index226.cjs +1 -1
  258. package/dist/index226.js +108 -11
  259. package/dist/index227.cjs +1 -1
  260. package/dist/index227.js +102 -11
  261. package/dist/index228.cjs +1 -1
  262. package/dist/index228.js +6 -19
  263. package/dist/index229.cjs +1 -1
  264. package/dist/index229.js +7 -109
  265. package/dist/index23.cjs +1 -1
  266. package/dist/index23.js +2 -2
  267. package/dist/index230.cjs +1 -1
  268. package/dist/index230.js +24 -101
  269. package/dist/index231.cjs +1 -1
  270. package/dist/index231.js +16 -6
  271. package/dist/index232.cjs +1 -1
  272. package/dist/index232.js +215 -7
  273. package/dist/index233.cjs +1 -1
  274. package/dist/index233.js +24 -26
  275. package/dist/index234.cjs +1 -1
  276. package/dist/index234.js +45 -15
  277. package/dist/index235.cjs +1 -1
  278. package/dist/index235.js +8 -213
  279. package/dist/index236.cjs +1 -1
  280. package/dist/index236.js +1 -1
  281. package/dist/index237.cjs +1 -1
  282. package/dist/index237.js +1 -1
  283. package/dist/index239.cjs +1 -1
  284. package/dist/index239.js +1 -1
  285. package/dist/index24.cjs +1 -1
  286. package/dist/index24.js +5 -5
  287. package/dist/index241.cjs +1 -2
  288. package/dist/index241.js +68 -66
  289. package/dist/index242.cjs +2 -1
  290. package/dist/index242.js +66 -14
  291. package/dist/index243.cjs +1 -1
  292. package/dist/index243.js +14 -68
  293. package/dist/index244.cjs +1 -1
  294. package/dist/index244.js +1 -1
  295. package/dist/index246.cjs +1 -1
  296. package/dist/index246.js +1 -1
  297. package/dist/index25.cjs +1 -1
  298. package/dist/index25.js +1 -1
  299. package/dist/index26.cjs +1 -1
  300. package/dist/index26.js +1 -1
  301. package/dist/index29.cjs +1 -1
  302. package/dist/index29.js +7 -171
  303. package/dist/index30.cjs +1 -1
  304. package/dist/index30.js +30 -110
  305. package/dist/index31.cjs +1 -1
  306. package/dist/index31.js +29 -30
  307. package/dist/index32.cjs +1 -1
  308. package/dist/index32.js +16 -3
  309. package/dist/index33.cjs +1 -1
  310. package/dist/index33.js +34 -2
  311. package/dist/index34.cjs +1 -1
  312. package/dist/index34.js +45 -4
  313. package/dist/index35.cjs +1 -2
  314. package/dist/index35.js +151 -59
  315. package/dist/index36.cjs +1 -2
  316. package/dist/index36.js +31 -50
  317. package/dist/index37.cjs +1 -3
  318. package/dist/index37.js +53 -210
  319. package/dist/index38.cjs +2 -1
  320. package/dist/index38.js +58 -22
  321. package/dist/index39.cjs +1 -1
  322. package/dist/index39.js +13 -18
  323. package/dist/index40.cjs +1 -1
  324. package/dist/index40.js +37 -10
  325. package/dist/index41.cjs +1 -1
  326. package/dist/index41.js +15 -20
  327. package/dist/index42.cjs +1 -1
  328. package/dist/index42.js +8 -45
  329. package/dist/index43.cjs +1 -1
  330. package/dist/index43.js +19 -12
  331. package/dist/index44.cjs +1 -1
  332. package/dist/index44.js +2 -13
  333. package/dist/index45.cjs +1 -1
  334. package/dist/index45.js +45 -24
  335. package/dist/index46.cjs +1 -1
  336. package/dist/index46.js +31 -27
  337. package/dist/index47.cjs +1 -1
  338. package/dist/index47.js +3 -47
  339. package/dist/index48.cjs +1 -1
  340. package/dist/index48.js +9 -19
  341. package/dist/index49.cjs +1 -1
  342. package/dist/index49.js +50 -11
  343. package/dist/index50.cjs +1 -1
  344. package/dist/index50.js +7 -31
  345. package/dist/index51.cjs +1 -1
  346. package/dist/index51.js +16 -36
  347. package/dist/index52.cjs +1 -1
  348. package/dist/index52.js +10 -7
  349. package/dist/index53.cjs +1 -1
  350. package/dist/index53.js +5 -29
  351. package/dist/index54.cjs +1 -1
  352. package/dist/index54.js +14 -22
  353. package/dist/index55.cjs +1 -1
  354. package/dist/index55.js +3 -7
  355. package/dist/index56.cjs +1 -1
  356. package/dist/index56.js +25 -65
  357. package/dist/index57.cjs +1 -1
  358. package/dist/index57.js +107 -44
  359. package/dist/index58.cjs +1 -1
  360. package/dist/index58.js +4 -23
  361. package/dist/index59.cjs +1 -1
  362. package/dist/index59.js +6 -37
  363. package/dist/index60.cjs +1 -1
  364. package/dist/index60.js +88 -17
  365. package/dist/index61.cjs +1 -1
  366. package/dist/index61.js +6 -6
  367. package/dist/index62.cjs +1 -1
  368. package/dist/index62.js +125 -9
  369. package/dist/index63.cjs +1 -1
  370. package/dist/index63.js +6 -12
  371. package/dist/index64.cjs +1 -1
  372. package/dist/index64.js +21 -109
  373. package/dist/index65.cjs +1 -1
  374. package/dist/index65.js +16 -22
  375. package/dist/index66.cjs +1 -1
  376. package/dist/index66.js +40 -7
  377. package/dist/index67.cjs +1 -1
  378. package/dist/index67.js +20 -20
  379. package/dist/index68.cjs +1 -1
  380. package/dist/index68.js +11 -8
  381. package/dist/index69.cjs +1 -1
  382. package/dist/index69.js +6 -31
  383. package/dist/index70.cjs +1 -1
  384. package/dist/index70.js +19 -7
  385. package/dist/index71.cjs +1 -1
  386. package/dist/index71.js +106 -16
  387. package/dist/index72.cjs +1 -1
  388. package/dist/index72.js +63 -68
  389. package/dist/index73.cjs +1 -1
  390. package/dist/index73.js +9 -35
  391. package/dist/index74.cjs +1 -1
  392. package/dist/index74.js +28 -16
  393. package/dist/index75.cjs +1 -1
  394. package/dist/index75.js +69 -63
  395. package/dist/index76.cjs +1 -1
  396. package/dist/index76.js +4 -12
  397. package/dist/index77.cjs +2 -1
  398. package/dist/index77.js +3 -15
  399. package/dist/index78.cjs +1 -3
  400. package/dist/index78.js +9 -96
  401. package/dist/index79.cjs +20 -1
  402. package/dist/index79.js +326 -24
  403. package/dist/index80.cjs +1 -1
  404. package/dist/index80.js +13 -33
  405. package/dist/index81.cjs +1 -1
  406. package/dist/index81.js +4 -44
  407. package/dist/index82.cjs +1 -1
  408. package/dist/index82.js +12 -6
  409. package/dist/index83.cjs +1 -1
  410. package/dist/index83.js +2 -152
  411. package/dist/index84.cjs +1 -20
  412. package/dist/index84.js +6 -325
  413. package/dist/index85.cjs +2 -3
  414. package/dist/index85.js +41 -438
  415. package/dist/index86.cjs +3 -1
  416. package/dist/index86.js +209 -58
  417. package/dist/index87.cjs +1 -1
  418. package/dist/index87.js +31 -37
  419. package/dist/index88.cjs +1 -1
  420. package/dist/index88.js +21 -15
  421. package/dist/index89.cjs +1 -1
  422. package/dist/index89.js +6 -2
  423. package/dist/index90.cjs +1 -1
  424. package/dist/index90.js +72 -15
  425. package/dist/index91.cjs +1 -1
  426. package/dist/index91.js +5 -10
  427. package/dist/index92.cjs +1 -1
  428. package/dist/index92.js +5 -125
  429. package/dist/index93.cjs +9 -1
  430. package/dist/index93.js +35 -5
  431. package/dist/index94.cjs +3 -1
  432. package/dist/index94.js +94 -20
  433. package/dist/index95.cjs +1 -1
  434. package/dist/index95.js +3 -46
  435. package/dist/index96.cjs +1 -1
  436. package/dist/index96.js +16 -36
  437. package/dist/index97.cjs +1 -1
  438. package/dist/index97.js +20 -6
  439. package/dist/index98.cjs +1 -1
  440. package/dist/index98.js +33 -86
  441. package/dist/index99.cjs +1 -1
  442. package/dist/index99.js +22 -13
  443. package/package.json +1 -1
package/dist/index140.js CHANGED
@@ -1,7 +1,35 @@
1
- import { isHex as r } from "./index172.js";
2
- function i(t) {
3
- return r(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
1
+ import { maxBytesPerTransaction as y, fieldElementsPerBlob as a, bytesPerFieldElement as f, bytesPerBlob as p } from "./index141.js";
2
+ import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index142.js";
3
+ import { createCursor as B } from "./index106.js";
4
+ import { size as u } from "./index81.js";
5
+ import { hexToBytes as x } from "./index110.js";
6
+ import { bytesToHex as d } from "./index111.js";
7
+ function S(e) {
8
+ const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
+ if (!o)
10
+ throw new c();
11
+ if (o > y)
12
+ throw new h({
13
+ maxSize: y,
14
+ size: o
15
+ });
16
+ const s = [];
17
+ let n = !0, r = 0;
18
+ for (; n; ) {
19
+ const t = B(new Uint8Array(p));
20
+ let l = 0;
21
+ for (; l < a; ) {
22
+ const b = i.slice(r, r + (f - 1));
23
+ if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
+ t.pushByte(128), n = !1;
25
+ break;
26
+ }
27
+ l++, r += 31;
28
+ }
29
+ s.push(t);
30
+ }
31
+ return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
4
32
  }
5
33
  export {
6
- i as size
34
+ S as toBlobs
7
35
  };
package/dist/index141.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index35.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=6,s=32,e=4096,n=s*e,o=n*t-1-1*e*t;exports.bytesPerBlob=n;exports.bytesPerFieldElement=s;exports.fieldElementsPerBlob=e;exports.maxBytesPerTransaction=o;
package/dist/index141.js CHANGED
@@ -1,15 +1,7 @@
1
- import { BaseError as r } from "./index35.js";
2
- class d extends r {
3
- constructor({ address: s }) {
4
- super(`Address "${s}" is invalid.`, {
5
- metaMessages: [
6
- "- Address must be a hex value of 20 bytes (40 hex characters).",
7
- "- Address must match its checksum counterpart."
8
- ],
9
- name: "InvalidAddressError"
10
- });
11
- }
12
- }
1
+ const e = 32, s = 4096, t = 131072, l = 761855;
13
2
  export {
14
- d as InvalidAddressError
3
+ t as bytesPerBlob,
4
+ e as bytesPerFieldElement,
5
+ s as fieldElementsPerBlob,
6
+ l as maxBytesPerTransaction
15
7
  };
package/dist/index142.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="2.37.8";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index175.cjs"),s=require("./index38.cjs");class i extends s.BaseError{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class n extends s.BaseError{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class t extends s.BaseError{constructor({hash:e,size:r}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${r}`],name:"InvalidVersionedHashSizeError"})}}class d extends s.BaseError{constructor({hash:e,version:r}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${a.versionedHashVersionKzg}`,`Received: ${r}`],name:"InvalidVersionedHashVersionError"})}}exports.BlobSizeTooLargeError=i;exports.EmptyBlobError=n;exports.InvalidVersionedHashSizeError=t;exports.InvalidVersionedHashVersionError=d;
package/dist/index142.js CHANGED
@@ -1,4 +1,40 @@
1
- const o = "2.37.8";
1
+ import { versionedHashVersionKzg as a } from "./index175.js";
2
+ import { BaseError as s } from "./index38.js";
3
+ class t extends s {
4
+ constructor({ maxSize: e, size: r }) {
5
+ super("Blob size is too large.", {
6
+ metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`],
7
+ name: "BlobSizeTooLargeError"
8
+ });
9
+ }
10
+ }
11
+ class d extends s {
12
+ constructor() {
13
+ super("Blob data must not be empty.", { name: "EmptyBlobError" });
14
+ }
15
+ }
16
+ class l extends s {
17
+ constructor({ hash: e, size: r }) {
18
+ super(`Versioned hash "${e}" size is invalid.`, {
19
+ metaMessages: ["Expected: 32", `Received: ${r}`],
20
+ name: "InvalidVersionedHashSizeError"
21
+ });
22
+ }
23
+ }
24
+ class c extends s {
25
+ constructor({ hash: e, version: r }) {
26
+ super(`Versioned hash "${e}" version is invalid.`, {
27
+ metaMessages: [
28
+ `Expected: ${a}`,
29
+ `Received: ${r}`
30
+ ],
31
+ name: "InvalidVersionedHashVersionError"
32
+ });
33
+ }
34
+ }
2
35
  export {
3
- o as version
36
+ t as BlobSizeTooLargeError,
37
+ d as EmptyBlobError,
38
+ l as InvalidVersionedHashSizeError,
39
+ c as InvalidVersionedHashVersionError
4
40
  };
package/dist/index143.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},o={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},t={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};exports.panicReasons=e;exports.solidityError=o;exports.solidityPanic=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./index144.cjs"),p=require("./index145.cjs"),h=require("./index72.cjs"),g=require("./index88.cjs"),E=require("./index112.cjs"),L=require("./index132.cjs"),R=require("./index120.cjs"),S=require("./index130.cjs"),q=require("./index146.cjs"),O=require("./index44.cjs"),T="0x556f1830",w={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function x(c,{blockNumber:u,blockTag:l,data:a,to:n}){const{args:i}=g.decodeErrorResult({data:a,abi:[w]}),[r,o,s,d,t]=i,{ccipRead:e}=c,y=e&&typeof(e==null?void 0:e.request)=="function"?e.request:b;try{if(!L.isAddressEqual(n,r))throw new p.OffchainLookupSenderMismatchError({sender:r,to:n});const f=o.includes(q.localBatchGatewayUrl)?await q.localBatchGatewayRequest({data:s,ccipRequest:y}):await y({data:s,sender:r,urls:o}),{data:m}=await k.call(c,{blockNumber:u,blockTag:l,data:R.concat([d,E.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[f,t])]),to:n});return m}catch(f){throw new p.OffchainLookupError({callbackSelector:d,cause:f,data:a,extraData:t,sender:r,urls:o})}}async function b({data:c,sender:u,urls:l}){var n;let a=new Error("An unknown error occurred.");for(let i=0;i<l.length;i++){const r=l[i],o=r.includes("{data}")?"GET":"POST",s=o==="POST"?{data:c,sender:u}:void 0,d=o==="POST"?{"Content-Type":"application/json"}:{};try{const t=await fetch(r.replace("{sender}",u.toLowerCase()).replace("{data}",c),{body:JSON.stringify(s),headers:d,method:o});let e;if((n=t.headers.get("Content-Type"))!=null&&n.startsWith("application/json")?e=(await t.json()).data:e=await t.text(),!t.ok){a=new h.HttpRequestError({body:s,details:e!=null&&e.error?O.stringify(e.error):t.statusText,headers:t.headers,status:t.status,url:r});continue}if(!S.isHex(e)){a=new p.OffchainLookupResponseMalformedError({result:e,url:r});continue}return e}catch(t){a=new h.HttpRequestError({body:s,details:t.message,url:r})}}throw a}exports.ccipRequest=b;exports.offchainLookup=x;exports.offchainLookupAbiItem=w;exports.offchainLookupSignature=T;
package/dist/index143.js CHANGED
@@ -1,34 +1,114 @@
1
- const e = {
2
- 1: "An `assert` condition failed.",
3
- 17: "Arithmetic operation resulted in underflow or overflow.",
4
- 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
5
- 33: "Attempted to convert to an invalid type.",
6
- 34: "Attempted to access a storage byte array that is incorrectly encoded.",
7
- 49: "Performed `.pop()` on an empty array",
8
- 50: "Array index is out of bounds.",
9
- 65: "Allocated too much memory or created an array which is too large.",
10
- 81: "Attempted to call a zero-initialized variable of internal function type."
11
- }, o = {
1
+ import { call as h } from "./index144.js";
2
+ import { OffchainLookupSenderMismatchError as w, OffchainLookupError as b, OffchainLookupResponseMalformedError as k } from "./index145.js";
3
+ import { HttpRequestError as d } from "./index72.js";
4
+ import { decodeErrorResult as g } from "./index88.js";
5
+ import { encodeAbiParameters as q } from "./index112.js";
6
+ import { isAddressEqual as E } from "./index132.js";
7
+ import { concat as L } from "./index120.js";
8
+ import { isHex as O } from "./index130.js";
9
+ import { localBatchGatewayUrl as x, localBatchGatewayRequest as S } from "./index146.js";
10
+ import { stringify as T } from "./index44.js";
11
+ const I = "0x556f1830", R = {
12
+ name: "OffchainLookup",
13
+ type: "error",
12
14
  inputs: [
13
15
  {
14
- name: "message",
15
- type: "string"
16
- }
17
- ],
18
- name: "Error",
19
- type: "error"
20
- }, t = {
21
- inputs: [
16
+ name: "sender",
17
+ type: "address"
18
+ },
19
+ {
20
+ name: "urls",
21
+ type: "string[]"
22
+ },
22
23
  {
23
- name: "reason",
24
- type: "uint256"
24
+ name: "callData",
25
+ type: "bytes"
26
+ },
27
+ {
28
+ name: "callbackFunction",
29
+ type: "bytes4"
30
+ },
31
+ {
32
+ name: "extraData",
33
+ type: "bytes"
25
34
  }
26
- ],
27
- name: "Panic",
28
- type: "error"
35
+ ]
29
36
  };
37
+ async function J(c, { blockNumber: p, blockTag: f, data: o, to: n }) {
38
+ const { args: i } = g({
39
+ data: o,
40
+ abi: [R]
41
+ }), [r, a, s, u, e] = i, { ccipRead: t } = c, m = t && typeof (t == null ? void 0 : t.request) == "function" ? t.request : A;
42
+ try {
43
+ if (!E(n, r))
44
+ throw new w({ sender: r, to: n });
45
+ const l = a.includes(x) ? await S({
46
+ data: s,
47
+ ccipRequest: m
48
+ }) : await m({ data: s, sender: r, urls: a }), { data: y } = await h(c, {
49
+ blockNumber: p,
50
+ blockTag: f,
51
+ data: L([
52
+ u,
53
+ q([{ type: "bytes" }, { type: "bytes" }], [l, e])
54
+ ]),
55
+ to: n
56
+ });
57
+ return y;
58
+ } catch (l) {
59
+ throw new b({
60
+ callbackSelector: u,
61
+ cause: l,
62
+ data: o,
63
+ extraData: e,
64
+ sender: r,
65
+ urls: a
66
+ });
67
+ }
68
+ }
69
+ async function A({ data: c, sender: p, urls: f }) {
70
+ var n;
71
+ let o = new Error("An unknown error occurred.");
72
+ for (let i = 0; i < f.length; i++) {
73
+ const r = f[i], a = r.includes("{data}") ? "GET" : "POST", s = a === "POST" ? { data: c, sender: p } : void 0, u = a === "POST" ? { "Content-Type": "application/json" } : {};
74
+ try {
75
+ const e = await fetch(r.replace("{sender}", p.toLowerCase()).replace("{data}", c), {
76
+ body: JSON.stringify(s),
77
+ headers: u,
78
+ method: a
79
+ });
80
+ let t;
81
+ if ((n = e.headers.get("Content-Type")) != null && n.startsWith("application/json") ? t = (await e.json()).data : t = await e.text(), !e.ok) {
82
+ o = new d({
83
+ body: s,
84
+ details: t != null && t.error ? T(t.error) : e.statusText,
85
+ headers: e.headers,
86
+ status: e.status,
87
+ url: r
88
+ });
89
+ continue;
90
+ }
91
+ if (!O(t)) {
92
+ o = new k({
93
+ result: t,
94
+ url: r
95
+ });
96
+ continue;
97
+ }
98
+ return t;
99
+ } catch (e) {
100
+ o = new d({
101
+ body: s,
102
+ details: e.message,
103
+ url: r
104
+ });
105
+ }
106
+ }
107
+ throw o;
108
+ }
30
109
  export {
31
- e as panicReasons,
32
- o as solidityError,
33
- t as solidityPanic
110
+ A as ccipRequest,
111
+ J as offchainLookup,
112
+ R as offchainLookupAbiItem,
113
+ I as offchainLookupSignature
34
114
  };
package/dist/index144.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index143.cjs"),n=require("./index84.cjs"),c=require("./index96.cjs"),u=require("./index161.cjs"),d=require("./index156.cjs"),l=require("./index139.cjs");function b(s){const{abi:a,data:t}=s,r=c.slice(t,0,4);if(r==="0x")throw new n.AbiDecodingZeroDataError;const e=[...a||[],i.solidityError,i.solidityPanic].find(o=>o.type==="error"&&r===u.toFunctionSelector(l.formatAbiItem(o)));if(!e)throw new n.AbiErrorSignatureNotFoundError(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:e,args:"inputs"in e&&e.inputs&&e.inputs.length>0?d.decodeAbiParameters(e.inputs,c.slice(t,4)):void 0,errorName:e.name}}exports.decodeErrorResult=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./index181.cjs"),Z=require("./index47.cjs"),j=require("./index21.cjs"),ee=require("./index182.cjs"),E=require("./index76.cjs"),A=require("./index38.cjs"),R=require("./index85.cjs"),L=require("./index86.cjs"),te=require("./index118.cjs"),$=require("./index123.cjs"),ae=require("./index127.cjs"),re=require("./index149.cjs"),G=require("./index111.cjs"),oe=require("./index183.cjs"),ce=require("./index184.cjs"),ne=require("./index157.cjs"),se=require("./index74.cjs"),ie=require("./index185.cjs"),le=require("./index173.cjs"),M=require("./index186.cjs");async function ue(e,t){var P,T,H,_;const{account:a=e.account,authorizationList:s,batch:i=!!((P=e.batch)!=null&&P.multicall),blockNumber:l,blockTag:C=e.experimental_blockTag??"latest",accessList:k,blobs:x,blockOverrides:y,code:m,data:c,factory:b,factoryData:u,gas:v,gasPrice:w,maxFeePerBlobGas:p,maxFeePerGas:g,maxPriorityFeePerGas:h,nonce:q,to:r,value:J,stateOverride:K,...Q}=t,D=a?Z.parseAccount(a):void 0;if(m&&(b||u))throw new A.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(m&&r)throw new A.BaseError("Cannot provide both `code` & `to` as parameters.");const N=m&&c,S=b&&u&&r&&c,O=N||S,U=N?W({code:m,data:c}):S?be({data:c,factory:b,factoryData:u,to:r}):c;try{le.assertRequest(t);const o=(typeof l=="bigint"?G.numberToHex(l):void 0)||C,d=y?Y.toRpc(y):void 0,f=ie.serializeStateOverride(K),V=(_=(H=(T=e.chain)==null?void 0:T.formatters)==null?void 0:H.transactionRequest)==null?void 0:_.format,F=(V||ne.formatTransactionRequest)({...ce.extract(Q,{format:V}),from:D==null?void 0:D.address,accessList:k,authorizationList:s,blobs:x,data:U,gas:v,gasPrice:w,maxFeePerBlobGas:p,maxFeePerGas:g,maxPriorityFeePerGas:h,nonce:q,to:O?void 0:r,value:J});if(i&&de({request:F})&&!f&&!d)try{return await fe(e,{...F,blockNumber:l,blockTag:C})}catch(n){if(!(n instanceof R.ClientChainNotConfiguredError)&&!(n instanceof R.ChainDoesNotSupportContract))throw n}const X=(()=>{const n=[F,o];return f&&d?[...n,f,d]:f?[...n,f]:d?[...n,{},d]:n})(),z=await e.request({method:"eth_call",params:X});return z==="0x"?{data:void 0}:{data:z}}catch(B){const o=I(B),{offchainLookup:d,offchainLookupSignature:f}=await Promise.resolve().then(()=>require("./index143.cjs"));if(e.ccipRead!==!1&&(o==null?void 0:o.slice(0,10))===f&&r)return{data:await d(e,{data:o,to:r})};throw O&&(o==null?void 0:o.slice(0,10))==="0x101bb98d"?new L.CounterfactualDeploymentFailedError({factory:b}):oe.getCallError(B,{...t,account:D,chain:e.chain})}}function de({request:e}){const{data:t,to:a,...s}=e;return!(!t||t.startsWith(ee.aggregate3Signature)||!a||Object.values(s).filter(i=>typeof i<"u").length>0)}async function fe(e,t){var w;const{batchSize:a=1024,deployless:s=!1,wait:i=0}=typeof((w=e.batch)==null?void 0:w.multicall)=="object"?e.batch.multicall:{},{blockNumber:l,blockTag:C=e.experimental_blockTag??"latest",data:k,to:x}=t,y=(()=>{if(s)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return re.getChainContractAddress({blockNumber:l,chain:e.chain,contract:"multicall3"});throw new R.ClientChainNotConfiguredError})(),c=(typeof l=="bigint"?G.numberToHex(l):void 0)||C,{schedule:b}=se.createBatchScheduler({id:`${e.uid}.${c}`,wait:i,shouldSplitBatch(p){return p.reduce((h,{data:q})=>h+(q.length-2),0)>a*2},fn:async p=>{const g=p.map(r=>({allowFailure:!0,callData:r.data,target:r.to})),h=ae.encodeFunctionData({abi:j.multicall3Abi,args:[g],functionName:"aggregate3"}),q=await e.request({method:"eth_call",params:[{...y===null?{data:W({code:E.multicall3Bytecode,data:h})}:{to:y,data:h}},c]});return te.decodeFunctionResult({abi:j.multicall3Abi,args:[g],functionName:"aggregate3",data:q||"0x"})}}),[{returnData:u,success:v}]=await b({data:k,to:x});if(!v)throw new L.RawContractError({data:u});return u==="0x"?{data:void 0}:{data:u}}function W(e){const{code:t,data:a}=e;return $.encodeDeployData({abi:M.parseAbi(["constructor(bytes, bytes)"]),bytecode:E.deploylessCallViaBytecodeBytecode,args:[t,a]})}function be(e){const{data:t,factory:a,factoryData:s,to:i}=e;return $.encodeDeployData({abi:M.parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:E.deploylessCallViaFactoryBytecode,args:[i,t,a,s]})}function I(e){var a;if(!(e instanceof A.BaseError))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(a=t.data)==null?void 0:a.data:t.data}exports.call=ue;exports.getRevertErrorData=I;
package/dist/index144.js CHANGED
@@ -1,24 +1,174 @@
1
- import { solidityError as m, solidityPanic as s } from "./index143.js";
2
- import { AbiDecodingZeroDataError as c, AbiErrorSignatureNotFoundError as d } from "./index84.js";
3
- import { slice as e } from "./index96.js";
4
- import { toFunctionSelector as u } from "./index161.js";
5
- import { decodeAbiParameters as f } from "./index156.js";
6
- import { formatAbiItem as p } from "./index139.js";
7
- function y(n) {
8
- const { abi: a, data: t } = n, o = e(t, 0, 4);
9
- if (o === "0x")
10
- throw new c();
11
- const r = [...a || [], m, s].find((i) => i.type === "error" && o === u(p(i)));
12
- if (!r)
13
- throw new d(o, {
14
- docsPath: "/docs/contract/decodeErrorResult"
1
+ import { toRpc as Q } from "./index181.js";
2
+ import { parseAccount as U } from "./index47.js";
3
+ import { multicall3Abi as z } from "./index21.js";
4
+ import { aggregate3Signature as X } from "./index182.js";
5
+ import { deploylessCallViaBytecodeBytecode as Y, deploylessCallViaFactoryBytecode as Z, multicall3Bytecode as tt } from "./index76.js";
6
+ import { BaseError as R } from "./index38.js";
7
+ import { ClientChainNotConfiguredError as H, ChainDoesNotSupportContract as at } from "./index85.js";
8
+ import { CounterfactualDeploymentFailedError as et, RawContractError as rt } from "./index86.js";
9
+ import { decodeFunctionResult as ot } from "./index118.js";
10
+ import { encodeDeployData as L } from "./index123.js";
11
+ import { encodeFunctionData as ct } from "./index127.js";
12
+ import { getChainContractAddress as nt } from "./index149.js";
13
+ import { numberToHex as j } from "./index111.js";
14
+ import { getCallError as st } from "./index183.js";
15
+ import { extract as it } from "./index184.js";
16
+ import { formatTransactionRequest as lt } from "./index157.js";
17
+ import { createBatchScheduler as ut } from "./index74.js";
18
+ import { serializeStateOverride as dt } from "./index185.js";
19
+ import { assertRequest as ft } from "./index173.js";
20
+ import { parseAbi as G } from "./index186.js";
21
+ async function zt(t, a) {
22
+ var q, E, O, P;
23
+ const { account: e = t.account, authorizationList: s, batch: i = !!((q = t.batch) != null && q.multicall), blockNumber: l, blockTag: C = t.experimental_blockTag ?? "latest", accessList: D, blobs: B, blockOverrides: b, code: h, data: c, factory: m, factoryData: u, gas: F, gasPrice: k, maxFeePerBlobGas: y, maxFeePerGas: g, maxPriorityFeePerGas: p, nonce: w, to: r, value: $, stateOverride: W, ...I } = a, x = e ? U(e) : void 0;
24
+ if (h && (m || u))
25
+ throw new R("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
26
+ if (h && r)
27
+ throw new R("Cannot provide both `code` & `to` as parameters.");
28
+ const S = h && c, A = m && u && r && c, _ = S || A, J = S ? M({
29
+ code: h,
30
+ data: c
31
+ }) : A ? bt({
32
+ data: c,
33
+ factory: m,
34
+ factoryData: u,
35
+ to: r
36
+ }) : c;
37
+ try {
38
+ ft(a);
39
+ const o = (typeof l == "bigint" ? j(l) : void 0) || C, d = b ? Q(b) : void 0, f = dt(W), T = (P = (O = (E = t.chain) == null ? void 0 : E.formatters) == null ? void 0 : O.transactionRequest) == null ? void 0 : P.format, N = (T || lt)({
40
+ // Pick out extra data that might exist on the chain's transaction request type.
41
+ ...it(I, { format: T }),
42
+ from: x == null ? void 0 : x.address,
43
+ accessList: D,
44
+ authorizationList: s,
45
+ blobs: B,
46
+ data: J,
47
+ gas: F,
48
+ gasPrice: k,
49
+ maxFeePerBlobGas: y,
50
+ maxFeePerGas: g,
51
+ maxPriorityFeePerGas: p,
52
+ nonce: w,
53
+ to: _ ? void 0 : r,
54
+ value: $
15
55
  });
16
- return {
17
- abiItem: r,
18
- args: "inputs" in r && r.inputs && r.inputs.length > 0 ? f(r.inputs, e(t, 4)) : void 0,
19
- errorName: r.name
20
- };
56
+ if (i && mt({ request: N }) && !f && !d)
57
+ try {
58
+ return await pt(t, {
59
+ ...N,
60
+ blockNumber: l,
61
+ blockTag: C
62
+ });
63
+ } catch (n) {
64
+ if (!(n instanceof H) && !(n instanceof at))
65
+ throw n;
66
+ }
67
+ const K = (() => {
68
+ const n = [
69
+ N,
70
+ o
71
+ ];
72
+ return f && d ? [...n, f, d] : f ? [...n, f] : d ? [...n, {}, d] : n;
73
+ })(), V = await t.request({
74
+ method: "eth_call",
75
+ params: K
76
+ });
77
+ return V === "0x" ? { data: void 0 } : { data: V };
78
+ } catch (v) {
79
+ const o = ht(v), { offchainLookup: d, offchainLookupSignature: f } = await import("./index143.js");
80
+ if (t.ccipRead !== !1 && (o == null ? void 0 : o.slice(0, 10)) === f && r)
81
+ return { data: await d(t, { data: o, to: r }) };
82
+ throw _ && (o == null ? void 0 : o.slice(0, 10)) === "0x101bb98d" ? new et({ factory: m }) : st(v, {
83
+ ...a,
84
+ account: x,
85
+ chain: t.chain
86
+ });
87
+ }
88
+ }
89
+ function mt({ request: t }) {
90
+ const { data: a, to: e, ...s } = t;
91
+ return !(!a || a.startsWith(X) || !e || Object.values(s).filter((i) => typeof i < "u").length > 0);
92
+ }
93
+ async function pt(t, a) {
94
+ var k;
95
+ const { batchSize: e = 1024, deployless: s = !1, wait: i = 0 } = typeof ((k = t.batch) == null ? void 0 : k.multicall) == "object" ? t.batch.multicall : {}, { blockNumber: l, blockTag: C = t.experimental_blockTag ?? "latest", data: D, to: B } = a, b = (() => {
96
+ if (s)
97
+ return null;
98
+ if (a.multicallAddress)
99
+ return a.multicallAddress;
100
+ if (t.chain)
101
+ return nt({
102
+ blockNumber: l,
103
+ chain: t.chain,
104
+ contract: "multicall3"
105
+ });
106
+ throw new H();
107
+ })(), c = (typeof l == "bigint" ? j(l) : void 0) || C, { schedule: m } = ut({
108
+ id: `${t.uid}.${c}`,
109
+ wait: i,
110
+ shouldSplitBatch(y) {
111
+ return y.reduce((p, { data: w }) => p + (w.length - 2), 0) > e * 2;
112
+ },
113
+ fn: async (y) => {
114
+ const g = y.map((r) => ({
115
+ allowFailure: !0,
116
+ callData: r.data,
117
+ target: r.to
118
+ })), p = ct({
119
+ abi: z,
120
+ args: [g],
121
+ functionName: "aggregate3"
122
+ }), w = await t.request({
123
+ method: "eth_call",
124
+ params: [
125
+ {
126
+ ...b === null ? {
127
+ data: M({
128
+ code: tt,
129
+ data: p
130
+ })
131
+ } : { to: b, data: p }
132
+ },
133
+ c
134
+ ]
135
+ });
136
+ return ot({
137
+ abi: z,
138
+ args: [g],
139
+ functionName: "aggregate3",
140
+ data: w || "0x"
141
+ });
142
+ }
143
+ }), [{ returnData: u, success: F }] = await m({ data: D, to: B });
144
+ if (!F)
145
+ throw new rt({ data: u });
146
+ return u === "0x" ? { data: void 0 } : { data: u };
147
+ }
148
+ function M(t) {
149
+ const { code: a, data: e } = t;
150
+ return L({
151
+ abi: G(["constructor(bytes, bytes)"]),
152
+ bytecode: Y,
153
+ args: [a, e]
154
+ });
155
+ }
156
+ function bt(t) {
157
+ const { data: a, factory: e, factoryData: s, to: i } = t;
158
+ return L({
159
+ abi: G(["constructor(address, bytes, address, bytes)"]),
160
+ bytecode: Z,
161
+ args: [i, a, e, s]
162
+ });
163
+ }
164
+ function ht(t) {
165
+ var e;
166
+ if (!(t instanceof R))
167
+ return;
168
+ const a = t.walk();
169
+ return typeof (a == null ? void 0 : a.data) == "object" ? (e = a.data) == null ? void 0 : e.data : a.data;
21
170
  }
22
171
  export {
23
- y as decodeErrorResult
172
+ zt as call,
173
+ ht as getRevertErrorData
24
174
  };
package/dist/index145.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index89.cjs");function o({abiItem:t,args:n,includeFunctionName:i=!0,includeName:u=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${i?t.name:""}(${t.inputs.map((r,e)=>`${u&&r.name?`${r.name}: `:""}${typeof n[e]=="object"?f.stringify(n[e]):n[e]}`).join(", ")})`}exports.formatAbiItemWithArgs=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index44.cjs"),s=require("./index38.cjs"),n=require("./index95.cjs");class h extends s.BaseError{constructor({callbackSelector:r,cause:e,data:c,extraData:f,sender:i,urls:o}){var t;super(e.shortMessage||"An error occurred while fetching for an offchain result.",{cause:e,metaMessages:[...e.metaMessages||[],(t=e.metaMessages)!=null&&t.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(d=>` ${n.getUrl(d)}`)],` Sender: ${i}`,` Data: ${c}`,` Callback selector: ${r}`,` Extra data: ${f}`].flat(),name:"OffchainLookupError"})}}class l extends s.BaseError{constructor({result:r,url:e}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${n.getUrl(e)}`,`Response: ${u.stringify(r)}`],name:"OffchainLookupResponseMalformedError"})}}class p extends s.BaseError{constructor({sender:r,to:e}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${e}`,`OffchainLookup sender address: ${r}`],name:"OffchainLookupSenderMismatchError"})}}exports.OffchainLookupError=h;exports.OffchainLookupResponseMalformedError=l;exports.OffchainLookupSenderMismatchError=p;
package/dist/index145.js CHANGED
@@ -1,8 +1,52 @@
1
- import { stringify as o } from "./index89.js";
2
- function p({ abiItem: n, args: r, includeFunctionName: f = !0, includeName: i = !1 }) {
3
- if ("name" in n && "inputs" in n && n.inputs)
4
- return `${f ? n.name : ""}(${n.inputs.map((e, t) => `${i && e.name ? `${e.name}: ` : ""}${typeof r[t] == "object" ? o(r[t]) : r[t]}`).join(", ")})`;
1
+ import { stringify as i } from "./index44.js";
2
+ import { BaseError as a } from "./index38.js";
3
+ import { getUrl as n } from "./index95.js";
4
+ class u extends a {
5
+ constructor({ callbackSelector: r, cause: e, data: f, extraData: c, sender: d, urls: o }) {
6
+ var t;
7
+ super(e.shortMessage || "An error occurred while fetching for an offchain result.", {
8
+ cause: e,
9
+ metaMessages: [
10
+ ...e.metaMessages || [],
11
+ (t = e.metaMessages) != null && t.length ? "" : [],
12
+ "Offchain Gateway Call:",
13
+ o && [
14
+ " Gateway URL(s):",
15
+ ...o.map((m) => ` ${n(m)}`)
16
+ ],
17
+ ` Sender: ${d}`,
18
+ ` Data: ${f}`,
19
+ ` Callback selector: ${r}`,
20
+ ` Extra data: ${c}`
21
+ ].flat(),
22
+ name: "OffchainLookupError"
23
+ });
24
+ }
25
+ }
26
+ class g extends a {
27
+ constructor({ result: r, url: e }) {
28
+ super("Offchain gateway response is malformed. Response data must be a hex value.", {
29
+ metaMessages: [
30
+ `Gateway URL: ${n(e)}`,
31
+ `Response: ${i(r)}`
32
+ ],
33
+ name: "OffchainLookupResponseMalformedError"
34
+ });
35
+ }
36
+ }
37
+ class M extends a {
38
+ constructor({ sender: r, to: e }) {
39
+ super("Reverted sender address does not match target contract address (`to`).", {
40
+ metaMessages: [
41
+ `Contract address: ${e}`,
42
+ `OffchainLookup sender address: ${r}`
43
+ ],
44
+ name: "OffchainLookupSenderMismatchError"
45
+ });
46
+ }
5
47
  }
6
48
  export {
7
- p as formatAbiItemWithArgs
49
+ u as OffchainLookupError,
50
+ g as OffchainLookupResponseMalformedError,
51
+ M as OffchainLookupSenderMismatchError
8
52
  };
package/dist/index146.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index138.cjs"),i=require("./index201.cjs");function n(t,e="wei"){return i.formatUnits(t,r.etherUnits[e])}exports.formatEther=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index21.cjs"),y=require("./index87.cjs"),h=require("./index117.cjs"),n=require("./index124.cjs"),w=require("./index129.cjs"),u="x-batch-gateway:true";async function i(t){const{data:l,ccipRequest:o}=t,{args:[d]}=h.decodeFunctionData({abi:c.batchGatewayAbi,data:l}),a=[],s=[];return await Promise.all(d.map(async(r,e)=>{try{s[e]=r.urls.includes(u)?await i({data:r.data,ccipRequest:o}):await o(r),a[e]=!1}catch(b){a[e]=!0,s[e]=g(b)}})),w.encodeFunctionResult({abi:c.batchGatewayAbi,functionName:"query",result:[a,s]})}function g(t){return t.name==="HttpRequestError"&&t.status?n.encodeErrorResult({abi:c.batchGatewayAbi,errorName:"HttpError",args:[t.status,t.shortMessage]}):n.encodeErrorResult({abi:[y.solidityError],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}exports.localBatchGatewayRequest=i;exports.localBatchGatewayUrl=u;
package/dist/index146.js CHANGED
@@ -1,8 +1,35 @@
1
- import { etherUnits as o } from "./index138.js";
2
- import { formatUnits as e } from "./index201.js";
3
- function f(r, t = "wei") {
4
- return e(r, o[t]);
1
+ import { batchGatewayAbi as o } from "./index21.js";
2
+ import { solidityError as l } from "./index87.js";
3
+ import { decodeFunctionData as f } from "./index117.js";
4
+ import { encodeErrorResult as n } from "./index124.js";
5
+ import { encodeFunctionResult as p } from "./index129.js";
6
+ const d = "x-batch-gateway:true";
7
+ async function g(t) {
8
+ const { data: i, ccipRequest: c } = t, { args: [u] } = f({ abi: o, data: i }), e = [], s = [];
9
+ return await Promise.all(u.map(async (r, a) => {
10
+ try {
11
+ s[a] = r.urls.includes(d) ? await g({ data: r.data, ccipRequest: c }) : await c(r), e[a] = !1;
12
+ } catch (m) {
13
+ e[a] = !0, s[a] = h(m);
14
+ }
15
+ })), p({
16
+ abi: o,
17
+ functionName: "query",
18
+ result: [e, s]
19
+ });
20
+ }
21
+ function h(t) {
22
+ return t.name === "HttpRequestError" && t.status ? n({
23
+ abi: o,
24
+ errorName: "HttpError",
25
+ args: [t.status, t.shortMessage]
26
+ }) : n({
27
+ abi: [l],
28
+ errorName: "Error",
29
+ args: ["shortMessage" in t ? t.shortMessage : t.message]
30
+ });
5
31
  }
6
32
  export {
7
- f as formatEther
33
+ g as localBatchGatewayRequest,
34
+ d as localBatchGatewayUrl
8
35
  };
package/dist/index147.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index138.cjs"),r=require("./index201.cjs");function n(t,e="wei"){return r.formatUnits(t,i.gweiUnits[e])}exports.formatGwei=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index85.cjs");function i({chain:r,currentChainId:t}){if(!r)throw new e.ChainNotFoundError;if(t!==r.id)throw new e.ChainMismatchError({chain:r,currentChainId:t})}exports.assertCurrentChain=i;
package/dist/index147.js CHANGED
@@ -1,8 +1,10 @@
1
- import { gweiUnits as i } from "./index138.js";
2
- import { formatUnits as o } from "./index201.js";
3
- function f(r, t = "wei") {
4
- return o(r, i[t]);
1
+ import { ChainNotFoundError as t, ChainMismatchError as i } from "./index85.js";
2
+ function e({ chain: r, currentChainId: o }) {
3
+ if (!r)
4
+ throw new t();
5
+ if (o !== r.id)
6
+ throw new i({ chain: r, currentChainId: o });
5
7
  }
6
8
  export {
7
- f as formatGwei
9
+ e as assertCurrentChain
8
10
  };
package/dist/index148.cjs CHANGED
@@ -1,9 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index35.cjs");class i extends a.BaseError{constructor({address:n}){super(`State for account "${n}" is set multiple times.`,{name:"AccountStateConflictError"})}}class s extends a.BaseError{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function o(r){return r.reduce((n,{slot:c,value:e})=>`${n} ${c}: ${e}
2
- `,"")}function f(r){return r.reduce((n,{address:c,...e})=>{let t=`${n} ${c}:
3
- `;return e.nonce&&(t+=` nonce: ${e.nonce}
4
- `),e.balance&&(t+=` balance: ${e.balance}
5
- `),e.code&&(t+=` code: ${e.code}
6
- `),e.state&&(t+=` state:
7
- `,t+=o(e.state)),e.stateDiff&&(t+=` stateDiff:
8
- `,t+=o(e.stateDiff)),t},` State Override:
9
- `).slice(0,-1)}exports.AccountStateConflictError=i;exports.StateAssignmentConflictError=s;exports.prettyStateMapping=o;exports.prettyStateOverride=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}exports.defineChain=n;