@reown/appkit-cdn 1.8.15-e95f0d61c614677233e13ea9f055d3f75fcdba81.0 → 1.8.15-viem-upgrade.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 (429) hide show
  1. package/package.json +10 -10
  2. package/dist/ConstantsUtil-C2Ed2H2U.js +0 -24
  3. package/dist/ConstantsUtil-C2Ed2H2U.js.map +0 -1
  4. package/dist/ExchangeController-h_95bqSB.js +0 -265
  5. package/dist/ExchangeController-h_95bqSB.js.map +0 -1
  6. package/dist/HelpersUtil-xYeUfp1A.js +0 -141
  7. package/dist/HelpersUtil-xYeUfp1A.js.map +0 -1
  8. package/dist/NavigationUtil-Ci15WS4K.js +0 -9
  9. package/dist/NavigationUtil-Ci15WS4K.js.map +0 -1
  10. package/dist/PhArrowCircleDown-B41iUlWV.js +0 -74
  11. package/dist/PhArrowCircleDown-B41iUlWV.js.map +0 -1
  12. package/dist/PhArrowClockwise-BY8u5n41.js +0 -74
  13. package/dist/PhArrowClockwise-BY8u5n41.js.map +0 -1
  14. package/dist/PhArrowDown-ClD8GZ65.js +0 -74
  15. package/dist/PhArrowDown-ClD8GZ65.js.map +0 -1
  16. package/dist/PhArrowLeft-B8MXUz60.js +0 -74
  17. package/dist/PhArrowLeft-B8MXUz60.js.map +0 -1
  18. package/dist/PhArrowRight-Cewa_Slb.js +0 -74
  19. package/dist/PhArrowRight-Cewa_Slb.js.map +0 -1
  20. package/dist/PhArrowSquareOut-whgWh-lD.js +0 -74
  21. package/dist/PhArrowSquareOut-whgWh-lD.js.map +0 -1
  22. package/dist/PhArrowUp-B1HXBxie.js +0 -74
  23. package/dist/PhArrowUp-B1HXBxie.js.map +0 -1
  24. package/dist/PhArrowUpRight-CfFYe4FP.js +0 -74
  25. package/dist/PhArrowUpRight-CfFYe4FP.js.map +0 -1
  26. package/dist/PhArrowsClockwise-gL1Gkrtx.js +0 -74
  27. package/dist/PhArrowsClockwise-gL1Gkrtx.js.map +0 -1
  28. package/dist/PhArrowsDownUp-BqUEdUQr.js +0 -74
  29. package/dist/PhArrowsDownUp-BqUEdUQr.js.map +0 -1
  30. package/dist/PhArrowsLeftRight-BlZU63eY.js +0 -74
  31. package/dist/PhArrowsLeftRight-BlZU63eY.js.map +0 -1
  32. package/dist/PhBank-gbg_jlI7.js +0 -74
  33. package/dist/PhBank-gbg_jlI7.js.map +0 -1
  34. package/dist/PhBrowser-CMlD-YJw.js +0 -74
  35. package/dist/PhBrowser-CMlD-YJw.js.map +0 -1
  36. package/dist/PhCaretDown-3agTO8Jp.js +0 -74
  37. package/dist/PhCaretDown-3agTO8Jp.js.map +0 -1
  38. package/dist/PhCaretLeft-_MTni7Z5.js +0 -74
  39. package/dist/PhCaretLeft-_MTni7Z5.js.map +0 -1
  40. package/dist/PhCaretRight-Ci9fAHPG.js +0 -74
  41. package/dist/PhCaretRight-Ci9fAHPG.js.map +0 -1
  42. package/dist/PhCaretUp-vFG4Fame.js +0 -74
  43. package/dist/PhCaretUp-vFG4Fame.js.map +0 -1
  44. package/dist/PhCheck-mChGK6K_.js +0 -74
  45. package/dist/PhCheck-mChGK6K_.js.map +0 -1
  46. package/dist/PhCircleHalf-DZ7-vfxf.js +0 -74
  47. package/dist/PhCircleHalf-DZ7-vfxf.js.map +0 -1
  48. package/dist/PhClock-Bc5XWXb6.js +0 -74
  49. package/dist/PhClock-Bc5XWXb6.js.map +0 -1
  50. package/dist/PhCompass-Cu2MB-55.js +0 -74
  51. package/dist/PhCompass-Cu2MB-55.js.map +0 -1
  52. package/dist/PhCopy-BGUjyTts.js +0 -74
  53. package/dist/PhCopy-BGUjyTts.js.map +0 -1
  54. package/dist/PhCreditCard-vxFWID4B.js +0 -74
  55. package/dist/PhCreditCard-vxFWID4B.js.map +0 -1
  56. package/dist/PhCurrencyDollar-BfOoDhJr.js +0 -74
  57. package/dist/PhCurrencyDollar-BfOoDhJr.js.map +0 -1
  58. package/dist/PhDesktop-Cq6jwzbS.js +0 -74
  59. package/dist/PhDesktop-Cq6jwzbS.js.map +0 -1
  60. package/dist/PhDeviceMobile-BCtTp6jj.js +0 -74
  61. package/dist/PhDeviceMobile-BCtTp6jj.js.map +0 -1
  62. package/dist/PhDotsThree-BGgD-WIO.js +0 -74
  63. package/dist/PhDotsThree-BGgD-WIO.js.map +0 -1
  64. package/dist/PhEnvelope-CQiV0-zG.js +0 -74
  65. package/dist/PhEnvelope-CQiV0-zG.js.map +0 -1
  66. package/dist/PhFunnelSimple-BHGtxTNf.js +0 -74
  67. package/dist/PhFunnelSimple-BHGtxTNf.js.map +0 -1
  68. package/dist/PhGlobe-Q8oVkf6X.js +0 -74
  69. package/dist/PhGlobe-Q8oVkf6X.js.map +0 -1
  70. package/dist/PhIdentificationCard-Cz9LzvVR.js +0 -74
  71. package/dist/PhIdentificationCard-Cz9LzvVR.js.map +0 -1
  72. package/dist/PhImage-CP5_qKk-.js +0 -74
  73. package/dist/PhImage-CP5_qKk-.js.map +0 -1
  74. package/dist/PhInfo-CTlE1X9Z.js +0 -74
  75. package/dist/PhInfo-CTlE1X9Z.js.map +0 -1
  76. package/dist/PhLightbulb-CcLpnAAb.js +0 -74
  77. package/dist/PhLightbulb-CcLpnAAb.js.map +0 -1
  78. package/dist/PhMagnifyingGlass-n58GUAck.js +0 -74
  79. package/dist/PhMagnifyingGlass-n58GUAck.js.map +0 -1
  80. package/dist/PhPaperPlaneRight-C0sf2XV8.js +0 -74
  81. package/dist/PhPaperPlaneRight-C0sf2XV8.js.map +0 -1
  82. package/dist/PhPlus-BJxvt7Uc.js +0 -74
  83. package/dist/PhPlus-BJxvt7Uc.js.map +0 -1
  84. package/dist/PhPower-BvktxO2-.js +0 -74
  85. package/dist/PhPower-BvktxO2-.js.map +0 -1
  86. package/dist/PhPuzzlePiece-CDDyUPYo.js +0 -74
  87. package/dist/PhPuzzlePiece-CDDyUPYo.js.map +0 -1
  88. package/dist/PhQrCode-BlGI8529.js +0 -74
  89. package/dist/PhQrCode-BlGI8529.js.map +0 -1
  90. package/dist/PhQuestion-DGZj6iDZ.js +0 -74
  91. package/dist/PhQuestion-DGZj6iDZ.js.map +0 -1
  92. package/dist/PhQuestionMark-CTmeI7MQ.js +0 -74
  93. package/dist/PhQuestionMark-CTmeI7MQ.js.map +0 -1
  94. package/dist/PhSealCheck-BSlqkxnH.js +0 -74
  95. package/dist/PhSealCheck-BSlqkxnH.js.map +0 -1
  96. package/dist/PhSignOut-CEXxlRk3.js +0 -74
  97. package/dist/PhSignOut-CEXxlRk3.js.map +0 -1
  98. package/dist/PhSpinner-Do1pY8fG.js +0 -74
  99. package/dist/PhSpinner-Do1pY8fG.js.map +0 -1
  100. package/dist/PhTrash-JNKavmpg.js +0 -74
  101. package/dist/PhTrash-JNKavmpg.js.map +0 -1
  102. package/dist/PhUser-BW7E-xYg.js +0 -74
  103. package/dist/PhUser-BW7E-xYg.js.map +0 -1
  104. package/dist/PhVault-mzxUgBYN.js +0 -74
  105. package/dist/PhVault-mzxUgBYN.js.map +0 -1
  106. package/dist/PhWallet-BR9JThKU.js +0 -74
  107. package/dist/PhWallet-BR9JThKU.js.map +0 -1
  108. package/dist/PhWarning-DxuQ70WM.js +0 -74
  109. package/dist/PhWarning-DxuQ70WM.js.map +0 -1
  110. package/dist/PhWarningCircle-DCI0JC1F.js +0 -74
  111. package/dist/PhWarningCircle-DCI0JC1F.js.map +0 -1
  112. package/dist/PhX-CWNXqpGn.js +0 -74
  113. package/dist/PhX-CWNXqpGn.js.map +0 -1
  114. package/dist/SwapController-CwWMKLPL.js +0 -684
  115. package/dist/SwapController-CwWMKLPL.js.map +0 -1
  116. package/dist/WebCryptoP256-B0F1BoHd.js +0 -3299
  117. package/dist/WebCryptoP256-B0F1BoHd.js.map +0 -1
  118. package/dist/add-emiZFWKE.js +0 -20
  119. package/dist/add-emiZFWKE.js.map +0 -1
  120. package/dist/all-wallets-BsUQMPgW.js +0 -11
  121. package/dist/all-wallets-BsUQMPgW.js.map +0 -1
  122. package/dist/app-store-C_L7BoYc.js +0 -22
  123. package/dist/app-store-C_L7BoYc.js.map +0 -1
  124. package/dist/appkit-DY7XpK4K.js +0 -118074
  125. package/dist/appkit-DY7XpK4K.js.map +0 -1
  126. package/dist/appkit.js +0 -11
  127. package/dist/appkit.js.map +0 -1
  128. package/dist/apple-c3IhsqlY.js +0 -23
  129. package/dist/apple-c3IhsqlY.js.map +0 -1
  130. package/dist/arrow-bottom-BZnD_9In.js +0 -13
  131. package/dist/arrow-bottom-BZnD_9In.js.map +0 -1
  132. package/dist/arrow-bottom-circle-C9HRc3sW.js +0 -16
  133. package/dist/arrow-bottom-circle-C9HRc3sW.js.map +0 -1
  134. package/dist/arrow-left-DFlXkOXB.js +0 -13
  135. package/dist/arrow-left-DFlXkOXB.js.map +0 -1
  136. package/dist/arrow-right-_EPGORWI.js +0 -13
  137. package/dist/arrow-right-_EPGORWI.js.map +0 -1
  138. package/dist/arrow-top-CrBCvUsj.js +0 -13
  139. package/dist/arrow-top-CrBCvUsj.js.map +0 -1
  140. package/dist/async-directive-CEBoIWb8.js +0 -73
  141. package/dist/async-directive-CEBoIWb8.js.map +0 -1
  142. package/dist/bank-IrtkQnW0.js +0 -19
  143. package/dist/bank-IrtkQnW0.js.map +0 -1
  144. package/dist/basic-CCVK4Xb-.js +0 -4914
  145. package/dist/basic-CCVK4Xb-.js.map +0 -1
  146. package/dist/browser-5XoTmr4n.js +0 -1991
  147. package/dist/browser-5XoTmr4n.js.map +0 -1
  148. package/dist/browser-DGJ1T57R.js +0 -19
  149. package/dist/browser-DGJ1T57R.js.map +0 -1
  150. package/dist/card-euIrImBb.js +0 -19
  151. package/dist/card-euIrImBb.js.map +0 -1
  152. package/dist/ccip-BnHcw2Q9.js +0 -164
  153. package/dist/ccip-BnHcw2Q9.js.map +0 -1
  154. package/dist/checkmark-DOfVZz7v.js +0 -16
  155. package/dist/checkmark-DOfVZz7v.js.map +0 -1
  156. package/dist/checkmark-bold-CBk9rneH.js +0 -13
  157. package/dist/checkmark-bold-CBk9rneH.js.map +0 -1
  158. package/dist/chevron-bottom-DqxWxVi0.js +0 -13
  159. package/dist/chevron-bottom-DqxWxVi0.js.map +0 -1
  160. package/dist/chevron-left-JKsYvrX0.js +0 -13
  161. package/dist/chevron-left-JKsYvrX0.js.map +0 -1
  162. package/dist/chevron-right-0IHVmnlN.js +0 -13
  163. package/dist/chevron-right-0IHVmnlN.js.map +0 -1
  164. package/dist/chevron-top-q1UXuE7C.js +0 -13
  165. package/dist/chevron-top-q1UXuE7C.js.map +0 -1
  166. package/dist/chrome-store-C1gUHLGC.js +0 -66
  167. package/dist/chrome-store-C1gUHLGC.js.map +0 -1
  168. package/dist/class-map-CqyLxUs0.js +0 -101
  169. package/dist/class-map-CqyLxUs0.js.map +0 -1
  170. package/dist/clock-CRgBEN3N.js +0 -13
  171. package/dist/clock-CRgBEN3N.js.map +0 -1
  172. package/dist/close-DqwtanuV.js +0 -13
  173. package/dist/close-DqwtanuV.js.map +0 -1
  174. package/dist/clsx.m-D57qXwfE.js +0 -21
  175. package/dist/clsx.m-D57qXwfE.js.map +0 -1
  176. package/dist/coinPlaceholder-DGuEyon3.js +0 -13
  177. package/dist/coinPlaceholder-DGuEyon3.js.map +0 -1
  178. package/dist/compass-D3Lk_JmD.js +0 -13
  179. package/dist/compass-D3Lk_JmD.js.map +0 -1
  180. package/dist/copy-0bHy8N_r.js +0 -20
  181. package/dist/copy-0bHy8N_r.js.map +0 -1
  182. package/dist/core-C111yg8v.js +0 -16288
  183. package/dist/core-C111yg8v.js.map +0 -1
  184. package/dist/cursor-Bnlh8YKu.js +0 -8
  185. package/dist/cursor-Bnlh8YKu.js.map +0 -1
  186. package/dist/cursor-transparent-BqTVTA3D.js +0 -17
  187. package/dist/cursor-transparent-BqTVTA3D.js.map +0 -1
  188. package/dist/data-capture-BtdmOx65.js +0 -549
  189. package/dist/data-capture-BtdmOx65.js.map +0 -1
  190. package/dist/desktop-BKaI6I0c.js +0 -14
  191. package/dist/desktop-BKaI6I0c.js.map +0 -1
  192. package/dist/disconnect-CJtwIHdJ.js +0 -13
  193. package/dist/disconnect-CJtwIHdJ.js.map +0 -1
  194. package/dist/discord-oHqb6ClE.js +0 -22
  195. package/dist/discord-oHqb6ClE.js.map +0 -1
  196. package/dist/email-9QNGgeQQ.js +0 -421
  197. package/dist/email-9QNGgeQQ.js.map +0 -1
  198. package/dist/embedded-wallet-C_CLs-ZL.js +0 -952
  199. package/dist/embedded-wallet-C_CLs-ZL.js.map +0 -1
  200. package/dist/etherscan-Dkkz1Mfh.js +0 -11
  201. package/dist/etherscan-Dkkz1Mfh.js.map +0 -1
  202. package/dist/exclamation-triangle-BQbUCEhi.js +0 -9
  203. package/dist/exclamation-triangle-BQbUCEhi.js.map +0 -1
  204. package/dist/extension-C2hKzEZZ.js +0 -13
  205. package/dist/extension-C2hKzEZZ.js.map +0 -1
  206. package/dist/external-link-CIjsnb3X.js +0 -13
  207. package/dist/external-link-CIjsnb3X.js.map +0 -1
  208. package/dist/facebook-1Hufe3sI.js +0 -31
  209. package/dist/facebook-1Hufe3sI.js.map +0 -1
  210. package/dist/farcaster-DlSxA8AD.js +0 -17
  211. package/dist/farcaster-DlSxA8AD.js.map +0 -1
  212. package/dist/features-CubAsZN1.js +0 -319
  213. package/dist/features-CubAsZN1.js.map +0 -1
  214. package/dist/filters-Bx5zOyri.js +0 -13
  215. package/dist/filters-Bx5zOyri.js.map +0 -1
  216. package/dist/github-CT_NtR6h.js +0 -23
  217. package/dist/github-CT_NtR6h.js.map +0 -1
  218. package/dist/google-Dkv0ZPY6.js +0 -23
  219. package/dist/google-Dkv0ZPY6.js.map +0 -1
  220. package/dist/hashTypedData-Q6QDIxse.js +0 -262
  221. package/dist/hashTypedData-Q6QDIxse.js.map +0 -1
  222. package/dist/help-circle-Dh0SYux9.js +0 -17
  223. package/dist/help-circle-Dh0SYux9.js.map +0 -1
  224. package/dist/id-Dc_gfIHE.js +0 -17
  225. package/dist/id-Dc_gfIHE.js.map +0 -1
  226. package/dist/if-defined-B5CxFQec.js +0 -11
  227. package/dist/if-defined-B5CxFQec.js.map +0 -1
  228. package/dist/image-DPwaTi09.js +0 -9
  229. package/dist/image-DPwaTi09.js.map +0 -1
  230. package/dist/index-AsDH-m9e.js +0 -456
  231. package/dist/index-AsDH-m9e.js.map +0 -1
  232. package/dist/index-B-AePZns.js +0 -1514
  233. package/dist/index-B-AePZns.js.map +0 -1
  234. package/dist/index-B0nuzWGd.js +0 -153
  235. package/dist/index-B0nuzWGd.js.map +0 -1
  236. package/dist/index-BFK8rn8f.js +0 -985
  237. package/dist/index-BFK8rn8f.js.map +0 -1
  238. package/dist/index-BGtDVhOX.js +0 -218
  239. package/dist/index-BGtDVhOX.js.map +0 -1
  240. package/dist/index-BXRoNn9X.js +0 -147
  241. package/dist/index-BXRoNn9X.js.map +0 -1
  242. package/dist/index-BYnWTIsP.js +0 -257
  243. package/dist/index-BYnWTIsP.js.map +0 -1
  244. package/dist/index-B_yrV2-r.js +0 -7258
  245. package/dist/index-B_yrV2-r.js.map +0 -1
  246. package/dist/index-BcCvzVg5.js +0 -716
  247. package/dist/index-BcCvzVg5.js.map +0 -1
  248. package/dist/index-BeSFhM_p.js +0 -120
  249. package/dist/index-BeSFhM_p.js.map +0 -1
  250. package/dist/index-BgnNrRDq.js +0 -967
  251. package/dist/index-BgnNrRDq.js.map +0 -1
  252. package/dist/index-BqpTTobE.js +0 -984
  253. package/dist/index-BqpTTobE.js.map +0 -1
  254. package/dist/index-BxPoDEMu.js +0 -7481
  255. package/dist/index-BxPoDEMu.js.map +0 -1
  256. package/dist/index-ByLuz3My.js +0 -182
  257. package/dist/index-ByLuz3My.js.map +0 -1
  258. package/dist/index-BzPjzg08.js +0 -62
  259. package/dist/index-BzPjzg08.js.map +0 -1
  260. package/dist/index-C2E-8AS5.js +0 -249
  261. package/dist/index-C2E-8AS5.js.map +0 -1
  262. package/dist/index-C4icMnjM.js +0 -521
  263. package/dist/index-C4icMnjM.js.map +0 -1
  264. package/dist/index-C8av2G6v.js +0 -136
  265. package/dist/index-C8av2G6v.js.map +0 -1
  266. package/dist/index-CE9D5nR3.js +0 -441
  267. package/dist/index-CE9D5nR3.js.map +0 -1
  268. package/dist/index-CI83C2eb.js +0 -124
  269. package/dist/index-CI83C2eb.js.map +0 -1
  270. package/dist/index-CK8vtUMI.js +0 -181
  271. package/dist/index-CK8vtUMI.js.map +0 -1
  272. package/dist/index-CY_gr4c7.js +0 -286
  273. package/dist/index-CY_gr4c7.js.map +0 -1
  274. package/dist/index-CZmyXVNe.js +0 -198
  275. package/dist/index-CZmyXVNe.js.map +0 -1
  276. package/dist/index-CemyBXIP.js +0 -8825
  277. package/dist/index-CemyBXIP.js.map +0 -1
  278. package/dist/index-CkrKEace.js +0 -180
  279. package/dist/index-CkrKEace.js.map +0 -1
  280. package/dist/index-Cl94CXn7.js +0 -110
  281. package/dist/index-Cl94CXn7.js.map +0 -1
  282. package/dist/index-CwK6o8Hz.js +0 -18322
  283. package/dist/index-CwK6o8Hz.js.map +0 -1
  284. package/dist/index-Cy1DAN6W.js +0 -542
  285. package/dist/index-Cy1DAN6W.js.map +0 -1
  286. package/dist/index-CziMS40-.js +0 -281
  287. package/dist/index-CziMS40-.js.map +0 -1
  288. package/dist/index-D6qUKJRD.js +0 -1178
  289. package/dist/index-D6qUKJRD.js.map +0 -1
  290. package/dist/index-DDYN4XOm.js +0 -211
  291. package/dist/index-DDYN4XOm.js.map +0 -1
  292. package/dist/index-DHcBAN0Q.js +0 -9350
  293. package/dist/index-DHcBAN0Q.js.map +0 -1
  294. package/dist/index-DPEv06yg.js +0 -520
  295. package/dist/index-DPEv06yg.js.map +0 -1
  296. package/dist/index-DShG1B5f.js +0 -131
  297. package/dist/index-DShG1B5f.js.map +0 -1
  298. package/dist/index-DTOiAL1i.js +0 -52
  299. package/dist/index-DTOiAL1i.js.map +0 -1
  300. package/dist/index-DVyI9O5i.js +0 -92
  301. package/dist/index-DVyI9O5i.js.map +0 -1
  302. package/dist/index-DvXemhcG.js +0 -611
  303. package/dist/index-DvXemhcG.js.map +0 -1
  304. package/dist/index-Fvw4sbfL.js +0 -198
  305. package/dist/index-Fvw4sbfL.js.map +0 -1
  306. package/dist/index-PiXpeN5n.js +0 -3987
  307. package/dist/index-PiXpeN5n.js.map +0 -1
  308. package/dist/index-btvyw5xW.js +0 -126
  309. package/dist/index-btvyw5xW.js.map +0 -1
  310. package/dist/index-dsKNiJml.js +0 -70
  311. package/dist/index-dsKNiJml.js.map +0 -1
  312. package/dist/index-gEaD8hfK.js +0 -109
  313. package/dist/index-gEaD8hfK.js.map +0 -1
  314. package/dist/index-isOxTzum.js +0 -147
  315. package/dist/index-isOxTzum.js.map +0 -1
  316. package/dist/index-nWSgWKaF.js +0 -2277
  317. package/dist/index-nWSgWKaF.js.map +0 -1
  318. package/dist/index-qQiVpif7.js +0 -1372
  319. package/dist/index-qQiVpif7.js.map +0 -1
  320. package/dist/index-tv-dalA1.js +0 -73
  321. package/dist/index-tv-dalA1.js.map +0 -1
  322. package/dist/index.es-BzCqYMc8.js +0 -8391
  323. package/dist/index.es-BzCqYMc8.js.map +0 -1
  324. package/dist/info-4ssFoXJS.js +0 -8
  325. package/dist/info-4ssFoXJS.js.map +0 -1
  326. package/dist/info-circle-BnqHwvcX.js +0 -17
  327. package/dist/info-circle-BnqHwvcX.js.map +0 -1
  328. package/dist/jsxRuntime.module-CWsrm3KZ.js +0 -14
  329. package/dist/jsxRuntime.module-CWsrm3KZ.js.map +0 -1
  330. package/dist/lightbulb-BEEbBBZQ.js +0 -8
  331. package/dist/lightbulb-BEEbBBZQ.js.map +0 -1
  332. package/dist/localBatchGatewayRequest-Dryp85EG.js +0 -103
  333. package/dist/localBatchGatewayRequest-Dryp85EG.js.map +0 -1
  334. package/dist/mail-CJLCh290.js +0 -13
  335. package/dist/mail-CJLCh290.js.map +0 -1
  336. package/dist/metamask-sdk-4u4X6Xn3.js +0 -16699
  337. package/dist/metamask-sdk-4u4X6Xn3.js.map +0 -1
  338. package/dist/mobile-Deau0Za4.js +0 -14
  339. package/dist/mobile-Deau0Za4.js.map +0 -1
  340. package/dist/more-BeXo-Pwn.js +0 -16
  341. package/dist/more-BeXo-Pwn.js.map +0 -1
  342. package/dist/native-DOlbMZnh.js +0 -17
  343. package/dist/native-DOlbMZnh.js.map +0 -1
  344. package/dist/network-placeholder-BoityKSt.js +0 -19
  345. package/dist/network-placeholder-BoityKSt.js.map +0 -1
  346. package/dist/nftPlaceholder-PTHT5Ulj.js +0 -13
  347. package/dist/nftPlaceholder-PTHT5Ulj.js.map +0 -1
  348. package/dist/off-BWWypY2E.js +0 -13
  349. package/dist/off-BWWypY2E.js.map +0 -1
  350. package/dist/onramp-DnL6ChSq.js +0 -979
  351. package/dist/onramp-DnL6ChSq.js.map +0 -1
  352. package/dist/parseAbiParameters-DfJcIE_w.js +0 -757
  353. package/dist/parseAbiParameters-DfJcIE_w.js.map +0 -1
  354. package/dist/parseSignature-CxTkG24t.js +0 -4690
  355. package/dist/parseSignature-CxTkG24t.js.map +0 -1
  356. package/dist/pay-with-exchange-CpuGLivJ.js +0 -603
  357. package/dist/pay-with-exchange-CpuGLivJ.js.map +0 -1
  358. package/dist/play-store-DkxQRJyA.js +0 -37
  359. package/dist/play-store-DkxQRJyA.js.map +0 -1
  360. package/dist/plus-DaGtBhNd.js +0 -18
  361. package/dist/plus-DaGtBhNd.js.map +0 -1
  362. package/dist/property-8UcTqffH.js +0 -623
  363. package/dist/property-8UcTqffH.js.map +0 -1
  364. package/dist/qr-code-DGvMTPaF.js +0 -11
  365. package/dist/qr-code-DGvMTPaF.js.map +0 -1
  366. package/dist/receive-CVWmkRpl.js +0 -262
  367. package/dist/receive-CVWmkRpl.js.map +0 -1
  368. package/dist/recycle-horizontal-DDVEtj7J.js +0 -14
  369. package/dist/recycle-horizontal-DDVEtj7J.js.map +0 -1
  370. package/dist/ref-DAjgVrGH.js +0 -43
  371. package/dist/ref-DAjgVrGH.js.map +0 -1
  372. package/dist/refresh-BmNFE8Pg.js +0 -13
  373. package/dist/refresh-BmNFE8Pg.js.map +0 -1
  374. package/dist/reown-logo-B-UO-SeO.js +0 -17
  375. package/dist/reown-logo-B-UO-SeO.js.map +0 -1
  376. package/dist/search-DR_B_4SQ.js +0 -13
  377. package/dist/search-DR_B_4SQ.js.map +0 -1
  378. package/dist/secp256k1-DnXqhCKw.js +0 -2031
  379. package/dist/secp256k1-DnXqhCKw.js.map +0 -1
  380. package/dist/send-BNU8VrfM.js +0 -20
  381. package/dist/send-BNU8VrfM.js.map +0 -1
  382. package/dist/send-DHzM4I8V.js +0 -1365
  383. package/dist/send-DHzM4I8V.js.map +0 -1
  384. package/dist/socials-DsoFf1B8.js +0 -796
  385. package/dist/socials-DsoFf1B8.js.map +0 -1
  386. package/dist/swapHorizontal-BQOjfwRW.js +0 -13
  387. package/dist/swapHorizontal-BQOjfwRW.js.map +0 -1
  388. package/dist/swapHorizontalBold-DMKR9Zys.js +0 -13
  389. package/dist/swapHorizontalBold-DMKR9Zys.js.map +0 -1
  390. package/dist/swapHorizontalMedium-DVsqt18q.js +0 -21
  391. package/dist/swapHorizontalMedium-DVsqt18q.js.map +0 -1
  392. package/dist/swapHorizontalRoundedBold-CM5U-o8X.js +0 -13
  393. package/dist/swapHorizontalRoundedBold-CM5U-o8X.js.map +0 -1
  394. package/dist/swapVertical-P9UnfCR-.js +0 -13
  395. package/dist/swapVertical-P9UnfCR-.js.map +0 -1
  396. package/dist/swaps-F0roy6mK.js +0 -2121
  397. package/dist/swaps-F0roy6mK.js.map +0 -1
  398. package/dist/telegram-Bd4DGbnk.js +0 -21
  399. package/dist/telegram-Bd4DGbnk.js.map +0 -1
  400. package/dist/three-dots-M94oc7-3.js +0 -10
  401. package/dist/three-dots-M94oc7-3.js.map +0 -1
  402. package/dist/transactions-DwtZvXx1.js +0 -38
  403. package/dist/transactions-DwtZvXx1.js.map +0 -1
  404. package/dist/twitch--lJ-X_Y6.js +0 -23
  405. package/dist/twitch--lJ-X_Y6.js.map +0 -1
  406. package/dist/twitterIcon-DDp_lnzc.js +0 -11
  407. package/dist/twitterIcon-DDp_lnzc.js.map +0 -1
  408. package/dist/vanilla-CgG5xMJO.js +0 -448
  409. package/dist/vanilla-CgG5xMJO.js.map +0 -1
  410. package/dist/verify-Doojt-tK.js +0 -13
  411. package/dist/verify-Doojt-tK.js.map +0 -1
  412. package/dist/verify-filled-EHdbo2B7.js +0 -13
  413. package/dist/verify-filled-EHdbo2B7.js.map +0 -1
  414. package/dist/w3m-modal-CVsid-gN.js +0 -1725
  415. package/dist/w3m-modal-CVsid-gN.js.map +0 -1
  416. package/dist/w3m-modal-CZ4s4A2R.js +0 -2008
  417. package/dist/w3m-modal-CZ4s4A2R.js.map +0 -1
  418. package/dist/wallet-CowxEORz.js +0 -13
  419. package/dist/wallet-CowxEORz.js.map +0 -1
  420. package/dist/wallet-placeholder-B7p7Oae2.js +0 -19
  421. package/dist/wallet-placeholder-B7p7Oae2.js.map +0 -1
  422. package/dist/wallet-standard-BUMbKbZo.js +0 -523
  423. package/dist/wallet-standard-BUMbKbZo.js.map +0 -1
  424. package/dist/walletconnect-CKMr88Pk.js +0 -39
  425. package/dist/walletconnect-CKMr88Pk.js.map +0 -1
  426. package/dist/warning-circle-CjIPgJnm.js +0 -17
  427. package/dist/warning-circle-CjIPgJnm.js.map +0 -1
  428. package/dist/x-CaxhfhgU.js +0 -17
  429. package/dist/x-CaxhfhgU.js.map +0 -1
