@reown/appkit-cdn 1.8.15-viem-upgrade.0 → 1.8.15-viem-upgrade-2.0

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 (427) hide show
  1. package/dist/ConstantsUtil-DSO-aT76.js +24 -0
  2. package/dist/ConstantsUtil-DSO-aT76.js.map +1 -0
  3. package/dist/ExchangeController-D7JbbTDN.js +265 -0
  4. package/dist/ExchangeController-D7JbbTDN.js.map +1 -0
  5. package/dist/HelpersUtil-BfwO5f4J.js +141 -0
  6. package/dist/HelpersUtil-BfwO5f4J.js.map +1 -0
  7. package/dist/NavigationUtil-Ci15WS4K.js +9 -0
  8. package/dist/NavigationUtil-Ci15WS4K.js.map +1 -0
  9. package/dist/PhArrowCircleDown-B41iUlWV.js +74 -0
  10. package/dist/PhArrowCircleDown-B41iUlWV.js.map +1 -0
  11. package/dist/PhArrowClockwise-BY8u5n41.js +74 -0
  12. package/dist/PhArrowClockwise-BY8u5n41.js.map +1 -0
  13. package/dist/PhArrowDown-ClD8GZ65.js +74 -0
  14. package/dist/PhArrowDown-ClD8GZ65.js.map +1 -0
  15. package/dist/PhArrowLeft-B8MXUz60.js +74 -0
  16. package/dist/PhArrowLeft-B8MXUz60.js.map +1 -0
  17. package/dist/PhArrowRight-Cewa_Slb.js +74 -0
  18. package/dist/PhArrowRight-Cewa_Slb.js.map +1 -0
  19. package/dist/PhArrowSquareOut-whgWh-lD.js +74 -0
  20. package/dist/PhArrowSquareOut-whgWh-lD.js.map +1 -0
  21. package/dist/PhArrowUp-B1HXBxie.js +74 -0
  22. package/dist/PhArrowUp-B1HXBxie.js.map +1 -0
  23. package/dist/PhArrowUpRight-CfFYe4FP.js +74 -0
  24. package/dist/PhArrowUpRight-CfFYe4FP.js.map +1 -0
  25. package/dist/PhArrowsClockwise-gL1Gkrtx.js +74 -0
  26. package/dist/PhArrowsClockwise-gL1Gkrtx.js.map +1 -0
  27. package/dist/PhArrowsDownUp-BqUEdUQr.js +74 -0
  28. package/dist/PhArrowsDownUp-BqUEdUQr.js.map +1 -0
  29. package/dist/PhArrowsLeftRight-BlZU63eY.js +74 -0
  30. package/dist/PhArrowsLeftRight-BlZU63eY.js.map +1 -0
  31. package/dist/PhBank-gbg_jlI7.js +74 -0
  32. package/dist/PhBank-gbg_jlI7.js.map +1 -0
  33. package/dist/PhBrowser-CMlD-YJw.js +74 -0
  34. package/dist/PhBrowser-CMlD-YJw.js.map +1 -0
  35. package/dist/PhCaretDown-3agTO8Jp.js +74 -0
  36. package/dist/PhCaretDown-3agTO8Jp.js.map +1 -0
  37. package/dist/PhCaretLeft-_MTni7Z5.js +74 -0
  38. package/dist/PhCaretLeft-_MTni7Z5.js.map +1 -0
  39. package/dist/PhCaretRight-Ci9fAHPG.js +74 -0
  40. package/dist/PhCaretRight-Ci9fAHPG.js.map +1 -0
  41. package/dist/PhCaretUp-vFG4Fame.js +74 -0
  42. package/dist/PhCaretUp-vFG4Fame.js.map +1 -0
  43. package/dist/PhCheck-mChGK6K_.js +74 -0
  44. package/dist/PhCheck-mChGK6K_.js.map +1 -0
  45. package/dist/PhCircleHalf-DZ7-vfxf.js +74 -0
  46. package/dist/PhCircleHalf-DZ7-vfxf.js.map +1 -0
  47. package/dist/PhClock-Bc5XWXb6.js +74 -0
  48. package/dist/PhClock-Bc5XWXb6.js.map +1 -0
  49. package/dist/PhCompass-Cu2MB-55.js +74 -0
  50. package/dist/PhCompass-Cu2MB-55.js.map +1 -0
  51. package/dist/PhCopy-BGUjyTts.js +74 -0
  52. package/dist/PhCopy-BGUjyTts.js.map +1 -0
  53. package/dist/PhCreditCard-vxFWID4B.js +74 -0
  54. package/dist/PhCreditCard-vxFWID4B.js.map +1 -0
  55. package/dist/PhCurrencyDollar-BfOoDhJr.js +74 -0
  56. package/dist/PhCurrencyDollar-BfOoDhJr.js.map +1 -0
  57. package/dist/PhDesktop-Cq6jwzbS.js +74 -0
  58. package/dist/PhDesktop-Cq6jwzbS.js.map +1 -0
  59. package/dist/PhDeviceMobile-BCtTp6jj.js +74 -0
  60. package/dist/PhDeviceMobile-BCtTp6jj.js.map +1 -0
  61. package/dist/PhDotsThree-BGgD-WIO.js +74 -0
  62. package/dist/PhDotsThree-BGgD-WIO.js.map +1 -0
  63. package/dist/PhEnvelope-CQiV0-zG.js +74 -0
  64. package/dist/PhEnvelope-CQiV0-zG.js.map +1 -0
  65. package/dist/PhFunnelSimple-BHGtxTNf.js +74 -0
  66. package/dist/PhFunnelSimple-BHGtxTNf.js.map +1 -0
  67. package/dist/PhGlobe-Q8oVkf6X.js +74 -0
  68. package/dist/PhGlobe-Q8oVkf6X.js.map +1 -0
  69. package/dist/PhIdentificationCard-Cz9LzvVR.js +74 -0
  70. package/dist/PhIdentificationCard-Cz9LzvVR.js.map +1 -0
  71. package/dist/PhImage-CP5_qKk-.js +74 -0
  72. package/dist/PhImage-CP5_qKk-.js.map +1 -0
  73. package/dist/PhInfo-CTlE1X9Z.js +74 -0
  74. package/dist/PhInfo-CTlE1X9Z.js.map +1 -0
  75. package/dist/PhLightbulb-CcLpnAAb.js +74 -0
  76. package/dist/PhLightbulb-CcLpnAAb.js.map +1 -0
  77. package/dist/PhMagnifyingGlass-n58GUAck.js +74 -0
  78. package/dist/PhMagnifyingGlass-n58GUAck.js.map +1 -0
  79. package/dist/PhPaperPlaneRight-C0sf2XV8.js +74 -0
  80. package/dist/PhPaperPlaneRight-C0sf2XV8.js.map +1 -0
  81. package/dist/PhPlus-BJxvt7Uc.js +74 -0
  82. package/dist/PhPlus-BJxvt7Uc.js.map +1 -0
  83. package/dist/PhPower-BvktxO2-.js +74 -0
  84. package/dist/PhPower-BvktxO2-.js.map +1 -0
  85. package/dist/PhPuzzlePiece-CDDyUPYo.js +74 -0
  86. package/dist/PhPuzzlePiece-CDDyUPYo.js.map +1 -0
  87. package/dist/PhQrCode-BlGI8529.js +74 -0
  88. package/dist/PhQrCode-BlGI8529.js.map +1 -0
  89. package/dist/PhQuestion-DGZj6iDZ.js +74 -0
  90. package/dist/PhQuestion-DGZj6iDZ.js.map +1 -0
  91. package/dist/PhQuestionMark-CTmeI7MQ.js +74 -0
  92. package/dist/PhQuestionMark-CTmeI7MQ.js.map +1 -0
  93. package/dist/PhSealCheck-BSlqkxnH.js +74 -0
  94. package/dist/PhSealCheck-BSlqkxnH.js.map +1 -0
  95. package/dist/PhSignOut-CEXxlRk3.js +74 -0
  96. package/dist/PhSignOut-CEXxlRk3.js.map +1 -0
  97. package/dist/PhSpinner-Do1pY8fG.js +74 -0
  98. package/dist/PhSpinner-Do1pY8fG.js.map +1 -0
  99. package/dist/PhTrash-JNKavmpg.js +74 -0
  100. package/dist/PhTrash-JNKavmpg.js.map +1 -0
  101. package/dist/PhUser-BW7E-xYg.js +74 -0
  102. package/dist/PhUser-BW7E-xYg.js.map +1 -0
  103. package/dist/PhVault-mzxUgBYN.js +74 -0
  104. package/dist/PhVault-mzxUgBYN.js.map +1 -0
  105. package/dist/PhWallet-BR9JThKU.js +74 -0
  106. package/dist/PhWallet-BR9JThKU.js.map +1 -0
  107. package/dist/PhWarning-DxuQ70WM.js +74 -0
  108. package/dist/PhWarning-DxuQ70WM.js.map +1 -0
  109. package/dist/PhWarningCircle-DCI0JC1F.js +74 -0
  110. package/dist/PhWarningCircle-DCI0JC1F.js.map +1 -0
  111. package/dist/PhX-CWNXqpGn.js +74 -0
  112. package/dist/PhX-CWNXqpGn.js.map +1 -0
  113. package/dist/SwapController-B9-o3mQi.js +684 -0
  114. package/dist/SwapController-B9-o3mQi.js.map +1 -0
  115. package/dist/WebCryptoP256-C3tULCeM.js +3306 -0
  116. package/dist/WebCryptoP256-C3tULCeM.js.map +1 -0
  117. package/dist/add-D30MIcu9.js +20 -0
  118. package/dist/add-D30MIcu9.js.map +1 -0
  119. package/dist/all-wallets-C80If_mR.js +11 -0
  120. package/dist/all-wallets-C80If_mR.js.map +1 -0
  121. package/dist/app-store-BmykKf9Z.js +22 -0
  122. package/dist/app-store-BmykKf9Z.js.map +1 -0
  123. package/dist/appkit-8yrMZRW-.js +122304 -0
  124. package/dist/appkit-8yrMZRW-.js.map +1 -0
  125. package/dist/appkit.js +11 -0
  126. package/dist/appkit.js.map +1 -0
  127. package/dist/apple-Dj3k73U9.js +23 -0
  128. package/dist/apple-Dj3k73U9.js.map +1 -0
  129. package/dist/arrow-bottom-circle-BChVBNAj.js +16 -0
  130. package/dist/arrow-bottom-circle-BChVBNAj.js.map +1 -0
  131. package/dist/arrow-bottom-yR02zZ81.js +13 -0
  132. package/dist/arrow-bottom-yR02zZ81.js.map +1 -0
  133. package/dist/arrow-left-Cee83VTx.js +13 -0
  134. package/dist/arrow-left-Cee83VTx.js.map +1 -0
  135. package/dist/arrow-right-DQ18mteW.js +13 -0
  136. package/dist/arrow-right-DQ18mteW.js.map +1 -0
  137. package/dist/arrow-top-B6s5gNau.js +13 -0
  138. package/dist/arrow-top-B6s5gNau.js.map +1 -0
  139. package/dist/async-directive-CMZZt7_p.js +73 -0
  140. package/dist/async-directive-CMZZt7_p.js.map +1 -0
  141. package/dist/bank-CbtVBu5E.js +19 -0
  142. package/dist/bank-CbtVBu5E.js.map +1 -0
  143. package/dist/basic-DgeOYTPN.js +4914 -0
  144. package/dist/basic-DgeOYTPN.js.map +1 -0
  145. package/dist/browser-5XoTmr4n.js +1991 -0
  146. package/dist/browser-5XoTmr4n.js.map +1 -0
  147. package/dist/browser-DKlNidhn.js +19 -0
  148. package/dist/browser-DKlNidhn.js.map +1 -0
  149. package/dist/card-SMLX2mqy.js +19 -0
  150. package/dist/card-SMLX2mqy.js.map +1 -0
  151. package/dist/ccip-CelHgeHp.js +164 -0
  152. package/dist/ccip-CelHgeHp.js.map +1 -0
  153. package/dist/checkmark-BFaipJhW.js +16 -0
  154. package/dist/checkmark-BFaipJhW.js.map +1 -0
  155. package/dist/checkmark-bold-Bo-g2gCt.js +13 -0
  156. package/dist/checkmark-bold-Bo-g2gCt.js.map +1 -0
  157. package/dist/chevron-bottom-CLdpL1_U.js +13 -0
  158. package/dist/chevron-bottom-CLdpL1_U.js.map +1 -0
  159. package/dist/chevron-left-BMatzLVm.js +13 -0
  160. package/dist/chevron-left-BMatzLVm.js.map +1 -0
  161. package/dist/chevron-right-2QBn-njW.js +13 -0
  162. package/dist/chevron-right-2QBn-njW.js.map +1 -0
  163. package/dist/chevron-top-3JfkBBnK.js +13 -0
  164. package/dist/chevron-top-3JfkBBnK.js.map +1 -0
  165. package/dist/chrome-store-zmrzd-ux.js +66 -0
  166. package/dist/chrome-store-zmrzd-ux.js.map +1 -0
  167. package/dist/class-map-k3nlzPqR.js +101 -0
  168. package/dist/class-map-k3nlzPqR.js.map +1 -0
  169. package/dist/clock-CwBvHRGi.js +13 -0
  170. package/dist/clock-CwBvHRGi.js.map +1 -0
  171. package/dist/close-DGwKhnz2.js +13 -0
  172. package/dist/close-DGwKhnz2.js.map +1 -0
  173. package/dist/clsx.m-D57qXwfE.js +21 -0
  174. package/dist/clsx.m-D57qXwfE.js.map +1 -0
  175. package/dist/coinPlaceholder-Bjl3yxih.js +13 -0
  176. package/dist/coinPlaceholder-Bjl3yxih.js.map +1 -0
  177. package/dist/compass-Ci53Xt_m.js +13 -0
  178. package/dist/compass-Ci53Xt_m.js.map +1 -0
  179. package/dist/copy-DEV1V6UY.js +20 -0
  180. package/dist/copy-DEV1V6UY.js.map +1 -0
  181. package/dist/core-C57n14fz.js +16288 -0
  182. package/dist/core-C57n14fz.js.map +1 -0
  183. package/dist/cursor-aZqnhG2b.js +8 -0
  184. package/dist/cursor-aZqnhG2b.js.map +1 -0
  185. package/dist/cursor-transparent-B1JSDQ4k.js +17 -0
  186. package/dist/cursor-transparent-B1JSDQ4k.js.map +1 -0
  187. package/dist/data-capture-4tu-_Un-.js +549 -0
  188. package/dist/data-capture-4tu-_Un-.js.map +1 -0
  189. package/dist/desktop-CYHnO2jB.js +14 -0
  190. package/dist/desktop-CYHnO2jB.js.map +1 -0
  191. package/dist/disconnect-Bort8PHj.js +13 -0
  192. package/dist/disconnect-Bort8PHj.js.map +1 -0
  193. package/dist/discord-DC76-391.js +22 -0
  194. package/dist/discord-DC76-391.js.map +1 -0
  195. package/dist/email-CetCpugE.js +421 -0
  196. package/dist/email-CetCpugE.js.map +1 -0
  197. package/dist/embedded-wallet-DGmopvFw.js +952 -0
  198. package/dist/embedded-wallet-DGmopvFw.js.map +1 -0
  199. package/dist/etherscan-CM1VXVi8.js +11 -0
  200. package/dist/etherscan-CM1VXVi8.js.map +1 -0
  201. package/dist/exclamation-triangle-C2EQS3zg.js +9 -0
  202. package/dist/exclamation-triangle-C2EQS3zg.js.map +1 -0
  203. package/dist/extension-CrQTWCzR.js +13 -0
  204. package/dist/extension-CrQTWCzR.js.map +1 -0
  205. package/dist/external-link-C-HaFB9S.js +13 -0
  206. package/dist/external-link-C-HaFB9S.js.map +1 -0
  207. package/dist/facebook-vNJNGTyY.js +31 -0
  208. package/dist/facebook-vNJNGTyY.js.map +1 -0
  209. package/dist/farcaster-BojA8Y3Q.js +17 -0
  210. package/dist/farcaster-BojA8Y3Q.js.map +1 -0
  211. package/dist/features-BqXSc1qT.js +319 -0
  212. package/dist/features-BqXSc1qT.js.map +1 -0
  213. package/dist/filters-CPcSdM3I.js +13 -0
  214. package/dist/filters-CPcSdM3I.js.map +1 -0
  215. package/dist/github-lRHD4KBY.js +23 -0
  216. package/dist/github-lRHD4KBY.js.map +1 -0
  217. package/dist/google-CxxvUUsR.js +23 -0
  218. package/dist/google-CxxvUUsR.js.map +1 -0
  219. package/dist/hashTypedData-CGPAwUvI.js +259 -0
  220. package/dist/hashTypedData-CGPAwUvI.js.map +1 -0
  221. package/dist/help-circle-YHj9O9n4.js +17 -0
  222. package/dist/help-circle-YHj9O9n4.js.map +1 -0
  223. package/dist/id-BbzMFdj1.js +17 -0
  224. package/dist/id-BbzMFdj1.js.map +1 -0
  225. package/dist/if-defined-G2Q1ofvJ.js +11 -0
  226. package/dist/if-defined-G2Q1ofvJ.js.map +1 -0
  227. package/dist/image-BXTuNWmr.js +9 -0
  228. package/dist/image-BXTuNWmr.js.map +1 -0
  229. package/dist/index-21QOMdJE.js +984 -0
  230. package/dist/index-21QOMdJE.js.map +1 -0
  231. package/dist/index-51p9LM0s.js +218 -0
  232. package/dist/index-51p9LM0s.js.map +1 -0
  233. package/dist/index-ALlvRvBi.js +3987 -0
  234. package/dist/index-ALlvRvBi.js.map +1 -0
  235. package/dist/index-B6tCHS_j.js +120 -0
  236. package/dist/index-B6tCHS_j.js.map +1 -0
  237. package/dist/index-B9IUGIqh.js +211 -0
  238. package/dist/index-B9IUGIqh.js.map +1 -0
  239. package/dist/index-BFKYwgq3.js +7488 -0
  240. package/dist/index-BFKYwgq3.js.map +1 -0
  241. package/dist/index-BPB7fVHQ.js +281 -0
  242. package/dist/index-BPB7fVHQ.js.map +1 -0
  243. package/dist/index-BdRMG5oJ.js +126 -0
  244. package/dist/index-BdRMG5oJ.js.map +1 -0
  245. package/dist/index-Bowi-aBJ.js +147 -0
  246. package/dist/index-Bowi-aBJ.js.map +1 -0
  247. package/dist/index-BpOoitMw.js +131 -0
  248. package/dist/index-BpOoitMw.js.map +1 -0
  249. package/dist/index-BqCjN5Bk.js +124 -0
  250. package/dist/index-BqCjN5Bk.js.map +1 -0
  251. package/dist/index-Bv2Jkp0T.js +967 -0
  252. package/dist/index-Bv2Jkp0T.js.map +1 -0
  253. package/dist/index-C2tJFA0B.js +1372 -0
  254. package/dist/index-C2tJFA0B.js.map +1 -0
  255. package/dist/index-C3h1bsiv.js +109 -0
  256. package/dist/index-C3h1bsiv.js.map +1 -0
  257. package/dist/index-CFC2NxJ5.js +180 -0
  258. package/dist/index-CFC2NxJ5.js.map +1 -0
  259. package/dist/index-CG2tDcOE.js +182 -0
  260. package/dist/index-CG2tDcOE.js.map +1 -0
  261. package/dist/index-CM8qnUNO.js +181 -0
  262. package/dist/index-CM8qnUNO.js.map +1 -0
  263. package/dist/index-CNivx0yI.js +1178 -0
  264. package/dist/index-CNivx0yI.js.map +1 -0
  265. package/dist/index-CStkjfQQ.js +521 -0
  266. package/dist/index-CStkjfQQ.js.map +1 -0
  267. package/dist/index-CV3sK6gH.js +7258 -0
  268. package/dist/index-CV3sK6gH.js.map +1 -0
  269. package/dist/index-CZkzO2fh.js +70 -0
  270. package/dist/index-CZkzO2fh.js.map +1 -0
  271. package/dist/index-Ce3DzdHE.js +520 -0
  272. package/dist/index-Ce3DzdHE.js.map +1 -0
  273. package/dist/index-CgVqanW1.js +611 -0
  274. package/dist/index-CgVqanW1.js.map +1 -0
  275. package/dist/index-Ci6Y519l.js +249 -0
  276. package/dist/index-Ci6Y519l.js.map +1 -0
  277. package/dist/index-CnpO-uMV.js +62 -0
  278. package/dist/index-CnpO-uMV.js.map +1 -0
  279. package/dist/index-Cs_Ue1li.js +9530 -0
  280. package/dist/index-Cs_Ue1li.js.map +1 -0
  281. package/dist/index-CzIN86Z6.js +52 -0
  282. package/dist/index-CzIN86Z6.js.map +1 -0
  283. package/dist/index-DGrOD_Uk.js +136 -0
  284. package/dist/index-DGrOD_Uk.js.map +1 -0
  285. package/dist/index-DQgrdARk.js +198 -0
  286. package/dist/index-DQgrdARk.js.map +1 -0
  287. package/dist/index-DUrjw7B_.js +92 -0
  288. package/dist/index-DUrjw7B_.js.map +1 -0
  289. package/dist/index-DYvUtH2H.js +198 -0
  290. package/dist/index-DYvUtH2H.js.map +1 -0
  291. package/dist/index-DjlKuTuO.js +1582 -0
  292. package/dist/index-DjlKuTuO.js.map +1 -0
  293. package/dist/index-DrdtZOyM.js +286 -0
  294. package/dist/index-DrdtZOyM.js.map +1 -0
  295. package/dist/index-Dt1IUAIj.js +716 -0
  296. package/dist/index-Dt1IUAIj.js.map +1 -0
  297. package/dist/index-DvmMzzVa.js +18322 -0
  298. package/dist/index-DvmMzzVa.js.map +1 -0
  299. package/dist/index-DzZOIbsR.js +147 -0
  300. package/dist/index-DzZOIbsR.js.map +1 -0
  301. package/dist/index-ENsIYRhz.js +542 -0
  302. package/dist/index-ENsIYRhz.js.map +1 -0
  303. package/dist/index-QqIUi-wY.js +2402 -0
  304. package/dist/index-QqIUi-wY.js.map +1 -0
  305. package/dist/index-SlVjFZvp.js +110 -0
  306. package/dist/index-SlVjFZvp.js.map +1 -0
  307. package/dist/index-VKogKIsA.js +985 -0
  308. package/dist/index-VKogKIsA.js.map +1 -0
  309. package/dist/index-bd39Gizk.js +153 -0
  310. package/dist/index-bd39Gizk.js.map +1 -0
  311. package/dist/index-ciqjpb4e.js +73 -0
  312. package/dist/index-ciqjpb4e.js.map +1 -0
  313. package/dist/index-d4z00ajR.js +456 -0
  314. package/dist/index-d4z00ajR.js.map +1 -0
  315. package/dist/index-dTaiyIFQ.js +257 -0
  316. package/dist/index-dTaiyIFQ.js.map +1 -0
  317. package/dist/index-nkefGcqB.js +9350 -0
  318. package/dist/index-nkefGcqB.js.map +1 -0
  319. package/dist/index-pg-zQJY9.js +441 -0
  320. package/dist/index-pg-zQJY9.js.map +1 -0
  321. package/dist/index.es-Dpl-2r0L.js +8503 -0
  322. package/dist/index.es-Dpl-2r0L.js.map +1 -0
  323. package/dist/info-BhGLu7a7.js +8 -0
  324. package/dist/info-BhGLu7a7.js.map +1 -0
  325. package/dist/info-circle-qS-gYigf.js +17 -0
  326. package/dist/info-circle-qS-gYigf.js.map +1 -0
  327. package/dist/jsxRuntime.module-Bj81_EKI.js +14 -0
  328. package/dist/jsxRuntime.module-Bj81_EKI.js.map +1 -0
  329. package/dist/lightbulb-CkRo4E3y.js +8 -0
  330. package/dist/lightbulb-CkRo4E3y.js.map +1 -0
  331. package/dist/localBatchGatewayRequest-BP_oqSkW.js +103 -0
  332. package/dist/localBatchGatewayRequest-BP_oqSkW.js.map +1 -0
  333. package/dist/mail-DPd51pyO.js +13 -0
  334. package/dist/mail-DPd51pyO.js.map +1 -0
  335. package/dist/metamask-sdk-yihv7E6u.js +16699 -0
  336. package/dist/metamask-sdk-yihv7E6u.js.map +1 -0
  337. package/dist/mobile-CRO9ITfa.js +14 -0
  338. package/dist/mobile-CRO9ITfa.js.map +1 -0
  339. package/dist/more-DyaHLM9d.js +16 -0
  340. package/dist/more-DyaHLM9d.js.map +1 -0
  341. package/dist/native-CMPA4OCm.js +17 -0
  342. package/dist/native-CMPA4OCm.js.map +1 -0
  343. package/dist/network-placeholder-DGSqV09i.js +19 -0
  344. package/dist/network-placeholder-DGSqV09i.js.map +1 -0
  345. package/dist/nftPlaceholder-CLGGLw6g.js +13 -0
  346. package/dist/nftPlaceholder-CLGGLw6g.js.map +1 -0
  347. package/dist/off-CDy-1GjF.js +13 -0
  348. package/dist/off-CDy-1GjF.js.map +1 -0
  349. package/dist/onramp-pjFNY0fj.js +979 -0
  350. package/dist/onramp-pjFNY0fj.js.map +1 -0
  351. package/dist/parseSignature-CV_ULbSZ.js +2828 -0
  352. package/dist/parseSignature-CV_ULbSZ.js.map +1 -0
  353. package/dist/pay-with-exchange-Cz8dXxOa.js +603 -0
  354. package/dist/pay-with-exchange-Cz8dXxOa.js.map +1 -0
  355. package/dist/play-store-CdQ0GJhU.js +37 -0
  356. package/dist/play-store-CdQ0GJhU.js.map +1 -0
  357. package/dist/plus-DD_oKDcI.js +18 -0
  358. package/dist/plus-DD_oKDcI.js.map +1 -0
  359. package/dist/property-8UcTqffH.js +623 -0
  360. package/dist/property-8UcTqffH.js.map +1 -0
  361. package/dist/qr-code-BJLuAwDg.js +11 -0
  362. package/dist/qr-code-BJLuAwDg.js.map +1 -0
  363. package/dist/receive-Brpo8_fV.js +262 -0
  364. package/dist/receive-Brpo8_fV.js.map +1 -0
  365. package/dist/recycle-horizontal-DMqA4Y6p.js +14 -0
  366. package/dist/recycle-horizontal-DMqA4Y6p.js.map +1 -0
  367. package/dist/ref-6sYmD-zI.js +43 -0
  368. package/dist/ref-6sYmD-zI.js.map +1 -0
  369. package/dist/refresh-SYbxLwZK.js +13 -0
  370. package/dist/refresh-SYbxLwZK.js.map +1 -0
  371. package/dist/reown-logo-FMoXntuJ.js +17 -0
  372. package/dist/reown-logo-FMoXntuJ.js.map +1 -0
  373. package/dist/search-DyRiO0T8.js +13 -0
  374. package/dist/search-DyRiO0T8.js.map +1 -0
  375. package/dist/secp256k1-DCQG8fZg.js +2031 -0
  376. package/dist/secp256k1-DCQG8fZg.js.map +1 -0
  377. package/dist/send-AaCUn2jw.js +20 -0
  378. package/dist/send-AaCUn2jw.js.map +1 -0
  379. package/dist/send-cysMDEC9.js +1365 -0
  380. package/dist/send-cysMDEC9.js.map +1 -0
  381. package/dist/socials-BU9YyLx1.js +796 -0
  382. package/dist/socials-BU9YyLx1.js.map +1 -0
  383. package/dist/swapHorizontal-kHwa5wbg.js +13 -0
  384. package/dist/swapHorizontal-kHwa5wbg.js.map +1 -0
  385. package/dist/swapHorizontalBold-Bf_Sy4KD.js +13 -0
  386. package/dist/swapHorizontalBold-Bf_Sy4KD.js.map +1 -0
  387. package/dist/swapHorizontalMedium-C4oU0KJg.js +21 -0
  388. package/dist/swapHorizontalMedium-C4oU0KJg.js.map +1 -0
  389. package/dist/swapHorizontalRoundedBold-IJ8G94V0.js +13 -0
  390. package/dist/swapHorizontalRoundedBold-IJ8G94V0.js.map +1 -0
  391. package/dist/swapVertical-CuDVDBMJ.js +13 -0
  392. package/dist/swapVertical-CuDVDBMJ.js.map +1 -0
  393. package/dist/swaps-TcZwQiir.js +2121 -0
  394. package/dist/swaps-TcZwQiir.js.map +1 -0
  395. package/dist/telegram-DSi6IsaA.js +21 -0
  396. package/dist/telegram-DSi6IsaA.js.map +1 -0
  397. package/dist/three-dots-CqgQBZQ6.js +10 -0
  398. package/dist/three-dots-CqgQBZQ6.js.map +1 -0
  399. package/dist/transactions-CcagUdpJ.js +38 -0
  400. package/dist/transactions-CcagUdpJ.js.map +1 -0
  401. package/dist/twitch-DrUmltT6.js +23 -0
  402. package/dist/twitch-DrUmltT6.js.map +1 -0
  403. package/dist/twitterIcon-eNCEY2nh.js +11 -0
  404. package/dist/twitterIcon-eNCEY2nh.js.map +1 -0
  405. package/dist/vanilla-CgG5xMJO.js +448 -0
  406. package/dist/vanilla-CgG5xMJO.js.map +1 -0
  407. package/dist/verify-DGCdp1PG.js +13 -0
  408. package/dist/verify-DGCdp1PG.js.map +1 -0
  409. package/dist/verify-filled-BN5Rdq_X.js +13 -0
  410. package/dist/verify-filled-BN5Rdq_X.js.map +1 -0
  411. package/dist/w3m-modal-C23tcwd0.js +2008 -0
  412. package/dist/w3m-modal-C23tcwd0.js.map +1 -0
  413. package/dist/w3m-modal-D_WKuA4j.js +1725 -0
  414. package/dist/w3m-modal-D_WKuA4j.js.map +1 -0
  415. package/dist/wallet-Dh8w0rox.js +13 -0
  416. package/dist/wallet-Dh8w0rox.js.map +1 -0
  417. package/dist/wallet-placeholder-gjfCYn59.js +19 -0
  418. package/dist/wallet-placeholder-gjfCYn59.js.map +1 -0
  419. package/dist/wallet-standard-CWX-EDlP.js +523 -0
  420. package/dist/wallet-standard-CWX-EDlP.js.map +1 -0
  421. package/dist/walletconnect-BI4tTckl.js +39 -0
  422. package/dist/walletconnect-BI4tTckl.js.map +1 -0
  423. package/dist/warning-circle-jCqjcA2f.js +17 -0
  424. package/dist/warning-circle-jCqjcA2f.js.map +1 -0
  425. package/dist/x-BfcQ5n6S.js +17 -0
  426. package/dist/x-BfcQ5n6S.js.map +1 -0
  427. package/package.json +10 -10
