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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +36 -35
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +4 -4
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +125 -3
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +5 -26
  9. package/dist/index102.cjs +1 -2
  10. package/dist/index102.js +20 -23
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +45 -9
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +38 -8
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +6 -10
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +90 -11
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +14 -13
  21. package/dist/index108.cjs +1 -1
  22. package/dist/index108.js +3 -14
  23. package/dist/index109.cjs +1 -1
  24. package/dist/index109.js +26 -4
  25. package/dist/index110.cjs +2 -1
  26. package/dist/index110.js +24 -6
  27. package/dist/index111.cjs +1 -1
  28. package/dist/index111.js +9 -18
  29. package/dist/index112.cjs +1 -1
  30. package/dist/index112.js +8 -13
  31. package/dist/index113.cjs +1 -1
  32. package/dist/index113.js +10 -6
  33. package/dist/index114.cjs +1 -1
  34. package/dist/index114.js +11 -7
  35. package/dist/index115.cjs +1 -1
  36. package/dist/index115.js +13 -21
  37. package/dist/index116.cjs +1 -1
  38. package/dist/index116.js +21 -7
  39. package/dist/index117.cjs +1 -1
  40. package/dist/index117.js +14 -21
  41. package/dist/index118.cjs +1 -1
  42. package/dist/index118.js +4 -17
  43. package/dist/index119.cjs +1 -1
  44. package/dist/index119.js +5 -39
  45. package/dist/index120.cjs +1 -1
  46. package/dist/index120.js +18 -21
  47. package/dist/index121.cjs +1 -1
  48. package/dist/index121.js +10 -80
  49. package/dist/index122.cjs +1 -1
  50. package/dist/index122.js +57 -10
  51. package/dist/index123.cjs +1 -1
  52. package/dist/index123.js +6 -58
  53. package/dist/index124.cjs +1 -1
  54. package/dist/index124.js +13 -13
  55. package/dist/index125.cjs +1 -1
  56. package/dist/index125.js +7 -8
  57. package/dist/index126.cjs +1 -1
  58. package/dist/index126.js +137 -20
  59. package/dist/index127.cjs +1 -1
  60. package/dist/index127.js +7 -6
  61. package/dist/index128.cjs +1 -1
  62. package/dist/index128.js +19 -33
  63. package/dist/index129.cjs +1 -1
  64. package/dist/index129.js +17 -32
  65. package/dist/index130.cjs +1 -1
  66. package/dist/index130.js +43 -9
  67. package/dist/index131.cjs +1 -1
  68. package/dist/index131.js +20 -49
  69. package/dist/index132.cjs +1 -1
  70. package/dist/index132.js +79 -18
  71. package/dist/index133.cjs +1 -1
  72. package/dist/index133.js +10 -105
  73. package/dist/index134.cjs +1 -1
  74. package/dist/index134.js +8 -63
  75. package/dist/index135.cjs +1 -1
  76. package/dist/index135.js +6 -9
  77. package/dist/index136.cjs +1 -1
  78. package/dist/index136.js +41 -71
  79. package/dist/index137.cjs +1 -2
  80. package/dist/index137.js +6 -3
  81. package/dist/index138.cjs +1 -1
  82. package/dist/index138.js +14 -9
  83. package/dist/index139.cjs +1 -1
  84. package/dist/index139.js +34 -13
  85. package/dist/index140.cjs +1 -1
  86. package/dist/index140.js +55 -4
  87. package/dist/index141.cjs +1 -1
  88. package/dist/index141.js +24 -11
  89. package/dist/index142.cjs +1 -1
  90. package/dist/index142.js +7 -2
  91. package/dist/index143.cjs +1 -1
  92. package/dist/index143.js +19 -32
  93. package/dist/index144.cjs +1 -1
  94. package/dist/index144.js +15 -21
  95. package/dist/index145.cjs +1 -1
  96. package/dist/index145.js +5 -5
  97. package/dist/index146.cjs +1 -1
  98. package/dist/index146.js +13 -5
  99. package/dist/index147.cjs +1 -1
  100. package/dist/index147.js +10 -5
  101. package/dist/index148.cjs +1 -9
  102. package/dist/index148.js +10 -33
  103. package/dist/index149.cjs +1 -1
  104. package/dist/index149.js +12 -3
  105. package/dist/index150.cjs +1 -1
  106. package/dist/index150.js +8 -18
  107. package/dist/index151.cjs +1 -1
  108. package/dist/index151.js +3 -20
  109. package/dist/index152.cjs +1 -1
  110. package/dist/index152.js +16 -35
  111. package/dist/index153.cjs +1 -1
  112. package/dist/index153.js +5 -8
  113. package/dist/index154.cjs +1 -4
  114. package/dist/index154.js +163 -186
  115. package/dist/index155.cjs +1 -1
  116. package/dist/index155.js +98 -22
  117. package/dist/index156.cjs +1 -1
  118. package/dist/index156.js +33 -161
  119. package/dist/index157.cjs +1 -1
  120. package/dist/index157.js +8 -126
  121. package/dist/index158.cjs +1 -1
  122. package/dist/index158.js +60 -27
  123. package/dist/index159.cjs +1 -1
  124. package/dist/index159.js +19 -55
  125. package/dist/index160.cjs +1 -1
  126. package/dist/index160.js +103 -188
  127. package/dist/index161.cjs +1 -1
  128. package/dist/index161.js +79 -4
  129. package/dist/index162.cjs +1 -1
  130. package/dist/index162.js +7 -18
  131. package/dist/index163.cjs +1 -1
  132. package/dist/index163.js +72 -3
  133. package/dist/index164.cjs +2 -1
  134. package/dist/index164.js +3 -17
  135. package/dist/index165.cjs +1 -1
  136. package/dist/index165.js +9 -12
  137. package/dist/index166.cjs +1 -1
  138. package/dist/index166.js +11 -32
  139. package/dist/index167.cjs +1 -1
  140. package/dist/index167.js +5 -3
  141. package/dist/index168.cjs +1 -1
  142. package/dist/index168.js +2 -28
  143. package/dist/index169.cjs +1 -1
  144. package/dist/index169.js +32 -9
  145. package/dist/index17.cjs +1 -1
  146. package/dist/index17.js +2 -2
  147. package/dist/index170.cjs +1 -1
  148. package/dist/index170.js +18 -22
  149. package/dist/index171.cjs +1 -1
  150. package/dist/index171.js +5 -28
  151. package/dist/index172.cjs +1 -1
  152. package/dist/index172.js +5 -3
  153. package/dist/index173.cjs +1 -1
  154. package/dist/index173.js +5 -6
  155. package/dist/index174.cjs +9 -1
  156. package/dist/index174.js +35 -6
  157. package/dist/index175.cjs +1 -1
  158. package/dist/index175.js +3 -33
  159. package/dist/index176.cjs +1 -1
  160. package/dist/index176.js +19 -5
  161. package/dist/index177.cjs +1 -1
  162. package/dist/index177.js +14 -31
  163. package/dist/index178.cjs +1 -1
  164. package/dist/index178.js +32 -46
  165. package/dist/index179.cjs +1 -1
  166. package/dist/index179.js +8 -32
  167. package/dist/index18.cjs +1 -1
  168. package/dist/index18.js +5 -5
  169. package/dist/index180.cjs +4 -1
  170. package/dist/index180.js +194 -8
  171. package/dist/index181.cjs +1 -1
  172. package/dist/index181.js +25 -40
  173. package/dist/index182.cjs +1 -1
  174. package/dist/index182.js +160 -50
  175. package/dist/index183.cjs +1 -1
  176. package/dist/index183.js +125 -102
  177. package/dist/index184.cjs +1 -1
  178. package/dist/index184.js +28 -3
  179. package/dist/index185.cjs +1 -1
  180. package/dist/index185.js +191 -5
  181. package/dist/index186.cjs +1 -1
  182. package/dist/index186.js +4 -4
  183. package/dist/index187.cjs +1 -1
  184. package/dist/index187.js +20 -17
  185. package/dist/index188.cjs +1 -1
  186. package/dist/index188.js +3 -6
  187. package/dist/index189.cjs +1 -1
  188. package/dist/index189.js +16 -8
  189. package/dist/index190.cjs +1 -1
  190. package/dist/index190.js +31 -100
  191. package/dist/index191.cjs +1 -1
  192. package/dist/index191.js +3 -6
  193. package/dist/index192.cjs +1 -1
  194. package/dist/index192.js +27 -6
  195. package/dist/index193.cjs +1 -1
  196. package/dist/index193.js +25 -27
  197. package/dist/index194.cjs +1 -1
  198. package/dist/index194.js +28 -34
  199. package/dist/index195.cjs +1 -1
  200. package/dist/index195.js +6 -13
  201. package/dist/index196.cjs +1 -1
  202. package/dist/index196.js +6 -78
  203. package/dist/index197.cjs +1 -1
  204. package/dist/index197.js +33 -2
  205. package/dist/index198.cjs +1 -1
  206. package/dist/index198.js +5 -19
  207. package/dist/index199.cjs +1 -1
  208. package/dist/index199.js +32 -166
  209. package/dist/index20.cjs +1 -1
  210. package/dist/index20.js +8 -8
  211. package/dist/index200.cjs +1 -1
  212. package/dist/index200.js +48 -16
  213. package/dist/index201.cjs +1 -1
  214. package/dist/index201.js +32 -10
  215. package/dist/index202.cjs +1 -1
  216. package/dist/index202.js +15 -23
  217. package/dist/index203.cjs +1 -1
  218. package/dist/index203.js +41 -17
  219. package/dist/index204.cjs +1 -1
  220. package/dist/index204.js +104 -15
  221. package/dist/index205.cjs +1 -1
  222. package/dist/index205.js +3 -6
  223. package/dist/index206.cjs +1 -1
  224. package/dist/index206.js +5 -13
  225. package/dist/index207.cjs +1 -1
  226. package/dist/index207.js +3 -10
  227. package/dist/index208.cjs +1 -1
  228. package/dist/index208.js +17 -16
  229. package/dist/index209.cjs +1 -1
  230. package/dist/index209.js +8 -24
  231. package/dist/index210.cjs +1 -1
  232. package/dist/index210.js +5 -46
  233. package/dist/index211.cjs +1 -1
  234. package/dist/index211.js +27 -9
  235. package/dist/index212.cjs +1 -2
  236. package/dist/index212.js +77 -40
  237. package/dist/index213.cjs +1 -1
  238. package/dist/index213.js +2 -2
  239. package/dist/index214.cjs +1 -1
  240. package/dist/index214.js +18 -5
  241. package/dist/index215.cjs +1 -1
  242. package/dist/index215.js +16 -9
  243. package/dist/index216.cjs +1 -1
  244. package/dist/index216.js +10 -19
  245. package/dist/index217.cjs +1 -1
  246. package/dist/index217.js +24 -8
  247. package/dist/index218.cjs +1 -1
  248. package/dist/index218.js +46 -66
  249. package/dist/index219.cjs +1 -1
  250. package/dist/index219.js +9 -65
  251. package/dist/index22.cjs +1 -1
  252. package/dist/index22.js +8 -8
  253. package/dist/index220.cjs +1 -1
  254. package/dist/index220.js +99 -184
  255. package/dist/index221.cjs +1 -1
  256. package/dist/index221.js +15 -27
  257. package/dist/index222.cjs +1 -1
  258. package/dist/index222.js +209 -71
  259. package/dist/index223.cjs +1 -1
  260. package/dist/index223.js +105 -37
  261. package/dist/index224.cjs +1 -1
  262. package/dist/index224.js +205 -15
  263. package/dist/index225.cjs +1 -1
  264. package/dist/index225.js +41 -12
  265. package/dist/index226.cjs +1 -1
  266. package/dist/index226.js +78 -11
  267. package/dist/index227.cjs +1 -1
  268. package/dist/index227.js +2 -13
  269. package/dist/index228.cjs +2 -1
  270. package/dist/index228.js +40 -18
  271. package/dist/index229.cjs +1 -1
  272. package/dist/index229.js +2 -109
  273. package/dist/index23.cjs +1 -1
  274. package/dist/index23.js +26 -12
  275. package/dist/index230.cjs +1 -1
  276. package/dist/index230.js +5 -6
  277. package/dist/index231.cjs +1 -1
  278. package/dist/index231.js +11 -7
  279. package/dist/index232.cjs +1 -1
  280. package/dist/index232.js +17 -101
  281. package/dist/index233.cjs +1 -1
  282. package/dist/index233.js +8 -26
  283. package/dist/index234.cjs +1 -1
  284. package/dist/index234.js +66 -16
  285. package/dist/index235.cjs +1 -1
  286. package/dist/index235.js +63 -212
  287. package/dist/index236.cjs +1 -1
  288. package/dist/index236.js +185 -39
  289. package/dist/index237.cjs +1 -1
  290. package/dist/index237.js +26 -76
  291. package/dist/index238.cjs +1 -1
  292. package/dist/index238.js +77 -2
  293. package/dist/index239.cjs +1 -1
  294. package/dist/index239.js +38 -9
  295. package/dist/index24.cjs +1 -1
  296. package/dist/index24.js +8 -59
  297. package/dist/index240.cjs +1 -1
  298. package/dist/index240.js +16 -19
  299. package/dist/index241.cjs +1 -2
  300. package/dist/index241.js +8 -61
  301. package/dist/index242.cjs +1 -1
  302. package/dist/index242.js +11 -14
  303. package/dist/index243.cjs +1 -1
  304. package/dist/index243.js +11 -67
  305. package/dist/index244.cjs +1 -1
  306. package/dist/index244.js +6 -657
  307. package/dist/index245.cjs +1 -1
  308. package/dist/index245.js +6 -206
  309. package/dist/index246.cjs +1 -1
  310. package/dist/index246.js +22 -173
  311. package/dist/index247.cjs +1 -1
  312. package/dist/index247.js +19 -4
  313. package/dist/index248.cjs +1 -1
  314. package/dist/index248.js +12 -2
  315. package/dist/index249.cjs +1 -0
  316. package/dist/index249.js +22 -0
  317. package/dist/index25.cjs +1 -16
  318. package/dist/index25.js +12 -113
  319. package/dist/index250.cjs +2 -0
  320. package/dist/index250.js +94 -0
  321. package/dist/index251.cjs +1 -0
  322. package/dist/index251.js +17 -0
  323. package/dist/index252.cjs +1 -0
  324. package/dist/index252.js +660 -0
  325. package/dist/index253.cjs +1 -0
  326. package/dist/index253.js +180 -0
  327. package/dist/index254.cjs +1 -0
  328. package/dist/index254.js +71 -0
  329. package/dist/index255.cjs +1 -0
  330. package/dist/index255.js +7 -0
  331. package/dist/index256.cjs +1 -0
  332. package/dist/index256.js +4 -0
  333. package/dist/index26.cjs +1 -1
  334. package/dist/index26.js +59 -30
  335. package/dist/index27.cjs +16 -1
  336. package/dist/index27.js +111 -24
  337. package/dist/index28.cjs +1 -1
  338. package/dist/index28.js +29 -7
  339. package/dist/index29.cjs +1 -1
  340. package/dist/index29.js +35 -35
  341. package/dist/index3.cjs +1 -1
  342. package/dist/index3.js +41 -24
  343. package/dist/index30.cjs +1 -1
  344. package/dist/index30.js +9 -9
  345. package/dist/index31.cjs +1 -1
  346. package/dist/index31.js +2 -2
  347. package/dist/index35.cjs +1 -1
  348. package/dist/index35.js +1 -1
  349. package/dist/index37.cjs +1 -1
  350. package/dist/index37.js +11 -11
  351. package/dist/index38.cjs +1 -1
  352. package/dist/index38.js +3 -3
  353. package/dist/index39.cjs +1 -1
  354. package/dist/index39.js +3 -3
  355. package/dist/index40.cjs +1 -1
  356. package/dist/index40.js +3 -3
  357. package/dist/index42.cjs +1 -1
  358. package/dist/index42.js +2 -2
  359. package/dist/index43.cjs +1 -1
  360. package/dist/index43.js +2 -2
  361. package/dist/index45.cjs +1 -1
  362. package/dist/index45.js +15 -15
  363. package/dist/index46.cjs +1 -1
  364. package/dist/index46.js +1 -1
  365. package/dist/index47.cjs +1 -1
  366. package/dist/index47.js +4 -4
  367. package/dist/index48.cjs +1 -1
  368. package/dist/index48.js +14 -17
  369. package/dist/index49.cjs +1 -1
  370. package/dist/index49.js +3 -3
  371. package/dist/index51.cjs +1 -1
  372. package/dist/index51.js +8 -8
  373. package/dist/index54.cjs +1 -1
  374. package/dist/index54.js +14 -14
  375. package/dist/index56.cjs +1 -1
  376. package/dist/index56.js +60 -56
  377. package/dist/index58.cjs +1 -1
  378. package/dist/index58.js +1 -1
  379. package/dist/index60.cjs +1 -1
  380. package/dist/index60.js +8 -8
  381. package/dist/index62.cjs +1 -1
  382. package/dist/index62.js +2 -2
  383. package/dist/index63.cjs +1 -1
  384. package/dist/index63.js +3 -3
  385. package/dist/index64.cjs +1 -1
  386. package/dist/index64.js +131 -76
  387. package/dist/index65.cjs +1 -1
  388. package/dist/index65.js +2 -2
  389. package/dist/index66.cjs +1 -1
  390. package/dist/index66.js +76 -6
  391. package/dist/index67.cjs +1 -1
  392. package/dist/index67.js +13 -21
  393. package/dist/index68.cjs +1 -1
  394. package/dist/index68.js +51 -8
  395. package/dist/index69.cjs +1 -1
  396. package/dist/index69.js +7 -31
  397. package/dist/index70.cjs +1 -1
  398. package/dist/index70.js +7 -7
  399. package/dist/index71.cjs +1 -1
  400. package/dist/index71.js +21 -16
  401. package/dist/index72.cjs +1 -1
  402. package/dist/index72.js +8 -73
  403. package/dist/index73.cjs +1 -1
  404. package/dist/index73.js +31 -35
  405. package/dist/index74.cjs +1 -1
  406. package/dist/index74.js +15 -15
  407. package/dist/index75.cjs +1 -1
  408. package/dist/index75.js +69 -61
  409. package/dist/index76.cjs +1 -1
  410. package/dist/index76.js +35 -11
  411. package/dist/index77.cjs +1 -1
  412. package/dist/index77.js +15 -13
  413. package/dist/index78.cjs +1 -3
  414. package/dist/index78.js +72 -92
  415. package/dist/index79.cjs +1 -1
  416. package/dist/index79.js +11 -23
  417. package/dist/index80.cjs +1 -1
  418. package/dist/index80.js +28 -32
  419. package/dist/index81.cjs +2 -1
  420. package/dist/index81.js +118 -42
  421. package/dist/index82.cjs +1 -1
  422. package/dist/index82.js +13 -5
  423. package/dist/index83.cjs +1 -1
  424. package/dist/index83.js +24 -151
  425. package/dist/index84.cjs +1 -20
  426. package/dist/index84.js +31 -324
  427. package/dist/index85.cjs +1 -3
  428. package/dist/index85.js +42 -449
  429. package/dist/index86.cjs +1 -1
  430. package/dist/index86.js +6 -64
  431. package/dist/index87.cjs +1 -1
  432. package/dist/index87.js +101 -35
  433. package/dist/index88.cjs +1 -1
  434. package/dist/index88.js +36 -14
  435. package/dist/index89.cjs +1 -1
  436. package/dist/index89.js +9 -2
  437. package/dist/index90.cjs +1 -1
  438. package/dist/index90.js +19 -15
  439. package/dist/index91.cjs +1 -1
  440. package/dist/index91.js +2 -11
  441. package/dist/index92.cjs +1 -1
  442. package/dist/index92.js +72 -122
  443. package/dist/index93.cjs +1 -1
  444. package/dist/index93.js +15 -5
  445. package/dist/index94.cjs +1 -1
  446. package/dist/index94.js +151 -21
  447. package/dist/index95.cjs +20 -1
  448. package/dist/index95.js +326 -45
  449. package/dist/index96.cjs +3 -1
  450. package/dist/index96.js +451 -38
  451. package/dist/index97.cjs +1 -1
  452. package/dist/index97.js +64 -6
  453. package/dist/index98.cjs +1 -1
  454. package/dist/index98.js +15 -87
  455. package/dist/index99.cjs +1 -1
  456. package/dist/index99.js +10 -14
  457. package/dist/src/lib/utils.d.ts +15 -0
  458. package/package.json +3 -3