@@ -1,3299 +0,0 @@
1
- import { bM as concat$1, bN as pad$1, bO as numberToHex, b3 as hashTypedData, bP as encodeAbiParameters, bQ as keccak256, bR as createNonceManager, bS as serializeErc6492Signature, bT as getAction, bU as getCode, bV as readContract, bW as parseAbi, bX as BaseError$1, bY as prettyPrint, bZ as formatGwei, b_ as decodeErrorResult, b$ as ContractFunctionZeroDataError, c0 as ContractFunctionRevertedError, c1 as ContractFunctionExecutionError, c2 as hexToBigInt, c3 as AccountNotFoundError, c4 as parseAccount, b1 as encodeFunctionData, c5 as estimateFeesPerGas, c6 as prepareAuthorization, c7 as getChainId, c8 as serializeStateOverride, c9 as formatLog, ca as formatTransactionReceipt, cb as stringify$1, cc as observe, cd as poll, ce as createClient, cf as sha256$1 } from "./appkit-DY7XpK4K.js";
2
- import { p as p256 } from "./index-CE9D5nR3.js";
3
- const entryPoint06Abi = [
4
- {
5
- inputs: [
6
- { name: "preOpGas", type: "uint256" },
7
- { name: "paid", type: "uint256" },
8
- { name: "validAfter", type: "uint48" },
9
- { name: "validUntil", type: "uint48" },
10
- { name: "targetSuccess", type: "bool" },
11
- { name: "targetResult", type: "bytes" }
12
- ],
13
- name: "ExecutionResult",
14
- type: "error"
15
- },
16
- {
17
- inputs: [
18
- { name: "opIndex", type: "uint256" },
19
- { name: "reason", type: "string" }
20
- ],
21
- name: "FailedOp",
22
- type: "error"
23
- },
24
- {
25
- inputs: [{ name: "sender", type: "address" }],
26
- name: "SenderAddressResult",
27
- type: "error"
28
- },
29
- {
30
- inputs: [{ name: "aggregator", type: "address" }],
31
- name: "SignatureValidationFailed",
32
- type: "error"
33
- },
34
- {
35
- inputs: [
36
- {
37
- components: [
38
- { name: "preOpGas", type: "uint256" },
39
- { name: "prefund", type: "uint256" },
40
- { name: "sigFailed", type: "bool" },
41
- { name: "validAfter", type: "uint48" },
42
- { name: "validUntil", type: "uint48" },
43
- { name: "paymasterContext", type: "bytes" }
44
- ],
45
- name: "returnInfo",
46
- type: "tuple"
47
- },
48
- {
49
- components: [
50
- { name: "stake", type: "uint256" },
51
- { name: "unstakeDelaySec", type: "uint256" }
52
- ],
53
- name: "senderInfo",
54
- type: "tuple"
55
- },
56
- {
57
- components: [
58
- { name: "stake", type: "uint256" },
59
- { name: "unstakeDelaySec", type: "uint256" }
60
- ],
61
- name: "factoryInfo",
62
- type: "tuple"
63
- },
64
- {
65
- components: [
66
- { name: "stake", type: "uint256" },
67
- { name: "unstakeDelaySec", type: "uint256" }
68
- ],
69
- name: "paymasterInfo",
70
- type: "tuple"
71
- }
72
- ],
73
- name: "ValidationResult",
74
- type: "error"
75
- },
76
- {
77
- inputs: [
78
- {
79
- components: [
80
- { name: "preOpGas", type: "uint256" },
81
- { name: "prefund", type: "uint256" },
82
- { name: "sigFailed", type: "bool" },
83
- { name: "validAfter", type: "uint48" },
84
- { name: "validUntil", type: "uint48" },
85
- { name: "paymasterContext", type: "bytes" }
86
- ],
87
- name: "returnInfo",
88
- type: "tuple"
89
- },
90
- {
91
- components: [
92
- { name: "stake", type: "uint256" },
93
- { name: "unstakeDelaySec", type: "uint256" }
94
- ],
95
- name: "senderInfo",
96
- type: "tuple"
97
- },
98
- {
99
- components: [
100
- { name: "stake", type: "uint256" },
101
- { name: "unstakeDelaySec", type: "uint256" }
102
- ],
103
- name: "factoryInfo",
104
- type: "tuple"
105
- },
106
- {
107
- components: [
108
- { name: "stake", type: "uint256" },
109
- { name: "unstakeDelaySec", type: "uint256" }
110
- ],
111
- name: "paymasterInfo",
112
- type: "tuple"
113
- },
114
- {
115
- components: [
116
- { name: "aggregator", type: "address" },
117
- {
118
- components: [
119
- { name: "stake", type: "uint256" },
120
- {
121
- name: "unstakeDelaySec",
122
- type: "uint256"
123
- }
124
- ],
125
- name: "stakeInfo",
126
- type: "tuple"
127
- }
128
- ],
129
- name: "aggregatorInfo",
130
- type: "tuple"
131
- }
132
- ],
133
- name: "ValidationResultWithAggregation",
134
- type: "error"
135
- },
136
- {
137
- anonymous: false,
138
- inputs: [
139
- {
140
- indexed: true,
141
- name: "userOpHash",
142
- type: "bytes32"
143
- },
144
- {
145
- indexed: true,
146
- name: "sender",
147
- type: "address"
148
- },
149
- {
150
- indexed: false,
151
- name: "factory",
152
- type: "address"
153
- },
154
- {
155
- indexed: false,
156
- name: "paymaster",
157
- type: "address"
158
- }
159
- ],
160
- name: "AccountDeployed",
161
- type: "event"
162
- },
163
- { anonymous: false, inputs: [], name: "BeforeExecution", type: "event" },
164
- {
165
- anonymous: false,
166
- inputs: [
167
- {
168
- indexed: true,
169
- name: "account",
170
- type: "address"
171
- },
172
- {
173
- indexed: false,
174
- name: "totalDeposit",
175
- type: "uint256"
176
- }
177
- ],
178
- name: "Deposited",
179
- type: "event"
180
- },
181
- {
182
- anonymous: false,
183
- inputs: [
184
- {
185
- indexed: true,
186
- name: "aggregator",
187
- type: "address"
188
- }
189
- ],
190
- name: "SignatureAggregatorChanged",
191
- type: "event"
192
- },
193
- {
194
- anonymous: false,
195
- inputs: [
196
- {
197
- indexed: true,
198
- name: "account",
199
- type: "address"
200
- },
201
- {
202
- indexed: false,
203
- name: "totalStaked",
204
- type: "uint256"
205
- },
206
- {
207
- indexed: false,
208
- name: "unstakeDelaySec",
209
- type: "uint256"
210
- }
211
- ],
212
- name: "StakeLocked",
213
- type: "event"
214
- },
215
- {
216
- anonymous: false,
217
- inputs: [
218
- {
219
- indexed: true,
220
- name: "account",
221
- type: "address"
222
- },
223
- {
224
- indexed: false,
225
- name: "withdrawTime",
226
- type: "uint256"
227
- }
228
- ],
229
- name: "StakeUnlocked",
230
- type: "event"
231
- },
232
- {
233
- anonymous: false,
234
- inputs: [
235
- {
236
- indexed: true,
237
- name: "account",
238
- type: "address"
239
- },
240
- {
241
- indexed: false,
242
- name: "withdrawAddress",
243
- type: "address"
244
- },
245
- {
246
- indexed: false,
247
- name: "amount",
248
- type: "uint256"
249
- }
250
- ],
251
- name: "StakeWithdrawn",
252
- type: "event"
253
- },
254
- {
255
- anonymous: false,
256
- inputs: [
257
- {
258
- indexed: true,
259
- name: "userOpHash",
260
- type: "bytes32"
261
- },
262
- {
263
- indexed: true,
264
- name: "sender",
265
- type: "address"
266
- },
267
- {
268
- indexed: true,
269
- name: "paymaster",
270
- type: "address"
271
- },
272
- {
273
- indexed: false,
274
- name: "nonce",
275
- type: "uint256"
276
- },
277
- { indexed: false, name: "success", type: "bool" },
278
- {
279
- indexed: false,
280
- name: "actualGasCost",
281
- type: "uint256"
282
- },
283
- {
284
- indexed: false,
285
- name: "actualGasUsed",
286
- type: "uint256"
287
- }
288
- ],
289
- name: "UserOperationEvent",
290
- type: "event"
291
- },
292
- {
293
- anonymous: false,
294
- inputs: [
295
- {
296
- indexed: true,
297
- name: "userOpHash",
298
- type: "bytes32"
299
- },
300
- {
301
- indexed: true,
302
- name: "sender",
303
- type: "address"
304
- },
305
- {
306
- indexed: false,
307
- name: "nonce",
308
- type: "uint256"
309
- },
310
- {
311
- indexed: false,
312
- name: "revertReason",
313
- type: "bytes"
314
- }
315
- ],
316
- name: "UserOperationRevertReason",
317
- type: "event"
318
- },
319
- {
320
- anonymous: false,
321
- inputs: [
322
- {
323
- indexed: true,
324
- name: "account",
325
- type: "address"
326
- },
327
- {
328
- indexed: false,
329
- name: "withdrawAddress",
330
- type: "address"
331
- },
332
- {
333
- indexed: false,
334
- name: "amount",
335
- type: "uint256"
336
- }
337
- ],
338
- name: "Withdrawn",
339
- type: "event"
340
- },
341
- {
342
- inputs: [],
343
- name: "SIG_VALIDATION_FAILED",
344
- outputs: [{ name: "", type: "uint256" }],
345
- stateMutability: "view",
346
- type: "function"
347
- },
348
- {
349
- inputs: [
350
- { name: "initCode", type: "bytes" },
351
- { name: "sender", type: "address" },
352
- { name: "paymasterAndData", type: "bytes" }
353
- ],
354
- name: "_validateSenderAndPaymaster",
355
- outputs: [],
356
- stateMutability: "view",
357
- type: "function"
358
- },
359
- {
360
- inputs: [{ name: "unstakeDelaySec", type: "uint32" }],
361
- name: "addStake",
362
- outputs: [],
363
- stateMutability: "payable",
364
- type: "function"
365
- },
366
- {
367
- inputs: [{ name: "account", type: "address" }],
368
- name: "balanceOf",
369
- outputs: [{ name: "", type: "uint256" }],
370
- stateMutability: "view",
371
- type: "function"
372
- },
373
- {
374
- inputs: [{ name: "account", type: "address" }],
375
- name: "depositTo",
376
- outputs: [],
377
- stateMutability: "payable",
378
- type: "function"
379
- },
380
- {
381
- inputs: [{ name: "", type: "address" }],
382
- name: "deposits",
383
- outputs: [
384
- { name: "deposit", type: "uint112" },
385
- { name: "staked", type: "bool" },
386
- { name: "stake", type: "uint112" },
387
- { name: "unstakeDelaySec", type: "uint32" },
388
- { name: "withdrawTime", type: "uint48" }
389
- ],
390
- stateMutability: "view",
391
- type: "function"
392
- },
393
- {
394
- inputs: [{ name: "account", type: "address" }],
395
- name: "getDepositInfo",
396
- outputs: [
397
- {
398
- components: [
399
- { name: "deposit", type: "uint112" },
400
- { name: "staked", type: "bool" },
401
- { name: "stake", type: "uint112" },
402
- { name: "unstakeDelaySec", type: "uint32" },
403
- { name: "withdrawTime", type: "uint48" }
404
- ],
405
- name: "info",
406
- type: "tuple"
407
- }
408
- ],
409
- stateMutability: "view",
410
- type: "function"
411
- },
412
- {
413
- inputs: [
414
- { name: "sender", type: "address" },
415
- { name: "key", type: "uint192" }
416
- ],
417
- name: "getNonce",
418
- outputs: [{ name: "nonce", type: "uint256" }],
419
- stateMutability: "view",
420
- type: "function"
421
- },
422
- {
423
- inputs: [{ name: "initCode", type: "bytes" }],
424
- name: "getSenderAddress",
425
- outputs: [],
426
- stateMutability: "nonpayable",
427
- type: "function"
428
- },
429
- {
430
- inputs: [
431
- {
432
- components: [
433
- { name: "sender", type: "address" },
434
- { name: "nonce", type: "uint256" },
435
- { name: "initCode", type: "bytes" },
436
- { name: "callData", type: "bytes" },
437
- { name: "callGasLimit", type: "uint256" },
438
- {
439
- name: "verificationGasLimit",
440
- type: "uint256"
441
- },
442
- {
443
- name: "preVerificationGas",
444
- type: "uint256"
445
- },
446
- { name: "maxFeePerGas", type: "uint256" },
447
- {
448
- name: "maxPriorityFeePerGas",
449
- type: "uint256"
450
- },
451
- { name: "paymasterAndData", type: "bytes" },
452
- { name: "signature", type: "bytes" }
453
- ],
454
- name: "userOp",
455
- type: "tuple"
456
- }
457
- ],
458
- name: "getUserOpHash",
459
- outputs: [{ name: "", type: "bytes32" }],
460
- stateMutability: "view",
461
- type: "function"
462
- },
463
- {
464
- inputs: [
465
- {
466
- components: [
467
- {
468
- components: [
469
- { name: "sender", type: "address" },
470
- { name: "nonce", type: "uint256" },
471
- { name: "initCode", type: "bytes" },
472
- { name: "callData", type: "bytes" },
473
- {
474
- name: "callGasLimit",
475
- type: "uint256"
476
- },
477
- {
478
- name: "verificationGasLimit",
479
- type: "uint256"
480
- },
481
- {
482
- name: "preVerificationGas",
483
- type: "uint256"
484
- },
485
- {
486
- name: "maxFeePerGas",
487
- type: "uint256"
488
- },
489
- {
490
- name: "maxPriorityFeePerGas",
491
- type: "uint256"
492
- },
493
- {
494
- name: "paymasterAndData",
495
- type: "bytes"
496
- },
497
- { name: "signature", type: "bytes" }
498
- ],
499
- name: "userOps",
500
- type: "tuple[]"
501
- },
502
- {
503
- name: "aggregator",
504
- type: "address"
505
- },
506
- { name: "signature", type: "bytes" }
507
- ],
508
- name: "opsPerAggregator",
509
- type: "tuple[]"
510
- },
511
- { name: "beneficiary", type: "address" }
512
- ],
513
- name: "handleAggregatedOps",
514
- outputs: [],
515
- stateMutability: "nonpayable",
516
- type: "function"
517
- },
518
- {
519
- inputs: [
520
- {
521
- components: [
522
- { name: "sender", type: "address" },
523
- { name: "nonce", type: "uint256" },
524
- { name: "initCode", type: "bytes" },
525
- { name: "callData", type: "bytes" },
526
- { name: "callGasLimit", type: "uint256" },
527
- {
528
- name: "verificationGasLimit",
529
- type: "uint256"
530
- },
531
- {
532
- name: "preVerificationGas",
533
- type: "uint256"
534
- },
535
- { name: "maxFeePerGas", type: "uint256" },
536
- {
537
- name: "maxPriorityFeePerGas",
538
- type: "uint256"
539
- },
540
- { name: "paymasterAndData", type: "bytes" },
541
- { name: "signature", type: "bytes" }
542
- ],
543
- name: "ops",
544
- type: "tuple[]"
545
- },
546
- { name: "beneficiary", type: "address" }
547
- ],
548
- name: "handleOps",
549
- outputs: [],
550
- stateMutability: "nonpayable",
551
- type: "function"
552
- },
553
- {
554
- inputs: [{ name: "key", type: "uint192" }],
555
- name: "incrementNonce",
556
- outputs: [],
557
- stateMutability: "nonpayable",
558
- type: "function"
559
- },
560
- {
561
- inputs: [
562
- { name: "callData", type: "bytes" },
563
- {
564
- components: [
565
- {
566
- components: [
567
- { name: "sender", type: "address" },
568
- { name: "nonce", type: "uint256" },
569
- {
570
- name: "callGasLimit",
571
- type: "uint256"
572
- },
573
- {
574
- name: "verificationGasLimit",
575
- type: "uint256"
576
- },
577
- {
578
- name: "preVerificationGas",
579
- type: "uint256"
580
- },
581
- { name: "paymaster", type: "address" },
582
- {
583
- name: "maxFeePerGas",
584
- type: "uint256"
585
- },
586
- {
587
- name: "maxPriorityFeePerGas",
588
- type: "uint256"
589
- }
590
- ],
591
- name: "mUserOp",
592
- type: "tuple"
593
- },
594
- { name: "userOpHash", type: "bytes32" },
595
- { name: "prefund", type: "uint256" },
596
- { name: "contextOffset", type: "uint256" },
597
- { name: "preOpGas", type: "uint256" }
598
- ],
599
- name: "opInfo",
600
- type: "tuple"
601
- },
602
- { name: "context", type: "bytes" }
603
- ],
604
- name: "innerHandleOp",
605
- outputs: [{ name: "actualGasCost", type: "uint256" }],
606
- stateMutability: "nonpayable",
607
- type: "function"
608
- },
609
- {
610
- inputs: [
611
- { name: "", type: "address" },
612
- { name: "", type: "uint192" }
613
- ],
614
- name: "nonceSequenceNumber",
615
- outputs: [{ name: "", type: "uint256" }],
616
- stateMutability: "view",
617
- type: "function"
618
- },
619
- {
620
- inputs: [
621
- {
622
- components: [
623
- { name: "sender", type: "address" },
624
- { name: "nonce", type: "uint256" },
625
- { name: "initCode", type: "bytes" },
626
- { name: "callData", type: "bytes" },
627
- { name: "callGasLimit", type: "uint256" },
628
- {
629
- name: "verificationGasLimit",
630
- type: "uint256"
631
- },
632
- {
633
- name: "preVerificationGas",
634
- type: "uint256"
635
- },
636
- { name: "maxFeePerGas", type: "uint256" },
637
- {
638
- name: "maxPriorityFeePerGas",
639
- type: "uint256"
640
- },
641
- { name: "paymasterAndData", type: "bytes" },
642
- { name: "signature", type: "bytes" }
643
- ],
644
- name: "op",
645
- type: "tuple"
646
- },
647
- { name: "target", type: "address" },
648
- { name: "targetCallData", type: "bytes" }
649
- ],
650
- name: "simulateHandleOp",
651
- outputs: [],
652
- stateMutability: "nonpayable",
653
- type: "function"
654
- },
655
- {
656
- inputs: [
657
- {
658
- components: [
659
- { name: "sender", type: "address" },
660
- { name: "nonce", type: "uint256" },
661
- { name: "initCode", type: "bytes" },
662
- { name: "callData", type: "bytes" },
663
- { name: "callGasLimit", type: "uint256" },
664
- {
665
- name: "verificationGasLimit",
666
- type: "uint256"
667
- },
668
- {
669
- name: "preVerificationGas",
670
- type: "uint256"
671
- },
672
- { name: "maxFeePerGas", type: "uint256" },
673
- {
674
- name: "maxPriorityFeePerGas",
675
- type: "uint256"
676
- },
677
- { name: "paymasterAndData", type: "bytes" },
678
- { name: "signature", type: "bytes" }
679
- ],
680
- name: "userOp",
681
- type: "tuple"
682
- }
683
- ],
684
- name: "simulateValidation",
685
- outputs: [],
686
- stateMutability: "nonpayable",
687
- type: "function"
688
- },
689
- {
690
- inputs: [],
691
- name: "unlockStake",
692
- outputs: [],
693
- stateMutability: "nonpayable",
694
- type: "function"
695
- },
696
- {
697
- inputs: [
698
- {
699
- name: "withdrawAddress",
700
- type: "address"
701
- }
702
- ],
703
- name: "withdrawStake",
704
- outputs: [],
705
- stateMutability: "nonpayable",
706
- type: "function"
707
- },
708
- {
709
- inputs: [
710
- {
711
- name: "withdrawAddress",
712
- type: "address"
713
- },
714
- { name: "withdrawAmount", type: "uint256" }
715
- ],
716
- name: "withdrawTo",
717
- outputs: [],
718
- stateMutability: "nonpayable",
719
- type: "function"
720
- },
721
- { stateMutability: "payable", type: "receive" }
722
- ];
723
- function getInitCode(userOperation) {
724
- const { authorization, factory, factoryData } = userOperation;
725
- if (factory === "0x7702" || factory === "0x7702000000000000000000000000000000000000") {
726
- if (!authorization)
727
- return "0x7702000000000000000000000000000000000000";
728
- const delegation = authorization.address;
729
- return concat$1([delegation, factoryData ?? "0x"]);
730
- }
731
- if (!factory)
732
- return "0x";
733
- return concat$1([factory, factoryData ?? "0x"]);
734
- }
735
- function toPackedUserOperation(userOperation) {
736
- const { callGasLimit, callData, maxPriorityFeePerGas, maxFeePerGas, paymaster, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, sender, signature = "0x", verificationGasLimit } = userOperation;
737
- const accountGasLimits = concat$1([
738
- pad$1(numberToHex(verificationGasLimit || 0n), { size: 16 }),
739
- pad$1(numberToHex(callGasLimit || 0n), { size: 16 })
740
- ]);
741
- const initCode = getInitCode(userOperation);
742
- const gasFees = concat$1([
743
- pad$1(numberToHex(maxPriorityFeePerGas || 0n), { size: 16 }),
744
- pad$1(numberToHex(maxFeePerGas || 0n), { size: 16 })
745
- ]);
746
- const nonce = userOperation.nonce ?? 0n;
747
- const paymasterAndData = paymaster ? concat$1([
748
- paymaster,
749
- pad$1(numberToHex(paymasterVerificationGasLimit || 0n), {
750
- size: 16
751
- }),
752
- pad$1(numberToHex(paymasterPostOpGasLimit || 0n), {
753
- size: 16
754
- }),
755
- paymasterData || "0x"
756
- ]) : "0x";
757
- const preVerificationGas = userOperation.preVerificationGas ?? 0n;
758
- return {
759
- accountGasLimits,
760
- callData,
761
- initCode,
762
- gasFees,
763
- nonce,
764
- paymasterAndData,
765
- preVerificationGas,
766
- sender,
767
- signature
768
- };
769
- }
770
- const types = {
771
- PackedUserOperation: [
772
- { type: "address", name: "sender" },
773
- { type: "uint256", name: "nonce" },
774
- { type: "bytes", name: "initCode" },
775
- { type: "bytes", name: "callData" },
776
- { type: "bytes32", name: "accountGasLimits" },
777
- { type: "uint256", name: "preVerificationGas" },
778
- { type: "bytes32", name: "gasFees" },
779
- { type: "bytes", name: "paymasterAndData" }
780
- ]
781
- };
782
- function getUserOperationTypedData(parameters) {
783
- const { chainId, entryPointAddress, userOperation } = parameters;
784
- const packedUserOp = toPackedUserOperation(userOperation);
785
- return {
786
- types,
787
- primaryType: "PackedUserOperation",
788
- domain: {
789
- name: "ERC4337",
790
- version: "1",
791
- chainId,
792
- verifyingContract: entryPointAddress
793
- },
794
- message: packedUserOp
795
- };
796
- }
797
- function getUserOperationHash(parameters) {
798
- const { chainId, entryPointAddress, entryPointVersion } = parameters;
799
- const userOperation = parameters.userOperation;
800
- const { authorization, callData = "0x", callGasLimit, maxFeePerGas, maxPriorityFeePerGas, nonce, paymasterAndData = "0x", preVerificationGas, sender, verificationGasLimit } = userOperation;
801
- if (entryPointVersion === "0.8")
802
- return hashTypedData(getUserOperationTypedData({
803
- chainId,
804
- entryPointAddress,
805
- userOperation
806
- }));
807
- const packedUserOp = (() => {
808
- var _a, _b;
809
- if (entryPointVersion === "0.6") {
810
- const factory = (_a = userOperation.initCode) == null ? void 0 : _a.slice(0, 42);
811
- const factoryData = (_b = userOperation.initCode) == null ? void 0 : _b.slice(42);
812
- const initCode = getInitCode({
813
- authorization,
814
- factory,
815
- factoryData
816
- });
817
- return encodeAbiParameters([
818
- { type: "address" },
819
- { type: "uint256" },
820
- { type: "bytes32" },
821
- { type: "bytes32" },
822
- { type: "uint256" },
823
- { type: "uint256" },
824
- { type: "uint256" },
825
- { type: "uint256" },
826
- { type: "uint256" },
827
- { type: "bytes32" }
828
- ], [
829
- sender,
830
- nonce,
831
- keccak256(initCode),
832
- keccak256(callData),
833
- callGasLimit,
834
- verificationGasLimit,
835
- preVerificationGas,
836
- maxFeePerGas,
837
- maxPriorityFeePerGas,
838
- keccak256(paymasterAndData)
839
- ]);
840
- }
841
- if (entryPointVersion === "0.7") {
842
- const packedUserOp2 = toPackedUserOperation(userOperation);
843
- return encodeAbiParameters([
844
- { type: "address" },
845
- { type: "uint256" },
846
- { type: "bytes32" },
847
- { type: "bytes32" },
848
- { type: "bytes32" },
849
- { type: "uint256" },
850
- { type: "bytes32" },
851
- { type: "bytes32" }
852
- ], [
853
- packedUserOp2.sender,
854
- packedUserOp2.nonce,
855
- keccak256(packedUserOp2.initCode),
856
- keccak256(packedUserOp2.callData),
857
- packedUserOp2.accountGasLimits,
858
- packedUserOp2.preVerificationGas,
859
- packedUserOp2.gasFees,
860
- keccak256(packedUserOp2.paymasterAndData)
861
- ]);
862
- }
863
- throw new Error(`entryPointVersion "${entryPointVersion}" not supported.`);
864
- })();
865
- return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [keccak256(packedUserOp), entryPointAddress, BigInt(chainId)]));
866
- }
867
- async function toSmartAccount(implementation) {
868
- const { extend, nonceKeyManager = createNonceManager({
869
- source: {
870
- get() {
871
- return Date.now();
872
- },
873
- set() {
874
- }
875
- }
876
- }), ...rest } = implementation;
877
- let deployed = false;
878
- const address = await implementation.getAddress();
879
- return {
880
- ...extend,
881
- ...rest,
882
- address,
883
- async getFactoryArgs() {
884
- if ("isDeployed" in this && await this.isDeployed())
885
- return { factory: void 0, factoryData: void 0 };
886
- return implementation.getFactoryArgs();
887
- },
888
- async getNonce(parameters) {
889
- const key = (parameters == null ? void 0 : parameters.key) ?? BigInt(await nonceKeyManager.consume({
890
- address,
891
- chainId: implementation.client.chain.id,
892
- client: implementation.client
893
- }));
894
- if (implementation.getNonce)
895
- return await implementation.getNonce({ ...parameters, key });
896
- const nonce = await readContract(implementation.client, {
897
- abi: parseAbi([
898
- "function getNonce(address, uint192) pure returns (uint256)"
899
- ]),
900
- address: implementation.entryPoint.address,
901
- functionName: "getNonce",
902
- args: [address, key]
903
- });
904
- return nonce;
905
- },
906
- async isDeployed() {
907
- if (deployed)
908
- return true;
909
- const code = await getAction(implementation.client, getCode, "getCode")({
910
- address
911
- });
912
- deployed = Boolean(code);
913
- return deployed;
914
- },
915
- ...implementation.sign ? {
916
- async sign(parameters) {
917
- const [{ factory, factoryData }, signature] = await Promise.all([
918
- this.getFactoryArgs(),
919
- implementation.sign(parameters)
920
- ]);
921
- if (factory && factoryData)
922
- return serializeErc6492Signature({
923
- address: factory,
924
- data: factoryData,
925
- signature
926
- });
927
- return signature;
928
- }
929
- } : {},
930
- async signMessage(parameters) {
931
- const [{ factory, factoryData }, signature] = await Promise.all([
932
- this.getFactoryArgs(),
933
- implementation.signMessage(parameters)
934
- ]);
935
- if (factory && factoryData && factory !== "0x7702")
936
- return serializeErc6492Signature({
937
- address: factory,
938
- data: factoryData,
939
- signature
940
- });
941
- return signature;
942
- },
943
- async signTypedData(parameters) {
944
- const [{ factory, factoryData }, signature] = await Promise.all([
945
- this.getFactoryArgs(),
946
- implementation.signTypedData(parameters)
947
- ]);
948
- if (factory && factoryData && factory !== "0x7702")
949
- return serializeErc6492Signature({
950
- address: factory,
951
- data: factoryData,
952
- signature
953
- });
954
- return signature;
955
- },
956
- type: "smart"
957
- };
958
- }
959
- class AccountNotDeployedError extends BaseError$1 {
960
- constructor({ cause }) {
961
- super("Smart Account is not deployed.", {
962
- cause,
963
- metaMessages: [
964
- "This could arise when:",
965
- "- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.",
966
- "- An incorrect `sender` address is provided."
967
- ],
968
- name: "AccountNotDeployedError"
969
- });
970
- }
971
- }
972
- Object.defineProperty(AccountNotDeployedError, "message", {
973
- enumerable: true,
974
- configurable: true,
975
- writable: true,
976
- value: /aa20/
977
- });
978
- class ExecutionRevertedError extends BaseError$1 {
979
- constructor({ cause, data, message } = {}) {
980
- var _a;
981
- const reason = (_a = message == null ? void 0 : message.replace("execution reverted: ", "")) == null ? void 0 : _a.replace("execution reverted", "");
982
- super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
983
- cause,
984
- name: "ExecutionRevertedError"
985
- });
986
- Object.defineProperty(this, "data", {
987
- enumerable: true,
988
- configurable: true,
989
- writable: true,
990
- value: void 0
991
- });
992
- this.data = data;
993
- }
994
- }
995
- Object.defineProperty(ExecutionRevertedError, "code", {
996
- enumerable: true,
997
- configurable: true,
998
- writable: true,
999
- value: -32521
1000
- });
1001
- Object.defineProperty(ExecutionRevertedError, "message", {
1002
- enumerable: true,
1003
- configurable: true,
1004
- writable: true,
1005
- value: /execution reverted/
1006
- });
1007
- class FailedToSendToBeneficiaryError extends BaseError$1 {
1008
- constructor({ cause }) {
1009
- super("Failed to send funds to beneficiary.", {
1010
- cause,
1011
- name: "FailedToSendToBeneficiaryError"
1012
- });
1013
- }
1014
- }
1015
- Object.defineProperty(FailedToSendToBeneficiaryError, "message", {
1016
- enumerable: true,
1017
- configurable: true,
1018
- writable: true,
1019
- value: /aa91/
1020
- });
1021
- class GasValuesOverflowError extends BaseError$1 {
1022
- constructor({ cause }) {
1023
- super("Gas value overflowed.", {
1024
- cause,
1025
- metaMessages: [
1026
- "This could arise when:",
1027
- "- one of the gas values exceeded 2**120 (uint120)"
1028
- ].filter(Boolean),
1029
- name: "GasValuesOverflowError"
1030
- });
1031
- }
1032
- }
1033
- Object.defineProperty(GasValuesOverflowError, "message", {
1034
- enumerable: true,
1035
- configurable: true,
1036
- writable: true,
1037
- value: /aa94/
1038
- });
1039
- class HandleOpsOutOfGasError extends BaseError$1 {
1040
- constructor({ cause }) {
1041
- super("The `handleOps` function was called by the Bundler with a gas limit too low.", {
1042
- cause,
1043
- name: "HandleOpsOutOfGasError"
1044
- });
1045
- }
1046
- }
1047
- Object.defineProperty(HandleOpsOutOfGasError, "message", {
1048
- enumerable: true,
1049
- configurable: true,
1050
- writable: true,
1051
- value: /aa95/
1052
- });
1053
- class InitCodeFailedError extends BaseError$1 {
1054
- constructor({ cause, factory, factoryData, initCode }) {
1055
- super("Failed to simulate deployment for Smart Account.", {
1056
- cause,
1057
- metaMessages: [
1058
- "This could arise when:",
1059
- "- Invalid `factory`/`factoryData` or `initCode` properties are present",
1060
- "- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",
1061
- "- Smart Account deployment execution reverted with an error\n",
1062
- factory && `factory: ${factory}`,
1063
- factoryData && `factoryData: ${factoryData}`,
1064
- initCode && `initCode: ${initCode}`
1065
- ].filter(Boolean),
1066
- name: "InitCodeFailedError"
1067
- });
1068
- }
1069
- }
1070
- Object.defineProperty(InitCodeFailedError, "message", {
1071
- enumerable: true,
1072
- configurable: true,
1073
- writable: true,
1074
- value: /aa13/
1075
- });
1076
- class InitCodeMustCreateSenderError extends BaseError$1 {
1077
- constructor({ cause, factory, factoryData, initCode }) {
1078
- super("Smart Account initialization implementation did not create an account.", {
1079
- cause,
1080
- metaMessages: [
1081
- "This could arise when:",
1082
- "- `factory`/`factoryData` or `initCode` properties are invalid",
1083
- "- Smart Account initialization implementation is incorrect\n",
1084
- factory && `factory: ${factory}`,
1085
- factoryData && `factoryData: ${factoryData}`,
1086
- initCode && `initCode: ${initCode}`
1087
- ].filter(Boolean),
1088
- name: "InitCodeMustCreateSenderError"
1089
- });
1090
- }
1091
- }
1092
- Object.defineProperty(InitCodeMustCreateSenderError, "message", {
1093
- enumerable: true,
1094
- configurable: true,
1095
- writable: true,
1096
- value: /aa15/
1097
- });
1098
- class InitCodeMustReturnSenderError extends BaseError$1 {
1099
- constructor({ cause, factory, factoryData, initCode, sender }) {
1100
- super("Smart Account initialization implementation does not return the expected sender.", {
1101
- cause,
1102
- metaMessages: [
1103
- "This could arise when:",
1104
- "Smart Account initialization implementation does not return a sender address\n",
1105
- factory && `factory: ${factory}`,
1106
- factoryData && `factoryData: ${factoryData}`,
1107
- initCode && `initCode: ${initCode}`,
1108
- sender && `sender: ${sender}`
1109
- ].filter(Boolean),
1110
- name: "InitCodeMustReturnSenderError"
1111
- });
1112
- }
1113
- }
1114
- Object.defineProperty(InitCodeMustReturnSenderError, "message", {
1115
- enumerable: true,
1116
- configurable: true,
1117
- writable: true,
1118
- value: /aa14/
1119
- });
1120
- class InsufficientPrefundError extends BaseError$1 {
1121
- constructor({ cause }) {
1122
- super("Smart Account does not have sufficient funds to execute the User Operation.", {
1123
- cause,
1124
- metaMessages: [
1125
- "This could arise when:",
1126
- "- the Smart Account does not have sufficient funds to cover the required prefund, or",
1127
- "- a Paymaster was not provided"
1128
- ].filter(Boolean),
1129
- name: "InsufficientPrefundError"
1130
- });
1131
- }
1132
- }
1133
- Object.defineProperty(InsufficientPrefundError, "message", {
1134
- enumerable: true,
1135
- configurable: true,
1136
- writable: true,
1137
- value: /aa21/
1138
- });
1139
- class InternalCallOnlyError extends BaseError$1 {
1140
- constructor({ cause }) {
1141
- super("Bundler attempted to call an invalid function on the EntryPoint.", {
1142
- cause,
1143
- name: "InternalCallOnlyError"
1144
- });
1145
- }
1146
- }
1147
- Object.defineProperty(InternalCallOnlyError, "message", {
1148
- enumerable: true,
1149
- configurable: true,
1150
- writable: true,
1151
- value: /aa92/
1152
- });
1153
- class InvalidAggregatorError extends BaseError$1 {
1154
- constructor({ cause }) {
1155
- super("Bundler used an invalid aggregator for handling aggregated User Operations.", {
1156
- cause,
1157
- name: "InvalidAggregatorError"
1158
- });
1159
- }
1160
- }
1161
- Object.defineProperty(InvalidAggregatorError, "message", {
1162
- enumerable: true,
1163
- configurable: true,
1164
- writable: true,
1165
- value: /aa96/
1166
- });
1167
- class InvalidAccountNonceError extends BaseError$1 {
1168
- constructor({ cause, nonce }) {
1169
- super("Invalid Smart Account nonce used for User Operation.", {
1170
- cause,
1171
- metaMessages: [nonce && `nonce: ${nonce}`].filter(Boolean),
1172
- name: "InvalidAccountNonceError"
1173
- });
1174
- }
1175
- }
1176
- Object.defineProperty(InvalidAccountNonceError, "message", {
1177
- enumerable: true,
1178
- configurable: true,
1179
- writable: true,
1180
- value: /aa25/
1181
- });
1182
- class InvalidBeneficiaryError extends BaseError$1 {
1183
- constructor({ cause }) {
1184
- super("Bundler has not set a beneficiary address.", {
1185
- cause,
1186
- name: "InvalidBeneficiaryError"
1187
- });
1188
- }
1189
- }
1190
- Object.defineProperty(InvalidBeneficiaryError, "message", {
1191
- enumerable: true,
1192
- configurable: true,
1193
- writable: true,
1194
- value: /aa90/
1195
- });
1196
- class InvalidFieldsError extends BaseError$1 {
1197
- constructor({ cause }) {
1198
- super("Invalid fields set on User Operation.", {
1199
- cause,
1200
- name: "InvalidFieldsError"
1201
- });
1202
- }
1203
- }
1204
- Object.defineProperty(InvalidFieldsError, "code", {
1205
- enumerable: true,
1206
- configurable: true,
1207
- writable: true,
1208
- value: -32602
1209
- });
1210
- class InvalidPaymasterAndDataError extends BaseError$1 {
1211
- constructor({ cause, paymasterAndData }) {
1212
- super("Paymaster properties provided are invalid.", {
1213
- cause,
1214
- metaMessages: [
1215
- "This could arise when:",
1216
- "- the `paymasterAndData` property is of an incorrect length\n",
1217
- paymasterAndData && `paymasterAndData: ${paymasterAndData}`
1218
- ].filter(Boolean),
1219
- name: "InvalidPaymasterAndDataError"
1220
- });
1221
- }
1222
- }
1223
- Object.defineProperty(InvalidPaymasterAndDataError, "message", {
1224
- enumerable: true,
1225
- configurable: true,
1226
- writable: true,
1227
- value: /aa93/
1228
- });
1229
- class PaymasterDepositTooLowError extends BaseError$1 {
1230
- constructor({ cause }) {
1231
- super("Paymaster deposit for the User Operation is too low.", {
1232
- cause,
1233
- metaMessages: [
1234
- "This could arise when:",
1235
- "- the Paymaster has deposited less than the expected amount via the `deposit` function"
1236
- ].filter(Boolean),
1237
- name: "PaymasterDepositTooLowError"
1238
- });
1239
- }
1240
- }
1241
- Object.defineProperty(PaymasterDepositTooLowError, "code", {
1242
- enumerable: true,
1243
- configurable: true,
1244
- writable: true,
1245
- value: -32508
1246
- });
1247
- Object.defineProperty(PaymasterDepositTooLowError, "message", {
1248
- enumerable: true,
1249
- configurable: true,
1250
- writable: true,
1251
- value: /aa31/
1252
- });
1253
- class PaymasterFunctionRevertedError extends BaseError$1 {
1254
- constructor({ cause }) {
1255
- super("The `validatePaymasterUserOp` function on the Paymaster reverted.", {
1256
- cause,
1257
- name: "PaymasterFunctionRevertedError"
1258
- });
1259
- }
1260
- }
1261
- Object.defineProperty(PaymasterFunctionRevertedError, "message", {
1262
- enumerable: true,
1263
- configurable: true,
1264
- writable: true,
1265
- value: /aa33/
1266
- });
1267
- class PaymasterNotDeployedError extends BaseError$1 {
1268
- constructor({ cause }) {
1269
- super("The Paymaster contract has not been deployed.", {
1270
- cause,
1271
- name: "PaymasterNotDeployedError"
1272
- });
1273
- }
1274
- }
1275
- Object.defineProperty(PaymasterNotDeployedError, "message", {
1276
- enumerable: true,
1277
- configurable: true,
1278
- writable: true,
1279
- value: /aa30/
1280
- });
1281
- class PaymasterRateLimitError extends BaseError$1 {
1282
- constructor({ cause }) {
1283
- super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.", {
1284
- cause,
1285
- name: "PaymasterRateLimitError"
1286
- });
1287
- }
1288
- }
1289
- Object.defineProperty(PaymasterRateLimitError, "code", {
1290
- enumerable: true,
1291
- configurable: true,
1292
- writable: true,
1293
- value: -32504
1294
- });
1295
- class PaymasterStakeTooLowError extends BaseError$1 {
1296
- constructor({ cause }) {
1297
- super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.", {
1298
- cause,
1299
- name: "PaymasterStakeTooLowError"
1300
- });
1301
- }
1302
- }
1303
- Object.defineProperty(PaymasterStakeTooLowError, "code", {
1304
- enumerable: true,
1305
- configurable: true,
1306
- writable: true,
1307
- value: -32505
1308
- });
1309
- class PaymasterPostOpFunctionRevertedError extends BaseError$1 {
1310
- constructor({ cause }) {
1311
- super("Paymaster `postOp` function reverted.", {
1312
- cause,
1313
- name: "PaymasterPostOpFunctionRevertedError"
1314
- });
1315
- }
1316
- }
1317
- Object.defineProperty(PaymasterPostOpFunctionRevertedError, "message", {
1318
- enumerable: true,
1319
- configurable: true,
1320
- writable: true,
1321
- value: /aa50/
1322
- });
1323
- class SenderAlreadyConstructedError extends BaseError$1 {
1324
- constructor({ cause, factory, factoryData, initCode }) {
1325
- super("Smart Account has already been deployed.", {
1326
- cause,
1327
- metaMessages: [
1328
- "Remove the following properties and try again:",
1329
- factory && "`factory`",
1330
- factoryData && "`factoryData`",
1331
- initCode && "`initCode`"
1332
- ].filter(Boolean),
1333
- name: "SenderAlreadyConstructedError"
1334
- });
1335
- }
1336
- }
1337
- Object.defineProperty(SenderAlreadyConstructedError, "message", {
1338
- enumerable: true,
1339
- configurable: true,
1340
- writable: true,
1341
- value: /aa10/
1342
- });
1343
- class SignatureCheckFailedError extends BaseError$1 {
1344
- constructor({ cause }) {
1345
- super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).", {
1346
- cause,
1347
- name: "SignatureCheckFailedError"
1348
- });
1349
- }
1350
- }
1351
- Object.defineProperty(SignatureCheckFailedError, "code", {
1352
- enumerable: true,
1353
- configurable: true,
1354
- writable: true,
1355
- value: -32507
1356
- });
1357
- class SmartAccountFunctionRevertedError extends BaseError$1 {
1358
- constructor({ cause }) {
1359
- super("The `validateUserOp` function on the Smart Account reverted.", {
1360
- cause,
1361
- name: "SmartAccountFunctionRevertedError"
1362
- });
1363
- }
1364
- }
1365
- Object.defineProperty(SmartAccountFunctionRevertedError, "message", {
1366
- enumerable: true,
1367
- configurable: true,
1368
- writable: true,
1369
- value: /aa23/
1370
- });
1371
- class UnsupportedSignatureAggregatorError extends BaseError$1 {
1372
- constructor({ cause }) {
1373
- super("UserOperation rejected because account specified unsupported signature aggregator.", {
1374
- cause,
1375
- name: "UnsupportedSignatureAggregatorError"
1376
- });
1377
- }
1378
- }
1379
- Object.defineProperty(UnsupportedSignatureAggregatorError, "code", {
1380
- enumerable: true,
1381
- configurable: true,
1382
- writable: true,
1383
- value: -32506
1384
- });
1385
- class UserOperationExpiredError extends BaseError$1 {
1386
- constructor({ cause }) {
1387
- super("User Operation expired.", {
1388
- cause,
1389
- metaMessages: [
1390
- "This could arise when:",
1391
- "- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"
1392
- ].filter(Boolean),
1393
- name: "UserOperationExpiredError"
1394
- });
1395
- }
1396
- }
1397
- Object.defineProperty(UserOperationExpiredError, "message", {
1398
- enumerable: true,
1399
- configurable: true,
1400
- writable: true,
1401
- value: /aa22/
1402
- });
1403
- class UserOperationPaymasterExpiredError extends BaseError$1 {
1404
- constructor({ cause }) {
1405
- super("Paymaster for User Operation expired.", {
1406
- cause,
1407
- metaMessages: [
1408
- "This could arise when:",
1409
- "- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"
1410
- ].filter(Boolean),
1411
- name: "UserOperationPaymasterExpiredError"
1412
- });
1413
- }
1414
- }
1415
- Object.defineProperty(UserOperationPaymasterExpiredError, "message", {
1416
- enumerable: true,
1417
- configurable: true,
1418
- writable: true,
1419
- value: /aa32/
1420
- });
1421
- class UserOperationSignatureError extends BaseError$1 {
1422
- constructor({ cause }) {
1423
- super("Signature provided for the User Operation is invalid.", {
1424
- cause,
1425
- metaMessages: [
1426
- "This could arise when:",
1427
- "- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"
1428
- ].filter(Boolean),
1429
- name: "UserOperationSignatureError"
1430
- });
1431
- }
1432
- }
1433
- Object.defineProperty(UserOperationSignatureError, "message", {
1434
- enumerable: true,
1435
- configurable: true,
1436
- writable: true,
1437
- value: /aa24/
1438
- });
1439
- class UserOperationPaymasterSignatureError extends BaseError$1 {
1440
- constructor({ cause }) {
1441
- super("Signature provided for the User Operation is invalid.", {
1442
- cause,
1443
- metaMessages: [
1444
- "This could arise when:",
1445
- "- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"
1446
- ].filter(Boolean),
1447
- name: "UserOperationPaymasterSignatureError"
1448
- });
1449
- }
1450
- }
1451
- Object.defineProperty(UserOperationPaymasterSignatureError, "message", {
1452
- enumerable: true,
1453
- configurable: true,
1454
- writable: true,
1455
- value: /aa34/
1456
- });
1457
- class UserOperationRejectedByEntryPointError extends BaseError$1 {
1458
- constructor({ cause }) {
1459
- super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.", {
1460
- cause,
1461
- name: "UserOperationRejectedByEntryPointError"
1462
- });
1463
- }
1464
- }
1465
- Object.defineProperty(UserOperationRejectedByEntryPointError, "code", {
1466
- enumerable: true,
1467
- configurable: true,
1468
- writable: true,
1469
- value: -32500
1470
- });
1471
- class UserOperationRejectedByPaymasterError extends BaseError$1 {
1472
- constructor({ cause }) {
1473
- super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.", {
1474
- cause,
1475
- name: "UserOperationRejectedByPaymasterError"
1476
- });
1477
- }
1478
- }
1479
- Object.defineProperty(UserOperationRejectedByPaymasterError, "code", {
1480
- enumerable: true,
1481
- configurable: true,
1482
- writable: true,
1483
- value: -32501
1484
- });
1485
- class UserOperationRejectedByOpCodeError extends BaseError$1 {
1486
- constructor({ cause }) {
1487
- super("User Operation rejected with op code validation error.", {
1488
- cause,
1489
- name: "UserOperationRejectedByOpCodeError"
1490
- });
1491
- }
1492
- }
1493
- Object.defineProperty(UserOperationRejectedByOpCodeError, "code", {
1494
- enumerable: true,
1495
- configurable: true,
1496
- writable: true,
1497
- value: -32502
1498
- });
1499
- class UserOperationOutOfTimeRangeError extends BaseError$1 {
1500
- constructor({ cause }) {
1501
- super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).", {
1502
- cause,
1503
- name: "UserOperationOutOfTimeRangeError"
1504
- });
1505
- }
1506
- }
1507
- Object.defineProperty(UserOperationOutOfTimeRangeError, "code", {
1508
- enumerable: true,
1509
- configurable: true,
1510
- writable: true,
1511
- value: -32503
1512
- });
1513
- class UnknownBundlerError extends BaseError$1 {
1514
- constructor({ cause }) {
1515
- super(`An error occurred while executing user operation: ${cause == null ? void 0 : cause.shortMessage}`, {
1516
- cause,
1517
- name: "UnknownBundlerError"
1518
- });
1519
- }
1520
- }
1521
- class VerificationGasLimitExceededError extends BaseError$1 {
1522
- constructor({ cause }) {
1523
- super("User Operation verification gas limit exceeded.", {
1524
- cause,
1525
- metaMessages: [
1526
- "This could arise when:",
1527
- "- the gas used for verification exceeded the `verificationGasLimit`"
1528
- ].filter(Boolean),
1529
- name: "VerificationGasLimitExceededError"
1530
- });
1531
- }
1532
- }
1533
- Object.defineProperty(VerificationGasLimitExceededError, "message", {
1534
- enumerable: true,
1535
- configurable: true,
1536
- writable: true,
1537
- value: /aa40/
1538
- });
1539
- class VerificationGasLimitTooLowError extends BaseError$1 {
1540
- constructor({ cause }) {
1541
- super("User Operation verification gas limit is too low.", {
1542
- cause,
1543
- metaMessages: [
1544
- "This could arise when:",
1545
- "- the `verificationGasLimit` is too low to verify the User Operation"
1546
- ].filter(Boolean),
1547
- name: "VerificationGasLimitTooLowError"
1548
- });
1549
- }
1550
- }
1551
- Object.defineProperty(VerificationGasLimitTooLowError, "message", {
1552
- enumerable: true,
1553
- configurable: true,
1554
- writable: true,
1555
- value: /aa41/
1556
- });
1557
- class UserOperationExecutionError extends BaseError$1 {
1558
- constructor(cause, { callData, callGasLimit, docsPath, factory, factoryData, initCode, maxFeePerGas, maxPriorityFeePerGas, nonce, paymaster, paymasterAndData, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, preVerificationGas, sender, signature, verificationGasLimit }) {
1559
- const prettyArgs = prettyPrint({
1560
- callData,
1561
- callGasLimit,
1562
- factory,
1563
- factoryData,
1564
- initCode,
1565
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1566
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1567
- nonce,
1568
- paymaster,
1569
- paymasterAndData,
1570
- paymasterData,
1571
- paymasterPostOpGasLimit,
1572
- paymasterVerificationGasLimit,
1573
- preVerificationGas,
1574
- sender,
1575
- signature,
1576
- verificationGasLimit
1577
- });
1578
- super(cause.shortMessage, {
1579
- cause,
1580
- docsPath,
1581
- metaMessages: [
1582
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1583
- "Request Arguments:",
1584
- prettyArgs
1585
- ].filter(Boolean),
1586
- name: "UserOperationExecutionError"
1587
- });
1588
- Object.defineProperty(this, "cause", {
1589
- enumerable: true,
1590
- configurable: true,
1591
- writable: true,
1592
- value: void 0
1593
- });
1594
- this.cause = cause;
1595
- }
1596
- }
1597
- class UserOperationReceiptNotFoundError extends BaseError$1 {
1598
- constructor({ hash }) {
1599
- super(`User Operation receipt with hash "${hash}" could not be found. The User Operation may not have been processed yet.`, { name: "UserOperationReceiptNotFoundError" });
1600
- }
1601
- }
1602
- class UserOperationNotFoundError extends BaseError$1 {
1603
- constructor({ hash }) {
1604
- super(`User Operation with hash "${hash}" could not be found.`, {
1605
- name: "UserOperationNotFoundError"
1606
- });
1607
- }
1608
- }
1609
- class WaitForUserOperationReceiptTimeoutError extends BaseError$1 {
1610
- constructor({ hash }) {
1611
- super(`Timed out while waiting for User Operation with hash "${hash}" to be confirmed.`, { name: "WaitForUserOperationReceiptTimeoutError" });
1612
- }
1613
- }
1614
- const bundlerErrors = [
1615
- ExecutionRevertedError,
1616
- InvalidFieldsError,
1617
- PaymasterDepositTooLowError,
1618
- PaymasterRateLimitError,
1619
- PaymasterStakeTooLowError,
1620
- SignatureCheckFailedError,
1621
- UnsupportedSignatureAggregatorError,
1622
- UserOperationOutOfTimeRangeError,
1623
- UserOperationRejectedByEntryPointError,
1624
- UserOperationRejectedByPaymasterError,
1625
- UserOperationRejectedByOpCodeError
1626
- ];
1627
- function getBundlerError(err, args) {
1628
- const message = (err.details || "").toLowerCase();
1629
- if (AccountNotDeployedError.message.test(message))
1630
- return new AccountNotDeployedError({
1631
- cause: err
1632
- });
1633
- if (FailedToSendToBeneficiaryError.message.test(message))
1634
- return new FailedToSendToBeneficiaryError({
1635
- cause: err
1636
- });
1637
- if (GasValuesOverflowError.message.test(message))
1638
- return new GasValuesOverflowError({
1639
- cause: err
1640
- });
1641
- if (HandleOpsOutOfGasError.message.test(message))
1642
- return new HandleOpsOutOfGasError({
1643
- cause: err
1644
- });
1645
- if (InitCodeFailedError.message.test(message))
1646
- return new InitCodeFailedError({
1647
- cause: err,
1648
- factory: args.factory,
1649
- factoryData: args.factoryData,
1650
- initCode: args.initCode
1651
- });
1652
- if (InitCodeMustCreateSenderError.message.test(message))
1653
- return new InitCodeMustCreateSenderError({
1654
- cause: err,
1655
- factory: args.factory,
1656
- factoryData: args.factoryData,
1657
- initCode: args.initCode
1658
- });
1659
- if (InitCodeMustReturnSenderError.message.test(message))
1660
- return new InitCodeMustReturnSenderError({
1661
- cause: err,
1662
- factory: args.factory,
1663
- factoryData: args.factoryData,
1664
- initCode: args.initCode,
1665
- sender: args.sender
1666
- });
1667
- if (InsufficientPrefundError.message.test(message))
1668
- return new InsufficientPrefundError({
1669
- cause: err
1670
- });
1671
- if (InternalCallOnlyError.message.test(message))
1672
- return new InternalCallOnlyError({
1673
- cause: err
1674
- });
1675
- if (InvalidAccountNonceError.message.test(message))
1676
- return new InvalidAccountNonceError({
1677
- cause: err,
1678
- nonce: args.nonce
1679
- });
1680
- if (InvalidAggregatorError.message.test(message))
1681
- return new InvalidAggregatorError({
1682
- cause: err
1683
- });
1684
- if (InvalidBeneficiaryError.message.test(message))
1685
- return new InvalidBeneficiaryError({
1686
- cause: err
1687
- });
1688
- if (InvalidPaymasterAndDataError.message.test(message))
1689
- return new InvalidPaymasterAndDataError({
1690
- cause: err
1691
- });
1692
- if (PaymasterDepositTooLowError.message.test(message))
1693
- return new PaymasterDepositTooLowError({
1694
- cause: err
1695
- });
1696
- if (PaymasterFunctionRevertedError.message.test(message))
1697
- return new PaymasterFunctionRevertedError({
1698
- cause: err
1699
- });
1700
- if (PaymasterNotDeployedError.message.test(message))
1701
- return new PaymasterNotDeployedError({
1702
- cause: err
1703
- });
1704
- if (PaymasterPostOpFunctionRevertedError.message.test(message))
1705
- return new PaymasterPostOpFunctionRevertedError({
1706
- cause: err
1707
- });
1708
- if (SmartAccountFunctionRevertedError.message.test(message))
1709
- return new SmartAccountFunctionRevertedError({
1710
- cause: err
1711
- });
1712
- if (SenderAlreadyConstructedError.message.test(message))
1713
- return new SenderAlreadyConstructedError({
1714
- cause: err,
1715
- factory: args.factory,
1716
- factoryData: args.factoryData,
1717
- initCode: args.initCode
1718
- });
1719
- if (UserOperationExpiredError.message.test(message))
1720
- return new UserOperationExpiredError({
1721
- cause: err
1722
- });
1723
- if (UserOperationPaymasterExpiredError.message.test(message))
1724
- return new UserOperationPaymasterExpiredError({
1725
- cause: err
1726
- });
1727
- if (UserOperationPaymasterSignatureError.message.test(message))
1728
- return new UserOperationPaymasterSignatureError({
1729
- cause: err
1730
- });
1731
- if (UserOperationSignatureError.message.test(message))
1732
- return new UserOperationSignatureError({
1733
- cause: err
1734
- });
1735
- if (VerificationGasLimitExceededError.message.test(message))
1736
- return new VerificationGasLimitExceededError({
1737
- cause: err
1738
- });
1739
- if (VerificationGasLimitTooLowError.message.test(message))
1740
- return new VerificationGasLimitTooLowError({
1741
- cause: err
1742
- });
1743
- const error = err.walk((e) => bundlerErrors.some((error2) => error2.code === e.code));
1744
- if (error) {
1745
- if (error.code === ExecutionRevertedError.code)
1746
- return new ExecutionRevertedError({
1747
- cause: err,
1748
- data: error.data,
1749
- message: error.details
1750
- });
1751
- if (error.code === InvalidFieldsError.code)
1752
- return new InvalidFieldsError({
1753
- cause: err
1754
- });
1755
- if (error.code === PaymasterDepositTooLowError.code)
1756
- return new PaymasterDepositTooLowError({
1757
- cause: err
1758
- });
1759
- if (error.code === PaymasterRateLimitError.code)
1760
- return new PaymasterRateLimitError({
1761
- cause: err
1762
- });
1763
- if (error.code === PaymasterStakeTooLowError.code)
1764
- return new PaymasterStakeTooLowError({
1765
- cause: err
1766
- });
1767
- if (error.code === SignatureCheckFailedError.code)
1768
- return new SignatureCheckFailedError({
1769
- cause: err
1770
- });
1771
- if (error.code === UnsupportedSignatureAggregatorError.code)
1772
- return new UnsupportedSignatureAggregatorError({
1773
- cause: err
1774
- });
1775
- if (error.code === UserOperationOutOfTimeRangeError.code)
1776
- return new UserOperationOutOfTimeRangeError({
1777
- cause: err
1778
- });
1779
- if (error.code === UserOperationRejectedByEntryPointError.code)
1780
- return new UserOperationRejectedByEntryPointError({
1781
- cause: err
1782
- });
1783
- if (error.code === UserOperationRejectedByPaymasterError.code)
1784
- return new UserOperationRejectedByPaymasterError({
1785
- cause: err
1786
- });
1787
- if (error.code === UserOperationRejectedByOpCodeError.code)
1788
- return new UserOperationRejectedByOpCodeError({
1789
- cause: err
1790
- });
1791
- }
1792
- return new UnknownBundlerError({
1793
- cause: err
1794
- });
1795
- }
1796
- function getUserOperationError(err, { calls, docsPath, ...args }) {
1797
- const cause = (() => {
1798
- const cause2 = getBundlerError(err, args);
1799
- if (calls && cause2 instanceof ExecutionRevertedError) {
1800
- const revertData = getRevertData(cause2);
1801
- const contractCalls = calls == null ? void 0 : calls.filter((call) => call.abi);
1802
- if (revertData && contractCalls.length > 0)
1803
- return getContractError({ calls: contractCalls, revertData });
1804
- }
1805
- return cause2;
1806
- })();
1807
- return new UserOperationExecutionError(cause, {
1808
- docsPath,
1809
- ...args
1810
- });
1811
- }
1812
- function getRevertData(error) {
1813
- let revertData;
1814
- error.walk((e) => {
1815
- var _a, _b, _c, _d;
1816
- const error2 = e;
1817
- if (typeof error2.data === "string" || typeof ((_a = error2.data) == null ? void 0 : _a.revertData) === "string" || !(error2 instanceof BaseError$1) && typeof error2.message === "string") {
1818
- const match = (_d = (_c = ((_b = error2.data) == null ? void 0 : _b.revertData) || error2.data || error2.message).match) == null ? void 0 : _d.call(_c, /(0x[A-Za-z0-9]*)/);
1819
- if (match) {
1820
- revertData = match[1];
1821
- return true;
1822
- }
1823
- }
1824
- return false;
1825
- });
1826
- return revertData;
1827
- }
1828
- function getContractError(parameters) {
1829
- const { calls, revertData } = parameters;
1830
- const { abi, functionName, args, to } = (() => {
1831
- const contractCalls = calls == null ? void 0 : calls.filter((call) => Boolean(call.abi));
1832
- if (contractCalls.length === 1)
1833
- return contractCalls[0];
1834
- const compatContractCalls = contractCalls.filter((call) => {
1835
- try {
1836
- return Boolean(decodeErrorResult({
1837
- abi: call.abi,
1838
- data: revertData
1839
- }));
1840
- } catch {
1841
- return false;
1842
- }
1843
- });
1844
- if (compatContractCalls.length === 1)
1845
- return compatContractCalls[0];
1846
- return {
1847
- abi: [],
1848
- functionName: contractCalls.reduce((acc, call) => `${acc ? `${acc} | ` : ""}${call.functionName}`, ""),
1849
- args: void 0,
1850
- to: void 0
1851
- };
1852
- })();
1853
- const cause = (() => {
1854
- if (revertData === "0x")
1855
- return new ContractFunctionZeroDataError({ functionName });
1856
- return new ContractFunctionRevertedError({
1857
- abi,
1858
- data: revertData,
1859
- functionName
1860
- });
1861
- })();
1862
- return new ContractFunctionExecutionError(cause, {
1863
- abi,
1864
- args,
1865
- contractAddress: to,
1866
- functionName
1867
- });
1868
- }
1869
- function formatUserOperationGas(parameters) {
1870
- const gas = {};
1871
- if (parameters.callGasLimit)
1872
- gas.callGasLimit = BigInt(parameters.callGasLimit);
1873
- if (parameters.preVerificationGas)
1874
- gas.preVerificationGas = BigInt(parameters.preVerificationGas);
1875
- if (parameters.verificationGasLimit)
1876
- gas.verificationGasLimit = BigInt(parameters.verificationGasLimit);
1877
- if (parameters.paymasterPostOpGasLimit)
1878
- gas.paymasterPostOpGasLimit = BigInt(parameters.paymasterPostOpGasLimit);
1879
- if (parameters.paymasterVerificationGasLimit)
1880
- gas.paymasterVerificationGasLimit = BigInt(parameters.paymasterVerificationGasLimit);
1881
- return gas;
1882
- }
1883
- function formatUserOperationRequest(request) {
1884
- const rpcRequest = {};
1885
- if (typeof request.callData !== "undefined")
1886
- rpcRequest.callData = request.callData;
1887
- if (typeof request.callGasLimit !== "undefined")
1888
- rpcRequest.callGasLimit = numberToHex(request.callGasLimit);
1889
- if (typeof request.factory !== "undefined")
1890
- rpcRequest.factory = request.factory;
1891
- if (typeof request.factoryData !== "undefined")
1892
- rpcRequest.factoryData = request.factoryData;
1893
- if (typeof request.initCode !== "undefined")
1894
- rpcRequest.initCode = request.initCode;
1895
- if (typeof request.maxFeePerGas !== "undefined")
1896
- rpcRequest.maxFeePerGas = numberToHex(request.maxFeePerGas);
1897
- if (typeof request.maxPriorityFeePerGas !== "undefined")
1898
- rpcRequest.maxPriorityFeePerGas = numberToHex(request.maxPriorityFeePerGas);
1899
- if (typeof request.nonce !== "undefined")
1900
- rpcRequest.nonce = numberToHex(request.nonce);
1901
- if (typeof request.paymaster !== "undefined")
1902
- rpcRequest.paymaster = request.paymaster;
1903
- if (typeof request.paymasterAndData !== "undefined")
1904
- rpcRequest.paymasterAndData = request.paymasterAndData || "0x";
1905
- if (typeof request.paymasterData !== "undefined")
1906
- rpcRequest.paymasterData = request.paymasterData;
1907
- if (typeof request.paymasterPostOpGasLimit !== "undefined")
1908
- rpcRequest.paymasterPostOpGasLimit = numberToHex(request.paymasterPostOpGasLimit);
1909
- if (typeof request.paymasterVerificationGasLimit !== "undefined")
1910
- rpcRequest.paymasterVerificationGasLimit = numberToHex(request.paymasterVerificationGasLimit);
1911
- if (typeof request.preVerificationGas !== "undefined")
1912
- rpcRequest.preVerificationGas = numberToHex(request.preVerificationGas);
1913
- if (typeof request.sender !== "undefined")
1914
- rpcRequest.sender = request.sender;
1915
- if (typeof request.signature !== "undefined")
1916
- rpcRequest.signature = request.signature;
1917
- if (typeof request.verificationGasLimit !== "undefined")
1918
- rpcRequest.verificationGasLimit = numberToHex(request.verificationGasLimit);
1919
- if (typeof request.authorization !== "undefined")
1920
- rpcRequest.eip7702Auth = formatAuthorization(request.authorization);
1921
- return rpcRequest;
1922
- }
1923
- function formatAuthorization(authorization) {
1924
- return {
1925
- address: authorization.address,
1926
- chainId: numberToHex(authorization.chainId),
1927
- nonce: numberToHex(authorization.nonce),
1928
- r: authorization.r ? numberToHex(BigInt(authorization.r), { size: 32 }) : pad$1("0x", { size: 32 }),
1929
- s: authorization.s ? numberToHex(BigInt(authorization.s), { size: 32 }) : pad$1("0x", { size: 32 }),
1930
- yParity: authorization.yParity ? numberToHex(authorization.yParity, { size: 1 }) : pad$1("0x", { size: 32 })
1931
- };
1932
- }
1933
- async function getPaymasterData(client, parameters) {
1934
- const { chainId, entryPointAddress, context, ...userOperation } = parameters;
1935
- const request = formatUserOperationRequest(userOperation);
1936
- const { paymasterPostOpGasLimit, paymasterVerificationGasLimit, ...rest } = await client.request({
1937
- method: "pm_getPaymasterData",
1938
- params: [
1939
- {
1940
- ...request,
1941
- callGasLimit: request.callGasLimit ?? "0x0",
1942
- verificationGasLimit: request.verificationGasLimit ?? "0x0",
1943
- preVerificationGas: request.preVerificationGas ?? "0x0"
1944
- },
1945
- entryPointAddress,
1946
- numberToHex(chainId),
1947
- context
1948
- ]
1949
- });
1950
- return {
1951
- ...rest,
1952
- ...paymasterPostOpGasLimit && {
1953
- paymasterPostOpGasLimit: hexToBigInt(paymasterPostOpGasLimit)
1954
- },
1955
- ...paymasterVerificationGasLimit && {
1956
- paymasterVerificationGasLimit: hexToBigInt(paymasterVerificationGasLimit)
1957
- }
1958
- };
1959
- }
1960
- async function getPaymasterStubData(client, parameters) {
1961
- const { chainId, entryPointAddress, context, ...userOperation } = parameters;
1962
- const request = formatUserOperationRequest(userOperation);
1963
- const { paymasterPostOpGasLimit, paymasterVerificationGasLimit, ...rest } = await client.request({
1964
- method: "pm_getPaymasterStubData",
1965
- params: [
1966
- {
1967
- ...request,
1968
- callGasLimit: request.callGasLimit ?? "0x0",
1969
- verificationGasLimit: request.verificationGasLimit ?? "0x0",
1970
- preVerificationGas: request.preVerificationGas ?? "0x0"
1971
- },
1972
- entryPointAddress,
1973
- numberToHex(chainId),
1974
- context
1975
- ]
1976
- });
1977
- return {
1978
- ...rest,
1979
- ...paymasterPostOpGasLimit && {
1980
- paymasterPostOpGasLimit: hexToBigInt(paymasterPostOpGasLimit)
1981
- },
1982
- ...paymasterVerificationGasLimit && {
1983
- paymasterVerificationGasLimit: hexToBigInt(paymasterVerificationGasLimit)
1984
- }
1985
- };
1986
- }
1987
- const defaultParameters = [
1988
- "factory",
1989
- "fees",
1990
- "gas",
1991
- "paymaster",
1992
- "nonce",
1993
- "signature",
1994
- "authorization"
1995
- ];
1996
- async function prepareUserOperation(client, parameters_) {
1997
- var _a;
1998
- const parameters = parameters_;
1999
- const { account: account_ = client.account, parameters: properties = defaultParameters, stateOverride } = parameters;
2000
- if (!account_)
2001
- throw new AccountNotFoundError();
2002
- const account = parseAccount(account_);
2003
- const bundlerClient = client;
2004
- const paymaster = parameters.paymaster ?? (bundlerClient == null ? void 0 : bundlerClient.paymaster);
2005
- const paymasterAddress = typeof paymaster === "string" ? paymaster : void 0;
2006
- const { getPaymasterStubData: getPaymasterStubData$1, getPaymasterData: getPaymasterData$1 } = (() => {
2007
- if (paymaster === true)
2008
- return {
2009
- getPaymasterStubData: (parameters2) => getAction(bundlerClient, getPaymasterStubData, "getPaymasterStubData")(parameters2),
2010
- getPaymasterData: (parameters2) => getAction(bundlerClient, getPaymasterData, "getPaymasterData")(parameters2)
2011
- };
2012
- if (typeof paymaster === "object") {
2013
- const { getPaymasterStubData: getPaymasterStubData2, getPaymasterData: getPaymasterData2 } = paymaster;
2014
- return {
2015
- getPaymasterStubData: getPaymasterData2 && getPaymasterStubData2 ? getPaymasterStubData2 : getPaymasterData2,
2016
- getPaymasterData: getPaymasterData2 && getPaymasterStubData2 ? getPaymasterData2 : void 0
2017
- };
2018
- }
2019
- return {
2020
- getPaymasterStubData: void 0,
2021
- getPaymasterData: void 0
2022
- };
2023
- })();
2024
- const paymasterContext = parameters.paymasterContext ? parameters.paymasterContext : bundlerClient == null ? void 0 : bundlerClient.paymasterContext;
2025
- let request = {
2026
- ...parameters,
2027
- paymaster: paymasterAddress,
2028
- sender: account.address
2029
- };
2030
- const [callData, factory, fees, nonce, authorization] = await Promise.all([
2031
- (async () => {
2032
- if (parameters.calls)
2033
- return account.encodeCalls(parameters.calls.map((call_) => {
2034
- const call = call_;
2035
- if (call.abi)
2036
- return {
2037
- data: encodeFunctionData(call),
2038
- to: call.to,
2039
- value: call.value
2040
- };
2041
- return call;
2042
- }));
2043
- return parameters.callData;
2044
- })(),
2045
- (async () => {
2046
- if (!properties.includes("factory"))
2047
- return void 0;
2048
- if (parameters.initCode)
2049
- return { initCode: parameters.initCode };
2050
- if (parameters.factory && parameters.factoryData) {
2051
- return {
2052
- factory: parameters.factory,
2053
- factoryData: parameters.factoryData
2054
- };
2055
- }
2056
- const { factory: factory2, factoryData } = await account.getFactoryArgs();
2057
- if (account.entryPoint.version === "0.6")
2058
- return {
2059
- initCode: factory2 && factoryData ? concat$1([factory2, factoryData]) : void 0
2060
- };
2061
- return {
2062
- factory: factory2,
2063
- factoryData
2064
- };
2065
- })(),
2066
- (async () => {
2067
- var _a2;
2068
- if (!properties.includes("fees"))
2069
- return void 0;
2070
- if (typeof parameters.maxFeePerGas === "bigint" && typeof parameters.maxPriorityFeePerGas === "bigint")
2071
- return request;
2072
- if ((_a2 = bundlerClient == null ? void 0 : bundlerClient.userOperation) == null ? void 0 : _a2.estimateFeesPerGas) {
2073
- const fees2 = await bundlerClient.userOperation.estimateFeesPerGas({
2074
- account,
2075
- bundlerClient,
2076
- userOperation: request
2077
- });
2078
- return {
2079
- ...request,
2080
- ...fees2
2081
- };
2082
- }
2083
- try {
2084
- const client_ = bundlerClient.client ?? client;
2085
- const fees2 = await getAction(client_, estimateFeesPerGas, "estimateFeesPerGas")({
2086
- chain: client_.chain,
2087
- type: "eip1559"
2088
- });
2089
- return {
2090
- maxFeePerGas: typeof parameters.maxFeePerGas === "bigint" ? parameters.maxFeePerGas : BigInt(
2091
- // Bundlers unfortunately have strict rules on fee prechecks – we will need to set a generous buffer.
2092
- 2n * fees2.maxFeePerGas
2093
- ),
2094
- maxPriorityFeePerGas: typeof parameters.maxPriorityFeePerGas === "bigint" ? parameters.maxPriorityFeePerGas : BigInt(
2095
- // Bundlers unfortunately have strict rules on fee prechecks – we will need to set a generous buffer.
2096
- 2n * fees2.maxPriorityFeePerGas
2097
- )
2098
- };
2099
- } catch {
2100
- return void 0;
2101
- }
2102
- })(),
2103
- (async () => {
2104
- if (!properties.includes("nonce"))
2105
- return void 0;
2106
- if (typeof parameters.nonce === "bigint")
2107
- return parameters.nonce;
2108
- return account.getNonce();
2109
- })(),
2110
- (async () => {
2111
- if (!properties.includes("authorization"))
2112
- return void 0;
2113
- if (typeof parameters.authorization === "object")
2114
- return parameters.authorization;
2115
- if (account.authorization && !await account.isDeployed()) {
2116
- const authorization2 = await prepareAuthorization(account.client, account.authorization);
2117
- return {
2118
- ...authorization2,
2119
- r: "0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",
2120
- s: "0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
2121
- yParity: 1
2122
- };
2123
- }
2124
- return void 0;
2125
- })()
2126
- ]);
2127
- if (typeof callData !== "undefined")
2128
- request.callData = callData;
2129
- if (typeof factory !== "undefined")
2130
- request = { ...request, ...factory };
2131
- if (typeof fees !== "undefined")
2132
- request = { ...request, ...fees };
2133
- if (typeof nonce !== "undefined")
2134
- request.nonce = nonce;
2135
- if (typeof authorization !== "undefined")
2136
- request.authorization = authorization;
2137
- if (properties.includes("signature")) {
2138
- if (typeof parameters.signature !== "undefined")
2139
- request.signature = parameters.signature;
2140
- else
2141
- request.signature = await account.getStubSignature(request);
2142
- }
2143
- if (account.entryPoint.version === "0.6" && !request.initCode)
2144
- request.initCode = "0x";
2145
- let chainId;
2146
- async function getChainId$1() {
2147
- if (chainId)
2148
- return chainId;
2149
- if (client.chain)
2150
- return client.chain.id;
2151
- const chainId_ = await getAction(client, getChainId, "getChainId")({});
2152
- chainId = chainId_;
2153
- return chainId;
2154
- }
2155
- let isPaymasterPopulated = false;
2156
- if (properties.includes("paymaster") && getPaymasterStubData$1 && !paymasterAddress && !parameters.paymasterAndData) {
2157
- const { isFinal = false, sponsor: _, ...paymasterArgs } = await getPaymasterStubData$1({
2158
- chainId: await getChainId$1(),
2159
- entryPointAddress: account.entryPoint.address,
2160
- context: paymasterContext,
2161
- ...request
2162
- });
2163
- isPaymasterPopulated = isFinal;
2164
- request = {
2165
- ...request,
2166
- ...paymasterArgs
2167
- };
2168
- }
2169
- if (account.entryPoint.version === "0.6" && !request.paymasterAndData)
2170
- request.paymasterAndData = "0x";
2171
- if (properties.includes("gas")) {
2172
- if ((_a = account.userOperation) == null ? void 0 : _a.estimateGas) {
2173
- const gas = await account.userOperation.estimateGas(request);
2174
- request = {
2175
- ...request,
2176
- ...gas
2177
- };
2178
- }
2179
- if (typeof request.callGasLimit === "undefined" || typeof request.preVerificationGas === "undefined" || typeof request.verificationGasLimit === "undefined" || request.paymaster && typeof request.paymasterPostOpGasLimit === "undefined" || request.paymaster && typeof request.paymasterVerificationGasLimit === "undefined") {
2180
- const gas = await getAction(bundlerClient, estimateUserOperationGas, "estimateUserOperationGas")({
2181
- account,
2182
- // Some Bundlers fail if nullish gas values are provided for gas estimation :') –
2183
- // so we will need to set a default zeroish value.
2184
- callGasLimit: 0n,
2185
- preVerificationGas: 0n,
2186
- verificationGasLimit: 0n,
2187
- stateOverride,
2188
- ...request.paymaster ? {
2189
- paymasterPostOpGasLimit: 0n,
2190
- paymasterVerificationGasLimit: 0n
2191
- } : {},
2192
- ...request
2193
- });
2194
- request = {
2195
- ...request,
2196
- callGasLimit: request.callGasLimit ?? gas.callGasLimit,
2197
- preVerificationGas: request.preVerificationGas ?? gas.preVerificationGas,
2198
- verificationGasLimit: request.verificationGasLimit ?? gas.verificationGasLimit,
2199
- paymasterPostOpGasLimit: request.paymasterPostOpGasLimit ?? gas.paymasterPostOpGasLimit,
2200
- paymasterVerificationGasLimit: request.paymasterVerificationGasLimit ?? gas.paymasterVerificationGasLimit
2201
- };
2202
- }
2203
- }
2204
- if (properties.includes("paymaster") && getPaymasterData$1 && !paymasterAddress && !parameters.paymasterAndData && !isPaymasterPopulated) {
2205
- const paymaster2 = await getPaymasterData$1({
2206
- chainId: await getChainId$1(),
2207
- entryPointAddress: account.entryPoint.address,
2208
- context: paymasterContext,
2209
- ...request
2210
- });
2211
- request = {
2212
- ...request,
2213
- ...paymaster2
2214
- };
2215
- }
2216
- delete request.calls;
2217
- delete request.parameters;
2218
- delete request.paymasterContext;
2219
- if (typeof request.paymaster !== "string")
2220
- delete request.paymaster;
2221
- return request;
2222
- }
2223
- async function estimateUserOperationGas(client, parameters) {
2224
- var _a;
2225
- const { account: account_ = client.account, entryPointAddress, stateOverride } = parameters;
2226
- if (!account_ && !parameters.sender)
2227
- throw new AccountNotFoundError();
2228
- const account = account_ ? parseAccount(account_) : void 0;
2229
- const rpcStateOverride = serializeStateOverride(stateOverride);
2230
- const request = account ? await getAction(client, prepareUserOperation, "prepareUserOperation")({
2231
- ...parameters,
2232
- parameters: [
2233
- "authorization",
2234
- "factory",
2235
- "nonce",
2236
- "paymaster",
2237
- "signature"
2238
- ]
2239
- }) : parameters;
2240
- try {
2241
- const params = [
2242
- formatUserOperationRequest(request),
2243
- entryPointAddress ?? ((_a = account == null ? void 0 : account.entryPoint) == null ? void 0 : _a.address)
2244
- ];
2245
- const result = await client.request({
2246
- method: "eth_estimateUserOperationGas",
2247
- params: rpcStateOverride ? [...params, rpcStateOverride] : [...params]
2248
- });
2249
- return formatUserOperationGas(result);
2250
- } catch (error) {
2251
- const calls = parameters.calls;
2252
- throw getUserOperationError(error, {
2253
- ...request,
2254
- ...calls ? { calls } : {}
2255
- });
2256
- }
2257
- }
2258
- function getSupportedEntryPoints(client) {
2259
- return client.request({ method: "eth_supportedEntryPoints" });
2260
- }
2261
- function formatUserOperation(parameters) {
2262
- const userOperation = { ...parameters };
2263
- if (parameters.callGasLimit)
2264
- userOperation.callGasLimit = BigInt(parameters.callGasLimit);
2265
- if (parameters.maxFeePerGas)
2266
- userOperation.maxFeePerGas = BigInt(parameters.maxFeePerGas);
2267
- if (parameters.maxPriorityFeePerGas)
2268
- userOperation.maxPriorityFeePerGas = BigInt(parameters.maxPriorityFeePerGas);
2269
- if (parameters.nonce)
2270
- userOperation.nonce = BigInt(parameters.nonce);
2271
- if (parameters.paymasterPostOpGasLimit)
2272
- userOperation.paymasterPostOpGasLimit = BigInt(parameters.paymasterPostOpGasLimit);
2273
- if (parameters.paymasterVerificationGasLimit)
2274
- userOperation.paymasterVerificationGasLimit = BigInt(parameters.paymasterVerificationGasLimit);
2275
- if (parameters.preVerificationGas)
2276
- userOperation.preVerificationGas = BigInt(parameters.preVerificationGas);
2277
- if (parameters.verificationGasLimit)
2278
- userOperation.verificationGasLimit = BigInt(parameters.verificationGasLimit);
2279
- return userOperation;
2280
- }
2281
- async function getUserOperation(client, { hash }) {
2282
- const result = await client.request({
2283
- method: "eth_getUserOperationByHash",
2284
- params: [hash]
2285
- }, { dedupe: true });
2286
- if (!result)
2287
- throw new UserOperationNotFoundError({ hash });
2288
- const { blockHash, blockNumber, entryPoint, transactionHash, userOperation } = result;
2289
- return {
2290
- blockHash,
2291
- blockNumber: BigInt(blockNumber),
2292
- entryPoint,
2293
- transactionHash,
2294
- userOperation: formatUserOperation(userOperation)
2295
- };
2296
- }
2297
- function formatUserOperationReceipt(parameters) {
2298
- const receipt = { ...parameters };
2299
- if (parameters.actualGasCost)
2300
- receipt.actualGasCost = BigInt(parameters.actualGasCost);
2301
- if (parameters.actualGasUsed)
2302
- receipt.actualGasUsed = BigInt(parameters.actualGasUsed);
2303
- if (parameters.logs)
2304
- receipt.logs = parameters.logs.map((log) => formatLog(log));
2305
- if (parameters.receipt)
2306
- receipt.receipt = formatTransactionReceipt(receipt.receipt);
2307
- return receipt;
2308
- }
2309
- async function getUserOperationReceipt(client, { hash }) {
2310
- const receipt = await client.request({
2311
- method: "eth_getUserOperationReceipt",
2312
- params: [hash]
2313
- }, { dedupe: true });
2314
- if (!receipt)
2315
- throw new UserOperationReceiptNotFoundError({ hash });
2316
- return formatUserOperationReceipt(receipt);
2317
- }
2318
- async function sendUserOperation(client, parameters) {
2319
- var _a, _b;
2320
- const { account: account_ = client.account, entryPointAddress } = parameters;
2321
- if (!account_ && !parameters.sender)
2322
- throw new AccountNotFoundError();
2323
- const account = account_ ? parseAccount(account_) : void 0;
2324
- const request = account ? await getAction(client, prepareUserOperation, "prepareUserOperation")(parameters) : parameters;
2325
- const signature = parameters.signature || await ((_a = account == null ? void 0 : account.signUserOperation) == null ? void 0 : _a.call(account, request));
2326
- const rpcParameters = formatUserOperationRequest({
2327
- ...request,
2328
- signature
2329
- });
2330
- try {
2331
- return await client.request({
2332
- method: "eth_sendUserOperation",
2333
- params: [
2334
- rpcParameters,
2335
- entryPointAddress ?? ((_b = account == null ? void 0 : account.entryPoint) == null ? void 0 : _b.address)
2336
- ]
2337
- }, { retryCount: 0 });
2338
- } catch (error) {
2339
- const calls = parameters.calls;
2340
- throw getUserOperationError(error, {
2341
- ...request,
2342
- ...calls ? { calls } : {},
2343
- signature
2344
- });
2345
- }
2346
- }
2347
- function waitForUserOperationReceipt(client, parameters) {
2348
- const { hash, pollingInterval = client.pollingInterval, retryCount, timeout = 12e4 } = parameters;
2349
- let count = 0;
2350
- const observerId = stringify$1([
2351
- "waitForUserOperationReceipt",
2352
- client.uid,
2353
- hash
2354
- ]);
2355
- return new Promise((resolve, reject) => {
2356
- const unobserve = observe(observerId, { resolve, reject }, (emit) => {
2357
- const done = (fn) => {
2358
- unpoll();
2359
- fn();
2360
- unobserve();
2361
- };
2362
- const unpoll = poll(async () => {
2363
- if (retryCount && count >= retryCount)
2364
- done(() => emit.reject(new WaitForUserOperationReceiptTimeoutError({ hash })));
2365
- try {
2366
- const receipt = await getAction(client, getUserOperationReceipt, "getUserOperationReceipt")({ hash });
2367
- done(() => emit.resolve(receipt));
2368
- } catch (err) {
2369
- const error = err;
2370
- if (error.name !== "UserOperationReceiptNotFoundError")
2371
- done(() => emit.reject(error));
2372
- }
2373
- count++;
2374
- }, {
2375
- emitOnBegin: true,
2376
- interval: pollingInterval
2377
- });
2378
- if (timeout)
2379
- setTimeout(() => done(() => emit.reject(new WaitForUserOperationReceiptTimeoutError({ hash }))), timeout);
2380
- return unpoll;
2381
- });
2382
- });
2383
- }
2384
- function bundlerActions(client) {
2385
- return {
2386
- estimateUserOperationGas: (parameters) => estimateUserOperationGas(client, parameters),
2387
- getChainId: () => getChainId(client),
2388
- getSupportedEntryPoints: () => getSupportedEntryPoints(client),
2389
- getUserOperation: (parameters) => getUserOperation(client, parameters),
2390
- getUserOperationReceipt: (parameters) => getUserOperationReceipt(client, parameters),
2391
- prepareUserOperation: (parameters) => prepareUserOperation(client, parameters),
2392
- sendUserOperation: (parameters) => sendUserOperation(client, parameters),
2393
- waitForUserOperationReceipt: (parameters) => waitForUserOperationReceipt(client, parameters)
2394
- };
2395
- }
2396
- function createBundlerClient(parameters) {
2397
- const { client: client_, key = "bundler", name = "Bundler Client", paymaster, paymasterContext, transport, userOperation } = parameters;
2398
- const client = Object.assign(createClient({
2399
- ...parameters,
2400
- chain: parameters.chain ?? (client_ == null ? void 0 : client_.chain),
2401
- key,
2402
- name,
2403
- transport,
2404
- type: "bundlerClient"
2405
- }), { client: client_, paymaster, paymasterContext, userOperation });
2406
- return client.extend(bundlerActions);
2407
- }
2408
- const entryPoint06Address = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
2409
- const version = "0.1.1";
2410
- function getVersion() {
2411
- return version;
2412
- }
2413
- class BaseError extends Error {
2414
- constructor(shortMessage, options = {}) {
2415
- const details = (() => {
2416
- var _a;
2417
- if (options.cause instanceof BaseError) {
2418
- if (options.cause.details)
2419
- return options.cause.details;
2420
- if (options.cause.shortMessage)
2421
- return options.cause.shortMessage;
2422
- }
2423
- if ((_a = options.cause) == null ? void 0 : _a.message)
2424
- return options.cause.message;
2425
- return options.details;
2426
- })();
2427
- const docsPath = (() => {
2428
- if (options.cause instanceof BaseError)
2429
- return options.cause.docsPath || options.docsPath;
2430
- return options.docsPath;
2431
- })();
2432
- const docsBaseUrl = "https://oxlib.sh";
2433
- const docs = `${docsBaseUrl}${docsPath ?? ""}`;
2434
- const message = [
2435
- shortMessage || "An error occurred.",
2436
- ...options.metaMessages ? ["", ...options.metaMessages] : [],
2437
- ...details || docsPath ? [
2438
- "",
2439
- details ? `Details: ${details}` : void 0,
2440
- docsPath ? `See: ${docs}` : void 0
2441
- ] : []
2442
- ].filter((x) => typeof x === "string").join("\n");
2443
- super(message, options.cause ? { cause: options.cause } : void 0);
2444
- Object.defineProperty(this, "details", {
2445
- enumerable: true,
2446
- configurable: true,
2447
- writable: true,
2448
- value: void 0
2449
- });
2450
- Object.defineProperty(this, "docs", {
2451
- enumerable: true,
2452
- configurable: true,
2453
- writable: true,
2454
- value: void 0
2455
- });
2456
- Object.defineProperty(this, "docsPath", {
2457
- enumerable: true,
2458
- configurable: true,
2459
- writable: true,
2460
- value: void 0
2461
- });
2462
- Object.defineProperty(this, "shortMessage", {
2463
- enumerable: true,
2464
- configurable: true,
2465
- writable: true,
2466
- value: void 0
2467
- });
2468
- Object.defineProperty(this, "cause", {
2469
- enumerable: true,
2470
- configurable: true,
2471
- writable: true,
2472
- value: void 0
2473
- });
2474
- Object.defineProperty(this, "name", {
2475
- enumerable: true,
2476
- configurable: true,
2477
- writable: true,
2478
- value: "BaseError"
2479
- });
2480
- Object.defineProperty(this, "version", {
2481
- enumerable: true,
2482
- configurable: true,
2483
- writable: true,
2484
- value: `ox@${getVersion()}`
2485
- });
2486
- this.cause = options.cause;
2487
- this.details = details;
2488
- this.docs = docs;
2489
- this.docsPath = docsPath;
2490
- this.shortMessage = shortMessage;
2491
- }
2492
- walk(fn) {
2493
- return walk(this, fn);
2494
- }
2495
- }
2496
- function walk(err, fn) {
2497
- if (fn == null ? void 0 : fn(err))
2498
- return err;
2499
- if (err && typeof err === "object" && "cause" in err && err.cause)
2500
- return walk(err.cause, fn);
2501
- return fn ? null : err;
2502
- }
2503
- const bigIntSuffix = "#__bigint";
2504
- function stringify(value, replacer, space) {
2505
- return JSON.stringify(value, (key, value2) => {
2506
- if (typeof value2 === "bigint")
2507
- return value2.toString() + bigIntSuffix;
2508
- return value2;
2509
- }, space);
2510
- }
2511
- function assertSize$1(bytes, size_) {
2512
- if (size(bytes) > size_)
2513
- throw new SizeOverflowError2({
2514
- givenSize: size(bytes),
2515
- maxSize: size_
2516
- });
2517
- }
2518
- function assertStartOffset$1(value, start) {
2519
- if (typeof start === "number" && start > 0 && start > size(value) - 1)
2520
- throw new SliceOffsetOutOfBoundsError2({
2521
- offset: start,
2522
- position: "start",
2523
- size: size(value)
2524
- });
2525
- }
2526
- function assertEndOffset$1(value, start, end) {
2527
- if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
2528
- throw new SliceOffsetOutOfBoundsError2({
2529
- offset: end,
2530
- position: "end",
2531
- size: size(value)
2532
- });
2533
- }
2534
- }
2535
- const charCodeMap = {
2536
- zero: 48,
2537
- nine: 57,
2538
- A: 65,
2539
- F: 70,
2540
- a: 97,
2541
- f: 102
2542
- };
2543
- function charCodeToBase16(char) {
2544
- if (char >= charCodeMap.zero && char <= charCodeMap.nine)
2545
- return char - charCodeMap.zero;
2546
- if (char >= charCodeMap.A && char <= charCodeMap.F)
2547
- return char - (charCodeMap.A - 10);
2548
- if (char >= charCodeMap.a && char <= charCodeMap.f)
2549
- return char - (charCodeMap.a - 10);
2550
- return void 0;
2551
- }
2552
- function assertSize(hex, size_) {
2553
- if (size$1(hex) > size_)
2554
- throw new SizeOverflowError$1({
2555
- givenSize: size$1(hex),
2556
- maxSize: size_
2557
- });
2558
- }
2559
- function assertStartOffset(value, start) {
2560
- if (typeof start === "number" && start > 0 && start > size$1(value) - 1)
2561
- throw new SliceOffsetOutOfBoundsError$1({
2562
- offset: start,
2563
- position: "start",
2564
- size: size$1(value)
2565
- });
2566
- }
2567
- function assertEndOffset(value, start, end) {
2568
- if (typeof start === "number" && typeof end === "number" && size$1(value) !== end - start) {
2569
- throw new SliceOffsetOutOfBoundsError$1({
2570
- offset: end,
2571
- position: "end",
2572
- size: size$1(value)
2573
- });
2574
- }
2575
- }
2576
- function pad(hex_, options = {}) {
2577
- const { dir, size: size2 = 32 } = options;
2578
- if (size2 === 0)
2579
- return hex_;
2580
- const hex = hex_.replace("0x", "");
2581
- if (hex.length > size2 * 2)
2582
- throw new SizeExceedsPaddingSizeError({
2583
- size: Math.ceil(hex.length / 2),
2584
- targetSize: size2,
2585
- type: "Hex"
2586
- });
2587
- return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
2588
- }
2589
- const encoder = /* @__PURE__ */ new TextEncoder();
2590
- const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
2591
- function assert$3(value, options = {}) {
2592
- const { strict = false } = options;
2593
- if (!value)
2594
- throw new InvalidHexTypeError(value);
2595
- if (typeof value !== "string")
2596
- throw new InvalidHexTypeError(value);
2597
- if (strict) {
2598
- if (!/^0x[0-9a-fA-F]*$/.test(value))
2599
- throw new InvalidHexValueError(value);
2600
- }
2601
- if (!value.startsWith("0x"))
2602
- throw new InvalidHexValueError(value);
2603
- }
2604
- function concat(...values) {
2605
- return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
2606
- }
2607
- function from$2(value) {
2608
- if (value instanceof Uint8Array)
2609
- return fromBytes$2(value);
2610
- if (Array.isArray(value))
2611
- return fromBytes$2(new Uint8Array(value));
2612
- return value;
2613
- }
2614
- function fromBytes$2(value, options = {}) {
2615
- let string = "";
2616
- for (let i = 0; i < value.length; i++)
2617
- string += hexes[value[i]];
2618
- const hex = `0x${string}`;
2619
- if (typeof options.size === "number") {
2620
- assertSize(hex, options.size);
2621
- return padRight(hex, options.size);
2622
- }
2623
- return hex;
2624
- }
2625
- function fromNumber(value, options = {}) {
2626
- const { signed, size: size2 } = options;
2627
- const value_ = BigInt(value);
2628
- let maxValue;
2629
- if (size2) {
2630
- if (signed)
2631
- maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
2632
- else
2633
- maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
2634
- } else if (typeof value === "number") {
2635
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
2636
- }
2637
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
2638
- if (maxValue && value_ > maxValue || value_ < minValue) {
2639
- const suffix = typeof value === "bigint" ? "n" : "";
2640
- throw new IntegerOutOfRangeError({
2641
- max: maxValue ? `${maxValue}${suffix}` : void 0,
2642
- min: `${minValue}${suffix}`,
2643
- signed,
2644
- size: size2,
2645
- value: `${value}${suffix}`
2646
- });
2647
- }
2648
- const stringValue = (signed && value_ < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value_) : value_).toString(16);
2649
- const hex = `0x${stringValue}`;
2650
- if (size2)
2651
- return padLeft(hex, size2);
2652
- return hex;
2653
- }
2654
- function fromString(value, options = {}) {
2655
- return fromBytes$2(encoder.encode(value), options);
2656
- }
2657
- function padLeft(value, size2) {
2658
- return pad(value, { dir: "left", size: size2 });
2659
- }
2660
- function padRight(value, size2) {
2661
- return pad(value, { dir: "right", size: size2 });
2662
- }
2663
- function slice$1(value, start, end, options = {}) {
2664
- const { strict } = options;
2665
- assertStartOffset(value, start);
2666
- const value_ = `0x${value.replace("0x", "").slice((start ?? 0) * 2, (end ?? value.length) * 2)}`;
2667
- if (strict)
2668
- assertEndOffset(value_, start, end);
2669
- return value_;
2670
- }
2671
- function size$1(value) {
2672
- return Math.ceil((value.length - 2) / 2);
2673
- }
2674
- function toBigInt$1(hex, options = {}) {
2675
- const { signed } = options;
2676
- if (options.size)
2677
- assertSize(hex, options.size);
2678
- const value = BigInt(hex);
2679
- if (!signed)
2680
- return value;
2681
- const size2 = (hex.length - 2) / 2;
2682
- const max_unsigned = (1n << BigInt(size2) * 8n) - 1n;
2683
- const max_signed = max_unsigned >> 1n;
2684
- if (value <= max_signed)
2685
- return value;
2686
- return value - max_unsigned - 1n;
2687
- }
2688
- function validate$1(value, options = {}) {
2689
- const { strict = false } = options;
2690
- try {
2691
- assert$3(value, { strict });
2692
- return true;
2693
- } catch {
2694
- return false;
2695
- }
2696
- }
2697
- class IntegerOutOfRangeError extends BaseError {
2698
- constructor({ max, min, signed, size: size2, value }) {
2699
- super(`Number \`${value}\` is not in safe${size2 ? ` ${size2 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
2700
- Object.defineProperty(this, "name", {
2701
- enumerable: true,
2702
- configurable: true,
2703
- writable: true,
2704
- value: "Hex.IntegerOutOfRangeError"
2705
- });
2706
- }
2707
- }
2708
- class InvalidHexTypeError extends BaseError {
2709
- constructor(value) {
2710
- super(`Value \`${typeof value === "object" ? stringify(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, {
2711
- metaMessages: ['Hex types must be represented as `"0x${string}"`.']
2712
- });
2713
- Object.defineProperty(this, "name", {
2714
- enumerable: true,
2715
- configurable: true,
2716
- writable: true,
2717
- value: "Hex.InvalidHexTypeError"
2718
- });
2719
- }
2720
- }
2721
- class InvalidHexValueError extends BaseError {
2722
- constructor(value) {
2723
- super(`Value \`${value}\` is an invalid hex value.`, {
2724
- metaMessages: [
2725
- 'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
2726
- ]
2727
- });
2728
- Object.defineProperty(this, "name", {
2729
- enumerable: true,
2730
- configurable: true,
2731
- writable: true,
2732
- value: "Hex.InvalidHexValueError"
2733
- });
2734
- }
2735
- }
2736
- let SizeOverflowError$1 = class SizeOverflowError extends BaseError {
2737
- constructor({ givenSize, maxSize }) {
2738
- super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
2739
- Object.defineProperty(this, "name", {
2740
- enumerable: true,
2741
- configurable: true,
2742
- writable: true,
2743
- value: "Hex.SizeOverflowError"
2744
- });
2745
- }
2746
- };
2747
- let SliceOffsetOutOfBoundsError$1 = class SliceOffsetOutOfBoundsError extends BaseError {
2748
- constructor({ offset, position, size: size2 }) {
2749
- super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size2}\`).`);
2750
- Object.defineProperty(this, "name", {
2751
- enumerable: true,
2752
- configurable: true,
2753
- writable: true,
2754
- value: "Hex.SliceOffsetOutOfBoundsError"
2755
- });
2756
- }
2757
- };
2758
- class SizeExceedsPaddingSizeError extends BaseError {
2759
- constructor({ size: size2, targetSize, type }) {
2760
- super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size2}\`) exceeds padding size (\`${targetSize}\`).`);
2761
- Object.defineProperty(this, "name", {
2762
- enumerable: true,
2763
- configurable: true,
2764
- writable: true,
2765
- value: "Hex.SizeExceedsPaddingSizeError"
2766
- });
2767
- }
2768
- }
2769
- function assert$2(value) {
2770
- if (value instanceof Uint8Array)
2771
- return;
2772
- if (!value)
2773
- throw new InvalidBytesTypeError(value);
2774
- if (typeof value !== "object")
2775
- throw new InvalidBytesTypeError(value);
2776
- if (!("BYTES_PER_ELEMENT" in value))
2777
- throw new InvalidBytesTypeError(value);
2778
- if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
2779
- throw new InvalidBytesTypeError(value);
2780
- }
2781
- function from$1(value) {
2782
- if (value instanceof Uint8Array)
2783
- return value;
2784
- if (typeof value === "string")
2785
- return fromHex$3(value);
2786
- return fromArray(value);
2787
- }
2788
- function fromArray(value) {
2789
- return value instanceof Uint8Array ? value : new Uint8Array(value);
2790
- }
2791
- function fromHex$3(value, options = {}) {
2792
- const { size: size2 } = options;
2793
- let hex = value;
2794
- if (size2) {
2795
- assertSize(value, size2);
2796
- hex = padRight(value, size2);
2797
- }
2798
- let hexString = hex.slice(2);
2799
- if (hexString.length % 2)
2800
- hexString = `0${hexString}`;
2801
- const length = hexString.length / 2;
2802
- const bytes = new Uint8Array(length);
2803
- for (let index = 0, j = 0; index < length; index++) {
2804
- const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
2805
- const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
2806
- if (nibbleLeft === void 0 || nibbleRight === void 0) {
2807
- throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
2808
- }
2809
- bytes[index] = nibbleLeft * 16 + nibbleRight;
2810
- }
2811
- return bytes;
2812
- }
2813
- function size(value) {
2814
- return value.length;
2815
- }
2816
- function slice(value, start, end, options = {}) {
2817
- const { strict } = options;
2818
- assertStartOffset$1(value, start);
2819
- const value_ = value.slice(start, end);
2820
- if (strict)
2821
- assertEndOffset$1(value_, start, end);
2822
- return value_;
2823
- }
2824
- function toBigInt(bytes, options = {}) {
2825
- const { size: size2 } = options;
2826
- if (typeof size2 !== "undefined")
2827
- assertSize$1(bytes, size2);
2828
- const hex = fromBytes$2(bytes, options);
2829
- return toBigInt$1(hex, options);
2830
- }
2831
- function validate(value) {
2832
- try {
2833
- assert$2(value);
2834
- return true;
2835
- } catch {
2836
- return false;
2837
- }
2838
- }
2839
- class InvalidBytesTypeError extends BaseError {
2840
- constructor(value) {
2841
- super(`Value \`${typeof value === "object" ? stringify(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value.`, {
2842
- metaMessages: ["Bytes values must be of type `Bytes`."]
2843
- });
2844
- Object.defineProperty(this, "name", {
2845
- enumerable: true,
2846
- configurable: true,
2847
- writable: true,
2848
- value: "Bytes.InvalidBytesTypeError"
2849
- });
2850
- }
2851
- }
2852
- class SizeOverflowError2 extends BaseError {
2853
- constructor({ givenSize, maxSize }) {
2854
- super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
2855
- Object.defineProperty(this, "name", {
2856
- enumerable: true,
2857
- configurable: true,
2858
- writable: true,
2859
- value: "Bytes.SizeOverflowError"
2860
- });
2861
- }
2862
- }
2863
- class SliceOffsetOutOfBoundsError2 extends BaseError {
2864
- constructor({ offset, position, size: size2 }) {
2865
- super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size2}\`).`);
2866
- Object.defineProperty(this, "name", {
2867
- enumerable: true,
2868
- configurable: true,
2869
- writable: true,
2870
- value: "Bytes.SliceOffsetOutOfBoundsError"
2871
- });
2872
- }
2873
- }
2874
- function sha256(value, options = {}) {
2875
- const { as = typeof value === "string" ? "Hex" : "Bytes" } = options;
2876
- const bytes = sha256$1(from$1(value));
2877
- if (as === "Bytes")
2878
- return bytes;
2879
- return fromBytes$2(bytes);
2880
- }
2881
- function assert$1(publicKey, options = {}) {
2882
- const { compressed } = options;
2883
- const { prefix, x, y } = publicKey;
2884
- if (compressed === false || typeof x === "bigint" && typeof y === "bigint") {
2885
- if (prefix !== 4)
2886
- throw new InvalidPrefixError({
2887
- prefix,
2888
- cause: new InvalidUncompressedPrefixError()
2889
- });
2890
- return;
2891
- }
2892
- if (compressed === true || typeof x === "bigint" && typeof y === "undefined") {
2893
- if (prefix !== 3 && prefix !== 2)
2894
- throw new InvalidPrefixError({
2895
- prefix,
2896
- cause: new InvalidCompressedPrefixError()
2897
- });
2898
- return;
2899
- }
2900
- throw new InvalidError({ publicKey });
2901
- }
2902
- function from(value) {
2903
- const publicKey = (() => {
2904
- if (validate$1(value))
2905
- return fromHex$2(value);
2906
- if (validate(value))
2907
- return fromBytes$1(value);
2908
- const { prefix, x, y } = value;
2909
- if (typeof x === "bigint" && typeof y === "bigint")
2910
- return { prefix: prefix ?? 4, x, y };
2911
- return { prefix, x };
2912
- })();
2913
- assert$1(publicKey);
2914
- return publicKey;
2915
- }
2916
- function fromBytes$1(publicKey) {
2917
- return fromHex$2(fromBytes$2(publicKey));
2918
- }
2919
- function fromHex$2(publicKey) {
2920
- if (publicKey.length !== 132 && publicKey.length !== 130 && publicKey.length !== 68)
2921
- throw new InvalidSerializedSizeError$1({ publicKey });
2922
- if (publicKey.length === 130) {
2923
- const x2 = BigInt(slice$1(publicKey, 0, 32));
2924
- const y = BigInt(slice$1(publicKey, 32, 64));
2925
- return {
2926
- prefix: 4,
2927
- x: x2,
2928
- y
2929
- };
2930
- }
2931
- if (publicKey.length === 132) {
2932
- const prefix2 = Number(slice$1(publicKey, 0, 1));
2933
- const x2 = BigInt(slice$1(publicKey, 1, 33));
2934
- const y = BigInt(slice$1(publicKey, 33, 65));
2935
- return {
2936
- prefix: prefix2,
2937
- x: x2,
2938
- y
2939
- };
2940
- }
2941
- const prefix = Number(slice$1(publicKey, 0, 1));
2942
- const x = BigInt(slice$1(publicKey, 1, 33));
2943
- return {
2944
- prefix,
2945
- x
2946
- };
2947
- }
2948
- function toHex$1(publicKey, options = {}) {
2949
- assert$1(publicKey);
2950
- const { prefix, x, y } = publicKey;
2951
- const { includePrefix = true } = options;
2952
- const publicKey_ = concat(
2953
- includePrefix ? fromNumber(prefix, { size: 1 }) : "0x",
2954
- fromNumber(x, { size: 32 }),
2955
- // If the public key is not compressed, add the y coordinate.
2956
- typeof y === "bigint" ? fromNumber(y, { size: 32 }) : "0x"
2957
- );
2958
- return publicKey_;
2959
- }
2960
- class InvalidError extends BaseError {
2961
- constructor({ publicKey }) {
2962
- super(`Value \`${stringify(publicKey)}\` is not a valid public key.`, {
2963
- metaMessages: [
2964
- "Public key must contain:",
2965
- "- an `x` and `prefix` value (compressed)",
2966
- "- an `x`, `y`, and `prefix` value (uncompressed)"
2967
- ]
2968
- });
2969
- Object.defineProperty(this, "name", {
2970
- enumerable: true,
2971
- configurable: true,
2972
- writable: true,
2973
- value: "PublicKey.InvalidError"
2974
- });
2975
- }
2976
- }
2977
- class InvalidPrefixError extends BaseError {
2978
- constructor({ prefix, cause }) {
2979
- super(`Prefix "${prefix}" is invalid.`, {
2980
- cause
2981
- });
2982
- Object.defineProperty(this, "name", {
2983
- enumerable: true,
2984
- configurable: true,
2985
- writable: true,
2986
- value: "PublicKey.InvalidPrefixError"
2987
- });
2988
- }
2989
- }
2990
- class InvalidCompressedPrefixError extends BaseError {
2991
- constructor() {
2992
- super("Prefix must be 2 or 3 for compressed public keys.");
2993
- Object.defineProperty(this, "name", {
2994
- enumerable: true,
2995
- configurable: true,
2996
- writable: true,
2997
- value: "PublicKey.InvalidCompressedPrefixError"
2998
- });
2999
- }
3000
- }
3001
- class InvalidUncompressedPrefixError extends BaseError {
3002
- constructor() {
3003
- super("Prefix must be 4 for uncompressed public keys.");
3004
- Object.defineProperty(this, "name", {
3005
- enumerable: true,
3006
- configurable: true,
3007
- writable: true,
3008
- value: "PublicKey.InvalidUncompressedPrefixError"
3009
- });
3010
- }
3011
- }
3012
- let InvalidSerializedSizeError$1 = class InvalidSerializedSizeError extends BaseError {
3013
- constructor({ publicKey }) {
3014
- super(`Value \`${publicKey}\` is an invalid public key size.`, {
3015
- metaMessages: [
3016
- "Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",
3017
- `Received ${size$1(from$2(publicKey))} bytes.`
3018
- ]
3019
- });
3020
- Object.defineProperty(this, "name", {
3021
- enumerable: true,
3022
- configurable: true,
3023
- writable: true,
3024
- value: "PublicKey.InvalidSerializedSizeError"
3025
- });
3026
- }
3027
- };
3028
- const maxUint256 = 2n ** 256n - 1n;
3029
- function assert(signature, options = {}) {
3030
- const { recovered } = options;
3031
- if (typeof signature.r === "undefined")
3032
- throw new MissingPropertiesError({ signature });
3033
- if (typeof signature.s === "undefined")
3034
- throw new MissingPropertiesError({ signature });
3035
- if (recovered && typeof signature.yParity === "undefined")
3036
- throw new MissingPropertiesError({ signature });
3037
- if (signature.r < 0n || signature.r > maxUint256)
3038
- throw new InvalidRError({ value: signature.r });
3039
- if (signature.s < 0n || signature.s > maxUint256)
3040
- throw new InvalidSError({ value: signature.s });
3041
- if (typeof signature.yParity === "number" && signature.yParity !== 0 && signature.yParity !== 1)
3042
- throw new InvalidYParityError({ value: signature.yParity });
3043
- }
3044
- function fromHex$1(signature) {
3045
- if (signature.length !== 130 && signature.length !== 132)
3046
- throw new InvalidSerializedSizeError2({ signature });
3047
- const r = BigInt(slice$1(signature, 0, 32));
3048
- const s = BigInt(slice$1(signature, 32, 64));
3049
- const yParity = (() => {
3050
- const yParity2 = Number(`0x${signature.slice(130)}`);
3051
- if (Number.isNaN(yParity2))
3052
- return void 0;
3053
- try {
3054
- return vToYParity(yParity2);
3055
- } catch {
3056
- throw new InvalidYParityError({ value: yParity2 });
3057
- }
3058
- })();
3059
- if (typeof yParity === "undefined")
3060
- return {
3061
- r,
3062
- s
3063
- };
3064
- return {
3065
- r,
3066
- s,
3067
- yParity
3068
- };
3069
- }
3070
- function toHex(signature) {
3071
- assert(signature);
3072
- const r = signature.r;
3073
- const s = signature.s;
3074
- const signature_ = concat(
3075
- fromNumber(r, { size: 32 }),
3076
- fromNumber(s, { size: 32 }),
3077
- // If the signature is recovered, add the recovery byte to the signature.
3078
- typeof signature.yParity === "number" ? fromNumber(yParityToV(signature.yParity), { size: 1 }) : "0x"
3079
- );
3080
- return signature_;
3081
- }
3082
- function vToYParity(v) {
3083
- if (v === 0 || v === 27)
3084
- return 0;
3085
- if (v === 1 || v === 28)
3086
- return 1;
3087
- if (v >= 35)
3088
- return v % 2 === 0 ? 1 : 0;
3089
- throw new InvalidVError({ value: v });
3090
- }
3091
- function yParityToV(yParity) {
3092
- if (yParity === 0)
3093
- return 27;
3094
- if (yParity === 1)
3095
- return 28;
3096
- throw new InvalidYParityError({ value: yParity });
3097
- }
3098
- class InvalidSerializedSizeError2 extends BaseError {
3099
- constructor({ signature }) {
3100
- super(`Value \`${signature}\` is an invalid signature size.`, {
3101
- metaMessages: [
3102
- "Expected: 64 bytes or 65 bytes.",
3103
- `Received ${size$1(from$2(signature))} bytes.`
3104
- ]
3105
- });
3106
- Object.defineProperty(this, "name", {
3107
- enumerable: true,
3108
- configurable: true,
3109
- writable: true,
3110
- value: "Signature.InvalidSerializedSizeError"
3111
- });
3112
- }
3113
- }
3114
- class MissingPropertiesError extends BaseError {
3115
- constructor({ signature }) {
3116
- super(`Signature \`${stringify(signature)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`);
3117
- Object.defineProperty(this, "name", {
3118
- enumerable: true,
3119
- configurable: true,
3120
- writable: true,
3121
- value: "Signature.MissingPropertiesError"
3122
- });
3123
- }
3124
- }
3125
- class InvalidRError extends BaseError {
3126
- constructor({ value }) {
3127
- super(`Value \`${value}\` is an invalid r value. r must be a positive integer less than 2^256.`);
3128
- Object.defineProperty(this, "name", {
3129
- enumerable: true,
3130
- configurable: true,
3131
- writable: true,
3132
- value: "Signature.InvalidRError"
3133
- });
3134
- }
3135
- }
3136
- class InvalidSError extends BaseError {
3137
- constructor({ value }) {
3138
- super(`Value \`${value}\` is an invalid s value. s must be a positive integer less than 2^256.`);
3139
- Object.defineProperty(this, "name", {
3140
- enumerable: true,
3141
- configurable: true,
3142
- writable: true,
3143
- value: "Signature.InvalidSError"
3144
- });
3145
- }
3146
- }
3147
- class InvalidYParityError extends BaseError {
3148
- constructor({ value }) {
3149
- super(`Value \`${value}\` is an invalid y-parity value. Y-parity must be 0 or 1.`);
3150
- Object.defineProperty(this, "name", {
3151
- enumerable: true,
3152
- configurable: true,
3153
- writable: true,
3154
- value: "Signature.InvalidYParityError"
3155
- });
3156
- }
3157
- }
3158
- class InvalidVError extends BaseError {
3159
- constructor({ value }) {
3160
- super(`Value \`${value}\` is an invalid v value. v must be 27, 28 or >=35.`);
3161
- Object.defineProperty(this, "name", {
3162
- enumerable: true,
3163
- configurable: true,
3164
- writable: true,
3165
- value: "Signature.InvalidVError"
3166
- });
3167
- }
3168
- }
3169
- const decoder = /* @__PURE__ */ new TextDecoder();
3170
- const integerToCharacter = /* @__PURE__ */ Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((a, i) => [i, a.charCodeAt(0)]));
3171
- ({
3172
- ...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((a, i) => [a.charCodeAt(0), i]))
3173
- });
3174
- function fromBytes(value, options = {}) {
3175
- const { pad: pad2 = true, url = false } = options;
3176
- const encoded = new Uint8Array(Math.ceil(value.length / 3) * 4);
3177
- for (let i = 0, j = 0; j < value.length; i += 4, j += 3) {
3178
- const y = (value[j] << 16) + (value[j + 1] << 8) + (value[j + 2] | 0);
3179
- encoded[i] = integerToCharacter[y >> 18];
3180
- encoded[i + 1] = integerToCharacter[y >> 12 & 63];
3181
- encoded[i + 2] = integerToCharacter[y >> 6 & 63];
3182
- encoded[i + 3] = integerToCharacter[y & 63];
3183
- }
3184
- const k = value.length % 3;
3185
- const end = Math.floor(value.length / 3) * 4 + (k && k + 1);
3186
- let base64 = decoder.decode(new Uint8Array(encoded.buffer, 0, end));
3187
- if (pad2 && k === 1)
3188
- base64 += "==";
3189
- if (pad2 && k === 2)
3190
- base64 += "=";
3191
- if (url)
3192
- base64 = base64.replaceAll("+", "-").replaceAll("/", "_");
3193
- return base64;
3194
- }
3195
- function fromHex(value, options = {}) {
3196
- return fromBytes(fromHex$3(value), options);
3197
- }
3198
- Uint8Array.from([
3199
- 105,
3200
- 171,
3201
- 180,
3202
- 181,
3203
- 160,
3204
- 222,
3205
- 75,
3206
- 198,
3207
- 42,
3208
- 42,
3209
- 32,
3210
- 31,
3211
- 141,
3212
- 37,
3213
- 186,
3214
- 233
3215
- ]);
3216
- function getAuthenticatorData(options = {}) {
3217
- const { flag = 5, rpId = window.location.hostname, signCount = 0 } = options;
3218
- const rpIdHash = sha256(fromString(rpId));
3219
- const flag_bytes = fromNumber(flag, { size: 1 });
3220
- const signCount_bytes = fromNumber(signCount, { size: 4 });
3221
- return concat(rpIdHash, flag_bytes, signCount_bytes);
3222
- }
3223
- function getClientDataJSON(options) {
3224
- const { challenge, crossOrigin = false, extraClientData, origin = window.location.origin } = options;
3225
- return JSON.stringify({
3226
- type: "webauthn.get",
3227
- challenge: fromHex(challenge, { url: true, pad: false }),
3228
- origin,
3229
- crossOrigin,
3230
- ...extraClientData
3231
- });
3232
- }
3233
- function getSignPayload(options) {
3234
- const { challenge, crossOrigin, extraClientData, flag, origin, rpId, signCount, userVerification = "required" } = options;
3235
- const authenticatorData = getAuthenticatorData({
3236
- flag,
3237
- rpId,
3238
- signCount
3239
- });
3240
- const clientDataJSON = getClientDataJSON({
3241
- challenge,
3242
- crossOrigin,
3243
- extraClientData,
3244
- origin
3245
- });
3246
- const clientDataJSONHash = sha256(fromString(clientDataJSON));
3247
- const challengeIndex = clientDataJSON.indexOf('"challenge"');
3248
- const typeIndex = clientDataJSON.indexOf('"type"');
3249
- const metadata = {
3250
- authenticatorData,
3251
- clientDataJSON,
3252
- challengeIndex,
3253
- typeIndex,
3254
- userVerificationRequired: userVerification === "required"
3255
- };
3256
- const payload = concat(authenticatorData, clientDataJSONHash);
3257
- return { metadata, payload };
3258
- }
3259
- async function createKeyPair(options = {}) {
3260
- const { extractable = false } = options;
3261
- const keypair = await globalThis.crypto.subtle.generateKey({
3262
- name: "ECDSA",
3263
- namedCurve: "P-256"
3264
- }, extractable, ["sign", "verify"]);
3265
- const publicKey_raw = await globalThis.crypto.subtle.exportKey("raw", keypair.publicKey);
3266
- const publicKey = from(new Uint8Array(publicKey_raw));
3267
- return {
3268
- privateKey: keypair.privateKey,
3269
- publicKey
3270
- };
3271
- }
3272
- async function sign(options) {
3273
- const { payload, privateKey } = options;
3274
- const signature = await globalThis.crypto.subtle.sign({
3275
- name: "ECDSA",
3276
- hash: "SHA-256"
3277
- }, privateKey, from$1(payload));
3278
- const signature_bytes = fromArray(new Uint8Array(signature));
3279
- const r = toBigInt(slice(signature_bytes, 0, 32));
3280
- let s = toBigInt(slice(signature_bytes, 32, 64));
3281
- if (s > p256.CURVE.n / 2n)
3282
- s = p256.CURVE.n - s;
3283
- return { r, s };
3284
- }
3285
- export {
3286
- sign as a,
3287
- toHex as b,
3288
- createBundlerClient as c,
3289
- createKeyPair as d,
3290
- toSmartAccount as e,
3291
- fromHex$1 as f,
3292
- getSignPayload as g,
3293
- entryPoint06Address as h,
3294
- entryPoint06Abi as i,
3295
- getUserOperationHash as j,
3296
- slice$1 as s,
3297
- toHex$1 as t
3298
- };
3299
- //# sourceMappingURL=WebCryptoP256-B0F1BoHd.js.map