@@ -0,0 +1,2828 @@
1
+ import { cD as parseSignature$1, cE as parseStructs, cF as isStructSignature, cG as InvalidAbiItemError, T as BaseError, ae as getAbiItem, cH as AbiEventNotFoundError, ab as formatAbiItem, cI as toEventSelector, aF as keccak256, cJ as toBytes, a0 as encodeAbiParameters, cK as createFilterRequestScope, K as numberToHex, b4 as encodeFunctionData, cL as getAction, cM as estimateGas, cN as parseAccount, cO as getContractError, cP as formatLog, cQ as parseEventLogs, _ as call, cR as decodeFunctionResult, X as stringify, cS as observe, cT as poll, cU as getFilterChanges, cV as getBlockNumber, cW as InvalidInputRpcError, cX as uninstallFilter, cY as decodeEventLog, cZ as DecodeLogDataMismatch, c_ as DecodeLogTopicsMismatch, $ as concat, c$ as UnsupportedNonOptionalCapabilityError, d0 as AtomicityNotSupportedError, d1 as sendTransaction, d2 as hexToBigInt, d3 as getTransactionError, d4 as hexToNumber, d5 as receiptStatuses, d6 as trim, d7 as sliceHex, d8 as withResolvers, d9 as withRetry, da as ContractFunctionRevertedError, a2 as isHex, aD as bytesToHex, db as stringToBytes, dc as getChainContractAddress, dd as addressResolverAbi, aL as toHex, de as universalResolverResolveAbi, df as readContract, dg as textResolverAbi, dh as universalResolverReverseAbi, di as assertRequest, dj as formatTransactionRequest, dk as extract, dl as getCallError, dm as AbiEncodingLengthMismatchError, ah as concatHex, aH as isAddress, aI as InvalidAddressError, dn as pad, aC as stringToHex, dp as boolToHex, aG as integerRegex, aJ as bytesRegex, aK as BytesSizeMismatchError, dq as arrayRegex, dr as UnsupportedPackedAbiType, ds as LruMap, dt as getTransactionCount, L as withTimeout, du as TimeoutError, a1 as HttpRequestError, dv as hexToBytes, dw as getTransaction, dx as toRpc, dy as serializeStateOverride, dz as formatBlock, dA as AbiDecodingZeroDataError, dB as RawContractError, dC as getNodeError, dD as UnknownNodeError, dE as validate, dF as BaseError$1, dG as validate$1, dH as slice, dI as keccak256$1, dJ as fromString, dK as formatAbiItem$1, dL as concat$1, dM as encode$2, dN as deploylessCallViaBytecodeBytecode, dO as verifyHash, dP as getBlock, Z as isAddressEqual, dQ as formatTransactionReceipt, dR as TransactionReceiptRevertedError, dS as watchPendingTransactions, dT as watchBlockNumber, dU as waitForTransactionReceipt, dV as sendRawTransaction, dW as prepareTransactionRequest, dX as multicall, dY as getTransactionReceipt, dZ as fillTransaction, d_ as estimateMaxPriorityFeePerGas, d$ as getGasPrice, e0 as estimateFeesPerGas, e1 as getCode, e2 as getChainId, e3 as getBalance, e4 as createPendingTransactionFilter, e5 as createClient, e6 as AccountNotFoundError, e7 as createTransport, e8 as createBatchScheduler, e9 as RpcRequestError, ea as secp256k1 } from "./appkit-8yrMZRW-.js";
2
+ import { l as localBatchGatewayUrl } from "./localBatchGatewayRequest-BP_oqSkW.js";
3
+ import { h as hashMessage, a as hashTypedData } from "./hashTypedData-CGPAwUvI.js";
4
+ function parseAbiItem(signature) {
5
+ let abiItem;
6
+ if (typeof signature === "string")
7
+ abiItem = parseSignature$1(signature);
8
+ else {
9
+ const structs = parseStructs(signature);
10
+ const length = signature.length;
11
+ for (let i = 0; i < length; i++) {
12
+ const signature_ = signature[i];
13
+ if (isStructSignature(signature_))
14
+ continue;
15
+ abiItem = parseSignature$1(signature_, structs);
16
+ break;
17
+ }
18
+ }
19
+ if (!abiItem)
20
+ throw new InvalidAbiItemError({ signature });
21
+ return abiItem;
22
+ }
23
+ class FilterTypeNotSupportedError extends BaseError {
24
+ constructor(type) {
25
+ super(`Filter type "${type}" is not supported.`, {
26
+ name: "FilterTypeNotSupportedError"
27
+ });
28
+ }
29
+ }
30
+ const docsPath = "/docs/contract/encodeEventTopics";
31
+ function encodeEventTopics(parameters) {
32
+ var _a;
33
+ const { abi: abi2, eventName, args } = parameters;
34
+ let abiItem = abi2[0];
35
+ if (eventName) {
36
+ const item = getAbiItem({ abi: abi2, name: eventName });
37
+ if (!item)
38
+ throw new AbiEventNotFoundError(eventName, { docsPath });
39
+ abiItem = item;
40
+ }
41
+ if (abiItem.type !== "event")
42
+ throw new AbiEventNotFoundError(void 0, { docsPath });
43
+ const definition = formatAbiItem(abiItem);
44
+ const signature = toEventSelector(definition);
45
+ let topics = [];
46
+ if (args && "inputs" in abiItem) {
47
+ const indexedInputs = (_a = abiItem.inputs) == null ? void 0 : _a.filter((param) => "indexed" in param && param.indexed);
48
+ const args_ = Array.isArray(args) ? args : Object.values(args).length > 0 ? (indexedInputs == null ? void 0 : indexedInputs.map((x) => args[x.name])) ?? [] : [];
49
+ if (args_.length > 0) {
50
+ topics = (indexedInputs == null ? void 0 : indexedInputs.map((param, i) => {
51
+ if (Array.isArray(args_[i]))
52
+ return args_[i].map((_, j) => encodeArg({ param, value: args_[i][j] }));
53
+ return typeof args_[i] !== "undefined" && args_[i] !== null ? encodeArg({ param, value: args_[i] }) : null;
54
+ })) ?? [];
55
+ }
56
+ }
57
+ return [signature, ...topics];
58
+ }
59
+ function encodeArg({ param, value }) {
60
+ if (param.type === "string" || param.type === "bytes")
61
+ return keccak256(toBytes(value));
62
+ if (param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
63
+ throw new FilterTypeNotSupportedError(param.type);
64
+ return encodeAbiParameters([param], [value]);
65
+ }
66
+ async function createContractEventFilter(client, parameters) {
67
+ const { address, abi: abi2, args, eventName, fromBlock, strict, toBlock } = parameters;
68
+ const getRequest = createFilterRequestScope(client, {
69
+ method: "eth_newFilter"
70
+ });
71
+ const topics = eventName ? encodeEventTopics({
72
+ abi: abi2,
73
+ args,
74
+ eventName
75
+ }) : void 0;
76
+ const id = await client.request({
77
+ method: "eth_newFilter",
78
+ params: [
79
+ {
80
+ address,
81
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
82
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
83
+ topics
84
+ }
85
+ ]
86
+ });
87
+ return {
88
+ abi: abi2,
89
+ args,
90
+ eventName,
91
+ id,
92
+ request: getRequest(id),
93
+ strict: Boolean(strict),
94
+ type: "event"
95
+ };
96
+ }
97
+ async function estimateContractGas(client, parameters) {
98
+ const { abi: abi2, address, args, functionName, dataSuffix, ...request } = parameters;
99
+ const data = encodeFunctionData({
100
+ abi: abi2,
101
+ args,
102
+ functionName
103
+ });
104
+ try {
105
+ const gas = await getAction(client, estimateGas, "estimateGas")({
106
+ data: `${data}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
107
+ to: address,
108
+ ...request
109
+ });
110
+ return gas;
111
+ } catch (error) {
112
+ const account = request.account ? parseAccount(request.account) : void 0;
113
+ throw getContractError(error, {
114
+ abi: abi2,
115
+ address,
116
+ args,
117
+ docsPath: "/docs/contract/estimateContractGas",
118
+ functionName,
119
+ sender: account == null ? void 0 : account.address
120
+ });
121
+ }
122
+ }
123
+ async function getLogs(client, { address, blockHash, fromBlock, toBlock, event, events: events_, args, strict: strict_ } = {}) {
124
+ const strict = strict_ ?? false;
125
+ const events = events_ ?? (event ? [event] : void 0);
126
+ let topics = [];
127
+ if (events) {
128
+ const encoded = events.flatMap((event2) => encodeEventTopics({
129
+ abi: [event2],
130
+ eventName: event2.name,
131
+ args: events_ ? void 0 : args
132
+ }));
133
+ topics = [encoded];
134
+ if (event)
135
+ topics = topics[0];
136
+ }
137
+ let logs;
138
+ if (blockHash) {
139
+ logs = await client.request({
140
+ method: "eth_getLogs",
141
+ params: [{ address, topics, blockHash }]
142
+ });
143
+ } else {
144
+ logs = await client.request({
145
+ method: "eth_getLogs",
146
+ params: [
147
+ {
148
+ address,
149
+ topics,
150
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
151
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock
152
+ }
153
+ ]
154
+ });
155
+ }
156
+ const formattedLogs = logs.map((log) => formatLog(log));
157
+ if (!events)
158
+ return formattedLogs;
159
+ return parseEventLogs({
160
+ abi: events,
161
+ args,
162
+ logs: formattedLogs,
163
+ strict
164
+ });
165
+ }
166
+ async function getContractEvents(client, parameters) {
167
+ const { abi: abi2, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
168
+ const event = eventName ? getAbiItem({ abi: abi2, name: eventName }) : void 0;
169
+ const events = !event ? abi2.filter((x) => x.type === "event") : void 0;
170
+ return getAction(client, getLogs, "getLogs")({
171
+ address,
172
+ args,
173
+ blockHash,
174
+ event,
175
+ events,
176
+ fromBlock,
177
+ toBlock,
178
+ strict
179
+ });
180
+ }
181
+ async function simulateContract(client, parameters) {
182
+ const { abi: abi2, address, args, dataSuffix, functionName, ...callRequest } = parameters;
183
+ const account = callRequest.account ? parseAccount(callRequest.account) : client.account;
184
+ const calldata = encodeFunctionData({ abi: abi2, args, functionName });
185
+ try {
186
+ const { data } = await getAction(client, call, "call")({
187
+ batch: false,
188
+ data: `${calldata}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
189
+ to: address,
190
+ ...callRequest,
191
+ account
192
+ });
193
+ const result = decodeFunctionResult({
194
+ abi: abi2,
195
+ args,
196
+ functionName,
197
+ data: data || "0x"
198
+ });
199
+ const minimizedAbi = abi2.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
200
+ return {
201
+ result,
202
+ request: {
203
+ abi: minimizedAbi,
204
+ address,
205
+ args,
206
+ dataSuffix,
207
+ functionName,
208
+ ...callRequest,
209
+ account
210
+ }
211
+ };
212
+ } catch (error) {
213
+ throw getContractError(error, {
214
+ abi: abi2,
215
+ address,
216
+ args,
217
+ docsPath: "/docs/contract/simulateContract",
218
+ functionName,
219
+ sender: account == null ? void 0 : account.address
220
+ });
221
+ }
222
+ }
223
+ function watchContractEvent(client, parameters) {
224
+ const { abi: abi2, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
225
+ const enablePolling = (() => {
226
+ if (typeof poll_ !== "undefined")
227
+ return poll_;
228
+ if (typeof fromBlock === "bigint")
229
+ return true;
230
+ if (client.transport.type === "webSocket" || client.transport.type === "ipc")
231
+ return false;
232
+ if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
233
+ return false;
234
+ return true;
235
+ })();
236
+ const pollContractEvent = () => {
237
+ const strict = strict_ ?? false;
238
+ const observerId = stringify([
239
+ "watchContractEvent",
240
+ address,
241
+ args,
242
+ batch,
243
+ client.uid,
244
+ eventName,
245
+ pollingInterval,
246
+ strict,
247
+ fromBlock
248
+ ]);
249
+ return observe(observerId, { onLogs, onError }, (emit) => {
250
+ let previousBlockNumber;
251
+ if (fromBlock !== void 0)
252
+ previousBlockNumber = fromBlock - 1n;
253
+ let filter;
254
+ let initialized = false;
255
+ const unwatch = poll(async () => {
256
+ var _a;
257
+ if (!initialized) {
258
+ try {
259
+ filter = await getAction(client, createContractEventFilter, "createContractEventFilter")({
260
+ abi: abi2,
261
+ address,
262
+ args,
263
+ eventName,
264
+ strict,
265
+ fromBlock
266
+ });
267
+ } catch {
268
+ }
269
+ initialized = true;
270
+ return;
271
+ }
272
+ try {
273
+ let logs;
274
+ if (filter) {
275
+ logs = await getAction(client, getFilterChanges, "getFilterChanges")({ filter });
276
+ } else {
277
+ const blockNumber = await getAction(client, getBlockNumber, "getBlockNumber")({});
278
+ if (previousBlockNumber && previousBlockNumber < blockNumber) {
279
+ logs = await getAction(client, getContractEvents, "getContractEvents")({
280
+ abi: abi2,
281
+ address,
282
+ args,
283
+ eventName,
284
+ fromBlock: previousBlockNumber + 1n,
285
+ toBlock: blockNumber,
286
+ strict
287
+ });
288
+ } else {
289
+ logs = [];
290
+ }
291
+ previousBlockNumber = blockNumber;
292
+ }
293
+ if (logs.length === 0)
294
+ return;
295
+ if (batch)
296
+ emit.onLogs(logs);
297
+ else
298
+ for (const log of logs)
299
+ emit.onLogs([log]);
300
+ } catch (err) {
301
+ if (filter && err instanceof InvalidInputRpcError)
302
+ initialized = false;
303
+ (_a = emit.onError) == null ? void 0 : _a.call(emit, err);
304
+ }
305
+ }, {
306
+ emitOnBegin: true,
307
+ interval: pollingInterval
308
+ });
309
+ return async () => {
310
+ if (filter)
311
+ await getAction(client, uninstallFilter, "uninstallFilter")({ filter });
312
+ unwatch();
313
+ };
314
+ });
315
+ };
316
+ const subscribeContractEvent = () => {
317
+ const strict = strict_ ?? false;
318
+ const observerId = stringify([
319
+ "watchContractEvent",
320
+ address,
321
+ args,
322
+ batch,
323
+ client.uid,
324
+ eventName,
325
+ pollingInterval,
326
+ strict
327
+ ]);
328
+ let active = true;
329
+ let unsubscribe = () => active = false;
330
+ return observe(observerId, { onLogs, onError }, (emit) => {
331
+ (async () => {
332
+ try {
333
+ const transport = (() => {
334
+ if (client.transport.type === "fallback") {
335
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
336
+ if (!transport2)
337
+ return client.transport;
338
+ return transport2.value;
339
+ }
340
+ return client.transport;
341
+ })();
342
+ const topics = eventName ? encodeEventTopics({
343
+ abi: abi2,
344
+ eventName,
345
+ args
346
+ }) : [];
347
+ const { unsubscribe: unsubscribe_ } = await transport.subscribe({
348
+ params: ["logs", { address, topics }],
349
+ onData(data) {
350
+ var _a;
351
+ if (!active)
352
+ return;
353
+ const log = data.result;
354
+ try {
355
+ const { eventName: eventName2, args: args2 } = decodeEventLog({
356
+ abi: abi2,
357
+ data: log.data,
358
+ topics: log.topics,
359
+ strict: strict_
360
+ });
361
+ const formatted = formatLog(log, {
362
+ args: args2,
363
+ eventName: eventName2
364
+ });
365
+ emit.onLogs([formatted]);
366
+ } catch (err) {
367
+ let eventName2;
368
+ let isUnnamed;
369
+ if (err instanceof DecodeLogDataMismatch || err instanceof DecodeLogTopicsMismatch) {
370
+ if (strict_)
371
+ return;
372
+ eventName2 = err.abiItem.name;
373
+ isUnnamed = (_a = err.abiItem.inputs) == null ? void 0 : _a.some((x) => !("name" in x && x.name));
374
+ }
375
+ const formatted = formatLog(log, {
376
+ args: isUnnamed ? [] : {},
377
+ eventName: eventName2
378
+ });
379
+ emit.onLogs([formatted]);
380
+ }
381
+ },
382
+ onError(error) {
383
+ var _a;
384
+ (_a = emit.onError) == null ? void 0 : _a.call(emit, error);
385
+ }
386
+ });
387
+ unsubscribe = unsubscribe_;
388
+ if (!active)
389
+ unsubscribe();
390
+ } catch (err) {
391
+ onError == null ? void 0 : onError(err);
392
+ }
393
+ })();
394
+ return () => unsubscribe();
395
+ });
396
+ };
397
+ return enablePolling ? pollContractEvent() : subscribeContractEvent();
398
+ }
399
+ class BundleFailedError extends BaseError {
400
+ constructor(result) {
401
+ super(`Call bundle failed with status: ${result.statusCode}`, {
402
+ name: "BundleFailedError"
403
+ });
404
+ Object.defineProperty(this, "result", {
405
+ enumerable: true,
406
+ configurable: true,
407
+ writable: true,
408
+ value: void 0
409
+ });
410
+ this.result = result;
411
+ }
412
+ }
413
+ const fallbackMagicIdentifier = "0x5792579257925792579257925792579257925792579257925792579257925792";
414
+ const fallbackTransactionErrorMagicIdentifier = numberToHex(0, {
415
+ size: 32
416
+ });
417
+ async function sendCalls(client, parameters) {
418
+ const { account: account_ = client.account, capabilities, chain = client.chain, experimental_fallback, experimental_fallbackDelay = 32, forceAtomic = false, id, version = "2.0.0" } = parameters;
419
+ const account = account_ ? parseAccount(account_) : null;
420
+ const calls = parameters.calls.map((call_) => {
421
+ const call2 = call_;
422
+ const data = call2.abi ? encodeFunctionData({
423
+ abi: call2.abi,
424
+ functionName: call2.functionName,
425
+ args: call2.args
426
+ }) : call2.data;
427
+ return {
428
+ data: call2.dataSuffix && data ? concat([data, call2.dataSuffix]) : data,
429
+ to: call2.to,
430
+ value: call2.value ? numberToHex(call2.value) : void 0
431
+ };
432
+ });
433
+ try {
434
+ const response = await client.request({
435
+ method: "wallet_sendCalls",
436
+ params: [
437
+ {
438
+ atomicRequired: forceAtomic,
439
+ calls,
440
+ capabilities,
441
+ chainId: numberToHex(chain.id),
442
+ from: account == null ? void 0 : account.address,
443
+ id,
444
+ version
445
+ }
446
+ ]
447
+ }, { retryCount: 0 });
448
+ if (typeof response === "string")
449
+ return { id: response };
450
+ return response;
451
+ } catch (err) {
452
+ const error = err;
453
+ if (experimental_fallback && (error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError" || error.name === "UnknownRpcError" || error.details.toLowerCase().includes("does not exist / is not available") || error.details.toLowerCase().includes("missing or invalid. request()") || error.details.toLowerCase().includes("did not match any variant of untagged enum") || error.details.toLowerCase().includes("account upgraded to unsupported contract") || error.details.toLowerCase().includes("eip-7702 not supported") || error.details.toLowerCase().includes("unsupported wc_ method") || // magic.link
454
+ error.details.toLowerCase().includes("feature toggled misconfigured") || // Trust Wallet
455
+ error.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))) {
456
+ if (capabilities) {
457
+ const hasNonOptionalCapability = Object.values(capabilities).some((capability) => !capability.optional);
458
+ if (hasNonOptionalCapability) {
459
+ const message = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
460
+ throw new UnsupportedNonOptionalCapabilityError(new BaseError(message, {
461
+ details: message
462
+ }));
463
+ }
464
+ }
465
+ if (forceAtomic && calls.length > 1) {
466
+ const message = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
467
+ throw new AtomicityNotSupportedError(new BaseError(message, {
468
+ details: message
469
+ }));
470
+ }
471
+ const promises = [];
472
+ for (const call2 of calls) {
473
+ const promise = sendTransaction(client, {
474
+ account,
475
+ chain,
476
+ data: call2.data,
477
+ to: call2.to,
478
+ value: call2.value ? hexToBigInt(call2.value) : void 0
479
+ });
480
+ promises.push(promise);
481
+ if (experimental_fallbackDelay > 0)
482
+ await new Promise((resolve) => setTimeout(resolve, experimental_fallbackDelay));
483
+ }
484
+ const results = await Promise.allSettled(promises);
485
+ if (results.every((r) => r.status === "rejected"))
486
+ throw results[0].reason;
487
+ const hashes = results.map((result) => {
488
+ if (result.status === "fulfilled")
489
+ return result.value;
490
+ return fallbackTransactionErrorMagicIdentifier;
491
+ });
492
+ return {
493
+ id: concat([
494
+ ...hashes,
495
+ numberToHex(chain.id, { size: 32 }),
496
+ fallbackMagicIdentifier
497
+ ])
498
+ };
499
+ }
500
+ throw getTransactionError(err, {
501
+ ...parameters,
502
+ account,
503
+ chain: parameters.chain
504
+ });
505
+ }
506
+ }
507
+ async function getCallsStatus(client, parameters) {
508
+ async function getStatus(id) {
509
+ const isTransactions = id.endsWith(fallbackMagicIdentifier.slice(2));
510
+ if (isTransactions) {
511
+ const chainId2 = trim(sliceHex(id, -64, -32));
512
+ const hashes = sliceHex(id, 0, -64).slice(2).match(/.{1,64}/g);
513
+ const receipts2 = await Promise.all(hashes.map((hash) => fallbackTransactionErrorMagicIdentifier.slice(2) !== hash ? client.request({
514
+ method: "eth_getTransactionReceipt",
515
+ params: [`0x${hash}`]
516
+ }, { dedupe: true }) : void 0));
517
+ const status2 = (() => {
518
+ if (receipts2.some((r) => r === null))
519
+ return 100;
520
+ if (receipts2.every((r) => (r == null ? void 0 : r.status) === "0x1"))
521
+ return 200;
522
+ if (receipts2.every((r) => (r == null ? void 0 : r.status) === "0x0"))
523
+ return 500;
524
+ return 600;
525
+ })();
526
+ return {
527
+ atomic: false,
528
+ chainId: hexToNumber(chainId2),
529
+ receipts: receipts2.filter(Boolean),
530
+ status: status2,
531
+ version: "2.0.0"
532
+ };
533
+ }
534
+ return client.request({
535
+ method: "wallet_getCallsStatus",
536
+ params: [id]
537
+ });
538
+ }
539
+ const { atomic = false, chainId, receipts, version = "2.0.0", ...response } = await getStatus(parameters.id);
540
+ const [status, statusCode] = (() => {
541
+ const statusCode2 = response.status;
542
+ if (statusCode2 >= 100 && statusCode2 < 200)
543
+ return ["pending", statusCode2];
544
+ if (statusCode2 >= 200 && statusCode2 < 300)
545
+ return ["success", statusCode2];
546
+ if (statusCode2 >= 300 && statusCode2 < 700)
547
+ return ["failure", statusCode2];
548
+ if (statusCode2 === "CONFIRMED")
549
+ return ["success", 200];
550
+ if (statusCode2 === "PENDING")
551
+ return ["pending", 100];
552
+ return [void 0, statusCode2];
553
+ })();
554
+ return {
555
+ ...response,
556
+ atomic,
557
+ // @ts-expect-error: for backwards compatibility
558
+ chainId: chainId ? hexToNumber(chainId) : void 0,
559
+ receipts: (receipts == null ? void 0 : receipts.map((receipt) => ({
560
+ ...receipt,
561
+ blockNumber: hexToBigInt(receipt.blockNumber),
562
+ gasUsed: hexToBigInt(receipt.gasUsed),
563
+ status: receiptStatuses[receipt.status]
564
+ }))) ?? [],
565
+ statusCode,
566
+ status,
567
+ version
568
+ };
569
+ }
570
+ async function waitForCallsStatus(client, parameters) {
571
+ const {
572
+ id,
573
+ pollingInterval = client.pollingInterval,
574
+ status = ({ statusCode }) => statusCode === 200 || statusCode >= 300,
575
+ retryCount = 4,
576
+ retryDelay = ({ count }) => ~~(1 << count) * 200,
577
+ // exponential backoff
578
+ timeout = 6e4,
579
+ throwOnFailure = false
580
+ } = parameters;
581
+ const observerId = stringify(["waitForCallsStatus", client.uid, id]);
582
+ const { promise, resolve, reject } = withResolvers();
583
+ let timer;
584
+ const unobserve = observe(observerId, { resolve, reject }, (emit) => {
585
+ const unpoll = poll(async () => {
586
+ const done = (fn) => {
587
+ clearTimeout(timer);
588
+ unpoll();
589
+ fn();
590
+ unobserve();
591
+ };
592
+ try {
593
+ const result = await withRetry(async () => {
594
+ const result2 = await getAction(client, getCallsStatus, "getCallsStatus")({ id });
595
+ if (throwOnFailure && result2.status === "failure")
596
+ throw new BundleFailedError(result2);
597
+ return result2;
598
+ }, {
599
+ retryCount,
600
+ delay: retryDelay
601
+ });
602
+ if (!status(result))
603
+ return;
604
+ done(() => emit.resolve(result));
605
+ } catch (error) {
606
+ done(() => emit.reject(error));
607
+ }
608
+ }, {
609
+ interval: pollingInterval,
610
+ emitOnBegin: true
611
+ });
612
+ return unpoll;
613
+ });
614
+ timer = timeout ? setTimeout(() => {
615
+ unobserve();
616
+ clearTimeout(timer);
617
+ reject(new WaitForCallsStatusTimeoutError({ id }));
618
+ }, timeout) : void 0;
619
+ return await promise;
620
+ }
621
+ class WaitForCallsStatusTimeoutError extends BaseError {
622
+ constructor({ id }) {
623
+ super(`Timed out while waiting for call bundle with id "${id}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
624
+ }
625
+ }
626
+ function isNullUniversalResolverError(err) {
627
+ var _a, _b, _c, _d, _e, _f;
628
+ if (!(err instanceof BaseError))
629
+ return false;
630
+ const cause = err.walk((e) => e instanceof ContractFunctionRevertedError);
631
+ if (!(cause instanceof ContractFunctionRevertedError))
632
+ return false;
633
+ if (((_a = cause.data) == null ? void 0 : _a.errorName) === "HttpError")
634
+ return true;
635
+ if (((_b = cause.data) == null ? void 0 : _b.errorName) === "ResolverError")
636
+ return true;
637
+ if (((_c = cause.data) == null ? void 0 : _c.errorName) === "ResolverNotContract")
638
+ return true;
639
+ if (((_d = cause.data) == null ? void 0 : _d.errorName) === "ResolverNotFound")
640
+ return true;
641
+ if (((_e = cause.data) == null ? void 0 : _e.errorName) === "ReverseAddressMismatch")
642
+ return true;
643
+ if (((_f = cause.data) == null ? void 0 : _f.errorName) === "UnsupportedResolverProfile")
644
+ return true;
645
+ return false;
646
+ }
647
+ function encodedLabelToLabelhash(label) {
648
+ if (label.length !== 66)
649
+ return null;
650
+ if (label.indexOf("[") !== 0)
651
+ return null;
652
+ if (label.indexOf("]") !== 65)
653
+ return null;
654
+ const hash = `0x${label.slice(1, 65)}`;
655
+ if (!isHex(hash))
656
+ return null;
657
+ return hash;
658
+ }
659
+ function namehash(name) {
660
+ let result = new Uint8Array(32).fill(0);
661
+ if (!name)
662
+ return bytesToHex(result);
663
+ const labels = name.split(".");
664
+ for (let i = labels.length - 1; i >= 0; i -= 1) {
665
+ const hashFromEncodedLabel = encodedLabelToLabelhash(labels[i]);
666
+ const hashed = hashFromEncodedLabel ? toBytes(hashFromEncodedLabel) : keccak256(stringToBytes(labels[i]), "bytes");
667
+ result = keccak256(concat([result, hashed]), "bytes");
668
+ }
669
+ return bytesToHex(result);
670
+ }
671
+ function encodeLabelhash(hash) {
672
+ return `[${hash.slice(2)}]`;
673
+ }
674
+ function labelhash(label) {
675
+ const result = new Uint8Array(32).fill(0);
676
+ if (!label)
677
+ return bytesToHex(result);
678
+ return encodedLabelToLabelhash(label) || keccak256(stringToBytes(label));
679
+ }
680
+ function packetToBytes(packet) {
681
+ const value = packet.replace(/^\.|\.$/gm, "");
682
+ if (value.length === 0)
683
+ return new Uint8Array(1);
684
+ const bytes = new Uint8Array(stringToBytes(value).byteLength + 2);
685
+ let offset = 0;
686
+ const list = value.split(".");
687
+ for (let i = 0; i < list.length; i++) {
688
+ let encoded = stringToBytes(list[i]);
689
+ if (encoded.byteLength > 255)
690
+ encoded = stringToBytes(encodeLabelhash(labelhash(list[i])));
691
+ bytes[offset] = encoded.length;
692
+ bytes.set(encoded, offset + 1);
693
+ offset += encoded.length + 1;
694
+ }
695
+ if (bytes.byteLength !== offset + 1)
696
+ return bytes.slice(0, offset + 1);
697
+ return bytes;
698
+ }
699
+ async function getEnsAddress(client, parameters) {
700
+ const { blockNumber, blockTag, coinType, name, gatewayUrls, strict } = parameters;
701
+ const { chain } = client;
702
+ const universalResolverAddress = (() => {
703
+ if (parameters.universalResolverAddress)
704
+ return parameters.universalResolverAddress;
705
+ if (!chain)
706
+ throw new Error("client chain not configured. universalResolverAddress is required.");
707
+ return getChainContractAddress({
708
+ blockNumber,
709
+ chain,
710
+ contract: "ensUniversalResolver"
711
+ });
712
+ })();
713
+ const tlds = chain == null ? void 0 : chain.ensTlds;
714
+ if (tlds && !tlds.some((tld) => name.endsWith(tld)))
715
+ return null;
716
+ const args = (() => {
717
+ if (coinType != null)
718
+ return [namehash(name), BigInt(coinType)];
719
+ return [namehash(name)];
720
+ })();
721
+ try {
722
+ const functionData = encodeFunctionData({
723
+ abi: addressResolverAbi,
724
+ functionName: "addr",
725
+ args
726
+ });
727
+ const readContractParameters = {
728
+ address: universalResolverAddress,
729
+ abi: universalResolverResolveAbi,
730
+ functionName: "resolveWithGateways",
731
+ args: [
732
+ toHex(packetToBytes(name)),
733
+ functionData,
734
+ gatewayUrls ?? [localBatchGatewayUrl]
735
+ ],
736
+ blockNumber,
737
+ blockTag
738
+ };
739
+ const readContractAction = getAction(client, readContract, "readContract");
740
+ const res = await readContractAction(readContractParameters);
741
+ if (res[0] === "0x")
742
+ return null;
743
+ const address = decodeFunctionResult({
744
+ abi: addressResolverAbi,
745
+ args,
746
+ functionName: "addr",
747
+ data: res[0]
748
+ });
749
+ if (address === "0x")
750
+ return null;
751
+ if (trim(address) === "0x00")
752
+ return null;
753
+ return address;
754
+ } catch (err) {
755
+ if (strict)
756
+ throw err;
757
+ if (isNullUniversalResolverError(err))
758
+ return null;
759
+ throw err;
760
+ }
761
+ }
762
+ class EnsAvatarInvalidMetadataError extends BaseError {
763
+ constructor({ data }) {
764
+ super("Unable to extract image from metadata. The metadata may be malformed or invalid.", {
765
+ metaMessages: [
766
+ "- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.",
767
+ "",
768
+ `Provided data: ${JSON.stringify(data)}`
769
+ ],
770
+ name: "EnsAvatarInvalidMetadataError"
771
+ });
772
+ }
773
+ }
774
+ class EnsAvatarInvalidNftUriError extends BaseError {
775
+ constructor({ reason }) {
776
+ super(`ENS NFT avatar URI is invalid. ${reason}`, {
777
+ name: "EnsAvatarInvalidNftUriError"
778
+ });
779
+ }
780
+ }
781
+ class EnsAvatarUriResolutionError extends BaseError {
782
+ constructor({ uri }) {
783
+ super(`Unable to resolve ENS avatar URI "${uri}". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: "EnsAvatarUriResolutionError" });
784
+ }
785
+ }
786
+ class EnsAvatarUnsupportedNamespaceError extends BaseError {
787
+ constructor({ namespace }) {
788
+ super(`ENS NFT avatar namespace "${namespace}" is not supported. Must be "erc721" or "erc1155".`, { name: "EnsAvatarUnsupportedNamespaceError" });
789
+ }
790
+ }
791
+ class EnsInvalidChainIdError extends BaseError {
792
+ constructor({ chainId }) {
793
+ super(`Invalid ENSIP-11 chainId: ${chainId}. Must be between 0 and 0x7fffffff, or 1.`, {
794
+ name: "EnsInvalidChainIdError"
795
+ });
796
+ }
797
+ }
798
+ const networkRegex = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/;
799
+ const ipfsHashRegex = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/;
800
+ const base64Regex = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/;
801
+ const dataURIRegex = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
802
+ async function isImageUri(uri) {
803
+ try {
804
+ const res = await fetch(uri, { method: "HEAD" });
805
+ if (res.status === 200) {
806
+ const contentType = res.headers.get("content-type");
807
+ return contentType == null ? void 0 : contentType.startsWith("image/");
808
+ }
809
+ return false;
810
+ } catch (error) {
811
+ if (typeof error === "object" && typeof error.response !== "undefined") {
812
+ return false;
813
+ }
814
+ if (!Object.hasOwn(globalThis, "Image"))
815
+ return false;
816
+ return new Promise((resolve) => {
817
+ const img = new Image();
818
+ img.onload = () => {
819
+ resolve(true);
820
+ };
821
+ img.onerror = () => {
822
+ resolve(false);
823
+ };
824
+ img.src = uri;
825
+ });
826
+ }
827
+ }
828
+ function getGateway(custom, defaultGateway) {
829
+ if (!custom)
830
+ return defaultGateway;
831
+ if (custom.endsWith("/"))
832
+ return custom.slice(0, -1);
833
+ return custom;
834
+ }
835
+ function resolveAvatarUri({ uri, gatewayUrls }) {
836
+ const isEncoded = base64Regex.test(uri);
837
+ if (isEncoded)
838
+ return { uri, isOnChain: true, isEncoded };
839
+ const ipfsGateway = getGateway(gatewayUrls == null ? void 0 : gatewayUrls.ipfs, "https://ipfs.io");
840
+ const arweaveGateway = getGateway(gatewayUrls == null ? void 0 : gatewayUrls.arweave, "https://arweave.net");
841
+ const networkRegexMatch = uri.match(networkRegex);
842
+ const { protocol, subpath, target, subtarget = "" } = (networkRegexMatch == null ? void 0 : networkRegexMatch.groups) || {};
843
+ const isIPNS = protocol === "ipns:/" || subpath === "ipns/";
844
+ const isIPFS = protocol === "ipfs:/" || subpath === "ipfs/" || ipfsHashRegex.test(uri);
845
+ if (uri.startsWith("http") && !isIPNS && !isIPFS) {
846
+ let replacedUri = uri;
847
+ if (gatewayUrls == null ? void 0 : gatewayUrls.arweave)
848
+ replacedUri = uri.replace(/https:\/\/arweave.net/g, gatewayUrls == null ? void 0 : gatewayUrls.arweave);
849
+ return { uri: replacedUri, isOnChain: false, isEncoded: false };
850
+ }
851
+ if ((isIPNS || isIPFS) && target) {
852
+ return {
853
+ uri: `${ipfsGateway}/${isIPNS ? "ipns" : "ipfs"}/${target}${subtarget}`,
854
+ isOnChain: false,
855
+ isEncoded: false
856
+ };
857
+ }
858
+ if (protocol === "ar:/" && target) {
859
+ return {
860
+ uri: `${arweaveGateway}/${target}${subtarget || ""}`,
861
+ isOnChain: false,
862
+ isEncoded: false
863
+ };
864
+ }
865
+ let parsedUri = uri.replace(dataURIRegex, "");
866
+ if (parsedUri.startsWith("<svg")) {
867
+ parsedUri = `data:image/svg+xml;base64,${btoa(parsedUri)}`;
868
+ }
869
+ if (parsedUri.startsWith("data:") || parsedUri.startsWith("{")) {
870
+ return {
871
+ uri: parsedUri,
872
+ isOnChain: true,
873
+ isEncoded: false
874
+ };
875
+ }
876
+ throw new EnsAvatarUriResolutionError({ uri });
877
+ }
878
+ function getJsonImage(data) {
879
+ if (typeof data !== "object" || !("image" in data) && !("image_url" in data) && !("image_data" in data)) {
880
+ throw new EnsAvatarInvalidMetadataError({ data });
881
+ }
882
+ return data.image || data.image_url || data.image_data;
883
+ }
884
+ async function getMetadataAvatarUri({ gatewayUrls, uri }) {
885
+ try {
886
+ const res = await fetch(uri).then((res2) => res2.json());
887
+ const image = await parseAvatarUri({
888
+ gatewayUrls,
889
+ uri: getJsonImage(res)
890
+ });
891
+ return image;
892
+ } catch {
893
+ throw new EnsAvatarUriResolutionError({ uri });
894
+ }
895
+ }
896
+ async function parseAvatarUri({ gatewayUrls, uri }) {
897
+ const { uri: resolvedURI, isOnChain } = resolveAvatarUri({ uri, gatewayUrls });
898
+ if (isOnChain)
899
+ return resolvedURI;
900
+ const isImage = await isImageUri(resolvedURI);
901
+ if (isImage)
902
+ return resolvedURI;
903
+ throw new EnsAvatarUriResolutionError({ uri });
904
+ }
905
+ function parseNftUri(uri_) {
906
+ let uri = uri_;
907
+ if (uri.startsWith("did:nft:")) {
908
+ uri = uri.replace("did:nft:", "").replace(/_/g, "/");
909
+ }
910
+ const [reference, asset_namespace, tokenID] = uri.split("/");
911
+ const [eip_namespace, chainID] = reference.split(":");
912
+ const [erc_namespace, contractAddress] = asset_namespace.split(":");
913
+ if (!eip_namespace || eip_namespace.toLowerCase() !== "eip155")
914
+ throw new EnsAvatarInvalidNftUriError({ reason: "Only EIP-155 supported" });
915
+ if (!chainID)
916
+ throw new EnsAvatarInvalidNftUriError({ reason: "Chain ID not found" });
917
+ if (!contractAddress)
918
+ throw new EnsAvatarInvalidNftUriError({
919
+ reason: "Contract address not found"
920
+ });
921
+ if (!tokenID)
922
+ throw new EnsAvatarInvalidNftUriError({ reason: "Token ID not found" });
923
+ if (!erc_namespace)
924
+ throw new EnsAvatarInvalidNftUriError({ reason: "ERC namespace not found" });
925
+ return {
926
+ chainID: Number.parseInt(chainID, 10),
927
+ namespace: erc_namespace.toLowerCase(),
928
+ contractAddress,
929
+ tokenID
930
+ };
931
+ }
932
+ async function getNftTokenUri(client, { nft }) {
933
+ if (nft.namespace === "erc721") {
934
+ return readContract(client, {
935
+ address: nft.contractAddress,
936
+ abi: [
937
+ {
938
+ name: "tokenURI",
939
+ type: "function",
940
+ stateMutability: "view",
941
+ inputs: [{ name: "tokenId", type: "uint256" }],
942
+ outputs: [{ name: "", type: "string" }]
943
+ }
944
+ ],
945
+ functionName: "tokenURI",
946
+ args: [BigInt(nft.tokenID)]
947
+ });
948
+ }
949
+ if (nft.namespace === "erc1155") {
950
+ return readContract(client, {
951
+ address: nft.contractAddress,
952
+ abi: [
953
+ {
954
+ name: "uri",
955
+ type: "function",
956
+ stateMutability: "view",
957
+ inputs: [{ name: "_id", type: "uint256" }],
958
+ outputs: [{ name: "", type: "string" }]
959
+ }
960
+ ],
961
+ functionName: "uri",
962
+ args: [BigInt(nft.tokenID)]
963
+ });
964
+ }
965
+ throw new EnsAvatarUnsupportedNamespaceError({ namespace: nft.namespace });
966
+ }
967
+ async function parseAvatarRecord(client, { gatewayUrls, record }) {
968
+ if (/eip155:/i.test(record))
969
+ return parseNftAvatarUri(client, { gatewayUrls, record });
970
+ return parseAvatarUri({ uri: record, gatewayUrls });
971
+ }
972
+ async function parseNftAvatarUri(client, { gatewayUrls, record }) {
973
+ const nft = parseNftUri(record);
974
+ const nftUri = await getNftTokenUri(client, { nft });
975
+ const { uri: resolvedNftUri, isOnChain, isEncoded } = resolveAvatarUri({ uri: nftUri, gatewayUrls });
976
+ if (isOnChain && (resolvedNftUri.includes("data:application/json;base64,") || resolvedNftUri.startsWith("{"))) {
977
+ const encodedJson = isEncoded ? (
978
+ // if it is encoded, decode it
979
+ atob(resolvedNftUri.replace("data:application/json;base64,", ""))
980
+ ) : (
981
+ // if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
982
+ resolvedNftUri
983
+ );
984
+ const decoded = JSON.parse(encodedJson);
985
+ return parseAvatarUri({ uri: getJsonImage(decoded), gatewayUrls });
986
+ }
987
+ let uriTokenId = nft.tokenID;
988
+ if (nft.namespace === "erc1155")
989
+ uriTokenId = uriTokenId.replace("0x", "").padStart(64, "0");
990
+ return getMetadataAvatarUri({
991
+ gatewayUrls,
992
+ uri: resolvedNftUri.replace(/(?:0x)?{id}/, uriTokenId)
993
+ });
994
+ }
995
+ async function getEnsText(client, parameters) {
996
+ const { blockNumber, blockTag, key, name, gatewayUrls, strict } = parameters;
997
+ const { chain } = client;
998
+ const universalResolverAddress = (() => {
999
+ if (parameters.universalResolverAddress)
1000
+ return parameters.universalResolverAddress;
1001
+ if (!chain)
1002
+ throw new Error("client chain not configured. universalResolverAddress is required.");
1003
+ return getChainContractAddress({
1004
+ blockNumber,
1005
+ chain,
1006
+ contract: "ensUniversalResolver"
1007
+ });
1008
+ })();
1009
+ const tlds = chain == null ? void 0 : chain.ensTlds;
1010
+ if (tlds && !tlds.some((tld) => name.endsWith(tld)))
1011
+ return null;
1012
+ try {
1013
+ const readContractParameters = {
1014
+ address: universalResolverAddress,
1015
+ abi: universalResolverResolveAbi,
1016
+ args: [
1017
+ toHex(packetToBytes(name)),
1018
+ encodeFunctionData({
1019
+ abi: textResolverAbi,
1020
+ functionName: "text",
1021
+ args: [namehash(name), key]
1022
+ }),
1023
+ gatewayUrls ?? [localBatchGatewayUrl]
1024
+ ],
1025
+ functionName: "resolveWithGateways",
1026
+ blockNumber,
1027
+ blockTag
1028
+ };
1029
+ const readContractAction = getAction(client, readContract, "readContract");
1030
+ const res = await readContractAction(readContractParameters);
1031
+ if (res[0] === "0x")
1032
+ return null;
1033
+ const record = decodeFunctionResult({
1034
+ abi: textResolverAbi,
1035
+ functionName: "text",
1036
+ data: res[0]
1037
+ });
1038
+ return record === "" ? null : record;
1039
+ } catch (err) {
1040
+ if (strict)
1041
+ throw err;
1042
+ if (isNullUniversalResolverError(err))
1043
+ return null;
1044
+ throw err;
1045
+ }
1046
+ }
1047
+ async function getEnsAvatar(client, { blockNumber, blockTag, assetGatewayUrls, name, gatewayUrls, strict, universalResolverAddress }) {
1048
+ const record = await getAction(client, getEnsText, "getEnsText")({
1049
+ blockNumber,
1050
+ blockTag,
1051
+ key: "avatar",
1052
+ name,
1053
+ universalResolverAddress,
1054
+ gatewayUrls,
1055
+ strict
1056
+ });
1057
+ if (!record)
1058
+ return null;
1059
+ try {
1060
+ return await parseAvatarRecord(client, {
1061
+ record,
1062
+ gatewayUrls: assetGatewayUrls
1063
+ });
1064
+ } catch {
1065
+ return null;
1066
+ }
1067
+ }
1068
+ async function getEnsName(client, parameters) {
1069
+ const { address, blockNumber, blockTag, coinType = 60n, gatewayUrls, strict } = parameters;
1070
+ const { chain } = client;
1071
+ const universalResolverAddress = (() => {
1072
+ if (parameters.universalResolverAddress)
1073
+ return parameters.universalResolverAddress;
1074
+ if (!chain)
1075
+ throw new Error("client chain not configured. universalResolverAddress is required.");
1076
+ return getChainContractAddress({
1077
+ blockNumber,
1078
+ chain,
1079
+ contract: "ensUniversalResolver"
1080
+ });
1081
+ })();
1082
+ try {
1083
+ const readContractParameters = {
1084
+ address: universalResolverAddress,
1085
+ abi: universalResolverReverseAbi,
1086
+ args: [address, coinType, gatewayUrls ?? [localBatchGatewayUrl]],
1087
+ functionName: "reverseWithGateways",
1088
+ blockNumber,
1089
+ blockTag
1090
+ };
1091
+ const readContractAction = getAction(client, readContract, "readContract");
1092
+ const [name] = await readContractAction(readContractParameters);
1093
+ return name || null;
1094
+ } catch (err) {
1095
+ if (strict)
1096
+ throw err;
1097
+ if (isNullUniversalResolverError(err))
1098
+ return null;
1099
+ throw err;
1100
+ }
1101
+ }
1102
+ async function getEnsResolver(client, parameters) {
1103
+ const { blockNumber, blockTag, name } = parameters;
1104
+ const { chain } = client;
1105
+ const universalResolverAddress = (() => {
1106
+ if (parameters.universalResolverAddress)
1107
+ return parameters.universalResolverAddress;
1108
+ if (!chain)
1109
+ throw new Error("client chain not configured. universalResolverAddress is required.");
1110
+ return getChainContractAddress({
1111
+ blockNumber,
1112
+ chain,
1113
+ contract: "ensUniversalResolver"
1114
+ });
1115
+ })();
1116
+ const tlds = chain == null ? void 0 : chain.ensTlds;
1117
+ if (tlds && !tlds.some((tld) => name.endsWith(tld)))
1118
+ throw new Error(`${name} is not a valid ENS TLD (${tlds == null ? void 0 : tlds.join(", ")}) for chain "${chain.name}" (id: ${chain.id}).`);
1119
+ const [resolverAddress] = await getAction(client, readContract, "readContract")({
1120
+ address: universalResolverAddress,
1121
+ abi: [
1122
+ {
1123
+ inputs: [{ type: "bytes" }],
1124
+ name: "findResolver",
1125
+ outputs: [
1126
+ { type: "address" },
1127
+ { type: "bytes32" },
1128
+ { type: "uint256" }
1129
+ ],
1130
+ stateMutability: "view",
1131
+ type: "function"
1132
+ }
1133
+ ],
1134
+ functionName: "findResolver",
1135
+ args: [toHex(packetToBytes(name))],
1136
+ blockNumber,
1137
+ blockTag
1138
+ });
1139
+ return resolverAddress;
1140
+ }
1141
+ async function createAccessList(client, args) {
1142
+ var _a, _b, _c;
1143
+ const { account: account_ = client.account, blockNumber, blockTag = "latest", blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, to, value, ...rest } = args;
1144
+ const account = account_ ? parseAccount(account_) : void 0;
1145
+ try {
1146
+ assertRequest(args);
1147
+ const blockNumberHex = typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0;
1148
+ const block = blockNumberHex || blockTag;
1149
+ const chainFormat = (_c = (_b = (_a = client.chain) == null ? void 0 : _a.formatters) == null ? void 0 : _b.transactionRequest) == null ? void 0 : _c.format;
1150
+ const format = chainFormat || formatTransactionRequest;
1151
+ const request = format({
1152
+ // Pick out extra data that might exist on the chain's transaction request type.
1153
+ ...extract(rest, { format: chainFormat }),
1154
+ account,
1155
+ blobs,
1156
+ data,
1157
+ gas,
1158
+ gasPrice,
1159
+ maxFeePerBlobGas,
1160
+ maxFeePerGas,
1161
+ maxPriorityFeePerGas,
1162
+ to,
1163
+ value
1164
+ }, "createAccessList");
1165
+ const response = await client.request({
1166
+ method: "eth_createAccessList",
1167
+ params: [request, block]
1168
+ });
1169
+ return {
1170
+ accessList: response.accessList,
1171
+ gasUsed: BigInt(response.gasUsed)
1172
+ };
1173
+ } catch (err) {
1174
+ throw getCallError(err, {
1175
+ ...args,
1176
+ account,
1177
+ chain: client.chain
1178
+ });
1179
+ }
1180
+ }
1181
+ async function createBlockFilter(client) {
1182
+ const getRequest = createFilterRequestScope(client, {
1183
+ method: "eth_newBlockFilter"
1184
+ });
1185
+ const id = await client.request({
1186
+ method: "eth_newBlockFilter"
1187
+ });
1188
+ return { id, request: getRequest(id), type: "block" };
1189
+ }
1190
+ async function createEventFilter(client, { address, args, event, events: events_, fromBlock, strict, toBlock } = {}) {
1191
+ const events = events_ ?? (event ? [event] : void 0);
1192
+ const getRequest = createFilterRequestScope(client, {
1193
+ method: "eth_newFilter"
1194
+ });
1195
+ let topics = [];
1196
+ if (events) {
1197
+ const encoded = events.flatMap((event2) => encodeEventTopics({
1198
+ abi: [event2],
1199
+ eventName: event2.name,
1200
+ args
1201
+ }));
1202
+ topics = [encoded];
1203
+ if (event)
1204
+ topics = topics[0];
1205
+ }
1206
+ const id = await client.request({
1207
+ method: "eth_newFilter",
1208
+ params: [
1209
+ {
1210
+ address,
1211
+ fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock,
1212
+ toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock,
1213
+ ...topics.length ? { topics } : {}
1214
+ }
1215
+ ]
1216
+ });
1217
+ return {
1218
+ abi: events,
1219
+ args,
1220
+ eventName: event ? event.name : void 0,
1221
+ fromBlock,
1222
+ id,
1223
+ request: getRequest(id),
1224
+ strict: Boolean(strict),
1225
+ toBlock,
1226
+ type: "event"
1227
+ };
1228
+ }
1229
+ async function getBlobBaseFee(client) {
1230
+ const baseFee = await client.request({
1231
+ method: "eth_blobBaseFee"
1232
+ });
1233
+ return BigInt(baseFee);
1234
+ }
1235
+ async function getBlockTransactionCount(client, { blockHash, blockNumber, blockTag = "latest" } = {}) {
1236
+ const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
1237
+ let count;
1238
+ if (blockHash) {
1239
+ count = await client.request({
1240
+ method: "eth_getBlockTransactionCountByHash",
1241
+ params: [blockHash]
1242
+ }, { dedupe: true });
1243
+ } else {
1244
+ count = await client.request({
1245
+ method: "eth_getBlockTransactionCountByNumber",
1246
+ params: [blockNumberHex || blockTag]
1247
+ }, { dedupe: Boolean(blockNumberHex) });
1248
+ }
1249
+ return hexToNumber(count);
1250
+ }
1251
+ class Eip712DomainNotFoundError extends BaseError {
1252
+ constructor({ address }) {
1253
+ super(`No EIP-712 domain found on contract "${address}".`, {
1254
+ metaMessages: [
1255
+ "Ensure that:",
1256
+ `- The contract is deployed at the address "${address}".`,
1257
+ "- `eip712Domain()` function exists on the contract.",
1258
+ "- `eip712Domain()` function matches signature to ERC-5267 specification."
1259
+ ],
1260
+ name: "Eip712DomainNotFoundError"
1261
+ });
1262
+ }
1263
+ }
1264
+ async function getEip712Domain(client, parameters) {
1265
+ const { address, factory, factoryData } = parameters;
1266
+ try {
1267
+ const [fields, name, version, chainId, verifyingContract, salt, extensions] = await getAction(client, readContract, "readContract")({
1268
+ abi,
1269
+ address,
1270
+ functionName: "eip712Domain",
1271
+ factory,
1272
+ factoryData
1273
+ });
1274
+ return {
1275
+ domain: {
1276
+ name,
1277
+ version,
1278
+ chainId: Number(chainId),
1279
+ verifyingContract,
1280
+ salt
1281
+ },
1282
+ extensions,
1283
+ fields
1284
+ };
1285
+ } catch (e) {
1286
+ const error = e;
1287
+ if (error.name === "ContractFunctionExecutionError" && error.cause.name === "ContractFunctionZeroDataError") {
1288
+ throw new Eip712DomainNotFoundError({ address });
1289
+ }
1290
+ throw error;
1291
+ }
1292
+ }
1293
+ const abi = [
1294
+ {
1295
+ inputs: [],
1296
+ name: "eip712Domain",
1297
+ outputs: [
1298
+ { name: "fields", type: "bytes1" },
1299
+ { name: "name", type: "string" },
1300
+ { name: "version", type: "string" },
1301
+ { name: "chainId", type: "uint256" },
1302
+ { name: "verifyingContract", type: "address" },
1303
+ { name: "salt", type: "bytes32" },
1304
+ { name: "extensions", type: "uint256[]" }
1305
+ ],
1306
+ stateMutability: "view",
1307
+ type: "function"
1308
+ }
1309
+ ];
1310
+ function formatFeeHistory(feeHistory) {
1311
+ var _a;
1312
+ return {
1313
+ baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
1314
+ gasUsedRatio: feeHistory.gasUsedRatio,
1315
+ oldestBlock: BigInt(feeHistory.oldestBlock),
1316
+ reward: (_a = feeHistory.reward) == null ? void 0 : _a.map((reward) => reward.map((value) => BigInt(value)))
1317
+ };
1318
+ }
1319
+ async function getFeeHistory(client, { blockCount, blockNumber, blockTag = "latest", rewardPercentiles }) {
1320
+ const blockNumberHex = typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0;
1321
+ const feeHistory = await client.request({
1322
+ method: "eth_feeHistory",
1323
+ params: [
1324
+ numberToHex(blockCount),
1325
+ blockNumberHex || blockTag,
1326
+ rewardPercentiles
1327
+ ]
1328
+ }, { dedupe: Boolean(blockNumberHex) });
1329
+ return formatFeeHistory(feeHistory);
1330
+ }
1331
+ async function getFilterLogs(_client, { filter }) {
1332
+ const strict = filter.strict ?? false;
1333
+ const logs = await filter.request({
1334
+ method: "eth_getFilterLogs",
1335
+ params: [filter.id]
1336
+ });
1337
+ const formattedLogs = logs.map((log) => formatLog(log));
1338
+ if (!filter.abi)
1339
+ return formattedLogs;
1340
+ return parseEventLogs({
1341
+ abi: filter.abi,
1342
+ logs: formattedLogs,
1343
+ strict
1344
+ });
1345
+ }
1346
+ function encodePacked(types, values) {
1347
+ if (types.length !== values.length)
1348
+ throw new AbiEncodingLengthMismatchError({
1349
+ expectedLength: types.length,
1350
+ givenLength: values.length
1351
+ });
1352
+ const data = [];
1353
+ for (let i = 0; i < types.length; i++) {
1354
+ const type = types[i];
1355
+ const value = values[i];
1356
+ data.push(encode$1(type, value));
1357
+ }
1358
+ return concatHex(data);
1359
+ }
1360
+ function encode$1(type, value, isArray = false) {
1361
+ if (type === "address") {
1362
+ const address = value;
1363
+ if (!isAddress(address))
1364
+ throw new InvalidAddressError({ address });
1365
+ return pad(address.toLowerCase(), {
1366
+ size: isArray ? 32 : null
1367
+ });
1368
+ }
1369
+ if (type === "string")
1370
+ return stringToHex(value);
1371
+ if (type === "bytes")
1372
+ return value;
1373
+ if (type === "bool")
1374
+ return pad(boolToHex(value), { size: isArray ? 32 : 1 });
1375
+ const intMatch = type.match(integerRegex);
1376
+ if (intMatch) {
1377
+ const [_type, baseType, bits = "256"] = intMatch;
1378
+ const size = Number.parseInt(bits, 10) / 8;
1379
+ return numberToHex(value, {
1380
+ size: isArray ? 32 : size,
1381
+ signed: baseType === "int"
1382
+ });
1383
+ }
1384
+ const bytesMatch = type.match(bytesRegex);
1385
+ if (bytesMatch) {
1386
+ const [_type, size] = bytesMatch;
1387
+ if (Number.parseInt(size, 10) !== (value.length - 2) / 2)
1388
+ throw new BytesSizeMismatchError({
1389
+ expectedSize: Number.parseInt(size, 10),
1390
+ givenSize: (value.length - 2) / 2
1391
+ });
1392
+ return pad(value, { dir: "right", size: isArray ? 32 : null });
1393
+ }
1394
+ const arrayMatch = type.match(arrayRegex);
1395
+ if (arrayMatch && Array.isArray(value)) {
1396
+ const [_type, childType] = arrayMatch;
1397
+ const data = [];
1398
+ for (let i = 0; i < value.length; i++) {
1399
+ data.push(encode$1(childType, value[i], true));
1400
+ }
1401
+ if (data.length === 0)
1402
+ return "0x";
1403
+ return concatHex(data);
1404
+ }
1405
+ throw new UnsupportedPackedAbiType(type);
1406
+ }
1407
+ function createNonceManager(parameters) {
1408
+ const { source } = parameters;
1409
+ const deltaMap = /* @__PURE__ */ new Map();
1410
+ const nonceMap = new LruMap(8192);
1411
+ const promiseMap = /* @__PURE__ */ new Map();
1412
+ const getKey = ({ address, chainId }) => `${address}.${chainId}`;
1413
+ return {
1414
+ async consume({ address, chainId, client }) {
1415
+ const key = getKey({ address, chainId });
1416
+ const promise = this.get({ address, chainId, client });
1417
+ this.increment({ address, chainId });
1418
+ const nonce = await promise;
1419
+ await source.set({ address, chainId }, nonce);
1420
+ nonceMap.set(key, nonce);
1421
+ return nonce;
1422
+ },
1423
+ async increment({ address, chainId }) {
1424
+ const key = getKey({ address, chainId });
1425
+ const delta = deltaMap.get(key) ?? 0;
1426
+ deltaMap.set(key, delta + 1);
1427
+ },
1428
+ async get({ address, chainId, client }) {
1429
+ const key = getKey({ address, chainId });
1430
+ let promise = promiseMap.get(key);
1431
+ if (!promise) {
1432
+ promise = (async () => {
1433
+ try {
1434
+ const nonce = await source.get({ address, chainId, client });
1435
+ const previousNonce = nonceMap.get(key) ?? 0;
1436
+ if (previousNonce > 0 && nonce <= previousNonce)
1437
+ return previousNonce + 1;
1438
+ nonceMap.delete(key);
1439
+ return nonce;
1440
+ } finally {
1441
+ this.reset({ address, chainId });
1442
+ }
1443
+ })();
1444
+ promiseMap.set(key, promise);
1445
+ }
1446
+ const delta = deltaMap.get(key) ?? 0;
1447
+ return delta + await promise;
1448
+ },
1449
+ reset({ address, chainId }) {
1450
+ const key = getKey({ address, chainId });
1451
+ deltaMap.delete(key);
1452
+ promiseMap.delete(key);
1453
+ }
1454
+ };
1455
+ }
1456
+ function jsonRpc() {
1457
+ return {
1458
+ async get(parameters) {
1459
+ const { address, client } = parameters;
1460
+ return getTransactionCount(client, {
1461
+ address,
1462
+ blockTag: "pending"
1463
+ });
1464
+ },
1465
+ set() {
1466
+ }
1467
+ };
1468
+ }
1469
+ const nonceManager = /* @__PURE__ */ createNonceManager({
1470
+ source: jsonRpc()
1471
+ });
1472
+ function createIdStore() {
1473
+ return {
1474
+ current: 0,
1475
+ take() {
1476
+ return this.current++;
1477
+ },
1478
+ reset() {
1479
+ this.current = 0;
1480
+ }
1481
+ };
1482
+ }
1483
+ const idCache = /* @__PURE__ */ createIdStore();
1484
+ function getHttpRpcClient(url, options = {}) {
1485
+ return {
1486
+ async request(params) {
1487
+ var _a;
1488
+ const { body, fetchFn = options.fetchFn ?? fetch, onRequest = options.onRequest, onResponse = options.onResponse, timeout = options.timeout ?? 1e4 } = params;
1489
+ const fetchOptions = {
1490
+ ...options.fetchOptions ?? {},
1491
+ ...params.fetchOptions ?? {}
1492
+ };
1493
+ const { headers, method, signal: signal_ } = fetchOptions;
1494
+ try {
1495
+ const response = await withTimeout(async ({ signal }) => {
1496
+ const init = {
1497
+ ...fetchOptions,
1498
+ body: Array.isArray(body) ? stringify(body.map((body2) => ({
1499
+ jsonrpc: "2.0",
1500
+ id: body2.id ?? idCache.take(),
1501
+ ...body2
1502
+ }))) : stringify({
1503
+ jsonrpc: "2.0",
1504
+ id: body.id ?? idCache.take(),
1505
+ ...body
1506
+ }),
1507
+ headers: {
1508
+ "Content-Type": "application/json",
1509
+ ...headers
1510
+ },
1511
+ method: method || "POST",
1512
+ signal: signal_ || (timeout > 0 ? signal : null)
1513
+ };
1514
+ const request = new Request(url, init);
1515
+ const args = await (onRequest == null ? void 0 : onRequest(request, init)) ?? { ...init, url };
1516
+ const response2 = await fetchFn(args.url ?? url, args);
1517
+ return response2;
1518
+ }, {
1519
+ errorInstance: new TimeoutError({ body, url }),
1520
+ timeout,
1521
+ signal: true
1522
+ });
1523
+ if (onResponse)
1524
+ await onResponse(response);
1525
+ let data;
1526
+ if ((_a = response.headers.get("Content-Type")) == null ? void 0 : _a.startsWith("application/json"))
1527
+ data = await response.json();
1528
+ else {
1529
+ data = await response.text();
1530
+ try {
1531
+ data = JSON.parse(data || "{}");
1532
+ } catch (err) {
1533
+ if (response.ok)
1534
+ throw err;
1535
+ data = { error: data };
1536
+ }
1537
+ }
1538
+ if (!response.ok) {
1539
+ throw new HttpRequestError({
1540
+ body,
1541
+ details: stringify(data.error) || response.statusText,
1542
+ headers: response.headers,
1543
+ status: response.status,
1544
+ url
1545
+ });
1546
+ }
1547
+ return data;
1548
+ } catch (err) {
1549
+ if (err instanceof HttpRequestError)
1550
+ throw err;
1551
+ if (err instanceof TimeoutError)
1552
+ throw err;
1553
+ throw new HttpRequestError({
1554
+ body,
1555
+ cause: err,
1556
+ url
1557
+ });
1558
+ }
1559
+ }
1560
+ };
1561
+ }
1562
+ const erc6492MagicBytes = "0x6492649264926492649264926492649264926492649264926492649264926492";
1563
+ const zeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000";
1564
+ function serializeErc6492Signature(parameters) {
1565
+ const { address, data, signature, to = "hex" } = parameters;
1566
+ const signature_ = concatHex([
1567
+ encodeAbiParameters([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], [address, data, signature]),
1568
+ erc6492MagicBytes
1569
+ ]);
1570
+ if (to === "hex")
1571
+ return signature_;
1572
+ return hexToBytes(signature_);
1573
+ }
1574
+ function formatStorageProof(storageProof) {
1575
+ return storageProof.map((proof) => ({
1576
+ ...proof,
1577
+ value: BigInt(proof.value)
1578
+ }));
1579
+ }
1580
+ function formatProof(proof) {
1581
+ return {
1582
+ ...proof,
1583
+ balance: proof.balance ? BigInt(proof.balance) : void 0,
1584
+ nonce: proof.nonce ? hexToNumber(proof.nonce) : void 0,
1585
+ storageProof: proof.storageProof ? formatStorageProof(proof.storageProof) : void 0
1586
+ };
1587
+ }
1588
+ async function getProof(client, { address, blockNumber, blockTag: blockTag_, storageKeys }) {
1589
+ const blockTag = blockTag_ ?? "latest";
1590
+ const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
1591
+ const proof = await client.request({
1592
+ method: "eth_getProof",
1593
+ params: [address, storageKeys, blockNumberHex || blockTag]
1594
+ });
1595
+ return formatProof(proof);
1596
+ }
1597
+ async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
1598
+ const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
1599
+ const data = await client.request({
1600
+ method: "eth_getStorageAt",
1601
+ params: [address, slot, blockNumberHex || blockTag]
1602
+ });
1603
+ return data;
1604
+ }
1605
+ async function getTransactionConfirmations(client, { hash, transactionReceipt }) {
1606
+ const [blockNumber, transaction] = await Promise.all([
1607
+ getAction(client, getBlockNumber, "getBlockNumber")({}),
1608
+ hash ? getAction(client, getTransaction, "getTransaction")({ hash }) : void 0
1609
+ ]);
1610
+ const transactionBlockNumber = (transactionReceipt == null ? void 0 : transactionReceipt.blockNumber) || (transaction == null ? void 0 : transaction.blockNumber);
1611
+ if (!transactionBlockNumber)
1612
+ return 0n;
1613
+ return blockNumber - transactionBlockNumber + 1n;
1614
+ }
1615
+ async function simulateBlocks(client, parameters) {
1616
+ const { blockNumber, blockTag = client.experimental_blockTag ?? "latest", blocks, returnFullTransactions, traceTransfers, validation } = parameters;
1617
+ try {
1618
+ const blockStateCalls = [];
1619
+ for (const block2 of blocks) {
1620
+ const blockOverrides = block2.blockOverrides ? toRpc(block2.blockOverrides) : void 0;
1621
+ const calls = block2.calls.map((call_) => {
1622
+ const call2 = call_;
1623
+ const account = call2.account ? parseAccount(call2.account) : void 0;
1624
+ const data = call2.abi ? encodeFunctionData(call2) : call2.data;
1625
+ const request = {
1626
+ ...call2,
1627
+ account,
1628
+ data: call2.dataSuffix ? concat([data || "0x", call2.dataSuffix]) : data,
1629
+ from: call2.from ?? (account == null ? void 0 : account.address)
1630
+ };
1631
+ assertRequest(request);
1632
+ return formatTransactionRequest(request);
1633
+ });
1634
+ const stateOverrides = block2.stateOverrides ? serializeStateOverride(block2.stateOverrides) : void 0;
1635
+ blockStateCalls.push({
1636
+ blockOverrides,
1637
+ calls,
1638
+ stateOverrides
1639
+ });
1640
+ }
1641
+ const blockNumberHex = typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0;
1642
+ const block = blockNumberHex || blockTag;
1643
+ const result = await client.request({
1644
+ method: "eth_simulateV1",
1645
+ params: [
1646
+ { blockStateCalls, returnFullTransactions, traceTransfers, validation },
1647
+ block
1648
+ ]
1649
+ });
1650
+ return result.map((block2, i) => ({
1651
+ ...formatBlock(block2),
1652
+ calls: block2.calls.map((call2, j) => {
1653
+ var _a, _b;
1654
+ const { abi: abi2, args, functionName, to } = blocks[i].calls[j];
1655
+ const data = ((_a = call2.error) == null ? void 0 : _a.data) ?? call2.returnData;
1656
+ const gasUsed = BigInt(call2.gasUsed);
1657
+ const logs = (_b = call2.logs) == null ? void 0 : _b.map((log) => formatLog(log));
1658
+ const status = call2.status === "0x1" ? "success" : "failure";
1659
+ const result2 = abi2 && status === "success" && data !== "0x" ? decodeFunctionResult({
1660
+ abi: abi2,
1661
+ data,
1662
+ functionName
1663
+ }) : null;
1664
+ const error = (() => {
1665
+ var _a2;
1666
+ if (status === "success")
1667
+ return void 0;
1668
+ let error2;
1669
+ if (((_a2 = call2.error) == null ? void 0 : _a2.data) === "0x")
1670
+ error2 = new AbiDecodingZeroDataError();
1671
+ else if (call2.error)
1672
+ error2 = new RawContractError(call2.error);
1673
+ if (!error2)
1674
+ return void 0;
1675
+ return getContractError(error2, {
1676
+ abi: abi2 ?? [],
1677
+ address: to ?? "0x",
1678
+ args,
1679
+ functionName: functionName ?? "<unknown>"
1680
+ });
1681
+ })();
1682
+ return {
1683
+ data,
1684
+ gasUsed,
1685
+ logs,
1686
+ status,
1687
+ ...status === "success" ? {
1688
+ result: result2
1689
+ } : {
1690
+ error
1691
+ }
1692
+ };
1693
+ })
1694
+ }));
1695
+ } catch (e) {
1696
+ const cause = e;
1697
+ const error = getNodeError(cause, {});
1698
+ if (error instanceof UnknownNodeError)
1699
+ throw cause;
1700
+ throw error;
1701
+ }
1702
+ }
1703
+ function normalizeSignature(signature) {
1704
+ let active = true;
1705
+ let current = "";
1706
+ let level = 0;
1707
+ let result = "";
1708
+ let valid = false;
1709
+ for (let i = 0; i < signature.length; i++) {
1710
+ const char = signature[i];
1711
+ if (["(", ")", ","].includes(char))
1712
+ active = true;
1713
+ if (char === "(")
1714
+ level++;
1715
+ if (char === ")")
1716
+ level--;
1717
+ if (!active)
1718
+ continue;
1719
+ if (level === 0) {
1720
+ if (char === " " && ["event", "function", "error", ""].includes(result))
1721
+ result = "";
1722
+ else {
1723
+ result += char;
1724
+ if (char === ")") {
1725
+ valid = true;
1726
+ break;
1727
+ }
1728
+ }
1729
+ continue;
1730
+ }
1731
+ if (char === " ") {
1732
+ if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
1733
+ current = "";
1734
+ active = false;
1735
+ }
1736
+ continue;
1737
+ }
1738
+ result += char;
1739
+ current += char;
1740
+ }
1741
+ if (!valid)
1742
+ throw new BaseError$1("Unable to normalize signature.");
1743
+ return result;
1744
+ }
1745
+ function isArgOfType(arg, abiParameter) {
1746
+ const argType = typeof arg;
1747
+ const abiParameterType = abiParameter.type;
1748
+ switch (abiParameterType) {
1749
+ case "address":
1750
+ return validate(arg, { strict: false });
1751
+ case "bool":
1752
+ return argType === "boolean";
1753
+ case "function":
1754
+ return argType === "string";
1755
+ case "string":
1756
+ return argType === "string";
1757
+ default: {
1758
+ if (abiParameterType === "tuple" && "components" in abiParameter)
1759
+ return Object.values(abiParameter.components).every((component, index) => {
1760
+ return isArgOfType(Object.values(arg)[index], component);
1761
+ });
1762
+ if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(abiParameterType))
1763
+ return argType === "number" || argType === "bigint";
1764
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
1765
+ return argType === "string" || arg instanceof Uint8Array;
1766
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
1767
+ return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
1768
+ ...abiParameter,
1769
+ // Pop off `[]` or `[M]` from end of type
1770
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
1771
+ }));
1772
+ }
1773
+ return false;
1774
+ }
1775
+ }
1776
+ }
1777
+ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
1778
+ for (const parameterIndex in sourceParameters) {
1779
+ const sourceParameter = sourceParameters[parameterIndex];
1780
+ const targetParameter = targetParameters[parameterIndex];
1781
+ if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter)
1782
+ return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);
1783
+ const types = [sourceParameter.type, targetParameter.type];
1784
+ const ambiguous = (() => {
1785
+ if (types.includes("address") && types.includes("bytes20"))
1786
+ return true;
1787
+ if (types.includes("address") && types.includes("string"))
1788
+ return validate(args[parameterIndex], {
1789
+ strict: false
1790
+ });
1791
+ if (types.includes("address") && types.includes("bytes"))
1792
+ return validate(args[parameterIndex], {
1793
+ strict: false
1794
+ });
1795
+ return false;
1796
+ })();
1797
+ if (ambiguous)
1798
+ return types;
1799
+ }
1800
+ return;
1801
+ }
1802
+ function from$2(abiItem, options = {}) {
1803
+ const { prepare = true } = options;
1804
+ const item = (() => {
1805
+ if (Array.isArray(abiItem))
1806
+ return parseAbiItem(abiItem);
1807
+ if (typeof abiItem === "string")
1808
+ return parseAbiItem(abiItem);
1809
+ return abiItem;
1810
+ })();
1811
+ return {
1812
+ ...item,
1813
+ ...prepare ? { hash: getSignatureHash(item) } : {}
1814
+ };
1815
+ }
1816
+ function fromAbi$2(abi2, name, options) {
1817
+ const { args = [], prepare = true } = options ?? {};
1818
+ const isSelector = validate$1(name, { strict: false });
1819
+ const abiItems = abi2.filter((abiItem2) => {
1820
+ if (isSelector) {
1821
+ if (abiItem2.type === "function" || abiItem2.type === "error")
1822
+ return getSelector$1(abiItem2) === slice(name, 0, 4);
1823
+ if (abiItem2.type === "event")
1824
+ return getSignatureHash(abiItem2) === name;
1825
+ return false;
1826
+ }
1827
+ return "name" in abiItem2 && abiItem2.name === name;
1828
+ });
1829
+ if (abiItems.length === 0)
1830
+ throw new NotFoundError({ name });
1831
+ if (abiItems.length === 1)
1832
+ return {
1833
+ ...abiItems[0],
1834
+ ...prepare ? { hash: getSignatureHash(abiItems[0]) } : {}
1835
+ };
1836
+ let matchedAbiItem;
1837
+ for (const abiItem2 of abiItems) {
1838
+ if (!("inputs" in abiItem2))
1839
+ continue;
1840
+ if (!args || args.length === 0) {
1841
+ if (!abiItem2.inputs || abiItem2.inputs.length === 0)
1842
+ return {
1843
+ ...abiItem2,
1844
+ ...prepare ? { hash: getSignatureHash(abiItem2) } : {}
1845
+ };
1846
+ continue;
1847
+ }
1848
+ if (!abiItem2.inputs)
1849
+ continue;
1850
+ if (abiItem2.inputs.length === 0)
1851
+ continue;
1852
+ if (abiItem2.inputs.length !== args.length)
1853
+ continue;
1854
+ const matched = args.every((arg, index) => {
1855
+ const abiParameter = "inputs" in abiItem2 && abiItem2.inputs[index];
1856
+ if (!abiParameter)
1857
+ return false;
1858
+ return isArgOfType(arg, abiParameter);
1859
+ });
1860
+ if (matched) {
1861
+ if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
1862
+ const ambiguousTypes = getAmbiguousTypes(abiItem2.inputs, matchedAbiItem.inputs, args);
1863
+ if (ambiguousTypes)
1864
+ throw new AmbiguityError({
1865
+ abiItem: abiItem2,
1866
+ type: ambiguousTypes[0]
1867
+ }, {
1868
+ abiItem: matchedAbiItem,
1869
+ type: ambiguousTypes[1]
1870
+ });
1871
+ }
1872
+ matchedAbiItem = abiItem2;
1873
+ }
1874
+ }
1875
+ const abiItem = (() => {
1876
+ if (matchedAbiItem)
1877
+ return matchedAbiItem;
1878
+ const [abiItem2, ...overloads] = abiItems;
1879
+ return { ...abiItem2, overloads };
1880
+ })();
1881
+ if (!abiItem)
1882
+ throw new NotFoundError({ name });
1883
+ return {
1884
+ ...abiItem,
1885
+ ...prepare ? { hash: getSignatureHash(abiItem) } : {}
1886
+ };
1887
+ }
1888
+ function getSelector$1(...parameters) {
1889
+ const abiItem = (() => {
1890
+ if (Array.isArray(parameters[0])) {
1891
+ const [abi2, name] = parameters;
1892
+ return fromAbi$2(abi2, name);
1893
+ }
1894
+ return parameters[0];
1895
+ })();
1896
+ return slice(getSignatureHash(abiItem), 0, 4);
1897
+ }
1898
+ function getSignature(...parameters) {
1899
+ const abiItem = (() => {
1900
+ if (Array.isArray(parameters[0])) {
1901
+ const [abi2, name] = parameters;
1902
+ return fromAbi$2(abi2, name);
1903
+ }
1904
+ return parameters[0];
1905
+ })();
1906
+ const signature = (() => {
1907
+ if (typeof abiItem === "string")
1908
+ return abiItem;
1909
+ return formatAbiItem$1(abiItem);
1910
+ })();
1911
+ return normalizeSignature(signature);
1912
+ }
1913
+ function getSignatureHash(...parameters) {
1914
+ const abiItem = (() => {
1915
+ if (Array.isArray(parameters[0])) {
1916
+ const [abi2, name] = parameters;
1917
+ return fromAbi$2(abi2, name);
1918
+ }
1919
+ return parameters[0];
1920
+ })();
1921
+ if (typeof abiItem !== "string" && "hash" in abiItem && abiItem.hash)
1922
+ return abiItem.hash;
1923
+ return keccak256$1(fromString(getSignature(abiItem)));
1924
+ }
1925
+ class AmbiguityError extends BaseError$1 {
1926
+ constructor(x, y) {
1927
+ super("Found ambiguous types in overloaded ABI Items.", {
1928
+ metaMessages: [
1929
+ // TODO: abitype to add support for signature-formatted ABI items.
1930
+ `\`${x.type}\` in \`${normalizeSignature(formatAbiItem$1(x.abiItem))}\`, and`,
1931
+ `\`${y.type}\` in \`${normalizeSignature(formatAbiItem$1(y.abiItem))}\``,
1932
+ "",
1933
+ "These types encode differently and cannot be distinguished at runtime.",
1934
+ "Remove one of the ambiguous items in the ABI."
1935
+ ]
1936
+ });
1937
+ Object.defineProperty(this, "name", {
1938
+ enumerable: true,
1939
+ configurable: true,
1940
+ writable: true,
1941
+ value: "AbiItem.AmbiguityError"
1942
+ });
1943
+ }
1944
+ }
1945
+ class NotFoundError extends BaseError$1 {
1946
+ constructor({ name, data, type = "item" }) {
1947
+ const selector = (() => {
1948
+ if (name)
1949
+ return ` with name "${name}"`;
1950
+ if (data)
1951
+ return ` with data "${data}"`;
1952
+ return "";
1953
+ })();
1954
+ super(`ABI ${type}${selector} not found.`);
1955
+ Object.defineProperty(this, "name", {
1956
+ enumerable: true,
1957
+ configurable: true,
1958
+ writable: true,
1959
+ value: "AbiItem.NotFoundError"
1960
+ });
1961
+ }
1962
+ }
1963
+ function encode(...parameters) {
1964
+ var _a;
1965
+ const [abiConstructor, options] = (() => {
1966
+ if (Array.isArray(parameters[0])) {
1967
+ const [abi2, options2] = parameters;
1968
+ return [fromAbi$1(abi2), options2];
1969
+ }
1970
+ return parameters;
1971
+ })();
1972
+ const { bytecode, args } = options;
1973
+ return concat$1(bytecode, ((_a = abiConstructor.inputs) == null ? void 0 : _a.length) && (args == null ? void 0 : args.length) ? encode$2(abiConstructor.inputs, args) : "0x");
1974
+ }
1975
+ function from$1(abiConstructor) {
1976
+ return from$2(abiConstructor);
1977
+ }
1978
+ function fromAbi$1(abi2) {
1979
+ const item = abi2.find((item2) => item2.type === "constructor");
1980
+ if (!item)
1981
+ throw new NotFoundError({ name: "constructor" });
1982
+ return item;
1983
+ }
1984
+ function encodeData(...parameters) {
1985
+ const [abiFunction, args = []] = (() => {
1986
+ if (Array.isArray(parameters[0])) {
1987
+ const [abi2, name, args3] = parameters;
1988
+ return [fromAbi(abi2, name, { args: args3 }), args3];
1989
+ }
1990
+ const [abiFunction2, args2] = parameters;
1991
+ return [abiFunction2, args2];
1992
+ })();
1993
+ const { overloads } = abiFunction;
1994
+ const item = overloads ? fromAbi([abiFunction, ...overloads], abiFunction.name, {
1995
+ args
1996
+ }) : abiFunction;
1997
+ const selector = getSelector(item);
1998
+ const data = args.length > 0 ? encode$2(item.inputs, args) : void 0;
1999
+ return data ? concat$1(selector, data) : selector;
2000
+ }
2001
+ function from(abiFunction, options = {}) {
2002
+ return from$2(abiFunction, options);
2003
+ }
2004
+ function fromAbi(abi2, name, options) {
2005
+ const item = fromAbi$2(abi2, name, options);
2006
+ if (item.type !== "function")
2007
+ throw new NotFoundError({ name, type: "function" });
2008
+ return item;
2009
+ }
2010
+ function getSelector(abiItem) {
2011
+ return getSelector$1(abiItem);
2012
+ }
2013
+ const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
2014
+ const zeroAddress = "0x0000000000000000000000000000000000000000";
2015
+ const getBalanceCode = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";
2016
+ async function simulateCalls(client, parameters) {
2017
+ const { blockNumber, blockTag, calls, stateOverrides, traceAssetChanges, traceTransfers, validation } = parameters;
2018
+ const account = parameters.account ? parseAccount(parameters.account) : void 0;
2019
+ if (traceAssetChanges && !account)
2020
+ throw new BaseError("`account` is required when `traceAssetChanges` is true");
2021
+ const getBalanceData = account ? encode(from$1("constructor(bytes, bytes)"), {
2022
+ bytecode: deploylessCallViaBytecodeBytecode,
2023
+ args: [
2024
+ getBalanceCode,
2025
+ encodeData(from("function getBalance(address)"), [account.address])
2026
+ ]
2027
+ }) : void 0;
2028
+ const assetAddresses = traceAssetChanges ? await Promise.all(parameters.calls.map(async (call2) => {
2029
+ if (!call2.data && !call2.abi)
2030
+ return;
2031
+ const { accessList } = await createAccessList(client, {
2032
+ account: account.address,
2033
+ ...call2,
2034
+ data: call2.abi ? encodeFunctionData(call2) : call2.data
2035
+ });
2036
+ return accessList.map(({ address, storageKeys }) => storageKeys.length > 0 ? address : null);
2037
+ })).then((x) => x.flat().filter(Boolean)) : [];
2038
+ const blocks = await simulateBlocks(client, {
2039
+ blockNumber,
2040
+ blockTag,
2041
+ blocks: [
2042
+ ...traceAssetChanges ? [
2043
+ // ETH pre balances
2044
+ {
2045
+ calls: [{ data: getBalanceData }],
2046
+ stateOverrides
2047
+ },
2048
+ // Asset pre balances
2049
+ {
2050
+ calls: assetAddresses.map((address, i) => ({
2051
+ abi: [
2052
+ from("function balanceOf(address) returns (uint256)")
2053
+ ],
2054
+ functionName: "balanceOf",
2055
+ args: [account.address],
2056
+ to: address,
2057
+ from: zeroAddress,
2058
+ nonce: i
2059
+ })),
2060
+ stateOverrides: [
2061
+ {
2062
+ address: zeroAddress,
2063
+ nonce: 0
2064
+ }
2065
+ ]
2066
+ }
2067
+ ] : [],
2068
+ {
2069
+ calls: [...calls, {}].map((call2) => ({
2070
+ ...call2,
2071
+ from: account == null ? void 0 : account.address
2072
+ })),
2073
+ stateOverrides
2074
+ },
2075
+ ...traceAssetChanges ? [
2076
+ // ETH post balances
2077
+ {
2078
+ calls: [{ data: getBalanceData }]
2079
+ },
2080
+ // Asset post balances
2081
+ {
2082
+ calls: assetAddresses.map((address, i) => ({
2083
+ abi: [
2084
+ from("function balanceOf(address) returns (uint256)")
2085
+ ],
2086
+ functionName: "balanceOf",
2087
+ args: [account.address],
2088
+ to: address,
2089
+ from: zeroAddress,
2090
+ nonce: i
2091
+ })),
2092
+ stateOverrides: [
2093
+ {
2094
+ address: zeroAddress,
2095
+ nonce: 0
2096
+ }
2097
+ ]
2098
+ },
2099
+ // Decimals
2100
+ {
2101
+ calls: assetAddresses.map((address, i) => ({
2102
+ to: address,
2103
+ abi: [
2104
+ from("function decimals() returns (uint256)")
2105
+ ],
2106
+ functionName: "decimals",
2107
+ from: zeroAddress,
2108
+ nonce: i
2109
+ })),
2110
+ stateOverrides: [
2111
+ {
2112
+ address: zeroAddress,
2113
+ nonce: 0
2114
+ }
2115
+ ]
2116
+ },
2117
+ // Token URI
2118
+ {
2119
+ calls: assetAddresses.map((address, i) => ({
2120
+ to: address,
2121
+ abi: [
2122
+ from("function tokenURI(uint256) returns (string)")
2123
+ ],
2124
+ functionName: "tokenURI",
2125
+ args: [0n],
2126
+ from: zeroAddress,
2127
+ nonce: i
2128
+ })),
2129
+ stateOverrides: [
2130
+ {
2131
+ address: zeroAddress,
2132
+ nonce: 0
2133
+ }
2134
+ ]
2135
+ },
2136
+ // Symbols
2137
+ {
2138
+ calls: assetAddresses.map((address, i) => ({
2139
+ to: address,
2140
+ abi: [from("function symbol() returns (string)")],
2141
+ functionName: "symbol",
2142
+ from: zeroAddress,
2143
+ nonce: i
2144
+ })),
2145
+ stateOverrides: [
2146
+ {
2147
+ address: zeroAddress,
2148
+ nonce: 0
2149
+ }
2150
+ ]
2151
+ }
2152
+ ] : []
2153
+ ],
2154
+ traceTransfers,
2155
+ validation
2156
+ });
2157
+ const block_results = traceAssetChanges ? blocks[2] : blocks[0];
2158
+ const [block_ethPre, block_assetsPre, , block_ethPost, block_assetsPost, block_decimals, block_tokenURI, block_symbols] = traceAssetChanges ? blocks : [];
2159
+ const { calls: block_calls, ...block } = block_results;
2160
+ const results = block_calls.slice(0, -1) ?? [];
2161
+ const ethPre = (block_ethPre == null ? void 0 : block_ethPre.calls) ?? [];
2162
+ const assetsPre = (block_assetsPre == null ? void 0 : block_assetsPre.calls) ?? [];
2163
+ const balancesPre = [...ethPre, ...assetsPre].map((call2) => call2.status === "success" ? hexToBigInt(call2.data) : null);
2164
+ const ethPost = (block_ethPost == null ? void 0 : block_ethPost.calls) ?? [];
2165
+ const assetsPost = (block_assetsPost == null ? void 0 : block_assetsPost.calls) ?? [];
2166
+ const balancesPost = [...ethPost, ...assetsPost].map((call2) => call2.status === "success" ? hexToBigInt(call2.data) : null);
2167
+ const decimals = ((block_decimals == null ? void 0 : block_decimals.calls) ?? []).map((x) => x.status === "success" ? x.result : null);
2168
+ const symbols = ((block_symbols == null ? void 0 : block_symbols.calls) ?? []).map((x) => x.status === "success" ? x.result : null);
2169
+ const tokenURI = ((block_tokenURI == null ? void 0 : block_tokenURI.calls) ?? []).map((x) => x.status === "success" ? x.result : null);
2170
+ const changes = [];
2171
+ for (const [i, balancePost] of balancesPost.entries()) {
2172
+ const balancePre = balancesPre[i];
2173
+ if (typeof balancePost !== "bigint")
2174
+ continue;
2175
+ if (typeof balancePre !== "bigint")
2176
+ continue;
2177
+ const decimals_ = decimals[i - 1];
2178
+ const symbol_ = symbols[i - 1];
2179
+ const tokenURI_ = tokenURI[i - 1];
2180
+ const token = (() => {
2181
+ if (i === 0)
2182
+ return {
2183
+ address: ethAddress,
2184
+ decimals: 18,
2185
+ symbol: "ETH"
2186
+ };
2187
+ return {
2188
+ address: assetAddresses[i - 1],
2189
+ decimals: tokenURI_ || decimals_ ? Number(decimals_ ?? 1) : void 0,
2190
+ symbol: symbol_ ?? void 0
2191
+ };
2192
+ })();
2193
+ if (changes.some((change) => change.token.address === token.address))
2194
+ continue;
2195
+ changes.push({
2196
+ token,
2197
+ value: {
2198
+ pre: balancePre,
2199
+ post: balancePost,
2200
+ diff: balancePost - balancePre
2201
+ }
2202
+ });
2203
+ }
2204
+ return {
2205
+ assetChanges: changes,
2206
+ block,
2207
+ results
2208
+ };
2209
+ }
2210
+ async function verifyMessage(client, { address, message, factory, factoryData, signature, ...callRequest }) {
2211
+ const hash = hashMessage(message);
2212
+ return getAction(client, verifyHash, "verifyHash")({
2213
+ address,
2214
+ factory,
2215
+ factoryData,
2216
+ hash,
2217
+ signature,
2218
+ ...callRequest
2219
+ });
2220
+ }
2221
+ async function verifyTypedData(client, parameters) {
2222
+ const { address, factory, factoryData, signature, message, primaryType, types, domain, ...callRequest } = parameters;
2223
+ const hash = hashTypedData({ message, primaryType, types, domain });
2224
+ return getAction(client, verifyHash, "verifyHash")({
2225
+ address,
2226
+ factory,
2227
+ factoryData,
2228
+ hash,
2229
+ signature,
2230
+ ...callRequest
2231
+ });
2232
+ }
2233
+ function watchBlocks(client, { blockTag = client.experimental_blockTag ?? "latest", emitMissed = false, emitOnBegin = false, onBlock, onError, includeTransactions: includeTransactions_, poll: poll_, pollingInterval = client.pollingInterval }) {
2234
+ const enablePolling = (() => {
2235
+ if (typeof poll_ !== "undefined")
2236
+ return poll_;
2237
+ if (client.transport.type === "webSocket" || client.transport.type === "ipc")
2238
+ return false;
2239
+ if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
2240
+ return false;
2241
+ return true;
2242
+ })();
2243
+ const includeTransactions = includeTransactions_ ?? false;
2244
+ let prevBlock;
2245
+ const pollBlocks = () => {
2246
+ const observerId = stringify([
2247
+ "watchBlocks",
2248
+ client.uid,
2249
+ blockTag,
2250
+ emitMissed,
2251
+ emitOnBegin,
2252
+ includeTransactions,
2253
+ pollingInterval
2254
+ ]);
2255
+ return observe(observerId, { onBlock, onError }, (emit) => poll(async () => {
2256
+ var _a;
2257
+ try {
2258
+ const block = await getAction(client, getBlock, "getBlock")({
2259
+ blockTag,
2260
+ includeTransactions
2261
+ });
2262
+ if (block.number !== null && (prevBlock == null ? void 0 : prevBlock.number) != null) {
2263
+ if (block.number === prevBlock.number)
2264
+ return;
2265
+ if (block.number - prevBlock.number > 1 && emitMissed) {
2266
+ for (let i = (prevBlock == null ? void 0 : prevBlock.number) + 1n; i < block.number; i++) {
2267
+ const block2 = await getAction(client, getBlock, "getBlock")({
2268
+ blockNumber: i,
2269
+ includeTransactions
2270
+ });
2271
+ emit.onBlock(block2, prevBlock);
2272
+ prevBlock = block2;
2273
+ }
2274
+ }
2275
+ }
2276
+ if (
2277
+ // If no previous block exists, emit.
2278
+ (prevBlock == null ? void 0 : prevBlock.number) == null || // If the block tag is "pending" with no block number, emit.
2279
+ blockTag === "pending" && (block == null ? void 0 : block.number) == null || // If the next block number is greater than the previous block number, emit.
2280
+ // We don't want to emit blocks in the past.
2281
+ block.number !== null && block.number > prevBlock.number
2282
+ ) {
2283
+ emit.onBlock(block, prevBlock);
2284
+ prevBlock = block;
2285
+ }
2286
+ } catch (err) {
2287
+ (_a = emit.onError) == null ? void 0 : _a.call(emit, err);
2288
+ }
2289
+ }, {
2290
+ emitOnBegin,
2291
+ interval: pollingInterval
2292
+ }));
2293
+ };
2294
+ const subscribeBlocks = () => {
2295
+ let active = true;
2296
+ let emitFetched = true;
2297
+ let unsubscribe = () => active = false;
2298
+ (async () => {
2299
+ try {
2300
+ if (emitOnBegin) {
2301
+ getAction(client, getBlock, "getBlock")({
2302
+ blockTag,
2303
+ includeTransactions
2304
+ }).then((block) => {
2305
+ if (!active)
2306
+ return;
2307
+ if (!emitFetched)
2308
+ return;
2309
+ onBlock(block, void 0);
2310
+ emitFetched = false;
2311
+ }).catch(onError);
2312
+ }
2313
+ const transport = (() => {
2314
+ if (client.transport.type === "fallback") {
2315
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
2316
+ if (!transport2)
2317
+ return client.transport;
2318
+ return transport2.value;
2319
+ }
2320
+ return client.transport;
2321
+ })();
2322
+ const { unsubscribe: unsubscribe_ } = await transport.subscribe({
2323
+ params: ["newHeads"],
2324
+ async onData(data) {
2325
+ var _a;
2326
+ if (!active)
2327
+ return;
2328
+ const block = await getAction(client, getBlock, "getBlock")({
2329
+ blockNumber: (_a = data.result) == null ? void 0 : _a.number,
2330
+ includeTransactions
2331
+ }).catch(() => {
2332
+ });
2333
+ if (!active)
2334
+ return;
2335
+ onBlock(block, prevBlock);
2336
+ emitFetched = false;
2337
+ prevBlock = block;
2338
+ },
2339
+ onError(error) {
2340
+ onError == null ? void 0 : onError(error);
2341
+ }
2342
+ });
2343
+ unsubscribe = unsubscribe_;
2344
+ if (!active)
2345
+ unsubscribe();
2346
+ } catch (err) {
2347
+ onError == null ? void 0 : onError(err);
2348
+ }
2349
+ })();
2350
+ return () => unsubscribe();
2351
+ };
2352
+ return enablePolling ? pollBlocks() : subscribeBlocks();
2353
+ }
2354
+ function watchEvent(client, { address, args, batch = true, event, events, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ }) {
2355
+ const enablePolling = (() => {
2356
+ if (typeof poll_ !== "undefined")
2357
+ return poll_;
2358
+ if (typeof fromBlock === "bigint")
2359
+ return true;
2360
+ if (client.transport.type === "webSocket" || client.transport.type === "ipc")
2361
+ return false;
2362
+ if (client.transport.type === "fallback" && (client.transport.transports[0].config.type === "webSocket" || client.transport.transports[0].config.type === "ipc"))
2363
+ return false;
2364
+ return true;
2365
+ })();
2366
+ const strict = strict_ ?? false;
2367
+ const pollEvent = () => {
2368
+ const observerId = stringify([
2369
+ "watchEvent",
2370
+ address,
2371
+ args,
2372
+ batch,
2373
+ client.uid,
2374
+ event,
2375
+ pollingInterval,
2376
+ fromBlock
2377
+ ]);
2378
+ return observe(observerId, { onLogs, onError }, (emit) => {
2379
+ let previousBlockNumber;
2380
+ if (fromBlock !== void 0)
2381
+ previousBlockNumber = fromBlock - 1n;
2382
+ let filter;
2383
+ let initialized = false;
2384
+ const unwatch = poll(async () => {
2385
+ var _a;
2386
+ if (!initialized) {
2387
+ try {
2388
+ filter = await getAction(client, createEventFilter, "createEventFilter")({
2389
+ address,
2390
+ args,
2391
+ event,
2392
+ events,
2393
+ strict,
2394
+ fromBlock
2395
+ });
2396
+ } catch {
2397
+ }
2398
+ initialized = true;
2399
+ return;
2400
+ }
2401
+ try {
2402
+ let logs;
2403
+ if (filter) {
2404
+ logs = await getAction(client, getFilterChanges, "getFilterChanges")({ filter });
2405
+ } else {
2406
+ const blockNumber = await getAction(client, getBlockNumber, "getBlockNumber")({});
2407
+ if (previousBlockNumber && previousBlockNumber !== blockNumber) {
2408
+ logs = await getAction(client, getLogs, "getLogs")({
2409
+ address,
2410
+ args,
2411
+ event,
2412
+ events,
2413
+ fromBlock: previousBlockNumber + 1n,
2414
+ toBlock: blockNumber
2415
+ });
2416
+ } else {
2417
+ logs = [];
2418
+ }
2419
+ previousBlockNumber = blockNumber;
2420
+ }
2421
+ if (logs.length === 0)
2422
+ return;
2423
+ if (batch)
2424
+ emit.onLogs(logs);
2425
+ else
2426
+ for (const log of logs)
2427
+ emit.onLogs([log]);
2428
+ } catch (err) {
2429
+ if (filter && err instanceof InvalidInputRpcError)
2430
+ initialized = false;
2431
+ (_a = emit.onError) == null ? void 0 : _a.call(emit, err);
2432
+ }
2433
+ }, {
2434
+ emitOnBegin: true,
2435
+ interval: pollingInterval
2436
+ });
2437
+ return async () => {
2438
+ if (filter)
2439
+ await getAction(client, uninstallFilter, "uninstallFilter")({ filter });
2440
+ unwatch();
2441
+ };
2442
+ });
2443
+ };
2444
+ const subscribeEvent = () => {
2445
+ let active = true;
2446
+ let unsubscribe = () => active = false;
2447
+ (async () => {
2448
+ try {
2449
+ const transport = (() => {
2450
+ if (client.transport.type === "fallback") {
2451
+ const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
2452
+ if (!transport2)
2453
+ return client.transport;
2454
+ return transport2.value;
2455
+ }
2456
+ return client.transport;
2457
+ })();
2458
+ const events_ = events ?? (event ? [event] : void 0);
2459
+ let topics = [];
2460
+ if (events_) {
2461
+ const encoded = events_.flatMap((event2) => encodeEventTopics({
2462
+ abi: [event2],
2463
+ eventName: event2.name,
2464
+ args
2465
+ }));
2466
+ topics = [encoded];
2467
+ if (event)
2468
+ topics = topics[0];
2469
+ }
2470
+ const { unsubscribe: unsubscribe_ } = await transport.subscribe({
2471
+ params: ["logs", { address, topics }],
2472
+ onData(data) {
2473
+ var _a;
2474
+ if (!active)
2475
+ return;
2476
+ const log = data.result;
2477
+ try {
2478
+ const { eventName, args: args2 } = decodeEventLog({
2479
+ abi: events_ ?? [],
2480
+ data: log.data,
2481
+ topics: log.topics,
2482
+ strict
2483
+ });
2484
+ const formatted = formatLog(log, { args: args2, eventName });
2485
+ onLogs([formatted]);
2486
+ } catch (err) {
2487
+ let eventName;
2488
+ let isUnnamed;
2489
+ if (err instanceof DecodeLogDataMismatch || err instanceof DecodeLogTopicsMismatch) {
2490
+ if (strict_)
2491
+ return;
2492
+ eventName = err.abiItem.name;
2493
+ isUnnamed = (_a = err.abiItem.inputs) == null ? void 0 : _a.some((x) => !("name" in x && x.name));
2494
+ }
2495
+ const formatted = formatLog(log, {
2496
+ args: isUnnamed ? [] : {},
2497
+ eventName
2498
+ });
2499
+ onLogs([formatted]);
2500
+ }
2501
+ },
2502
+ onError(error) {
2503
+ onError == null ? void 0 : onError(error);
2504
+ }
2505
+ });
2506
+ unsubscribe = unsubscribe_;
2507
+ if (!active)
2508
+ unsubscribe();
2509
+ } catch (err) {
2510
+ onError == null ? void 0 : onError(err);
2511
+ }
2512
+ })();
2513
+ return () => unsubscribe();
2514
+ };
2515
+ return enablePolling ? pollEvent() : subscribeEvent();
2516
+ }
2517
+ function parseSiweMessage(message) {
2518
+ var _a, _b, _c;
2519
+ const { scheme, statement, ...prefix } = ((_a = message.match(prefixRegex)) == null ? void 0 : _a.groups) ?? {};
2520
+ const { chainId, expirationTime, issuedAt, notBefore, requestId, ...suffix } = ((_b = message.match(suffixRegex)) == null ? void 0 : _b.groups) ?? {};
2521
+ const resources = (_c = message.split("Resources:")[1]) == null ? void 0 : _c.split("\n- ").slice(1);
2522
+ return {
2523
+ ...prefix,
2524
+ ...suffix,
2525
+ ...chainId ? { chainId: Number(chainId) } : {},
2526
+ ...expirationTime ? { expirationTime: new Date(expirationTime) } : {},
2527
+ ...issuedAt ? { issuedAt: new Date(issuedAt) } : {},
2528
+ ...notBefore ? { notBefore: new Date(notBefore) } : {},
2529
+ ...requestId ? { requestId } : {},
2530
+ ...resources ? { resources } : {},
2531
+ ...scheme ? { scheme } : {},
2532
+ ...statement ? { statement } : {}
2533
+ };
2534
+ }
2535
+ const prefixRegex = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/;
2536
+ const suffixRegex = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
2537
+ function validateSiweMessage(parameters) {
2538
+ const { address, domain, message, nonce, scheme, time = /* @__PURE__ */ new Date() } = parameters;
2539
+ if (domain && message.domain !== domain)
2540
+ return false;
2541
+ if (nonce && message.nonce !== nonce)
2542
+ return false;
2543
+ if (scheme && message.scheme !== scheme)
2544
+ return false;
2545
+ if (message.expirationTime && time >= message.expirationTime)
2546
+ return false;
2547
+ if (message.notBefore && time < message.notBefore)
2548
+ return false;
2549
+ try {
2550
+ if (!message.address)
2551
+ return false;
2552
+ if (!isAddress(message.address, { strict: false }))
2553
+ return false;
2554
+ if (address && !isAddressEqual(message.address, address))
2555
+ return false;
2556
+ } catch {
2557
+ return false;
2558
+ }
2559
+ return true;
2560
+ }
2561
+ async function verifySiweMessage(client, parameters) {
2562
+ const { address, domain, message, nonce, scheme, signature, time = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
2563
+ const parsed = parseSiweMessage(message);
2564
+ if (!parsed.address)
2565
+ return false;
2566
+ const isValid = validateSiweMessage({
2567
+ address,
2568
+ domain,
2569
+ message: parsed,
2570
+ nonce,
2571
+ scheme,
2572
+ time
2573
+ });
2574
+ if (!isValid)
2575
+ return false;
2576
+ const hash = hashMessage(message);
2577
+ return verifyHash(client, {
2578
+ address: parsed.address,
2579
+ hash,
2580
+ signature,
2581
+ ...callRequest
2582
+ });
2583
+ }
2584
+ async function sendRawTransactionSync(client, { serializedTransaction, throwOnReceiptRevert, timeout }) {
2585
+ var _a, _b, _c;
2586
+ const receipt = await client.request({
2587
+ method: "eth_sendRawTransactionSync",
2588
+ params: timeout ? [serializedTransaction, numberToHex(timeout)] : [serializedTransaction]
2589
+ }, { retryCount: 0 });
2590
+ const format = ((_c = (_b = (_a = client.chain) == null ? void 0 : _a.formatters) == null ? void 0 : _b.transactionReceipt) == null ? void 0 : _c.format) || formatTransactionReceipt;
2591
+ const formatted = format(receipt);
2592
+ if (formatted.status === "reverted" && throwOnReceiptRevert)
2593
+ throw new TransactionReceiptRevertedError({ receipt: formatted });
2594
+ return formatted;
2595
+ }
2596
+ function publicActions(client) {
2597
+ return {
2598
+ call: (args) => call(client, args),
2599
+ createAccessList: (args) => createAccessList(client, args),
2600
+ createBlockFilter: () => createBlockFilter(client),
2601
+ createContractEventFilter: (args) => createContractEventFilter(client, args),
2602
+ createEventFilter: (args) => createEventFilter(client, args),
2603
+ createPendingTransactionFilter: () => createPendingTransactionFilter(client),
2604
+ estimateContractGas: (args) => estimateContractGas(client, args),
2605
+ estimateGas: (args) => estimateGas(client, args),
2606
+ getBalance: (args) => getBalance(client, args),
2607
+ getBlobBaseFee: () => getBlobBaseFee(client),
2608
+ getBlock: (args) => getBlock(client, args),
2609
+ getBlockNumber: (args) => getBlockNumber(client, args),
2610
+ getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
2611
+ getBytecode: (args) => getCode(client, args),
2612
+ getChainId: () => getChainId(client),
2613
+ getCode: (args) => getCode(client, args),
2614
+ getContractEvents: (args) => getContractEvents(client, args),
2615
+ getEip712Domain: (args) => getEip712Domain(client, args),
2616
+ getEnsAddress: (args) => getEnsAddress(client, args),
2617
+ getEnsAvatar: (args) => getEnsAvatar(client, args),
2618
+ getEnsName: (args) => getEnsName(client, args),
2619
+ getEnsResolver: (args) => getEnsResolver(client, args),
2620
+ getEnsText: (args) => getEnsText(client, args),
2621
+ getFeeHistory: (args) => getFeeHistory(client, args),
2622
+ estimateFeesPerGas: (args) => estimateFeesPerGas(client, args),
2623
+ getFilterChanges: (args) => getFilterChanges(client, args),
2624
+ getFilterLogs: (args) => getFilterLogs(client, args),
2625
+ getGasPrice: () => getGasPrice(client),
2626
+ getLogs: (args) => getLogs(client, args),
2627
+ getProof: (args) => getProof(client, args),
2628
+ estimateMaxPriorityFeePerGas: (args) => estimateMaxPriorityFeePerGas(client, args),
2629
+ fillTransaction: (args) => fillTransaction(client, args),
2630
+ getStorageAt: (args) => getStorageAt(client, args),
2631
+ getTransaction: (args) => getTransaction(client, args),
2632
+ getTransactionConfirmations: (args) => getTransactionConfirmations(client, args),
2633
+ getTransactionCount: (args) => getTransactionCount(client, args),
2634
+ getTransactionReceipt: (args) => getTransactionReceipt(client, args),
2635
+ multicall: (args) => multicall(client, args),
2636
+ prepareTransactionRequest: (args) => prepareTransactionRequest(client, args),
2637
+ readContract: (args) => readContract(client, args),
2638
+ sendRawTransaction: (args) => sendRawTransaction(client, args),
2639
+ sendRawTransactionSync: (args) => sendRawTransactionSync(client, args),
2640
+ simulate: (args) => simulateBlocks(client, args),
2641
+ simulateBlocks: (args) => simulateBlocks(client, args),
2642
+ simulateCalls: (args) => simulateCalls(client, args),
2643
+ simulateContract: (args) => simulateContract(client, args),
2644
+ verifyHash: (args) => verifyHash(client, args),
2645
+ verifyMessage: (args) => verifyMessage(client, args),
2646
+ verifySiweMessage: (args) => verifySiweMessage(client, args),
2647
+ verifyTypedData: (args) => verifyTypedData(client, args),
2648
+ uninstallFilter: (args) => uninstallFilter(client, args),
2649
+ waitForTransactionReceipt: (args) => waitForTransactionReceipt(client, args),
2650
+ watchBlocks: (args) => watchBlocks(client, args),
2651
+ watchBlockNumber: (args) => watchBlockNumber(client, args),
2652
+ watchContractEvent: (args) => watchContractEvent(client, args),
2653
+ watchEvent: (args) => watchEvent(client, args),
2654
+ watchPendingTransactions: (args) => watchPendingTransactions(client, args)
2655
+ };
2656
+ }
2657
+ function createPublicClient(parameters) {
2658
+ const { key = "public", name = "Public Client" } = parameters;
2659
+ const client = createClient({
2660
+ ...parameters,
2661
+ key,
2662
+ name,
2663
+ type: "publicClient"
2664
+ });
2665
+ return client.extend(publicActions);
2666
+ }
2667
+ async function prepareAuthorization(client, parameters) {
2668
+ var _a;
2669
+ const { account: account_ = client.account, chainId, nonce } = parameters;
2670
+ if (!account_)
2671
+ throw new AccountNotFoundError({
2672
+ docsPath: "/docs/eip7702/prepareAuthorization"
2673
+ });
2674
+ const account = parseAccount(account_);
2675
+ const executor = (() => {
2676
+ if (!parameters.executor)
2677
+ return void 0;
2678
+ if (parameters.executor === "self")
2679
+ return parameters.executor;
2680
+ return parseAccount(parameters.executor);
2681
+ })();
2682
+ const authorization = {
2683
+ address: parameters.contractAddress ?? parameters.address,
2684
+ chainId,
2685
+ nonce
2686
+ };
2687
+ if (typeof authorization.chainId === "undefined")
2688
+ authorization.chainId = ((_a = client.chain) == null ? void 0 : _a.id) ?? await getAction(client, getChainId, "getChainId")({});
2689
+ if (typeof authorization.nonce === "undefined") {
2690
+ authorization.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
2691
+ address: account.address,
2692
+ blockTag: "pending"
2693
+ });
2694
+ if (executor === "self" || (executor == null ? void 0 : executor.address) && isAddressEqual(executor.address, account.address))
2695
+ authorization.nonce += 1;
2696
+ }
2697
+ return authorization;
2698
+ }
2699
+ class UrlRequiredError extends BaseError {
2700
+ constructor() {
2701
+ super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.", {
2702
+ docsPath: "/docs/clients/intro",
2703
+ name: "UrlRequiredError"
2704
+ });
2705
+ }
2706
+ }
2707
+ function http(url, config = {}) {
2708
+ const { batch, fetchFn, fetchOptions, key = "http", methods, name = "HTTP JSON-RPC", onFetchRequest, onFetchResponse, retryDelay, raw } = config;
2709
+ return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {
2710
+ const { batchSize = 1e3, wait = 0 } = typeof batch === "object" ? batch : {};
2711
+ const retryCount = config.retryCount ?? retryCount_;
2712
+ const timeout = timeout_ ?? config.timeout ?? 1e4;
2713
+ const url_ = url || (chain == null ? void 0 : chain.rpcUrls.default.http[0]);
2714
+ if (!url_)
2715
+ throw new UrlRequiredError();
2716
+ const rpcClient = getHttpRpcClient(url_, {
2717
+ fetchFn,
2718
+ fetchOptions,
2719
+ onRequest: onFetchRequest,
2720
+ onResponse: onFetchResponse,
2721
+ timeout
2722
+ });
2723
+ return createTransport({
2724
+ key,
2725
+ methods,
2726
+ name,
2727
+ async request({ method, params }) {
2728
+ const body = { method, params };
2729
+ const { schedule } = createBatchScheduler({
2730
+ id: url_,
2731
+ wait,
2732
+ shouldSplitBatch(requests) {
2733
+ return requests.length > batchSize;
2734
+ },
2735
+ fn: (body2) => rpcClient.request({
2736
+ body: body2
2737
+ }),
2738
+ sort: (a, b) => a.id - b.id
2739
+ });
2740
+ const fn = async (body2) => batch ? schedule(body2) : [
2741
+ await rpcClient.request({
2742
+ body: body2
2743
+ })
2744
+ ];
2745
+ const [{ error, result }] = await fn(body);
2746
+ if (raw)
2747
+ return { error, result };
2748
+ if (error)
2749
+ throw new RpcRequestError({
2750
+ body,
2751
+ error,
2752
+ url: url_
2753
+ });
2754
+ return result;
2755
+ },
2756
+ retryCount,
2757
+ retryDelay,
2758
+ timeout,
2759
+ type: "http"
2760
+ }, {
2761
+ fetchOptions,
2762
+ url: url_
2763
+ });
2764
+ };
2765
+ }
2766
+ function parseSignature(signatureHex) {
2767
+ const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));
2768
+ const yParityOrV = Number(`0x${signatureHex.slice(130)}`);
2769
+ const [v, yParity] = (() => {
2770
+ if (yParityOrV === 0 || yParityOrV === 1)
2771
+ return [void 0, yParityOrV];
2772
+ if (yParityOrV === 27)
2773
+ return [BigInt(yParityOrV), 0];
2774
+ if (yParityOrV === 28)
2775
+ return [BigInt(yParityOrV), 1];
2776
+ throw new Error("Invalid yParityOrV value");
2777
+ })();
2778
+ if (typeof v !== "undefined")
2779
+ return {
2780
+ r: numberToHex(r, { size: 32 }),
2781
+ s: numberToHex(s, { size: 32 }),
2782
+ v,
2783
+ yParity
2784
+ };
2785
+ return {
2786
+ r: numberToHex(r, { size: 32 }),
2787
+ s: numberToHex(s, { size: 32 }),
2788
+ yParity
2789
+ };
2790
+ }
2791
+ export {
2792
+ publicActions as A,
2793
+ BundleFailedError as B,
2794
+ serializeErc6492Signature as C,
2795
+ zeroAddress as D,
2796
+ EnsInvalidChainIdError as E,
2797
+ FilterTypeNotSupportedError as F,
2798
+ zeroHash as G,
2799
+ UrlRequiredError as U,
2800
+ WaitForCallsStatusTimeoutError as W,
2801
+ erc6492MagicBytes as a,
2802
+ sendCalls as b,
2803
+ createContractEventFilter as c,
2804
+ waitForCallsStatus as d,
2805
+ estimateContractGas as e,
2806
+ sendRawTransactionSync as f,
2807
+ getContractEvents as g,
2808
+ getCallsStatus as h,
2809
+ idCache as i,
2810
+ EnsAvatarInvalidNftUriError as j,
2811
+ EnsAvatarUnsupportedNamespaceError as k,
2812
+ EnsAvatarUriResolutionError as l,
2813
+ createNonceManager as m,
2814
+ createPublicClient as n,
2815
+ encodeEventTopics as o,
2816
+ prepareAuthorization as p,
2817
+ encodePacked as q,
2818
+ ethAddress as r,
2819
+ simulateContract as s,
2820
+ parseSignature as t,
2821
+ http as u,
2822
+ labelhash as v,
2823
+ watchContractEvent as w,
2824
+ namehash as x,
2825
+ nonceManager as y,
2826
+ parseAbiItem as z
2827
+ };
2828
+ //# sourceMappingURL=parseSignature-CV_ULbSZ.js.map