package/dist/index120.js CHANGED
@@ -1,24 +1,21 @@
1
- import { parseAccount as p } from "./index32.js";
2
- import { AccountNotFoundError as d } from "./index102.js";
3
- import { getTypesForEIP712Domain as y, validateTypedData as m, serializeTypedData as u } from "./index121.js";
4
- async function f(r, s) {
5
- const { account: c = r.account, domain: t, message: a, primaryType: o } = s;
6
- if (!c)
7
- throw new d({
8
- docsPath: "/docs/actions/wallet/signTypedData"
9
- });
10
- const e = p(c), n = {
11
- EIP712Domain: y({ domain: t }),
12
- ...s.types
13
- };
14
- if (m({ domain: t, message: a, primaryType: o, types: n }), e.signTypedData)
15
- return e.signTypedData({ domain: t, message: a, primaryType: o, types: n });
16
- const i = u({ domain: t, message: a, primaryType: o, types: n });
17
- return r.request({
18
- method: "eth_signTypedData_v4",
19
- params: [e.address, i]
20
- }, { retryCount: 0 });
1
+ function i(t) {
2
+ return typeof t[0] == "string" ? f(t) : c(t);
3
+ }
4
+ function c(t) {
5
+ let n = 0;
6
+ for (const e of t)
7
+ n += e.length;
8
+ const r = new Uint8Array(n);
9
+ let o = 0;
10
+ for (const e of t)
11
+ r.set(e, o), o += e.length;
12
+ return r;
13
+ }
14
+ function f(t) {
15
+ return `0x${t.reduce((n, r) => n + r.replace("0x", ""), "")}`;
21
16
  }
22
17
  export {
23
- f as signTypedData
18
+ i as concat,
19
+ c as concatBytes,
20
+ f as concatHex
24
21
  };
package/dist/index121.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index84.cjs"),E=require("./index141.cjs"),b=require("./index155.cjs"),z=require("./index165.cjs"),d=require("./index140.cjs"),T=require("./index42.cjs"),h=require("./index167.cjs"),w=require("./index89.cjs");function P(e){const{domain:i,message:y,primaryType:n,types:t}=e,a=(g,l)=>{const s={...l};for(const r of g){const{name:o,type:f}=r;f==="address"&&(s[o]=s[o].toLowerCase())}return s},u=t.EIP712Domain?i?a(t.EIP712Domain,i):{}:{},p=(()=>{if(n!=="EIP712Domain")return a(t[n],y)})();return w.stringify({domain:u,message:p,primaryType:n,types:t})}function q(e){const{domain:i,message:y,primaryType:n,types:t}=e,a=(u,p)=>{for(const g of u){const{name:l,type:s}=g,r=p[l],o=s.match(h.integerRegex);if(o&&(typeof r=="number"||typeof r=="bigint")){const[D,c,v]=o;T.numberToHex(r,{signed:c==="int",size:Number.parseInt(v,10)/8})}if(s==="address"&&typeof r=="string"&&!z.isAddress(r))throw new E.InvalidAddressError({address:r});const f=s.match(h.bytesRegex);if(f){const[D,c]=f;if(c&&d.size(r)!==Number.parseInt(c,10))throw new m.BytesSizeMismatchError({expectedSize:Number.parseInt(c,10),givenSize:d.size(r)})}const I=t[s];I&&(S(s),a(I,r))}};if(t.EIP712Domain&&i){if(typeof i!="object")throw new b.InvalidDomainError({domain:i});a(t.EIP712Domain,i)}if(n!=="EIP712Domain")if(t[n])a(t[n],y);else throw new b.InvalidPrimaryTypeError({primaryType:n,types:t})}function x({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function S(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new b.InvalidStructTypeError({type:e})}exports.getTypesForEIP712Domain=x;exports.serializeTypedData=P;exports.validateTypedData=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index106.cjs"),u=require("./index122.cjs");async function i(s,t){const{chain:n=s.chain}=t,o=t.timeout??Math.max(((n==null?void 0:n.blockTime)??0)*3,5e3),a=await l.sendCalls(s,t);return await u.waitForCallsStatus(s,{...t,id:a.id,timeout:o})}exports.sendCallsSync=i;
package/dist/index121.js CHANGED
@@ -1,83 +1,13 @@
1
- import { BytesSizeMismatchError as v } from "./index84.js";
2
- import { InvalidAddressError as D } from "./index141.js";
3
- import { InvalidDomainError as E, InvalidPrimaryTypeError as w, InvalidStructTypeError as z } from "./index155.js";
4
- import { isAddress as P } from "./index165.js";
5
- import { size as h } from "./index140.js";
6
- import { numberToHex as T } from "./index42.js";
7
- import { integerRegex as d, bytesRegex as _ } from "./index167.js";
8
- import { stringify as x } from "./index89.js";
9
- function F(e) {
10
- const { domain: i, message: p, primaryType: n, types: t } = e, o = (u, g) => {
11
- const s = { ...g };
12
- for (const r of u) {
13
- const { name: a, type: c } = r;
14
- c === "address" && (s[a] = s[a].toLowerCase());
15
- }
16
- return s;
17
- }, y = t.EIP712Domain ? i ? o(t.EIP712Domain, i) : {} : {}, m = (() => {
18
- if (n !== "EIP712Domain")
19
- return o(t[n], p);
20
- })();
21
- return x({ domain: y, message: m, primaryType: n, types: t });
22
- }
23
- function H(e) {
24
- const { domain: i, message: p, primaryType: n, types: t } = e, o = (y, m) => {
25
- for (const u of y) {
26
- const { name: g, type: s } = u, r = m[g], a = s.match(d);
27
- if (a && (typeof r == "number" || typeof r == "bigint")) {
28
- const [l, f, b] = a;
29
- T(r, {
30
- signed: f === "int",
31
- size: Number.parseInt(b, 10) / 8
32
- });
33
- }
34
- if (s === "address" && typeof r == "string" && !P(r))
35
- throw new D({ address: r });
36
- const c = s.match(_);
37
- if (c) {
38
- const [l, f] = c;
39
- if (f && h(r) !== Number.parseInt(f, 10))
40
- throw new v({
41
- expectedSize: Number.parseInt(f, 10),
42
- givenSize: h(r)
43
- });
44
- }
45
- const I = t[s];
46
- I && (S(s), o(I, r));
47
- }
48
- };
49
- if (t.EIP712Domain && i) {
50
- if (typeof i != "object")
51
- throw new E({ domain: i });
52
- o(t.EIP712Domain, i);
53
- }
54
- if (n !== "EIP712Domain")
55
- if (t[n])
56
- o(t[n], p);
57
- else
58
- throw new w({ primaryType: n, types: t });
59
- }
60
- function L({ domain: e }) {
61
- return [
62
- typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
63
- (e == null ? void 0 : e.version) && { name: "version", type: "string" },
64
- (typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
65
- name: "chainId",
66
- type: "uint256"
67
- },
68
- (e == null ? void 0 : e.verifyingContract) && {
69
- name: "verifyingContract",
70
- type: "address"
71
- },
72
- (e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
73
- ].filter(Boolean);
74
- }
75
- function S(e) {
76
- if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
77
- throw new z({ type: e });
1
+ import { sendCalls as a } from "./index106.js";
2
+ import { waitForCallsStatus as u } from "./index122.js";
3
+ async function d(o, t) {
4
+ const { chain: s = o.chain } = t, i = t.timeout ?? Math.max(((s == null ? void 0 : s.blockTime) ?? 0) * 3, 5e3), n = await a(o, t);
5
+ return await u(o, {
6
+ ...t,
7
+ id: n.id,
8
+ timeout: i
9
+ });
78
10
  }
79
11
  export {
80
- L as getTypesForEIP712Domain,
81
- F as serializeTypedData,
82
- H as validateTypedData
12
+ d as sendCallsSync
83
13
  };
package/dist/index122.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index42.cjs");async function a(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:i.numberToHex(t)}]},{retryCount:0})}exports.switchChain=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./index35.cjs"),C=require("./index134.cjs"),p=require("./index55.cjs"),F=require("./index88.cjs"),T=require("./index93.cjs"),E=require("./index89.cjs"),R=require("./index90.cjs"),j=require("./index91.cjs"),B=require("./index103.cjs");async function I(r,s){const{id:o,pollingInterval:y=r.pollingInterval,status:g=({statusCode:t})=>t===200||t>=300,retryCount:m=4,retryDelay:v=({count:t})=>~~(1<<t)*200,timeout:l=6e4,throwOnFailure:f=!1}=s,S=j.stringify(["waitForCallsStatus",r.uid,o]),{promise:b,resolve:h,reject:n}=E.withResolvers();let i;const u=F.observe(S,{resolve:h,reject:n},t=>{const c=T.poll(async()=>{const w=e=>{clearTimeout(i),c(),e(),u()};try{const e=await R.withRetry(async()=>{const a=await p.getAction(r,B.getCallsStatus,"getCallsStatus")({id:o});if(f&&a.status==="failure")throw new C.BundleFailedError(a);return a},{retryCount:m,delay:v});if(!g(e))return;w(()=>t.resolve(e))}catch(e){w(()=>t.reject(e))}},{interval:y,emitOnBegin:!0});return c});return i=l?setTimeout(()=>{u(),clearTimeout(i),n(new d({id:o}))},l):void 0,await b}class d extends q.BaseError{constructor({id:s}){super(`Timed out while waiting for call bundle with id "${s}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}exports.WaitForCallsStatusTimeoutError=d;exports.waitForCallsStatus=I;
package/dist/index122.js CHANGED
@@ -1,14 +1,61 @@
1
- import { numberToHex as a } from "./index42.js";
2
- async function i(t, { id: e }) {
3
- await t.request({
4
- method: "wallet_switchEthereumChain",
5
- params: [
6
- {
7
- chainId: a(e)
1
+ import { BaseError as C } from "./index35.js";
2
+ import { BundleFailedError as F } from "./index134.js";
3
+ import { getAction as S } from "./index55.js";
4
+ import { observe as T } from "./index88.js";
5
+ import { poll as b } from "./index93.js";
6
+ import { withResolvers as E } from "./index89.js";
7
+ import { withRetry as B } from "./index90.js";
8
+ import { stringify as I } from "./index91.js";
9
+ import { getCallsStatus as j } from "./index103.js";
10
+ async function z(e, o) {
11
+ const {
12
+ id: i,
13
+ pollingInterval: f = e.pollingInterval,
14
+ status: p = ({ statusCode: t }) => t === 200 || t >= 300,
15
+ retryCount: w = 4,
16
+ retryDelay: d = ({ count: t }) => ~~(1 << t) * 200,
17
+ // exponential backoff
18
+ timeout: l = 6e4,
19
+ throwOnFailure: y = !1
20
+ } = o, v = I(["waitForCallsStatus", e.uid, i]), { promise: g, resolve: h, reject: n } = E();
21
+ let s;
22
+ const u = T(v, { resolve: h, reject: n }, (t) => {
23
+ const m = b(async () => {
24
+ const c = (r) => {
25
+ clearTimeout(s), m(), r(), u();
26
+ };
27
+ try {
28
+ const r = await B(async () => {
29
+ const a = await S(e, j, "getCallsStatus")({ id: i });
30
+ if (y && a.status === "failure")
31
+ throw new F(a);
32
+ return a;
33
+ }, {
34
+ retryCount: w,
35
+ delay: d
36
+ });
37
+ if (!p(r))
38
+ return;
39
+ c(() => t.resolve(r));
40
+ } catch (r) {
41
+ c(() => t.reject(r));
8
42
  }
9
- ]
10
- }, { retryCount: 0 });
43
+ }, {
44
+ interval: f,
45
+ emitOnBegin: !0
46
+ });
47
+ return m;
48
+ });
49
+ return s = l ? setTimeout(() => {
50
+ u(), clearTimeout(s), n(new x({ id: i }));
51
+ }, l) : void 0, await g;
52
+ }
53
+ class x extends C {
54
+ constructor({ id: o }) {
55
+ super(`Timed out while waiting for call bundle with id "${o}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
56
+ }
11
57
  }
12
58
  export {
13
- i as switchChain
59
+ x as WaitForCallsStatusTimeoutError,
60
+ z as waitForCallsStatus
14
61
  };
package/dist/index123.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./index35.cjs"),C=require("./index124.cjs"),p=require("./index55.cjs"),F=require("./index87.cjs"),T=require("./index88.cjs"),E=require("./index125.cjs"),R=require("./index126.cjs"),j=require("./index89.cjs"),B=require("./index95.cjs");async function I(r,s){const{id:o,pollingInterval:y=r.pollingInterval,status:g=({statusCode:t})=>t===200||t>=300,retryCount:m=4,retryDelay:v=({count:t})=>~~(1<<t)*200,timeout:l=6e4,throwOnFailure:f=!1}=s,S=j.stringify(["waitForCallsStatus",r.uid,o]),{promise:b,resolve:h,reject:n}=E.withResolvers();let i;const u=F.observe(S,{resolve:h,reject:n},t=>{const c=T.poll(async()=>{const w=e=>{clearTimeout(i),c(),e(),u()};try{const e=await R.withRetry(async()=>{const a=await p.getAction(r,B.getCallsStatus,"getCallsStatus")({id:o});if(f&&a.status==="failure")throw new C.BundleFailedError(a);return a},{retryCount:m,delay:v});if(!g(e))return;w(()=>t.resolve(e))}catch(e){w(()=>t.reject(e))}},{interval:y,emitOnBegin:!0});return c});return i=l?setTimeout(()=>{u(),clearTimeout(i),n(new d({id:o}))},l):void 0,await b}class d extends q.BaseError{constructor({id:s}){super(`Timed out while waiting for call bundle with id "${s}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}exports.WaitForCallsStatusTimeoutError=d;exports.waitForCallsStatus=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function t(e,{serializedTransaction:n}){return e.request({method:"eth_sendRawTransaction",params:[n]},{retryCount:0})}exports.sendRawTransaction=t;
package/dist/index123.js CHANGED
@@ -1,61 +1,9 @@
1
- import { BaseError as C } from "./index35.js";
2
- import { BundleFailedError as F } from "./index124.js";
3
- import { getAction as S } from "./index55.js";
4
- import { observe as T } from "./index87.js";
5
- import { poll as b } from "./index88.js";
6
- import { withResolvers as E } from "./index125.js";
7
- import { withRetry as B } from "./index126.js";
8
- import { stringify as I } from "./index89.js";
9
- import { getCallsStatus as j } from "./index95.js";
10
- async function z(e, o) {
11
- const {
12
- id: i,
13
- pollingInterval: f = e.pollingInterval,
14
- status: p = ({ statusCode: t }) => t === 200 || t >= 300,
15
- retryCount: w = 4,
16
- retryDelay: d = ({ count: t }) => ~~(1 << t) * 200,
17
- // exponential backoff
18
- timeout: l = 6e4,
19
- throwOnFailure: y = !1
20
- } = o, v = I(["waitForCallsStatus", e.uid, i]), { promise: g, resolve: h, reject: n } = E();
21
- let s;
22
- const u = T(v, { resolve: h, reject: n }, (t) => {
23
- const m = b(async () => {
24
- const c = (r) => {
25
- clearTimeout(s), m(), r(), u();
26
- };
27
- try {
28
- const r = await B(async () => {
29
- const a = await S(e, j, "getCallsStatus")({ id: i });
30
- if (y && a.status === "failure")
31
- throw new F(a);
32
- return a;
33
- }, {
34
- retryCount: w,
35
- delay: d
36
- });
37
- if (!p(r))
38
- return;
39
- c(() => t.resolve(r));
40
- } catch (r) {
41
- c(() => t.reject(r));
42
- }
43
- }, {
44
- interval: f,
45
- emitOnBegin: !0
46
- });
47
- return m;
48
- });
49
- return s = l ? setTimeout(() => {
50
- u(), clearTimeout(s), n(new x({ id: i }));
51
- }, l) : void 0, await g;
52
- }
53
- class x extends C {
54
- constructor({ id: o }) {
55
- super(`Timed out while waiting for call bundle with id "${o}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
56
- }
1
+ async function a(n, { serializedTransaction: t }) {
2
+ return n.request({
3
+ method: "eth_sendRawTransaction",
4
+ params: [t]
5
+ }, { retryCount: 0 });
57
6
  }
58
7
  export {
59
- x as WaitForCallsStatusTimeoutError,
60
- z as waitForCallsStatus
8
+ a as sendRawTransaction
61
9
  };
package/dist/index124.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index35.cjs");class t extends r.BaseError{constructor(e){super(`Call bundle failed with status: ${e.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=e}}exports.BundleFailedError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index81.cjs"),f=require("./index83.cjs"),m=require("./index42.cjs");async function d(e,{serializedTransaction:r,throwOnReceiptRevert:s,timeout:n}){var a,o,c;const i=await e.request({method:"eth_sendRawTransactionSync",params:n?[r,m.numberToHex(n)]:[r]},{retryCount:0}),t=(((c=(o=(a=e.chain)==null?void 0:a.formatters)==null?void 0:o.transactionReceipt)==null?void 0:c.format)||f.formatTransactionReceipt)(i);if(t.status==="reverted"&&s)throw new u.TransactionReceiptRevertedError({receipt:t});return t}exports.sendRawTransactionSync=d;
package/dist/index124.js CHANGED
@@ -1,16 +1,16 @@
1
- import { BaseError as r } from "./index35.js";
2
- class u extends r {
3
- constructor(e) {
4
- super(`Call bundle failed with status: ${e.statusCode}`, {
5
- name: "BundleFailedError"
6
- }), Object.defineProperty(this, "result", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: void 0
11
- }), this.result = e;
12
- }
1
+ import { TransactionReceiptRevertedError as i } from "./index81.js";
2
+ import { formatTransactionReceipt as f } from "./index83.js";
3
+ import { numberToHex as p } from "./index42.js";
4
+ async function h(r, { serializedTransaction: e, throwOnReceiptRevert: m, timeout: o }) {
5
+ var a, n, c;
6
+ const s = await r.request({
7
+ method: "eth_sendRawTransactionSync",
8
+ params: o ? [e, p(o)] : [e]
9
+ }, { retryCount: 0 }), t = (((c = (n = (a = r.chain) == null ? void 0 : a.formatters) == null ? void 0 : n.transactionReceipt) == null ? void 0 : c.format) || f)(s);
10
+ if (t.status === "reverted" && m)
11
+ throw new i({ receipt: t });
12
+ return t;
13
13
  }
14
14
  export {
15
- u as BundleFailedError
15
+ h as sendRawTransactionSync
16
16
  };
package/dist/index125.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index36.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/index125.js CHANGED
@@ -1,11 +1,10 @@
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 };
1
+ import { ChainNotFoundError as t, ChainMismatchError as i } from "./index36.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 });
8
7
  }
9
8
  export {
10
- i as withResolvers
9
+ e as assertCurrentChain
11
10
  };
package/dist/index126.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index186.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./index32.cjs"),u=require("./index110.cjs"),W=require("./index35.cjs"),D=require("./index81.cjs"),H=require("./index62.cjs"),J=require("./index125.cjs"),K=require("./index67.cjs"),Q=require("./index44.cjs"),V=require("./index45.cjs"),d=require("./index55.cjs"),X=require("./index116.cjs"),Y=require("./index48.cjs"),Z=require("./index69.cjs"),$=require("./index87.cjs"),O=require("./index64.cjs"),tt=require("./index124.cjs"),f=new X.LruMap(128);async function et(e,n){var F,M,I,b;const{account:p=e.account,chain:r=e.chain,accessList:m,authorizationList:s,blobs:q,data:y,gas:T,gasPrice:R,maxFeePerBlobGas:g,maxFeePerGas:A,maxPriorityFeePerGas:E,nonce:S,pollingInterval:G,throwOnReceiptRevert:C,type:N,value:P,...v}=n,j=n.timeout??Math.max(((r==null?void 0:r.blockTime)??0)*3,5e3);if(typeof p>"u")throw new u.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransactionSync"});const t=p?U.parseAccount(p):null;try{Y.assertRequest(n);const a=await(async()=>{if(n.to)return n.to;if(n.to!==null&&s&&s.length>0)return await H.recoverAuthorizationAddress({authorization:s[0]}).catch(()=>{throw new W.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((t==null?void 0:t.type)==="json-rpc"||t===null){let c;r!==null&&(c=await d.getAction(e,Z.getChainId,"getChainId")({}),J.assertCurrentChain({currentChainId:c,chain:r}));const i=(I=(M=(F=e.chain)==null?void 0:F.formatters)==null?void 0:M.transactionRequest)==null?void 0:I.format,x=(i||V.formatTransactionRequest)({...Q.extract(v,{format:i}),accessList:m,account:t,authorizationList:s,blobs:q,chainId:c,data:y,gas:T,gasPrice:R,maxFeePerBlobGas:g,maxFeePerGas:A,maxPriorityFeePerGas:E,nonce:S,to:a,type:N,value:P},"sendTransaction"),_=f.get(e.uid),k=_?"wallet_sendTransaction":"eth_sendTransaction",B=await(async()=>{try{return await e.request({method:k,params:[x]},{retryCount:0})}catch(L){if(_===!1)throw L;const o=L;if(o.name==="InvalidInputRpcError"||o.name==="InvalidParamsRpcError"||o.name==="MethodNotFoundRpcError"||o.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[x]},{retryCount:0}).then(w=>(f.set(e.uid,!0),w)).catch(w=>{const l=w;throw l.name==="MethodNotFoundRpcError"||l.name==="MethodNotSupportedRpcError"?(f.set(e.uid,!1),o):l});throw o}})(),h=await d.getAction(e,$.waitForTransactionReceipt,"waitForTransactionReceipt")({checkReplacement:!1,hash:B,pollingInterval:G,timeout:j});if(C&&h.status==="reverted")throw new D.TransactionReceiptRevertedError({receipt:h});return h}if((t==null?void 0:t.type)==="local"){const c=await d.getAction(e,O.prepareTransactionRequest,"prepareTransactionRequest")({account:t,accessList:m,authorizationList:s,blobs:q,chain:r,data:y,gas:T,gasPrice:R,maxFeePerBlobGas:g,maxFeePerGas:A,maxPriorityFeePerGas:E,nonce:S,nonceManager:t.nonceManager,parameters:[...O.defaultParameters,"sidecars"],type:N,value:P,...v,to:a}),i=(b=r==null?void 0:r.serializers)==null?void 0:b.transaction,z=await t.signTransaction(c,{serializer:i});return await d.getAction(e,tt.sendRawTransactionSync,"sendRawTransactionSync")({serializedTransaction:z,throwOnReceiptRevert:C})}throw(t==null?void 0:t.type)==="smart"?new u.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new u.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransactionSync",type:t==null?void 0:t.type})}catch(a){throw a instanceof u.AccountTypeNotSupportedError?a:K.getTransactionError(a,{...n,account:t,chain:n.chain||void 0})}}exports.sendTransactionSync=et;
package/dist/index126.js CHANGED
@@ -1,23 +1,140 @@
1
- import { wait as w } from "./index186.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
- });
1
+ import { parseAccount as U } from "./index32.js";
2
+ import { AccountNotFoundError as W, AccountTypeNotSupportedError as h } from "./index110.js";
3
+ import { BaseError as j } from "./index35.js";
4
+ import { TransactionReceiptRevertedError as D } from "./index81.js";
5
+ import { recoverAuthorizationAddress as H } from "./index62.js";
6
+ import { assertCurrentChain as J } from "./index125.js";
7
+ import { getTransactionError as K } from "./index67.js";
8
+ import { extract as Q } from "./index44.js";
9
+ import { formatTransactionRequest as V } from "./index45.js";
10
+ import { getAction as d } from "./index55.js";
11
+ import { LruMap as X } from "./index116.js";
12
+ import { assertRequest as Y } from "./index48.js";
13
+ import { getChainId as Z } from "./index69.js";
14
+ import { waitForTransactionReceipt as $ } from "./index87.js";
15
+ import { prepareTransactionRequest as tt, defaultParameters as rt } from "./index64.js";
16
+ import { sendRawTransactionSync as et } from "./index124.js";
17
+ const w = new X(128);
18
+ async function Tt(r, o) {
19
+ var v, I, z, A;
20
+ const { account: m = r.account, chain: e = r.chain, accessList: l, authorizationList: s, blobs: y, data: R, gas: T, gasPrice: g, maxFeePerBlobGas: E, maxFeePerGas: q, maxPriorityFeePerGas: P, nonce: C, pollingInterval: G, throwOnReceiptRevert: F, type: M, value: N, ...S } = o, O = o.timeout ?? Math.max(((e == null ? void 0 : e.blockTime) ?? 0) * 3, 5e3);
21
+ if (typeof m > "u")
22
+ throw new W({
23
+ docsPath: "/docs/actions/wallet/sendTransactionSync"
24
+ });
25
+ const t = m ? U(m) : null;
26
+ try {
27
+ Y(o);
28
+ const a = await (async () => {
29
+ if (o.to)
30
+ return o.to;
31
+ if (o.to !== null && s && s.length > 0)
32
+ return await H({
33
+ authorization: s[0]
34
+ }).catch(() => {
35
+ throw new j("`to` is required. Could not infer from `authorizationList`.");
36
+ });
37
+ })();
38
+ if ((t == null ? void 0 : t.type) === "json-rpc" || t === null) {
39
+ let i;
40
+ e !== null && (i = await d(r, Z, "getChainId")({}), J({
41
+ currentChainId: i,
42
+ chain: e
43
+ }));
44
+ const c = (z = (I = (v = r.chain) == null ? void 0 : v.formatters) == null ? void 0 : I.transactionRequest) == null ? void 0 : z.format, b = (c || V)({
45
+ // Pick out extra data that might exist on the chain's transaction request type.
46
+ ...Q(S, { format: c }),
47
+ accessList: l,
48
+ account: t,
49
+ authorizationList: s,
50
+ blobs: y,
51
+ chainId: i,
52
+ data: R,
53
+ gas: T,
54
+ gasPrice: g,
55
+ maxFeePerBlobGas: E,
56
+ maxFeePerGas: q,
57
+ maxPriorityFeePerGas: P,
58
+ nonce: C,
59
+ to: a,
60
+ type: M,
61
+ value: N
62
+ }, "sendTransaction"), _ = w.get(r.uid), k = _ ? "wallet_sendTransaction" : "eth_sendTransaction", B = await (async () => {
63
+ try {
64
+ return await r.request({
65
+ method: k,
66
+ params: [b]
67
+ }, { retryCount: 0 });
68
+ } catch (L) {
69
+ if (_ === !1)
70
+ throw L;
71
+ const n = L;
72
+ if (n.name === "InvalidInputRpcError" || n.name === "InvalidParamsRpcError" || n.name === "MethodNotFoundRpcError" || n.name === "MethodNotSupportedRpcError")
73
+ return await r.request({
74
+ method: "wallet_sendTransaction",
75
+ params: [b]
76
+ }, { retryCount: 0 }).then((u) => (w.set(r.uid, !0), u)).catch((u) => {
77
+ const f = u;
78
+ throw f.name === "MethodNotFoundRpcError" || f.name === "MethodNotSupportedRpcError" ? (w.set(r.uid, !1), n) : f;
79
+ });
80
+ throw n;
81
+ }
82
+ })(), p = await d(r, $, "waitForTransactionReceipt")({
83
+ checkReplacement: !1,
84
+ hash: B,
85
+ pollingInterval: G,
86
+ timeout: O
87
+ });
88
+ if (F && p.status === "reverted")
89
+ throw new D({ receipt: p });
90
+ return p;
91
+ }
92
+ if ((t == null ? void 0 : t.type) === "local") {
93
+ const i = await d(r, tt, "prepareTransactionRequest")({
94
+ account: t,
95
+ accessList: l,
96
+ authorizationList: s,
97
+ blobs: y,
98
+ chain: e,
99
+ data: R,
100
+ gas: T,
101
+ gasPrice: g,
102
+ maxFeePerBlobGas: E,
103
+ maxFeePerGas: q,
104
+ maxPriorityFeePerGas: P,
105
+ nonce: C,
106
+ nonceManager: t.nonceManager,
107
+ parameters: [...rt, "sidecars"],
108
+ type: M,
109
+ value: N,
110
+ ...S,
111
+ to: a
112
+ }), c = (A = e == null ? void 0 : e.serializers) == null ? void 0 : A.transaction, x = await t.signTransaction(i, {
113
+ serializer: c
114
+ });
115
+ return await d(r, et, "sendRawTransactionSync")({
116
+ serializedTransaction: x,
117
+ throwOnReceiptRevert: F
118
+ });
119
+ }
120
+ throw (t == null ? void 0 : t.type) === "smart" ? new h({
121
+ metaMessages: [
122
+ "Consider using the `sendUserOperation` Action instead."
123
+ ],
124
+ docsPath: "/docs/actions/bundler/sendUserOperation",
125
+ type: "smart"
126
+ }) : new h({
127
+ docsPath: "/docs/actions/wallet/sendTransactionSync",
128
+ type: t == null ? void 0 : t.type
129
+ });
130
+ } catch (a) {
131
+ throw a instanceof h ? a : K(a, {
132
+ ...o,
133
+ account: t,
134
+ chain: o.chain || void 0
135
+ });
136
+ }
20
137
  }
21
138
  export {
22
- p as withRetry
139
+ Tt as sendTransactionSync
23
140
  };
package/dist/index127.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function a(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}exports.watchAsset=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function e(t,s){const{id:a}=s;await t.request({method:"wallet_showCallsStatus",params:[a]})}exports.showCallsStatus=e;
package/dist/index127.js CHANGED
@@ -1,9 +1,10 @@
1
- async function d(t, e) {
2
- return await t.request({
3
- method: "wallet_watchAsset",
4
- params: e
5
- }, { retryCount: 0 });
1
+ async function e(t, a) {
2
+ const { id: s } = a;
3
+ await t.request({
4
+ method: "wallet_showCallsStatus",
5
+ params: [s]
6
+ });
6
7
  }
7
8
  export {
8
- d as watchAsset
9
+ e as showCallsStatus
9
10
  };
package/dist/index128.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index32.cjs"),g=require("./index102.cjs"),q=require("./index40.cjs"),C=require("./index54.cjs"),h=require("./index55.cjs"),l=require("./index92.cjs");async function p(n,i){const{abi:c,account:r=n.account,address:o,args:e,dataSuffix:a,functionName:s,...u}=i;if(typeof r>"u")throw new g.AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const t=r?w.parseAccount(r):null,d=q.encodeFunctionData({abi:c,args:e,functionName:s});try{return await h.getAction(n,l.sendTransaction,"sendTransaction")({data:`${d}${a?a.replace("0x",""):""}`,to:o,account:t,...u})}catch(f){throw C.getContractError(f,{abi:c,address:o,args:e,docsPath:"/docs/contract/writeContract",functionName:s,sender:t==null?void 0:t.address})}}exports.writeContract=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index32.cjs"),r=require("./index110.cjs"),e=require("./index109.cjs");async function a(t,n){const{account:i=t.account}=n;if(!i)throw new r.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});const o=u.parseAccount(i);if(!o.signAuthorization)throw new r.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:o.type});const c=await e.prepareAuthorization(t,n);return o.signAuthorization(c)}exports.signAuthorization=a;
package/dist/index128.js CHANGED
@@ -1,38 +1,24 @@
1
- import { parseAccount as u } from "./index32.js";
2
- import { AccountNotFoundError as p } from "./index102.js";
3
- import { encodeFunctionData as w } from "./index40.js";
4
- import { getContractError as h } from "./index54.js";
5
- import { getAction as C } from "./index55.js";
6
- import { sendTransaction as g } from "./index92.js";
7
- async function N(r, i) {
8
- const { abi: n, account: o = r.account, address: a, args: c, dataSuffix: e, functionName: s, ...d } = i;
9
- if (typeof o > "u")
10
- throw new p({
11
- docsPath: "/docs/contract/writeContract"
1
+ import { parseAccount as c } from "./index32.js";
2
+ import { AccountNotFoundError as u, AccountTypeNotSupportedError as a } from "./index110.js";
3
+ import { prepareAuthorization as s } from "./index109.js";
4
+ async function A(t, n) {
5
+ const { account: i = t.account } = n;
6
+ if (!i)
7
+ throw new u({
8
+ docsPath: "/docs/eip7702/signAuthorization"
12
9
  });
13
- const t = o ? u(o) : null, f = w({
14
- abi: n,
15
- args: c,
16
- functionName: s
17
- });
18
- try {
19
- return await C(r, g, "sendTransaction")({
20
- data: `${f}${e ? e.replace("0x", "") : ""}`,
21
- to: a,
22
- account: t,
23
- ...d
10
+ const o = c(i);
11
+ if (!o.signAuthorization)
12
+ throw new a({
13
+ docsPath: "/docs/eip7702/signAuthorization",
14
+ metaMessages: [
15
+ "The `signAuthorization` Action does not support JSON-RPC Accounts."
16
+ ],
17
+ type: o.type
24
18
  });
25
- } catch (m) {
26
- throw h(m, {
27
- abi: n,
28
- address: a,
29
- args: c,
30
- docsPath: "/docs/contract/writeContract",
31
- functionName: s,
32
- sender: t == null ? void 0 : t.address
33
- });
34
- }
19
+ const r = await s(t, n);
20
+ return o.signAuthorization(r);
35
21
  }
36
22
  export {
37
- N as writeContract
23
+ A as signAuthorization
38
24
  };