@reown/appkit-cdn 1.8.15-viem-upgrade.0 → 1.8.15-viem-upgrade-2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConstantsUtil-DSO-aT76.js +24 -0
- package/dist/ConstantsUtil-DSO-aT76.js.map +1 -0
- package/dist/ExchangeController-D7JbbTDN.js +265 -0
- package/dist/ExchangeController-D7JbbTDN.js.map +1 -0
- package/dist/HelpersUtil-BfwO5f4J.js +141 -0
- package/dist/HelpersUtil-BfwO5f4J.js.map +1 -0
- package/dist/NavigationUtil-Ci15WS4K.js +9 -0
- package/dist/NavigationUtil-Ci15WS4K.js.map +1 -0
- package/dist/PhArrowCircleDown-B41iUlWV.js +74 -0
- package/dist/PhArrowCircleDown-B41iUlWV.js.map +1 -0
- package/dist/PhArrowClockwise-BY8u5n41.js +74 -0
- package/dist/PhArrowClockwise-BY8u5n41.js.map +1 -0
- package/dist/PhArrowDown-ClD8GZ65.js +74 -0
- package/dist/PhArrowDown-ClD8GZ65.js.map +1 -0
- package/dist/PhArrowLeft-B8MXUz60.js +74 -0
- package/dist/PhArrowLeft-B8MXUz60.js.map +1 -0
- package/dist/PhArrowRight-Cewa_Slb.js +74 -0
- package/dist/PhArrowRight-Cewa_Slb.js.map +1 -0
- package/dist/PhArrowSquareOut-whgWh-lD.js +74 -0
- package/dist/PhArrowSquareOut-whgWh-lD.js.map +1 -0
- package/dist/PhArrowUp-B1HXBxie.js +74 -0
- package/dist/PhArrowUp-B1HXBxie.js.map +1 -0
- package/dist/PhArrowUpRight-CfFYe4FP.js +74 -0
- package/dist/PhArrowUpRight-CfFYe4FP.js.map +1 -0
- package/dist/PhArrowsClockwise-gL1Gkrtx.js +74 -0
- package/dist/PhArrowsClockwise-gL1Gkrtx.js.map +1 -0
- package/dist/PhArrowsDownUp-BqUEdUQr.js +74 -0
- package/dist/PhArrowsDownUp-BqUEdUQr.js.map +1 -0
- package/dist/PhArrowsLeftRight-BlZU63eY.js +74 -0
- package/dist/PhArrowsLeftRight-BlZU63eY.js.map +1 -0
- package/dist/PhBank-gbg_jlI7.js +74 -0
- package/dist/PhBank-gbg_jlI7.js.map +1 -0
- package/dist/PhBrowser-CMlD-YJw.js +74 -0
- package/dist/PhBrowser-CMlD-YJw.js.map +1 -0
- package/dist/PhCaretDown-3agTO8Jp.js +74 -0
- package/dist/PhCaretDown-3agTO8Jp.js.map +1 -0
- package/dist/PhCaretLeft-_MTni7Z5.js +74 -0
- package/dist/PhCaretLeft-_MTni7Z5.js.map +1 -0
- package/dist/PhCaretRight-Ci9fAHPG.js +74 -0
- package/dist/PhCaretRight-Ci9fAHPG.js.map +1 -0
- package/dist/PhCaretUp-vFG4Fame.js +74 -0
- package/dist/PhCaretUp-vFG4Fame.js.map +1 -0
- package/dist/PhCheck-mChGK6K_.js +74 -0
- package/dist/PhCheck-mChGK6K_.js.map +1 -0
- package/dist/PhCircleHalf-DZ7-vfxf.js +74 -0
- package/dist/PhCircleHalf-DZ7-vfxf.js.map +1 -0
- package/dist/PhClock-Bc5XWXb6.js +74 -0
- package/dist/PhClock-Bc5XWXb6.js.map +1 -0
- package/dist/PhCompass-Cu2MB-55.js +74 -0
- package/dist/PhCompass-Cu2MB-55.js.map +1 -0
- package/dist/PhCopy-BGUjyTts.js +74 -0
- package/dist/PhCopy-BGUjyTts.js.map +1 -0
- package/dist/PhCreditCard-vxFWID4B.js +74 -0
- package/dist/PhCreditCard-vxFWID4B.js.map +1 -0
- package/dist/PhCurrencyDollar-BfOoDhJr.js +74 -0
- package/dist/PhCurrencyDollar-BfOoDhJr.js.map +1 -0
- package/dist/PhDesktop-Cq6jwzbS.js +74 -0
- package/dist/PhDesktop-Cq6jwzbS.js.map +1 -0
- package/dist/PhDeviceMobile-BCtTp6jj.js +74 -0
- package/dist/PhDeviceMobile-BCtTp6jj.js.map +1 -0
- package/dist/PhDotsThree-BGgD-WIO.js +74 -0
- package/dist/PhDotsThree-BGgD-WIO.js.map +1 -0
- package/dist/PhEnvelope-CQiV0-zG.js +74 -0
- package/dist/PhEnvelope-CQiV0-zG.js.map +1 -0
- package/dist/PhFunnelSimple-BHGtxTNf.js +74 -0
- package/dist/PhFunnelSimple-BHGtxTNf.js.map +1 -0
- package/dist/PhGlobe-Q8oVkf6X.js +74 -0
- package/dist/PhGlobe-Q8oVkf6X.js.map +1 -0
- package/dist/PhIdentificationCard-Cz9LzvVR.js +74 -0
- package/dist/PhIdentificationCard-Cz9LzvVR.js.map +1 -0
- package/dist/PhImage-CP5_qKk-.js +74 -0
- package/dist/PhImage-CP5_qKk-.js.map +1 -0
- package/dist/PhInfo-CTlE1X9Z.js +74 -0
- package/dist/PhInfo-CTlE1X9Z.js.map +1 -0
- package/dist/PhLightbulb-CcLpnAAb.js +74 -0
- package/dist/PhLightbulb-CcLpnAAb.js.map +1 -0
- package/dist/PhMagnifyingGlass-n58GUAck.js +74 -0
- package/dist/PhMagnifyingGlass-n58GUAck.js.map +1 -0
- package/dist/PhPaperPlaneRight-C0sf2XV8.js +74 -0
- package/dist/PhPaperPlaneRight-C0sf2XV8.js.map +1 -0
- package/dist/PhPlus-BJxvt7Uc.js +74 -0
- package/dist/PhPlus-BJxvt7Uc.js.map +1 -0
- package/dist/PhPower-BvktxO2-.js +74 -0
- package/dist/PhPower-BvktxO2-.js.map +1 -0
- package/dist/PhPuzzlePiece-CDDyUPYo.js +74 -0
- package/dist/PhPuzzlePiece-CDDyUPYo.js.map +1 -0
- package/dist/PhQrCode-BlGI8529.js +74 -0
- package/dist/PhQrCode-BlGI8529.js.map +1 -0
- package/dist/PhQuestion-DGZj6iDZ.js +74 -0
- package/dist/PhQuestion-DGZj6iDZ.js.map +1 -0
- package/dist/PhQuestionMark-CTmeI7MQ.js +74 -0
- package/dist/PhQuestionMark-CTmeI7MQ.js.map +1 -0
- package/dist/PhSealCheck-BSlqkxnH.js +74 -0
- package/dist/PhSealCheck-BSlqkxnH.js.map +1 -0
- package/dist/PhSignOut-CEXxlRk3.js +74 -0
- package/dist/PhSignOut-CEXxlRk3.js.map +1 -0
- package/dist/PhSpinner-Do1pY8fG.js +74 -0
- package/dist/PhSpinner-Do1pY8fG.js.map +1 -0
- package/dist/PhTrash-JNKavmpg.js +74 -0
- package/dist/PhTrash-JNKavmpg.js.map +1 -0
- package/dist/PhUser-BW7E-xYg.js +74 -0
- package/dist/PhUser-BW7E-xYg.js.map +1 -0
- package/dist/PhVault-mzxUgBYN.js +74 -0
- package/dist/PhVault-mzxUgBYN.js.map +1 -0
- package/dist/PhWallet-BR9JThKU.js +74 -0
- package/dist/PhWallet-BR9JThKU.js.map +1 -0
- package/dist/PhWarning-DxuQ70WM.js +74 -0
- package/dist/PhWarning-DxuQ70WM.js.map +1 -0
- package/dist/PhWarningCircle-DCI0JC1F.js +74 -0
- package/dist/PhWarningCircle-DCI0JC1F.js.map +1 -0
- package/dist/PhX-CWNXqpGn.js +74 -0
- package/dist/PhX-CWNXqpGn.js.map +1 -0
- package/dist/SwapController-B9-o3mQi.js +684 -0
- package/dist/SwapController-B9-o3mQi.js.map +1 -0
- package/dist/WebCryptoP256-C3tULCeM.js +3306 -0
- package/dist/WebCryptoP256-C3tULCeM.js.map +1 -0
- package/dist/add-D30MIcu9.js +20 -0
- package/dist/add-D30MIcu9.js.map +1 -0
- package/dist/all-wallets-C80If_mR.js +11 -0
- package/dist/all-wallets-C80If_mR.js.map +1 -0
- package/dist/app-store-BmykKf9Z.js +22 -0
- package/dist/app-store-BmykKf9Z.js.map +1 -0
- package/dist/appkit-8yrMZRW-.js +122304 -0
- package/dist/appkit-8yrMZRW-.js.map +1 -0
- package/dist/appkit.js +11 -0
- package/dist/appkit.js.map +1 -0
- package/dist/apple-Dj3k73U9.js +23 -0
- package/dist/apple-Dj3k73U9.js.map +1 -0
- package/dist/arrow-bottom-circle-BChVBNAj.js +16 -0
- package/dist/arrow-bottom-circle-BChVBNAj.js.map +1 -0
- package/dist/arrow-bottom-yR02zZ81.js +13 -0
- package/dist/arrow-bottom-yR02zZ81.js.map +1 -0
- package/dist/arrow-left-Cee83VTx.js +13 -0
- package/dist/arrow-left-Cee83VTx.js.map +1 -0
- package/dist/arrow-right-DQ18mteW.js +13 -0
- package/dist/arrow-right-DQ18mteW.js.map +1 -0
- package/dist/arrow-top-B6s5gNau.js +13 -0
- package/dist/arrow-top-B6s5gNau.js.map +1 -0
- package/dist/async-directive-CMZZt7_p.js +73 -0
- package/dist/async-directive-CMZZt7_p.js.map +1 -0
- package/dist/bank-CbtVBu5E.js +19 -0
- package/dist/bank-CbtVBu5E.js.map +1 -0
- package/dist/basic-DgeOYTPN.js +4914 -0
- package/dist/basic-DgeOYTPN.js.map +1 -0
- package/dist/browser-5XoTmr4n.js +1991 -0
- package/dist/browser-5XoTmr4n.js.map +1 -0
- package/dist/browser-DKlNidhn.js +19 -0
- package/dist/browser-DKlNidhn.js.map +1 -0
- package/dist/card-SMLX2mqy.js +19 -0
- package/dist/card-SMLX2mqy.js.map +1 -0
- package/dist/ccip-CelHgeHp.js +164 -0
- package/dist/ccip-CelHgeHp.js.map +1 -0
- package/dist/checkmark-BFaipJhW.js +16 -0
- package/dist/checkmark-BFaipJhW.js.map +1 -0
- package/dist/checkmark-bold-Bo-g2gCt.js +13 -0
- package/dist/checkmark-bold-Bo-g2gCt.js.map +1 -0
- package/dist/chevron-bottom-CLdpL1_U.js +13 -0
- package/dist/chevron-bottom-CLdpL1_U.js.map +1 -0
- package/dist/chevron-left-BMatzLVm.js +13 -0
- package/dist/chevron-left-BMatzLVm.js.map +1 -0
- package/dist/chevron-right-2QBn-njW.js +13 -0
- package/dist/chevron-right-2QBn-njW.js.map +1 -0
- package/dist/chevron-top-3JfkBBnK.js +13 -0
- package/dist/chevron-top-3JfkBBnK.js.map +1 -0
- package/dist/chrome-store-zmrzd-ux.js +66 -0
- package/dist/chrome-store-zmrzd-ux.js.map +1 -0
- package/dist/class-map-k3nlzPqR.js +101 -0
- package/dist/class-map-k3nlzPqR.js.map +1 -0
- package/dist/clock-CwBvHRGi.js +13 -0
- package/dist/clock-CwBvHRGi.js.map +1 -0
- package/dist/close-DGwKhnz2.js +13 -0
- package/dist/close-DGwKhnz2.js.map +1 -0
- package/dist/clsx.m-D57qXwfE.js +21 -0
- package/dist/clsx.m-D57qXwfE.js.map +1 -0
- package/dist/coinPlaceholder-Bjl3yxih.js +13 -0
- package/dist/coinPlaceholder-Bjl3yxih.js.map +1 -0
- package/dist/compass-Ci53Xt_m.js +13 -0
- package/dist/compass-Ci53Xt_m.js.map +1 -0
- package/dist/copy-DEV1V6UY.js +20 -0
- package/dist/copy-DEV1V6UY.js.map +1 -0
- package/dist/core-C57n14fz.js +16288 -0
- package/dist/core-C57n14fz.js.map +1 -0
- package/dist/cursor-aZqnhG2b.js +8 -0
- package/dist/cursor-aZqnhG2b.js.map +1 -0
- package/dist/cursor-transparent-B1JSDQ4k.js +17 -0
- package/dist/cursor-transparent-B1JSDQ4k.js.map +1 -0
- package/dist/data-capture-4tu-_Un-.js +549 -0
- package/dist/data-capture-4tu-_Un-.js.map +1 -0
- package/dist/desktop-CYHnO2jB.js +14 -0
- package/dist/desktop-CYHnO2jB.js.map +1 -0
- package/dist/disconnect-Bort8PHj.js +13 -0
- package/dist/disconnect-Bort8PHj.js.map +1 -0
- package/dist/discord-DC76-391.js +22 -0
- package/dist/discord-DC76-391.js.map +1 -0
- package/dist/email-CetCpugE.js +421 -0
- package/dist/email-CetCpugE.js.map +1 -0
- package/dist/embedded-wallet-DGmopvFw.js +952 -0
- package/dist/embedded-wallet-DGmopvFw.js.map +1 -0
- package/dist/etherscan-CM1VXVi8.js +11 -0
- package/dist/etherscan-CM1VXVi8.js.map +1 -0
- package/dist/exclamation-triangle-C2EQS3zg.js +9 -0
- package/dist/exclamation-triangle-C2EQS3zg.js.map +1 -0
- package/dist/extension-CrQTWCzR.js +13 -0
- package/dist/extension-CrQTWCzR.js.map +1 -0
- package/dist/external-link-C-HaFB9S.js +13 -0
- package/dist/external-link-C-HaFB9S.js.map +1 -0
- package/dist/facebook-vNJNGTyY.js +31 -0
- package/dist/facebook-vNJNGTyY.js.map +1 -0
- package/dist/farcaster-BojA8Y3Q.js +17 -0
- package/dist/farcaster-BojA8Y3Q.js.map +1 -0
- package/dist/features-BqXSc1qT.js +319 -0
- package/dist/features-BqXSc1qT.js.map +1 -0
- package/dist/filters-CPcSdM3I.js +13 -0
- package/dist/filters-CPcSdM3I.js.map +1 -0
- package/dist/github-lRHD4KBY.js +23 -0
- package/dist/github-lRHD4KBY.js.map +1 -0
- package/dist/google-CxxvUUsR.js +23 -0
- package/dist/google-CxxvUUsR.js.map +1 -0
- package/dist/hashTypedData-CGPAwUvI.js +259 -0
- package/dist/hashTypedData-CGPAwUvI.js.map +1 -0
- package/dist/help-circle-YHj9O9n4.js +17 -0
- package/dist/help-circle-YHj9O9n4.js.map +1 -0
- package/dist/id-BbzMFdj1.js +17 -0
- package/dist/id-BbzMFdj1.js.map +1 -0
- package/dist/if-defined-G2Q1ofvJ.js +11 -0
- package/dist/if-defined-G2Q1ofvJ.js.map +1 -0
- package/dist/image-BXTuNWmr.js +9 -0
- package/dist/image-BXTuNWmr.js.map +1 -0
- package/dist/index-21QOMdJE.js +984 -0
- package/dist/index-21QOMdJE.js.map +1 -0
- package/dist/index-51p9LM0s.js +218 -0
- package/dist/index-51p9LM0s.js.map +1 -0
- package/dist/index-ALlvRvBi.js +3987 -0
- package/dist/index-ALlvRvBi.js.map +1 -0
- package/dist/index-B6tCHS_j.js +120 -0
- package/dist/index-B6tCHS_j.js.map +1 -0
- package/dist/index-B9IUGIqh.js +211 -0
- package/dist/index-B9IUGIqh.js.map +1 -0
- package/dist/index-BFKYwgq3.js +7488 -0
- package/dist/index-BFKYwgq3.js.map +1 -0
- package/dist/index-BPB7fVHQ.js +281 -0
- package/dist/index-BPB7fVHQ.js.map +1 -0
- package/dist/index-BdRMG5oJ.js +126 -0
- package/dist/index-BdRMG5oJ.js.map +1 -0
- package/dist/index-Bowi-aBJ.js +147 -0
- package/dist/index-Bowi-aBJ.js.map +1 -0
- package/dist/index-BpOoitMw.js +131 -0
- package/dist/index-BpOoitMw.js.map +1 -0
- package/dist/index-BqCjN5Bk.js +124 -0
- package/dist/index-BqCjN5Bk.js.map +1 -0
- package/dist/index-Bv2Jkp0T.js +967 -0
- package/dist/index-Bv2Jkp0T.js.map +1 -0
- package/dist/index-C2tJFA0B.js +1372 -0
- package/dist/index-C2tJFA0B.js.map +1 -0
- package/dist/index-C3h1bsiv.js +109 -0
- package/dist/index-C3h1bsiv.js.map +1 -0
- package/dist/index-CFC2NxJ5.js +180 -0
- package/dist/index-CFC2NxJ5.js.map +1 -0
- package/dist/index-CG2tDcOE.js +182 -0
- package/dist/index-CG2tDcOE.js.map +1 -0
- package/dist/index-CM8qnUNO.js +181 -0
- package/dist/index-CM8qnUNO.js.map +1 -0
- package/dist/index-CNivx0yI.js +1178 -0
- package/dist/index-CNivx0yI.js.map +1 -0
- package/dist/index-CStkjfQQ.js +521 -0
- package/dist/index-CStkjfQQ.js.map +1 -0
- package/dist/index-CV3sK6gH.js +7258 -0
- package/dist/index-CV3sK6gH.js.map +1 -0
- package/dist/index-CZkzO2fh.js +70 -0
- package/dist/index-CZkzO2fh.js.map +1 -0
- package/dist/index-Ce3DzdHE.js +520 -0
- package/dist/index-Ce3DzdHE.js.map +1 -0
- package/dist/index-CgVqanW1.js +611 -0
- package/dist/index-CgVqanW1.js.map +1 -0
- package/dist/index-Ci6Y519l.js +249 -0
- package/dist/index-Ci6Y519l.js.map +1 -0
- package/dist/index-CnpO-uMV.js +62 -0
- package/dist/index-CnpO-uMV.js.map +1 -0
- package/dist/index-Cs_Ue1li.js +9530 -0
- package/dist/index-Cs_Ue1li.js.map +1 -0
- package/dist/index-CzIN86Z6.js +52 -0
- package/dist/index-CzIN86Z6.js.map +1 -0
- package/dist/index-DGrOD_Uk.js +136 -0
- package/dist/index-DGrOD_Uk.js.map +1 -0
- package/dist/index-DQgrdARk.js +198 -0
- package/dist/index-DQgrdARk.js.map +1 -0
- package/dist/index-DUrjw7B_.js +92 -0
- package/dist/index-DUrjw7B_.js.map +1 -0
- package/dist/index-DYvUtH2H.js +198 -0
- package/dist/index-DYvUtH2H.js.map +1 -0
- package/dist/index-DjlKuTuO.js +1582 -0
- package/dist/index-DjlKuTuO.js.map +1 -0
- package/dist/index-DrdtZOyM.js +286 -0
- package/dist/index-DrdtZOyM.js.map +1 -0
- package/dist/index-Dt1IUAIj.js +716 -0
- package/dist/index-Dt1IUAIj.js.map +1 -0
- package/dist/index-DvmMzzVa.js +18322 -0
- package/dist/index-DvmMzzVa.js.map +1 -0
- package/dist/index-DzZOIbsR.js +147 -0
- package/dist/index-DzZOIbsR.js.map +1 -0
- package/dist/index-ENsIYRhz.js +542 -0
- package/dist/index-ENsIYRhz.js.map +1 -0
- package/dist/index-QqIUi-wY.js +2402 -0
- package/dist/index-QqIUi-wY.js.map +1 -0
- package/dist/index-SlVjFZvp.js +110 -0
- package/dist/index-SlVjFZvp.js.map +1 -0
- package/dist/index-VKogKIsA.js +985 -0
- package/dist/index-VKogKIsA.js.map +1 -0
- package/dist/index-bd39Gizk.js +153 -0
- package/dist/index-bd39Gizk.js.map +1 -0
- package/dist/index-ciqjpb4e.js +73 -0
- package/dist/index-ciqjpb4e.js.map +1 -0
- package/dist/index-d4z00ajR.js +456 -0
- package/dist/index-d4z00ajR.js.map +1 -0
- package/dist/index-dTaiyIFQ.js +257 -0
- package/dist/index-dTaiyIFQ.js.map +1 -0
- package/dist/index-nkefGcqB.js +9350 -0
- package/dist/index-nkefGcqB.js.map +1 -0
- package/dist/index-pg-zQJY9.js +441 -0
- package/dist/index-pg-zQJY9.js.map +1 -0
- package/dist/index.es-Dpl-2r0L.js +8503 -0
- package/dist/index.es-Dpl-2r0L.js.map +1 -0
- package/dist/info-BhGLu7a7.js +8 -0
- package/dist/info-BhGLu7a7.js.map +1 -0
- package/dist/info-circle-qS-gYigf.js +17 -0
- package/dist/info-circle-qS-gYigf.js.map +1 -0
- package/dist/jsxRuntime.module-Bj81_EKI.js +14 -0
- package/dist/jsxRuntime.module-Bj81_EKI.js.map +1 -0
- package/dist/lightbulb-CkRo4E3y.js +8 -0
- package/dist/lightbulb-CkRo4E3y.js.map +1 -0
- package/dist/localBatchGatewayRequest-BP_oqSkW.js +103 -0
- package/dist/localBatchGatewayRequest-BP_oqSkW.js.map +1 -0
- package/dist/mail-DPd51pyO.js +13 -0
- package/dist/mail-DPd51pyO.js.map +1 -0
- package/dist/metamask-sdk-yihv7E6u.js +16699 -0
- package/dist/metamask-sdk-yihv7E6u.js.map +1 -0
- package/dist/mobile-CRO9ITfa.js +14 -0
- package/dist/mobile-CRO9ITfa.js.map +1 -0
- package/dist/more-DyaHLM9d.js +16 -0
- package/dist/more-DyaHLM9d.js.map +1 -0
- package/dist/native-CMPA4OCm.js +17 -0
- package/dist/native-CMPA4OCm.js.map +1 -0
- package/dist/network-placeholder-DGSqV09i.js +19 -0
- package/dist/network-placeholder-DGSqV09i.js.map +1 -0
- package/dist/nftPlaceholder-CLGGLw6g.js +13 -0
- package/dist/nftPlaceholder-CLGGLw6g.js.map +1 -0
- package/dist/off-CDy-1GjF.js +13 -0
- package/dist/off-CDy-1GjF.js.map +1 -0
- package/dist/onramp-pjFNY0fj.js +979 -0
- package/dist/onramp-pjFNY0fj.js.map +1 -0
- package/dist/parseSignature-CV_ULbSZ.js +2828 -0
- package/dist/parseSignature-CV_ULbSZ.js.map +1 -0
- package/dist/pay-with-exchange-Cz8dXxOa.js +603 -0
- package/dist/pay-with-exchange-Cz8dXxOa.js.map +1 -0
- package/dist/play-store-CdQ0GJhU.js +37 -0
- package/dist/play-store-CdQ0GJhU.js.map +1 -0
- package/dist/plus-DD_oKDcI.js +18 -0
- package/dist/plus-DD_oKDcI.js.map +1 -0
- package/dist/property-8UcTqffH.js +623 -0
- package/dist/property-8UcTqffH.js.map +1 -0
- package/dist/qr-code-BJLuAwDg.js +11 -0
- package/dist/qr-code-BJLuAwDg.js.map +1 -0
- package/dist/receive-Brpo8_fV.js +262 -0
- package/dist/receive-Brpo8_fV.js.map +1 -0
- package/dist/recycle-horizontal-DMqA4Y6p.js +14 -0
- package/dist/recycle-horizontal-DMqA4Y6p.js.map +1 -0
- package/dist/ref-6sYmD-zI.js +43 -0
- package/dist/ref-6sYmD-zI.js.map +1 -0
- package/dist/refresh-SYbxLwZK.js +13 -0
- package/dist/refresh-SYbxLwZK.js.map +1 -0
- package/dist/reown-logo-FMoXntuJ.js +17 -0
- package/dist/reown-logo-FMoXntuJ.js.map +1 -0
- package/dist/search-DyRiO0T8.js +13 -0
- package/dist/search-DyRiO0T8.js.map +1 -0
- package/dist/secp256k1-DCQG8fZg.js +2031 -0
- package/dist/secp256k1-DCQG8fZg.js.map +1 -0
- package/dist/send-AaCUn2jw.js +20 -0
- package/dist/send-AaCUn2jw.js.map +1 -0
- package/dist/send-cysMDEC9.js +1365 -0
- package/dist/send-cysMDEC9.js.map +1 -0
- package/dist/socials-BU9YyLx1.js +796 -0
- package/dist/socials-BU9YyLx1.js.map +1 -0
- package/dist/swapHorizontal-kHwa5wbg.js +13 -0
- package/dist/swapHorizontal-kHwa5wbg.js.map +1 -0
- package/dist/swapHorizontalBold-Bf_Sy4KD.js +13 -0
- package/dist/swapHorizontalBold-Bf_Sy4KD.js.map +1 -0
- package/dist/swapHorizontalMedium-C4oU0KJg.js +21 -0
- package/dist/swapHorizontalMedium-C4oU0KJg.js.map +1 -0
- package/dist/swapHorizontalRoundedBold-IJ8G94V0.js +13 -0
- package/dist/swapHorizontalRoundedBold-IJ8G94V0.js.map +1 -0
- package/dist/swapVertical-CuDVDBMJ.js +13 -0
- package/dist/swapVertical-CuDVDBMJ.js.map +1 -0
- package/dist/swaps-TcZwQiir.js +2121 -0
- package/dist/swaps-TcZwQiir.js.map +1 -0
- package/dist/telegram-DSi6IsaA.js +21 -0
- package/dist/telegram-DSi6IsaA.js.map +1 -0
- package/dist/three-dots-CqgQBZQ6.js +10 -0
- package/dist/three-dots-CqgQBZQ6.js.map +1 -0
- package/dist/transactions-CcagUdpJ.js +38 -0
- package/dist/transactions-CcagUdpJ.js.map +1 -0
- package/dist/twitch-DrUmltT6.js +23 -0
- package/dist/twitch-DrUmltT6.js.map +1 -0
- package/dist/twitterIcon-eNCEY2nh.js +11 -0
- package/dist/twitterIcon-eNCEY2nh.js.map +1 -0
- package/dist/vanilla-CgG5xMJO.js +448 -0
- package/dist/vanilla-CgG5xMJO.js.map +1 -0
- package/dist/verify-DGCdp1PG.js +13 -0
- package/dist/verify-DGCdp1PG.js.map +1 -0
- package/dist/verify-filled-BN5Rdq_X.js +13 -0
- package/dist/verify-filled-BN5Rdq_X.js.map +1 -0
- package/dist/w3m-modal-C23tcwd0.js +2008 -0
- package/dist/w3m-modal-C23tcwd0.js.map +1 -0
- package/dist/w3m-modal-D_WKuA4j.js +1725 -0
- package/dist/w3m-modal-D_WKuA4j.js.map +1 -0
- package/dist/wallet-Dh8w0rox.js +13 -0
- package/dist/wallet-Dh8w0rox.js.map +1 -0
- package/dist/wallet-placeholder-gjfCYn59.js +19 -0
- package/dist/wallet-placeholder-gjfCYn59.js.map +1 -0
- package/dist/wallet-standard-CWX-EDlP.js +523 -0
- package/dist/wallet-standard-CWX-EDlP.js.map +1 -0
- package/dist/walletconnect-BI4tTckl.js +39 -0
- package/dist/walletconnect-BI4tTckl.js.map +1 -0
- package/dist/warning-circle-jCqjcA2f.js +17 -0
- package/dist/warning-circle-jCqjcA2f.js.map +1 -0
- package/dist/x-BfcQ5n6S.js +17 -0
- package/dist/x-BfcQ5n6S.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,3306 @@
|
|
|
1
|
+
import { bL as concat$1, bM as pad$1, bN as numberToHex, b3 as hashTypedData, bO as encodeAbiParameters, bP as keccak256, bQ as createNonceManager, bR as serializeErc6492Signature, bS as getAction, bT as getCode, bU as readContract, bV as parseAbi, bW as BaseError$1, bX as prettyPrint, bY as formatGwei, bZ as decodeErrorResult, b_ as ContractFunctionZeroDataError, b$ as ContractFunctionRevertedError, c0 as ContractFunctionExecutionError, c1 as hexToBigInt, c2 as AccountNotFoundError, c3 as parseAccount, b1 as encodeFunctionData, c4 as estimateFeesPerGas, c5 as prepareAuthorization, c6 as getChainId, c7 as serializeStateOverride, c8 as formatLog, c9 as formatTransactionReceipt, ca as stringify$1, cb as observe, cc as poll, cd as createClient, ce as sha256$1 } from "./appkit-8yrMZRW-.js";
|
|
2
|
+
import { p as p256 } from "./index-pg-zQJY9.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
|
+
const entryPoint06Address = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
|
|
724
|
+
function getInitCode(userOperation) {
|
|
725
|
+
const { authorization, factory, factoryData } = userOperation;
|
|
726
|
+
if (factory === "0x7702" || factory === "0x7702000000000000000000000000000000000000") {
|
|
727
|
+
if (!authorization)
|
|
728
|
+
return "0x7702000000000000000000000000000000000000";
|
|
729
|
+
const delegation = authorization.address;
|
|
730
|
+
return concat$1([delegation, factoryData ?? "0x"]);
|
|
731
|
+
}
|
|
732
|
+
if (!factory)
|
|
733
|
+
return "0x";
|
|
734
|
+
return concat$1([factory, factoryData ?? "0x"]);
|
|
735
|
+
}
|
|
736
|
+
function toPackedUserOperation(userOperation) {
|
|
737
|
+
const { callGasLimit, callData, maxPriorityFeePerGas, maxFeePerGas, paymaster, paymasterData, paymasterPostOpGasLimit, paymasterSignature, paymasterVerificationGasLimit, sender, signature = "0x", verificationGasLimit } = userOperation;
|
|
738
|
+
const accountGasLimits = concat$1([
|
|
739
|
+
pad$1(numberToHex(verificationGasLimit || 0n), { size: 16 }),
|
|
740
|
+
pad$1(numberToHex(callGasLimit || 0n), { size: 16 })
|
|
741
|
+
]);
|
|
742
|
+
const initCode = getInitCode(userOperation);
|
|
743
|
+
const gasFees = concat$1([
|
|
744
|
+
pad$1(numberToHex(maxPriorityFeePerGas || 0n), { size: 16 }),
|
|
745
|
+
pad$1(numberToHex(maxFeePerGas || 0n), { size: 16 })
|
|
746
|
+
]);
|
|
747
|
+
const nonce = userOperation.nonce ?? 0n;
|
|
748
|
+
const paymasterAndData = paymaster ? concat$1([
|
|
749
|
+
paymaster,
|
|
750
|
+
pad$1(numberToHex(paymasterVerificationGasLimit || 0n), {
|
|
751
|
+
size: 16
|
|
752
|
+
}),
|
|
753
|
+
pad$1(numberToHex(paymasterPostOpGasLimit || 0n), {
|
|
754
|
+
size: 16
|
|
755
|
+
}),
|
|
756
|
+
paymasterData || "0x",
|
|
757
|
+
...paymasterSignature ? [paymasterSignature] : []
|
|
758
|
+
]) : "0x";
|
|
759
|
+
const preVerificationGas = userOperation.preVerificationGas ?? 0n;
|
|
760
|
+
return {
|
|
761
|
+
accountGasLimits,
|
|
762
|
+
callData,
|
|
763
|
+
initCode,
|
|
764
|
+
gasFees,
|
|
765
|
+
nonce,
|
|
766
|
+
paymasterAndData,
|
|
767
|
+
preVerificationGas,
|
|
768
|
+
sender,
|
|
769
|
+
signature
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
const types = {
|
|
773
|
+
PackedUserOperation: [
|
|
774
|
+
{ type: "address", name: "sender" },
|
|
775
|
+
{ type: "uint256", name: "nonce" },
|
|
776
|
+
{ type: "bytes", name: "initCode" },
|
|
777
|
+
{ type: "bytes", name: "callData" },
|
|
778
|
+
{ type: "bytes32", name: "accountGasLimits" },
|
|
779
|
+
{ type: "uint256", name: "preVerificationGas" },
|
|
780
|
+
{ type: "bytes32", name: "gasFees" },
|
|
781
|
+
{ type: "bytes", name: "paymasterAndData" }
|
|
782
|
+
]
|
|
783
|
+
};
|
|
784
|
+
function getUserOperationTypedData(parameters) {
|
|
785
|
+
const { chainId, entryPointAddress, userOperation } = parameters;
|
|
786
|
+
const packedUserOp = toPackedUserOperation(userOperation);
|
|
787
|
+
return {
|
|
788
|
+
types,
|
|
789
|
+
primaryType: "PackedUserOperation",
|
|
790
|
+
domain: {
|
|
791
|
+
name: "ERC4337",
|
|
792
|
+
version: "1",
|
|
793
|
+
chainId,
|
|
794
|
+
verifyingContract: entryPointAddress
|
|
795
|
+
},
|
|
796
|
+
message: packedUserOp
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
function getUserOperationHash(parameters) {
|
|
800
|
+
const { chainId, entryPointAddress, entryPointVersion } = parameters;
|
|
801
|
+
const userOperation = parameters.userOperation;
|
|
802
|
+
const { authorization, callData = "0x", callGasLimit, maxFeePerGas, maxPriorityFeePerGas, nonce, paymasterAndData = "0x", preVerificationGas, sender, verificationGasLimit } = userOperation;
|
|
803
|
+
if (entryPointVersion === "0.8" || entryPointVersion === "0.9")
|
|
804
|
+
return hashTypedData(getUserOperationTypedData({
|
|
805
|
+
chainId,
|
|
806
|
+
entryPointAddress,
|
|
807
|
+
userOperation
|
|
808
|
+
}));
|
|
809
|
+
const packedUserOp = (() => {
|
|
810
|
+
var _a, _b;
|
|
811
|
+
if (entryPointVersion === "0.6") {
|
|
812
|
+
const factory = (_a = userOperation.initCode) == null ? void 0 : _a.slice(0, 42);
|
|
813
|
+
const factoryData = (_b = userOperation.initCode) == null ? void 0 : _b.slice(42);
|
|
814
|
+
const initCode = getInitCode({
|
|
815
|
+
authorization,
|
|
816
|
+
factory,
|
|
817
|
+
factoryData
|
|
818
|
+
});
|
|
819
|
+
return encodeAbiParameters([
|
|
820
|
+
{ type: "address" },
|
|
821
|
+
{ type: "uint256" },
|
|
822
|
+
{ type: "bytes32" },
|
|
823
|
+
{ type: "bytes32" },
|
|
824
|
+
{ type: "uint256" },
|
|
825
|
+
{ type: "uint256" },
|
|
826
|
+
{ type: "uint256" },
|
|
827
|
+
{ type: "uint256" },
|
|
828
|
+
{ type: "uint256" },
|
|
829
|
+
{ type: "bytes32" }
|
|
830
|
+
], [
|
|
831
|
+
sender,
|
|
832
|
+
nonce,
|
|
833
|
+
keccak256(initCode),
|
|
834
|
+
keccak256(callData),
|
|
835
|
+
callGasLimit,
|
|
836
|
+
verificationGasLimit,
|
|
837
|
+
preVerificationGas,
|
|
838
|
+
maxFeePerGas,
|
|
839
|
+
maxPriorityFeePerGas,
|
|
840
|
+
keccak256(paymasterAndData)
|
|
841
|
+
]);
|
|
842
|
+
}
|
|
843
|
+
if (entryPointVersion === "0.7") {
|
|
844
|
+
const packedUserOp2 = toPackedUserOperation(userOperation);
|
|
845
|
+
return encodeAbiParameters([
|
|
846
|
+
{ type: "address" },
|
|
847
|
+
{ type: "uint256" },
|
|
848
|
+
{ type: "bytes32" },
|
|
849
|
+
{ type: "bytes32" },
|
|
850
|
+
{ type: "bytes32" },
|
|
851
|
+
{ type: "uint256" },
|
|
852
|
+
{ type: "bytes32" },
|
|
853
|
+
{ type: "bytes32" }
|
|
854
|
+
], [
|
|
855
|
+
packedUserOp2.sender,
|
|
856
|
+
packedUserOp2.nonce,
|
|
857
|
+
keccak256(packedUserOp2.initCode),
|
|
858
|
+
keccak256(packedUserOp2.callData),
|
|
859
|
+
packedUserOp2.accountGasLimits,
|
|
860
|
+
packedUserOp2.preVerificationGas,
|
|
861
|
+
packedUserOp2.gasFees,
|
|
862
|
+
keccak256(packedUserOp2.paymasterAndData)
|
|
863
|
+
]);
|
|
864
|
+
}
|
|
865
|
+
throw new Error(`entryPointVersion "${entryPointVersion}" not supported.`);
|
|
866
|
+
})();
|
|
867
|
+
return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [keccak256(packedUserOp), entryPointAddress, BigInt(chainId)]));
|
|
868
|
+
}
|
|
869
|
+
async function toSmartAccount(implementation) {
|
|
870
|
+
const { extend, nonceKeyManager = createNonceManager({
|
|
871
|
+
source: {
|
|
872
|
+
get() {
|
|
873
|
+
return Date.now();
|
|
874
|
+
},
|
|
875
|
+
set() {
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}), ...rest } = implementation;
|
|
879
|
+
let deployed = false;
|
|
880
|
+
const address = await implementation.getAddress();
|
|
881
|
+
return {
|
|
882
|
+
...extend,
|
|
883
|
+
...rest,
|
|
884
|
+
address,
|
|
885
|
+
async getFactoryArgs() {
|
|
886
|
+
if ("isDeployed" in this && await this.isDeployed())
|
|
887
|
+
return { factory: void 0, factoryData: void 0 };
|
|
888
|
+
return implementation.getFactoryArgs();
|
|
889
|
+
},
|
|
890
|
+
async getNonce(parameters) {
|
|
891
|
+
const key = (parameters == null ? void 0 : parameters.key) ?? BigInt(await nonceKeyManager.consume({
|
|
892
|
+
address,
|
|
893
|
+
chainId: implementation.client.chain.id,
|
|
894
|
+
client: implementation.client
|
|
895
|
+
}));
|
|
896
|
+
if (implementation.getNonce)
|
|
897
|
+
return await implementation.getNonce({ ...parameters, key });
|
|
898
|
+
const nonce = await readContract(implementation.client, {
|
|
899
|
+
abi: parseAbi([
|
|
900
|
+
"function getNonce(address, uint192) pure returns (uint256)"
|
|
901
|
+
]),
|
|
902
|
+
address: implementation.entryPoint.address,
|
|
903
|
+
functionName: "getNonce",
|
|
904
|
+
args: [address, key]
|
|
905
|
+
});
|
|
906
|
+
return nonce;
|
|
907
|
+
},
|
|
908
|
+
async isDeployed() {
|
|
909
|
+
if (deployed)
|
|
910
|
+
return true;
|
|
911
|
+
const code = await getAction(implementation.client, getCode, "getCode")({
|
|
912
|
+
address
|
|
913
|
+
});
|
|
914
|
+
deployed = Boolean(code);
|
|
915
|
+
return deployed;
|
|
916
|
+
},
|
|
917
|
+
...implementation.sign ? {
|
|
918
|
+
async sign(parameters) {
|
|
919
|
+
const [{ factory, factoryData }, signature] = await Promise.all([
|
|
920
|
+
this.getFactoryArgs(),
|
|
921
|
+
implementation.sign(parameters)
|
|
922
|
+
]);
|
|
923
|
+
if (factory && factoryData)
|
|
924
|
+
return serializeErc6492Signature({
|
|
925
|
+
address: factory,
|
|
926
|
+
data: factoryData,
|
|
927
|
+
signature
|
|
928
|
+
});
|
|
929
|
+
return signature;
|
|
930
|
+
}
|
|
931
|
+
} : {},
|
|
932
|
+
async signMessage(parameters) {
|
|
933
|
+
const [{ factory, factoryData }, signature] = await Promise.all([
|
|
934
|
+
this.getFactoryArgs(),
|
|
935
|
+
implementation.signMessage(parameters)
|
|
936
|
+
]);
|
|
937
|
+
if (factory && factoryData && factory !== "0x7702")
|
|
938
|
+
return serializeErc6492Signature({
|
|
939
|
+
address: factory,
|
|
940
|
+
data: factoryData,
|
|
941
|
+
signature
|
|
942
|
+
});
|
|
943
|
+
return signature;
|
|
944
|
+
},
|
|
945
|
+
async signTypedData(parameters) {
|
|
946
|
+
const [{ factory, factoryData }, signature] = await Promise.all([
|
|
947
|
+
this.getFactoryArgs(),
|
|
948
|
+
implementation.signTypedData(parameters)
|
|
949
|
+
]);
|
|
950
|
+
if (factory && factoryData && factory !== "0x7702")
|
|
951
|
+
return serializeErc6492Signature({
|
|
952
|
+
address: factory,
|
|
953
|
+
data: factoryData,
|
|
954
|
+
signature
|
|
955
|
+
});
|
|
956
|
+
return signature;
|
|
957
|
+
},
|
|
958
|
+
type: "smart"
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
class AccountNotDeployedError extends BaseError$1 {
|
|
962
|
+
constructor({ cause }) {
|
|
963
|
+
super("Smart Account is not deployed.", {
|
|
964
|
+
cause,
|
|
965
|
+
metaMessages: [
|
|
966
|
+
"This could arise when:",
|
|
967
|
+
"- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.",
|
|
968
|
+
"- An incorrect `sender` address is provided."
|
|
969
|
+
],
|
|
970
|
+
name: "AccountNotDeployedError"
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
Object.defineProperty(AccountNotDeployedError, "message", {
|
|
975
|
+
enumerable: true,
|
|
976
|
+
configurable: true,
|
|
977
|
+
writable: true,
|
|
978
|
+
value: /aa20/
|
|
979
|
+
});
|
|
980
|
+
class ExecutionRevertedError extends BaseError$1 {
|
|
981
|
+
constructor({ cause, data, message } = {}) {
|
|
982
|
+
var _a;
|
|
983
|
+
const reason = (_a = message == null ? void 0 : message.replace("execution reverted: ", "")) == null ? void 0 : _a.replace("execution reverted", "");
|
|
984
|
+
super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
|
|
985
|
+
cause,
|
|
986
|
+
name: "ExecutionRevertedError"
|
|
987
|
+
});
|
|
988
|
+
Object.defineProperty(this, "data", {
|
|
989
|
+
enumerable: true,
|
|
990
|
+
configurable: true,
|
|
991
|
+
writable: true,
|
|
992
|
+
value: void 0
|
|
993
|
+
});
|
|
994
|
+
this.data = data;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
Object.defineProperty(ExecutionRevertedError, "code", {
|
|
998
|
+
enumerable: true,
|
|
999
|
+
configurable: true,
|
|
1000
|
+
writable: true,
|
|
1001
|
+
value: -32521
|
|
1002
|
+
});
|
|
1003
|
+
Object.defineProperty(ExecutionRevertedError, "message", {
|
|
1004
|
+
enumerable: true,
|
|
1005
|
+
configurable: true,
|
|
1006
|
+
writable: true,
|
|
1007
|
+
value: /execution reverted/
|
|
1008
|
+
});
|
|
1009
|
+
class FailedToSendToBeneficiaryError extends BaseError$1 {
|
|
1010
|
+
constructor({ cause }) {
|
|
1011
|
+
super("Failed to send funds to beneficiary.", {
|
|
1012
|
+
cause,
|
|
1013
|
+
name: "FailedToSendToBeneficiaryError"
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
Object.defineProperty(FailedToSendToBeneficiaryError, "message", {
|
|
1018
|
+
enumerable: true,
|
|
1019
|
+
configurable: true,
|
|
1020
|
+
writable: true,
|
|
1021
|
+
value: /aa91/
|
|
1022
|
+
});
|
|
1023
|
+
class GasValuesOverflowError extends BaseError$1 {
|
|
1024
|
+
constructor({ cause }) {
|
|
1025
|
+
super("Gas value overflowed.", {
|
|
1026
|
+
cause,
|
|
1027
|
+
metaMessages: [
|
|
1028
|
+
"This could arise when:",
|
|
1029
|
+
"- one of the gas values exceeded 2**120 (uint120)"
|
|
1030
|
+
].filter(Boolean),
|
|
1031
|
+
name: "GasValuesOverflowError"
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
Object.defineProperty(GasValuesOverflowError, "message", {
|
|
1036
|
+
enumerable: true,
|
|
1037
|
+
configurable: true,
|
|
1038
|
+
writable: true,
|
|
1039
|
+
value: /aa94/
|
|
1040
|
+
});
|
|
1041
|
+
class HandleOpsOutOfGasError extends BaseError$1 {
|
|
1042
|
+
constructor({ cause }) {
|
|
1043
|
+
super("The `handleOps` function was called by the Bundler with a gas limit too low.", {
|
|
1044
|
+
cause,
|
|
1045
|
+
name: "HandleOpsOutOfGasError"
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
Object.defineProperty(HandleOpsOutOfGasError, "message", {
|
|
1050
|
+
enumerable: true,
|
|
1051
|
+
configurable: true,
|
|
1052
|
+
writable: true,
|
|
1053
|
+
value: /aa95/
|
|
1054
|
+
});
|
|
1055
|
+
class InitCodeFailedError extends BaseError$1 {
|
|
1056
|
+
constructor({ cause, factory, factoryData, initCode }) {
|
|
1057
|
+
super("Failed to simulate deployment for Smart Account.", {
|
|
1058
|
+
cause,
|
|
1059
|
+
metaMessages: [
|
|
1060
|
+
"This could arise when:",
|
|
1061
|
+
"- Invalid `factory`/`factoryData` or `initCode` properties are present",
|
|
1062
|
+
"- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",
|
|
1063
|
+
"- Smart Account deployment execution reverted with an error\n",
|
|
1064
|
+
factory && `factory: ${factory}`,
|
|
1065
|
+
factoryData && `factoryData: ${factoryData}`,
|
|
1066
|
+
initCode && `initCode: ${initCode}`
|
|
1067
|
+
].filter(Boolean),
|
|
1068
|
+
name: "InitCodeFailedError"
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
Object.defineProperty(InitCodeFailedError, "message", {
|
|
1073
|
+
enumerable: true,
|
|
1074
|
+
configurable: true,
|
|
1075
|
+
writable: true,
|
|
1076
|
+
value: /aa13/
|
|
1077
|
+
});
|
|
1078
|
+
class InitCodeMustCreateSenderError extends BaseError$1 {
|
|
1079
|
+
constructor({ cause, factory, factoryData, initCode }) {
|
|
1080
|
+
super("Smart Account initialization implementation did not create an account.", {
|
|
1081
|
+
cause,
|
|
1082
|
+
metaMessages: [
|
|
1083
|
+
"This could arise when:",
|
|
1084
|
+
"- `factory`/`factoryData` or `initCode` properties are invalid",
|
|
1085
|
+
"- Smart Account initialization implementation is incorrect\n",
|
|
1086
|
+
factory && `factory: ${factory}`,
|
|
1087
|
+
factoryData && `factoryData: ${factoryData}`,
|
|
1088
|
+
initCode && `initCode: ${initCode}`
|
|
1089
|
+
].filter(Boolean),
|
|
1090
|
+
name: "InitCodeMustCreateSenderError"
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
Object.defineProperty(InitCodeMustCreateSenderError, "message", {
|
|
1095
|
+
enumerable: true,
|
|
1096
|
+
configurable: true,
|
|
1097
|
+
writable: true,
|
|
1098
|
+
value: /aa15/
|
|
1099
|
+
});
|
|
1100
|
+
class InitCodeMustReturnSenderError extends BaseError$1 {
|
|
1101
|
+
constructor({ cause, factory, factoryData, initCode, sender }) {
|
|
1102
|
+
super("Smart Account initialization implementation does not return the expected sender.", {
|
|
1103
|
+
cause,
|
|
1104
|
+
metaMessages: [
|
|
1105
|
+
"This could arise when:",
|
|
1106
|
+
"Smart Account initialization implementation does not return a sender address\n",
|
|
1107
|
+
factory && `factory: ${factory}`,
|
|
1108
|
+
factoryData && `factoryData: ${factoryData}`,
|
|
1109
|
+
initCode && `initCode: ${initCode}`,
|
|
1110
|
+
sender && `sender: ${sender}`
|
|
1111
|
+
].filter(Boolean),
|
|
1112
|
+
name: "InitCodeMustReturnSenderError"
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
Object.defineProperty(InitCodeMustReturnSenderError, "message", {
|
|
1117
|
+
enumerable: true,
|
|
1118
|
+
configurable: true,
|
|
1119
|
+
writable: true,
|
|
1120
|
+
value: /aa14/
|
|
1121
|
+
});
|
|
1122
|
+
class InsufficientPrefundError extends BaseError$1 {
|
|
1123
|
+
constructor({ cause }) {
|
|
1124
|
+
super("Smart Account does not have sufficient funds to execute the User Operation.", {
|
|
1125
|
+
cause,
|
|
1126
|
+
metaMessages: [
|
|
1127
|
+
"This could arise when:",
|
|
1128
|
+
"- the Smart Account does not have sufficient funds to cover the required prefund, or",
|
|
1129
|
+
"- a Paymaster was not provided"
|
|
1130
|
+
].filter(Boolean),
|
|
1131
|
+
name: "InsufficientPrefundError"
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
Object.defineProperty(InsufficientPrefundError, "message", {
|
|
1136
|
+
enumerable: true,
|
|
1137
|
+
configurable: true,
|
|
1138
|
+
writable: true,
|
|
1139
|
+
value: /aa21/
|
|
1140
|
+
});
|
|
1141
|
+
class InternalCallOnlyError extends BaseError$1 {
|
|
1142
|
+
constructor({ cause }) {
|
|
1143
|
+
super("Bundler attempted to call an invalid function on the EntryPoint.", {
|
|
1144
|
+
cause,
|
|
1145
|
+
name: "InternalCallOnlyError"
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
Object.defineProperty(InternalCallOnlyError, "message", {
|
|
1150
|
+
enumerable: true,
|
|
1151
|
+
configurable: true,
|
|
1152
|
+
writable: true,
|
|
1153
|
+
value: /aa92/
|
|
1154
|
+
});
|
|
1155
|
+
class InvalidAggregatorError extends BaseError$1 {
|
|
1156
|
+
constructor({ cause }) {
|
|
1157
|
+
super("Bundler used an invalid aggregator for handling aggregated User Operations.", {
|
|
1158
|
+
cause,
|
|
1159
|
+
name: "InvalidAggregatorError"
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
Object.defineProperty(InvalidAggregatorError, "message", {
|
|
1164
|
+
enumerable: true,
|
|
1165
|
+
configurable: true,
|
|
1166
|
+
writable: true,
|
|
1167
|
+
value: /aa96/
|
|
1168
|
+
});
|
|
1169
|
+
class InvalidAccountNonceError extends BaseError$1 {
|
|
1170
|
+
constructor({ cause, nonce }) {
|
|
1171
|
+
super("Invalid Smart Account nonce used for User Operation.", {
|
|
1172
|
+
cause,
|
|
1173
|
+
metaMessages: [nonce && `nonce: ${nonce}`].filter(Boolean),
|
|
1174
|
+
name: "InvalidAccountNonceError"
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
Object.defineProperty(InvalidAccountNonceError, "message", {
|
|
1179
|
+
enumerable: true,
|
|
1180
|
+
configurable: true,
|
|
1181
|
+
writable: true,
|
|
1182
|
+
value: /aa25/
|
|
1183
|
+
});
|
|
1184
|
+
class InvalidBeneficiaryError extends BaseError$1 {
|
|
1185
|
+
constructor({ cause }) {
|
|
1186
|
+
super("Bundler has not set a beneficiary address.", {
|
|
1187
|
+
cause,
|
|
1188
|
+
name: "InvalidBeneficiaryError"
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
Object.defineProperty(InvalidBeneficiaryError, "message", {
|
|
1193
|
+
enumerable: true,
|
|
1194
|
+
configurable: true,
|
|
1195
|
+
writable: true,
|
|
1196
|
+
value: /aa90/
|
|
1197
|
+
});
|
|
1198
|
+
class InvalidFieldsError extends BaseError$1 {
|
|
1199
|
+
constructor({ cause }) {
|
|
1200
|
+
super("Invalid fields set on User Operation.", {
|
|
1201
|
+
cause,
|
|
1202
|
+
name: "InvalidFieldsError"
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
Object.defineProperty(InvalidFieldsError, "code", {
|
|
1207
|
+
enumerable: true,
|
|
1208
|
+
configurable: true,
|
|
1209
|
+
writable: true,
|
|
1210
|
+
value: -32602
|
|
1211
|
+
});
|
|
1212
|
+
class InvalidPaymasterAndDataError extends BaseError$1 {
|
|
1213
|
+
constructor({ cause, paymasterAndData }) {
|
|
1214
|
+
super("Paymaster properties provided are invalid.", {
|
|
1215
|
+
cause,
|
|
1216
|
+
metaMessages: [
|
|
1217
|
+
"This could arise when:",
|
|
1218
|
+
"- the `paymasterAndData` property is of an incorrect length\n",
|
|
1219
|
+
paymasterAndData && `paymasterAndData: ${paymasterAndData}`
|
|
1220
|
+
].filter(Boolean),
|
|
1221
|
+
name: "InvalidPaymasterAndDataError"
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
Object.defineProperty(InvalidPaymasterAndDataError, "message", {
|
|
1226
|
+
enumerable: true,
|
|
1227
|
+
configurable: true,
|
|
1228
|
+
writable: true,
|
|
1229
|
+
value: /aa93/
|
|
1230
|
+
});
|
|
1231
|
+
class PaymasterDepositTooLowError extends BaseError$1 {
|
|
1232
|
+
constructor({ cause }) {
|
|
1233
|
+
super("Paymaster deposit for the User Operation is too low.", {
|
|
1234
|
+
cause,
|
|
1235
|
+
metaMessages: [
|
|
1236
|
+
"This could arise when:",
|
|
1237
|
+
"- the Paymaster has deposited less than the expected amount via the `deposit` function"
|
|
1238
|
+
].filter(Boolean),
|
|
1239
|
+
name: "PaymasterDepositTooLowError"
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
Object.defineProperty(PaymasterDepositTooLowError, "code", {
|
|
1244
|
+
enumerable: true,
|
|
1245
|
+
configurable: true,
|
|
1246
|
+
writable: true,
|
|
1247
|
+
value: -32508
|
|
1248
|
+
});
|
|
1249
|
+
Object.defineProperty(PaymasterDepositTooLowError, "message", {
|
|
1250
|
+
enumerable: true,
|
|
1251
|
+
configurable: true,
|
|
1252
|
+
writable: true,
|
|
1253
|
+
value: /aa31/
|
|
1254
|
+
});
|
|
1255
|
+
class PaymasterFunctionRevertedError extends BaseError$1 {
|
|
1256
|
+
constructor({ cause }) {
|
|
1257
|
+
super("The `validatePaymasterUserOp` function on the Paymaster reverted.", {
|
|
1258
|
+
cause,
|
|
1259
|
+
name: "PaymasterFunctionRevertedError"
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
Object.defineProperty(PaymasterFunctionRevertedError, "message", {
|
|
1264
|
+
enumerable: true,
|
|
1265
|
+
configurable: true,
|
|
1266
|
+
writable: true,
|
|
1267
|
+
value: /aa33/
|
|
1268
|
+
});
|
|
1269
|
+
class PaymasterNotDeployedError extends BaseError$1 {
|
|
1270
|
+
constructor({ cause }) {
|
|
1271
|
+
super("The Paymaster contract has not been deployed.", {
|
|
1272
|
+
cause,
|
|
1273
|
+
name: "PaymasterNotDeployedError"
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
Object.defineProperty(PaymasterNotDeployedError, "message", {
|
|
1278
|
+
enumerable: true,
|
|
1279
|
+
configurable: true,
|
|
1280
|
+
writable: true,
|
|
1281
|
+
value: /aa30/
|
|
1282
|
+
});
|
|
1283
|
+
class PaymasterRateLimitError extends BaseError$1 {
|
|
1284
|
+
constructor({ cause }) {
|
|
1285
|
+
super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.", {
|
|
1286
|
+
cause,
|
|
1287
|
+
name: "PaymasterRateLimitError"
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
Object.defineProperty(PaymasterRateLimitError, "code", {
|
|
1292
|
+
enumerable: true,
|
|
1293
|
+
configurable: true,
|
|
1294
|
+
writable: true,
|
|
1295
|
+
value: -32504
|
|
1296
|
+
});
|
|
1297
|
+
class PaymasterStakeTooLowError extends BaseError$1 {
|
|
1298
|
+
constructor({ cause }) {
|
|
1299
|
+
super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.", {
|
|
1300
|
+
cause,
|
|
1301
|
+
name: "PaymasterStakeTooLowError"
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
Object.defineProperty(PaymasterStakeTooLowError, "code", {
|
|
1306
|
+
enumerable: true,
|
|
1307
|
+
configurable: true,
|
|
1308
|
+
writable: true,
|
|
1309
|
+
value: -32505
|
|
1310
|
+
});
|
|
1311
|
+
class PaymasterPostOpFunctionRevertedError extends BaseError$1 {
|
|
1312
|
+
constructor({ cause }) {
|
|
1313
|
+
super("Paymaster `postOp` function reverted.", {
|
|
1314
|
+
cause,
|
|
1315
|
+
name: "PaymasterPostOpFunctionRevertedError"
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
Object.defineProperty(PaymasterPostOpFunctionRevertedError, "message", {
|
|
1320
|
+
enumerable: true,
|
|
1321
|
+
configurable: true,
|
|
1322
|
+
writable: true,
|
|
1323
|
+
value: /aa50/
|
|
1324
|
+
});
|
|
1325
|
+
class SenderAlreadyConstructedError extends BaseError$1 {
|
|
1326
|
+
constructor({ cause, factory, factoryData, initCode }) {
|
|
1327
|
+
super("Smart Account has already been deployed.", {
|
|
1328
|
+
cause,
|
|
1329
|
+
metaMessages: [
|
|
1330
|
+
"Remove the following properties and try again:",
|
|
1331
|
+
factory && "`factory`",
|
|
1332
|
+
factoryData && "`factoryData`",
|
|
1333
|
+
initCode && "`initCode`"
|
|
1334
|
+
].filter(Boolean),
|
|
1335
|
+
name: "SenderAlreadyConstructedError"
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
Object.defineProperty(SenderAlreadyConstructedError, "message", {
|
|
1340
|
+
enumerable: true,
|
|
1341
|
+
configurable: true,
|
|
1342
|
+
writable: true,
|
|
1343
|
+
value: /aa10/
|
|
1344
|
+
});
|
|
1345
|
+
class SignatureCheckFailedError extends BaseError$1 {
|
|
1346
|
+
constructor({ cause }) {
|
|
1347
|
+
super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).", {
|
|
1348
|
+
cause,
|
|
1349
|
+
name: "SignatureCheckFailedError"
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
Object.defineProperty(SignatureCheckFailedError, "code", {
|
|
1354
|
+
enumerable: true,
|
|
1355
|
+
configurable: true,
|
|
1356
|
+
writable: true,
|
|
1357
|
+
value: -32507
|
|
1358
|
+
});
|
|
1359
|
+
class SmartAccountFunctionRevertedError extends BaseError$1 {
|
|
1360
|
+
constructor({ cause }) {
|
|
1361
|
+
super("The `validateUserOp` function on the Smart Account reverted.", {
|
|
1362
|
+
cause,
|
|
1363
|
+
name: "SmartAccountFunctionRevertedError"
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
Object.defineProperty(SmartAccountFunctionRevertedError, "message", {
|
|
1368
|
+
enumerable: true,
|
|
1369
|
+
configurable: true,
|
|
1370
|
+
writable: true,
|
|
1371
|
+
value: /aa23/
|
|
1372
|
+
});
|
|
1373
|
+
class UnsupportedSignatureAggregatorError extends BaseError$1 {
|
|
1374
|
+
constructor({ cause }) {
|
|
1375
|
+
super("UserOperation rejected because account specified unsupported signature aggregator.", {
|
|
1376
|
+
cause,
|
|
1377
|
+
name: "UnsupportedSignatureAggregatorError"
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
Object.defineProperty(UnsupportedSignatureAggregatorError, "code", {
|
|
1382
|
+
enumerable: true,
|
|
1383
|
+
configurable: true,
|
|
1384
|
+
writable: true,
|
|
1385
|
+
value: -32506
|
|
1386
|
+
});
|
|
1387
|
+
class UserOperationExpiredError extends BaseError$1 {
|
|
1388
|
+
constructor({ cause }) {
|
|
1389
|
+
super("User Operation expired.", {
|
|
1390
|
+
cause,
|
|
1391
|
+
metaMessages: [
|
|
1392
|
+
"This could arise when:",
|
|
1393
|
+
"- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"
|
|
1394
|
+
].filter(Boolean),
|
|
1395
|
+
name: "UserOperationExpiredError"
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
Object.defineProperty(UserOperationExpiredError, "message", {
|
|
1400
|
+
enumerable: true,
|
|
1401
|
+
configurable: true,
|
|
1402
|
+
writable: true,
|
|
1403
|
+
value: /aa22/
|
|
1404
|
+
});
|
|
1405
|
+
class UserOperationPaymasterExpiredError extends BaseError$1 {
|
|
1406
|
+
constructor({ cause }) {
|
|
1407
|
+
super("Paymaster for User Operation expired.", {
|
|
1408
|
+
cause,
|
|
1409
|
+
metaMessages: [
|
|
1410
|
+
"This could arise when:",
|
|
1411
|
+
"- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"
|
|
1412
|
+
].filter(Boolean),
|
|
1413
|
+
name: "UserOperationPaymasterExpiredError"
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
Object.defineProperty(UserOperationPaymasterExpiredError, "message", {
|
|
1418
|
+
enumerable: true,
|
|
1419
|
+
configurable: true,
|
|
1420
|
+
writable: true,
|
|
1421
|
+
value: /aa32/
|
|
1422
|
+
});
|
|
1423
|
+
class UserOperationSignatureError extends BaseError$1 {
|
|
1424
|
+
constructor({ cause }) {
|
|
1425
|
+
super("Signature provided for the User Operation is invalid.", {
|
|
1426
|
+
cause,
|
|
1427
|
+
metaMessages: [
|
|
1428
|
+
"This could arise when:",
|
|
1429
|
+
"- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"
|
|
1430
|
+
].filter(Boolean),
|
|
1431
|
+
name: "UserOperationSignatureError"
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
Object.defineProperty(UserOperationSignatureError, "message", {
|
|
1436
|
+
enumerable: true,
|
|
1437
|
+
configurable: true,
|
|
1438
|
+
writable: true,
|
|
1439
|
+
value: /aa24/
|
|
1440
|
+
});
|
|
1441
|
+
class UserOperationPaymasterSignatureError extends BaseError$1 {
|
|
1442
|
+
constructor({ cause }) {
|
|
1443
|
+
super("Signature provided for the User Operation is invalid.", {
|
|
1444
|
+
cause,
|
|
1445
|
+
metaMessages: [
|
|
1446
|
+
"This could arise when:",
|
|
1447
|
+
"- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"
|
|
1448
|
+
].filter(Boolean),
|
|
1449
|
+
name: "UserOperationPaymasterSignatureError"
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
Object.defineProperty(UserOperationPaymasterSignatureError, "message", {
|
|
1454
|
+
enumerable: true,
|
|
1455
|
+
configurable: true,
|
|
1456
|
+
writable: true,
|
|
1457
|
+
value: /aa34/
|
|
1458
|
+
});
|
|
1459
|
+
class UserOperationRejectedByEntryPointError extends BaseError$1 {
|
|
1460
|
+
constructor({ cause }) {
|
|
1461
|
+
super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.", {
|
|
1462
|
+
cause,
|
|
1463
|
+
name: "UserOperationRejectedByEntryPointError"
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
Object.defineProperty(UserOperationRejectedByEntryPointError, "code", {
|
|
1468
|
+
enumerable: true,
|
|
1469
|
+
configurable: true,
|
|
1470
|
+
writable: true,
|
|
1471
|
+
value: -32500
|
|
1472
|
+
});
|
|
1473
|
+
class UserOperationRejectedByPaymasterError extends BaseError$1 {
|
|
1474
|
+
constructor({ cause }) {
|
|
1475
|
+
super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.", {
|
|
1476
|
+
cause,
|
|
1477
|
+
name: "UserOperationRejectedByPaymasterError"
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
Object.defineProperty(UserOperationRejectedByPaymasterError, "code", {
|
|
1482
|
+
enumerable: true,
|
|
1483
|
+
configurable: true,
|
|
1484
|
+
writable: true,
|
|
1485
|
+
value: -32501
|
|
1486
|
+
});
|
|
1487
|
+
class UserOperationRejectedByOpCodeError extends BaseError$1 {
|
|
1488
|
+
constructor({ cause }) {
|
|
1489
|
+
super("User Operation rejected with op code validation error.", {
|
|
1490
|
+
cause,
|
|
1491
|
+
name: "UserOperationRejectedByOpCodeError"
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
Object.defineProperty(UserOperationRejectedByOpCodeError, "code", {
|
|
1496
|
+
enumerable: true,
|
|
1497
|
+
configurable: true,
|
|
1498
|
+
writable: true,
|
|
1499
|
+
value: -32502
|
|
1500
|
+
});
|
|
1501
|
+
class UserOperationOutOfTimeRangeError extends BaseError$1 {
|
|
1502
|
+
constructor({ cause }) {
|
|
1503
|
+
super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).", {
|
|
1504
|
+
cause,
|
|
1505
|
+
name: "UserOperationOutOfTimeRangeError"
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
Object.defineProperty(UserOperationOutOfTimeRangeError, "code", {
|
|
1510
|
+
enumerable: true,
|
|
1511
|
+
configurable: true,
|
|
1512
|
+
writable: true,
|
|
1513
|
+
value: -32503
|
|
1514
|
+
});
|
|
1515
|
+
class UnknownBundlerError extends BaseError$1 {
|
|
1516
|
+
constructor({ cause }) {
|
|
1517
|
+
super(`An error occurred while executing user operation: ${cause == null ? void 0 : cause.shortMessage}`, {
|
|
1518
|
+
cause,
|
|
1519
|
+
name: "UnknownBundlerError"
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
class VerificationGasLimitExceededError extends BaseError$1 {
|
|
1524
|
+
constructor({ cause }) {
|
|
1525
|
+
super("User Operation verification gas limit exceeded.", {
|
|
1526
|
+
cause,
|
|
1527
|
+
metaMessages: [
|
|
1528
|
+
"This could arise when:",
|
|
1529
|
+
"- the gas used for verification exceeded the `verificationGasLimit`"
|
|
1530
|
+
].filter(Boolean),
|
|
1531
|
+
name: "VerificationGasLimitExceededError"
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
Object.defineProperty(VerificationGasLimitExceededError, "message", {
|
|
1536
|
+
enumerable: true,
|
|
1537
|
+
configurable: true,
|
|
1538
|
+
writable: true,
|
|
1539
|
+
value: /aa40/
|
|
1540
|
+
});
|
|
1541
|
+
class VerificationGasLimitTooLowError extends BaseError$1 {
|
|
1542
|
+
constructor({ cause }) {
|
|
1543
|
+
super("User Operation verification gas limit is too low.", {
|
|
1544
|
+
cause,
|
|
1545
|
+
metaMessages: [
|
|
1546
|
+
"This could arise when:",
|
|
1547
|
+
"- the `verificationGasLimit` is too low to verify the User Operation"
|
|
1548
|
+
].filter(Boolean),
|
|
1549
|
+
name: "VerificationGasLimitTooLowError"
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
Object.defineProperty(VerificationGasLimitTooLowError, "message", {
|
|
1554
|
+
enumerable: true,
|
|
1555
|
+
configurable: true,
|
|
1556
|
+
writable: true,
|
|
1557
|
+
value: /aa41/
|
|
1558
|
+
});
|
|
1559
|
+
class UserOperationExecutionError extends BaseError$1 {
|
|
1560
|
+
constructor(cause, { callData, callGasLimit, docsPath, factory, factoryData, initCode, maxFeePerGas, maxPriorityFeePerGas, nonce, paymaster, paymasterAndData, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, preVerificationGas, sender, signature, verificationGasLimit }) {
|
|
1561
|
+
const prettyArgs = prettyPrint({
|
|
1562
|
+
callData,
|
|
1563
|
+
callGasLimit,
|
|
1564
|
+
factory,
|
|
1565
|
+
factoryData,
|
|
1566
|
+
initCode,
|
|
1567
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
|
|
1568
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
|
|
1569
|
+
nonce,
|
|
1570
|
+
paymaster,
|
|
1571
|
+
paymasterAndData,
|
|
1572
|
+
paymasterData,
|
|
1573
|
+
paymasterPostOpGasLimit,
|
|
1574
|
+
paymasterVerificationGasLimit,
|
|
1575
|
+
preVerificationGas,
|
|
1576
|
+
sender,
|
|
1577
|
+
signature,
|
|
1578
|
+
verificationGasLimit
|
|
1579
|
+
});
|
|
1580
|
+
super(cause.shortMessage, {
|
|
1581
|
+
cause,
|
|
1582
|
+
docsPath,
|
|
1583
|
+
metaMessages: [
|
|
1584
|
+
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
|
1585
|
+
"Request Arguments:",
|
|
1586
|
+
prettyArgs
|
|
1587
|
+
].filter(Boolean),
|
|
1588
|
+
name: "UserOperationExecutionError"
|
|
1589
|
+
});
|
|
1590
|
+
Object.defineProperty(this, "cause", {
|
|
1591
|
+
enumerable: true,
|
|
1592
|
+
configurable: true,
|
|
1593
|
+
writable: true,
|
|
1594
|
+
value: void 0
|
|
1595
|
+
});
|
|
1596
|
+
this.cause = cause;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
class UserOperationReceiptNotFoundError extends BaseError$1 {
|
|
1600
|
+
constructor({ hash }) {
|
|
1601
|
+
super(`User Operation receipt with hash "${hash}" could not be found. The User Operation may not have been processed yet.`, { name: "UserOperationReceiptNotFoundError" });
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
class UserOperationNotFoundError extends BaseError$1 {
|
|
1605
|
+
constructor({ hash }) {
|
|
1606
|
+
super(`User Operation with hash "${hash}" could not be found.`, {
|
|
1607
|
+
name: "UserOperationNotFoundError"
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
class WaitForUserOperationReceiptTimeoutError extends BaseError$1 {
|
|
1612
|
+
constructor({ hash }) {
|
|
1613
|
+
super(`Timed out while waiting for User Operation with hash "${hash}" to be confirmed.`, { name: "WaitForUserOperationReceiptTimeoutError" });
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
const bundlerErrors = [
|
|
1617
|
+
ExecutionRevertedError,
|
|
1618
|
+
InvalidFieldsError,
|
|
1619
|
+
PaymasterDepositTooLowError,
|
|
1620
|
+
PaymasterRateLimitError,
|
|
1621
|
+
PaymasterStakeTooLowError,
|
|
1622
|
+
SignatureCheckFailedError,
|
|
1623
|
+
UnsupportedSignatureAggregatorError,
|
|
1624
|
+
UserOperationOutOfTimeRangeError,
|
|
1625
|
+
UserOperationRejectedByEntryPointError,
|
|
1626
|
+
UserOperationRejectedByPaymasterError,
|
|
1627
|
+
UserOperationRejectedByOpCodeError
|
|
1628
|
+
];
|
|
1629
|
+
function getBundlerError(err, args) {
|
|
1630
|
+
const message = (err.details || "").toLowerCase();
|
|
1631
|
+
if (AccountNotDeployedError.message.test(message))
|
|
1632
|
+
return new AccountNotDeployedError({
|
|
1633
|
+
cause: err
|
|
1634
|
+
});
|
|
1635
|
+
if (FailedToSendToBeneficiaryError.message.test(message))
|
|
1636
|
+
return new FailedToSendToBeneficiaryError({
|
|
1637
|
+
cause: err
|
|
1638
|
+
});
|
|
1639
|
+
if (GasValuesOverflowError.message.test(message))
|
|
1640
|
+
return new GasValuesOverflowError({
|
|
1641
|
+
cause: err
|
|
1642
|
+
});
|
|
1643
|
+
if (HandleOpsOutOfGasError.message.test(message))
|
|
1644
|
+
return new HandleOpsOutOfGasError({
|
|
1645
|
+
cause: err
|
|
1646
|
+
});
|
|
1647
|
+
if (InitCodeFailedError.message.test(message))
|
|
1648
|
+
return new InitCodeFailedError({
|
|
1649
|
+
cause: err,
|
|
1650
|
+
factory: args.factory,
|
|
1651
|
+
factoryData: args.factoryData,
|
|
1652
|
+
initCode: args.initCode
|
|
1653
|
+
});
|
|
1654
|
+
if (InitCodeMustCreateSenderError.message.test(message))
|
|
1655
|
+
return new InitCodeMustCreateSenderError({
|
|
1656
|
+
cause: err,
|
|
1657
|
+
factory: args.factory,
|
|
1658
|
+
factoryData: args.factoryData,
|
|
1659
|
+
initCode: args.initCode
|
|
1660
|
+
});
|
|
1661
|
+
if (InitCodeMustReturnSenderError.message.test(message))
|
|
1662
|
+
return new InitCodeMustReturnSenderError({
|
|
1663
|
+
cause: err,
|
|
1664
|
+
factory: args.factory,
|
|
1665
|
+
factoryData: args.factoryData,
|
|
1666
|
+
initCode: args.initCode,
|
|
1667
|
+
sender: args.sender
|
|
1668
|
+
});
|
|
1669
|
+
if (InsufficientPrefundError.message.test(message))
|
|
1670
|
+
return new InsufficientPrefundError({
|
|
1671
|
+
cause: err
|
|
1672
|
+
});
|
|
1673
|
+
if (InternalCallOnlyError.message.test(message))
|
|
1674
|
+
return new InternalCallOnlyError({
|
|
1675
|
+
cause: err
|
|
1676
|
+
});
|
|
1677
|
+
if (InvalidAccountNonceError.message.test(message))
|
|
1678
|
+
return new InvalidAccountNonceError({
|
|
1679
|
+
cause: err,
|
|
1680
|
+
nonce: args.nonce
|
|
1681
|
+
});
|
|
1682
|
+
if (InvalidAggregatorError.message.test(message))
|
|
1683
|
+
return new InvalidAggregatorError({
|
|
1684
|
+
cause: err
|
|
1685
|
+
});
|
|
1686
|
+
if (InvalidBeneficiaryError.message.test(message))
|
|
1687
|
+
return new InvalidBeneficiaryError({
|
|
1688
|
+
cause: err
|
|
1689
|
+
});
|
|
1690
|
+
if (InvalidPaymasterAndDataError.message.test(message))
|
|
1691
|
+
return new InvalidPaymasterAndDataError({
|
|
1692
|
+
cause: err
|
|
1693
|
+
});
|
|
1694
|
+
if (PaymasterDepositTooLowError.message.test(message))
|
|
1695
|
+
return new PaymasterDepositTooLowError({
|
|
1696
|
+
cause: err
|
|
1697
|
+
});
|
|
1698
|
+
if (PaymasterFunctionRevertedError.message.test(message))
|
|
1699
|
+
return new PaymasterFunctionRevertedError({
|
|
1700
|
+
cause: err
|
|
1701
|
+
});
|
|
1702
|
+
if (PaymasterNotDeployedError.message.test(message))
|
|
1703
|
+
return new PaymasterNotDeployedError({
|
|
1704
|
+
cause: err
|
|
1705
|
+
});
|
|
1706
|
+
if (PaymasterPostOpFunctionRevertedError.message.test(message))
|
|
1707
|
+
return new PaymasterPostOpFunctionRevertedError({
|
|
1708
|
+
cause: err
|
|
1709
|
+
});
|
|
1710
|
+
if (SmartAccountFunctionRevertedError.message.test(message))
|
|
1711
|
+
return new SmartAccountFunctionRevertedError({
|
|
1712
|
+
cause: err
|
|
1713
|
+
});
|
|
1714
|
+
if (SenderAlreadyConstructedError.message.test(message))
|
|
1715
|
+
return new SenderAlreadyConstructedError({
|
|
1716
|
+
cause: err,
|
|
1717
|
+
factory: args.factory,
|
|
1718
|
+
factoryData: args.factoryData,
|
|
1719
|
+
initCode: args.initCode
|
|
1720
|
+
});
|
|
1721
|
+
if (UserOperationExpiredError.message.test(message))
|
|
1722
|
+
return new UserOperationExpiredError({
|
|
1723
|
+
cause: err
|
|
1724
|
+
});
|
|
1725
|
+
if (UserOperationPaymasterExpiredError.message.test(message))
|
|
1726
|
+
return new UserOperationPaymasterExpiredError({
|
|
1727
|
+
cause: err
|
|
1728
|
+
});
|
|
1729
|
+
if (UserOperationPaymasterSignatureError.message.test(message))
|
|
1730
|
+
return new UserOperationPaymasterSignatureError({
|
|
1731
|
+
cause: err
|
|
1732
|
+
});
|
|
1733
|
+
if (UserOperationSignatureError.message.test(message))
|
|
1734
|
+
return new UserOperationSignatureError({
|
|
1735
|
+
cause: err
|
|
1736
|
+
});
|
|
1737
|
+
if (VerificationGasLimitExceededError.message.test(message))
|
|
1738
|
+
return new VerificationGasLimitExceededError({
|
|
1739
|
+
cause: err
|
|
1740
|
+
});
|
|
1741
|
+
if (VerificationGasLimitTooLowError.message.test(message))
|
|
1742
|
+
return new VerificationGasLimitTooLowError({
|
|
1743
|
+
cause: err
|
|
1744
|
+
});
|
|
1745
|
+
const error = err.walk((e) => bundlerErrors.some((error2) => error2.code === e.code));
|
|
1746
|
+
if (error) {
|
|
1747
|
+
if (error.code === ExecutionRevertedError.code)
|
|
1748
|
+
return new ExecutionRevertedError({
|
|
1749
|
+
cause: err,
|
|
1750
|
+
data: error.data,
|
|
1751
|
+
message: error.details
|
|
1752
|
+
});
|
|
1753
|
+
if (error.code === InvalidFieldsError.code)
|
|
1754
|
+
return new InvalidFieldsError({
|
|
1755
|
+
cause: err
|
|
1756
|
+
});
|
|
1757
|
+
if (error.code === PaymasterDepositTooLowError.code)
|
|
1758
|
+
return new PaymasterDepositTooLowError({
|
|
1759
|
+
cause: err
|
|
1760
|
+
});
|
|
1761
|
+
if (error.code === PaymasterRateLimitError.code)
|
|
1762
|
+
return new PaymasterRateLimitError({
|
|
1763
|
+
cause: err
|
|
1764
|
+
});
|
|
1765
|
+
if (error.code === PaymasterStakeTooLowError.code)
|
|
1766
|
+
return new PaymasterStakeTooLowError({
|
|
1767
|
+
cause: err
|
|
1768
|
+
});
|
|
1769
|
+
if (error.code === SignatureCheckFailedError.code)
|
|
1770
|
+
return new SignatureCheckFailedError({
|
|
1771
|
+
cause: err
|
|
1772
|
+
});
|
|
1773
|
+
if (error.code === UnsupportedSignatureAggregatorError.code)
|
|
1774
|
+
return new UnsupportedSignatureAggregatorError({
|
|
1775
|
+
cause: err
|
|
1776
|
+
});
|
|
1777
|
+
if (error.code === UserOperationOutOfTimeRangeError.code)
|
|
1778
|
+
return new UserOperationOutOfTimeRangeError({
|
|
1779
|
+
cause: err
|
|
1780
|
+
});
|
|
1781
|
+
if (error.code === UserOperationRejectedByEntryPointError.code)
|
|
1782
|
+
return new UserOperationRejectedByEntryPointError({
|
|
1783
|
+
cause: err
|
|
1784
|
+
});
|
|
1785
|
+
if (error.code === UserOperationRejectedByPaymasterError.code)
|
|
1786
|
+
return new UserOperationRejectedByPaymasterError({
|
|
1787
|
+
cause: err
|
|
1788
|
+
});
|
|
1789
|
+
if (error.code === UserOperationRejectedByOpCodeError.code)
|
|
1790
|
+
return new UserOperationRejectedByOpCodeError({
|
|
1791
|
+
cause: err
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
return new UnknownBundlerError({
|
|
1795
|
+
cause: err
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
function getUserOperationError(err, { calls, docsPath, ...args }) {
|
|
1799
|
+
const cause = (() => {
|
|
1800
|
+
const cause2 = getBundlerError(err, args);
|
|
1801
|
+
if (calls && cause2 instanceof ExecutionRevertedError) {
|
|
1802
|
+
const revertData = getRevertData(cause2);
|
|
1803
|
+
const contractCalls = calls == null ? void 0 : calls.filter((call) => call.abi);
|
|
1804
|
+
if (revertData && contractCalls.length > 0)
|
|
1805
|
+
return getContractError({ calls: contractCalls, revertData });
|
|
1806
|
+
}
|
|
1807
|
+
return cause2;
|
|
1808
|
+
})();
|
|
1809
|
+
return new UserOperationExecutionError(cause, {
|
|
1810
|
+
docsPath,
|
|
1811
|
+
...args
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
function getRevertData(error) {
|
|
1815
|
+
let revertData;
|
|
1816
|
+
error.walk((e) => {
|
|
1817
|
+
var _a, _b, _c, _d;
|
|
1818
|
+
const error2 = e;
|
|
1819
|
+
if (typeof error2.data === "string" || typeof ((_a = error2.data) == null ? void 0 : _a.revertData) === "string" || !(error2 instanceof BaseError$1) && typeof error2.message === "string") {
|
|
1820
|
+
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]*)/);
|
|
1821
|
+
if (match) {
|
|
1822
|
+
revertData = match[1];
|
|
1823
|
+
return true;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
return false;
|
|
1827
|
+
});
|
|
1828
|
+
return revertData;
|
|
1829
|
+
}
|
|
1830
|
+
function getContractError(parameters) {
|
|
1831
|
+
const { calls, revertData } = parameters;
|
|
1832
|
+
const { abi, functionName, args, to } = (() => {
|
|
1833
|
+
const contractCalls = calls == null ? void 0 : calls.filter((call) => Boolean(call.abi));
|
|
1834
|
+
if (contractCalls.length === 1)
|
|
1835
|
+
return contractCalls[0];
|
|
1836
|
+
const compatContractCalls = contractCalls.filter((call) => {
|
|
1837
|
+
try {
|
|
1838
|
+
return Boolean(decodeErrorResult({
|
|
1839
|
+
abi: call.abi,
|
|
1840
|
+
data: revertData
|
|
1841
|
+
}));
|
|
1842
|
+
} catch {
|
|
1843
|
+
return false;
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
if (compatContractCalls.length === 1)
|
|
1847
|
+
return compatContractCalls[0];
|
|
1848
|
+
return {
|
|
1849
|
+
abi: [],
|
|
1850
|
+
functionName: contractCalls.reduce((acc, call) => `${acc ? `${acc} | ` : ""}${call.functionName}`, ""),
|
|
1851
|
+
args: void 0,
|
|
1852
|
+
to: void 0
|
|
1853
|
+
};
|
|
1854
|
+
})();
|
|
1855
|
+
const cause = (() => {
|
|
1856
|
+
if (revertData === "0x")
|
|
1857
|
+
return new ContractFunctionZeroDataError({ functionName });
|
|
1858
|
+
return new ContractFunctionRevertedError({
|
|
1859
|
+
abi,
|
|
1860
|
+
data: revertData,
|
|
1861
|
+
functionName
|
|
1862
|
+
});
|
|
1863
|
+
})();
|
|
1864
|
+
return new ContractFunctionExecutionError(cause, {
|
|
1865
|
+
abi,
|
|
1866
|
+
args,
|
|
1867
|
+
contractAddress: to,
|
|
1868
|
+
functionName
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
function formatUserOperationGas(parameters) {
|
|
1872
|
+
const gas = {};
|
|
1873
|
+
if (parameters.callGasLimit)
|
|
1874
|
+
gas.callGasLimit = BigInt(parameters.callGasLimit);
|
|
1875
|
+
if (parameters.preVerificationGas)
|
|
1876
|
+
gas.preVerificationGas = BigInt(parameters.preVerificationGas);
|
|
1877
|
+
if (parameters.verificationGasLimit)
|
|
1878
|
+
gas.verificationGasLimit = BigInt(parameters.verificationGasLimit);
|
|
1879
|
+
if (parameters.paymasterPostOpGasLimit)
|
|
1880
|
+
gas.paymasterPostOpGasLimit = BigInt(parameters.paymasterPostOpGasLimit);
|
|
1881
|
+
if (parameters.paymasterVerificationGasLimit)
|
|
1882
|
+
gas.paymasterVerificationGasLimit = BigInt(parameters.paymasterVerificationGasLimit);
|
|
1883
|
+
return gas;
|
|
1884
|
+
}
|
|
1885
|
+
function formatUserOperationRequest(request) {
|
|
1886
|
+
const rpcRequest = {};
|
|
1887
|
+
if (typeof request.callData !== "undefined")
|
|
1888
|
+
rpcRequest.callData = request.callData;
|
|
1889
|
+
if (typeof request.callGasLimit !== "undefined")
|
|
1890
|
+
rpcRequest.callGasLimit = numberToHex(request.callGasLimit);
|
|
1891
|
+
if (typeof request.factory !== "undefined")
|
|
1892
|
+
rpcRequest.factory = request.factory;
|
|
1893
|
+
if (typeof request.factoryData !== "undefined")
|
|
1894
|
+
rpcRequest.factoryData = request.factoryData;
|
|
1895
|
+
if (typeof request.initCode !== "undefined")
|
|
1896
|
+
rpcRequest.initCode = request.initCode;
|
|
1897
|
+
if (typeof request.maxFeePerGas !== "undefined")
|
|
1898
|
+
rpcRequest.maxFeePerGas = numberToHex(request.maxFeePerGas);
|
|
1899
|
+
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1900
|
+
rpcRequest.maxPriorityFeePerGas = numberToHex(request.maxPriorityFeePerGas);
|
|
1901
|
+
if (typeof request.nonce !== "undefined")
|
|
1902
|
+
rpcRequest.nonce = numberToHex(request.nonce);
|
|
1903
|
+
if (typeof request.paymaster !== "undefined")
|
|
1904
|
+
rpcRequest.paymaster = request.paymaster;
|
|
1905
|
+
if (typeof request.paymasterAndData !== "undefined")
|
|
1906
|
+
rpcRequest.paymasterAndData = request.paymasterAndData || "0x";
|
|
1907
|
+
if (typeof request.paymasterData !== "undefined")
|
|
1908
|
+
rpcRequest.paymasterData = request.paymasterData;
|
|
1909
|
+
if (typeof request.paymasterPostOpGasLimit !== "undefined")
|
|
1910
|
+
rpcRequest.paymasterPostOpGasLimit = numberToHex(request.paymasterPostOpGasLimit);
|
|
1911
|
+
if (typeof request.paymasterSignature !== "undefined")
|
|
1912
|
+
rpcRequest.paymasterSignature = request.paymasterSignature;
|
|
1913
|
+
if (typeof request.paymasterVerificationGasLimit !== "undefined")
|
|
1914
|
+
rpcRequest.paymasterVerificationGasLimit = numberToHex(request.paymasterVerificationGasLimit);
|
|
1915
|
+
if (typeof request.preVerificationGas !== "undefined")
|
|
1916
|
+
rpcRequest.preVerificationGas = numberToHex(request.preVerificationGas);
|
|
1917
|
+
if (typeof request.sender !== "undefined")
|
|
1918
|
+
rpcRequest.sender = request.sender;
|
|
1919
|
+
if (typeof request.signature !== "undefined")
|
|
1920
|
+
rpcRequest.signature = request.signature;
|
|
1921
|
+
if (typeof request.verificationGasLimit !== "undefined")
|
|
1922
|
+
rpcRequest.verificationGasLimit = numberToHex(request.verificationGasLimit);
|
|
1923
|
+
if (typeof request.authorization !== "undefined")
|
|
1924
|
+
rpcRequest.eip7702Auth = formatAuthorization(request.authorization);
|
|
1925
|
+
return rpcRequest;
|
|
1926
|
+
}
|
|
1927
|
+
function formatAuthorization(authorization) {
|
|
1928
|
+
return {
|
|
1929
|
+
address: authorization.address,
|
|
1930
|
+
chainId: numberToHex(authorization.chainId),
|
|
1931
|
+
nonce: numberToHex(authorization.nonce),
|
|
1932
|
+
r: authorization.r ? numberToHex(BigInt(authorization.r), { size: 32 }) : pad$1("0x", { size: 32 }),
|
|
1933
|
+
s: authorization.s ? numberToHex(BigInt(authorization.s), { size: 32 }) : pad$1("0x", { size: 32 }),
|
|
1934
|
+
yParity: authorization.yParity ? numberToHex(authorization.yParity, { size: 1 }) : pad$1("0x", { size: 32 })
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
async function getPaymasterData(client, parameters) {
|
|
1938
|
+
const { chainId, entryPointAddress, context, ...userOperation } = parameters;
|
|
1939
|
+
const request = formatUserOperationRequest(userOperation);
|
|
1940
|
+
const { paymasterPostOpGasLimit, paymasterVerificationGasLimit, ...rest } = await client.request({
|
|
1941
|
+
method: "pm_getPaymasterData",
|
|
1942
|
+
params: [
|
|
1943
|
+
{
|
|
1944
|
+
...request,
|
|
1945
|
+
callGasLimit: request.callGasLimit ?? "0x0",
|
|
1946
|
+
verificationGasLimit: request.verificationGasLimit ?? "0x0",
|
|
1947
|
+
preVerificationGas: request.preVerificationGas ?? "0x0"
|
|
1948
|
+
},
|
|
1949
|
+
entryPointAddress,
|
|
1950
|
+
numberToHex(chainId),
|
|
1951
|
+
context
|
|
1952
|
+
]
|
|
1953
|
+
});
|
|
1954
|
+
return {
|
|
1955
|
+
...rest,
|
|
1956
|
+
...paymasterPostOpGasLimit && {
|
|
1957
|
+
paymasterPostOpGasLimit: hexToBigInt(paymasterPostOpGasLimit)
|
|
1958
|
+
},
|
|
1959
|
+
...paymasterVerificationGasLimit && {
|
|
1960
|
+
paymasterVerificationGasLimit: hexToBigInt(paymasterVerificationGasLimit)
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
async function getPaymasterStubData(client, parameters) {
|
|
1965
|
+
const { chainId, entryPointAddress, context, ...userOperation } = parameters;
|
|
1966
|
+
const request = formatUserOperationRequest(userOperation);
|
|
1967
|
+
const { paymasterPostOpGasLimit, paymasterVerificationGasLimit, ...rest } = await client.request({
|
|
1968
|
+
method: "pm_getPaymasterStubData",
|
|
1969
|
+
params: [
|
|
1970
|
+
{
|
|
1971
|
+
...request,
|
|
1972
|
+
callGasLimit: request.callGasLimit ?? "0x0",
|
|
1973
|
+
verificationGasLimit: request.verificationGasLimit ?? "0x0",
|
|
1974
|
+
preVerificationGas: request.preVerificationGas ?? "0x0"
|
|
1975
|
+
},
|
|
1976
|
+
entryPointAddress,
|
|
1977
|
+
numberToHex(chainId),
|
|
1978
|
+
context
|
|
1979
|
+
]
|
|
1980
|
+
});
|
|
1981
|
+
return {
|
|
1982
|
+
...rest,
|
|
1983
|
+
...paymasterPostOpGasLimit && {
|
|
1984
|
+
paymasterPostOpGasLimit: hexToBigInt(paymasterPostOpGasLimit)
|
|
1985
|
+
},
|
|
1986
|
+
...paymasterVerificationGasLimit && {
|
|
1987
|
+
paymasterVerificationGasLimit: hexToBigInt(paymasterVerificationGasLimit)
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
const defaultParameters = [
|
|
1992
|
+
"factory",
|
|
1993
|
+
"fees",
|
|
1994
|
+
"gas",
|
|
1995
|
+
"paymaster",
|
|
1996
|
+
"nonce",
|
|
1997
|
+
"signature",
|
|
1998
|
+
"authorization"
|
|
1999
|
+
];
|
|
2000
|
+
async function prepareUserOperation(client, parameters_) {
|
|
2001
|
+
var _a;
|
|
2002
|
+
const parameters = parameters_;
|
|
2003
|
+
const { account: account_ = client.account, parameters: properties = defaultParameters, stateOverride } = parameters;
|
|
2004
|
+
if (!account_)
|
|
2005
|
+
throw new AccountNotFoundError();
|
|
2006
|
+
const account = parseAccount(account_);
|
|
2007
|
+
const bundlerClient = client;
|
|
2008
|
+
const paymaster = parameters.paymaster ?? (bundlerClient == null ? void 0 : bundlerClient.paymaster);
|
|
2009
|
+
const paymasterAddress = typeof paymaster === "string" ? paymaster : void 0;
|
|
2010
|
+
const { getPaymasterStubData: getPaymasterStubData$1, getPaymasterData: getPaymasterData$1 } = (() => {
|
|
2011
|
+
if (paymaster === true)
|
|
2012
|
+
return {
|
|
2013
|
+
getPaymasterStubData: (parameters2) => getAction(bundlerClient, getPaymasterStubData, "getPaymasterStubData")(parameters2),
|
|
2014
|
+
getPaymasterData: (parameters2) => getAction(bundlerClient, getPaymasterData, "getPaymasterData")(parameters2)
|
|
2015
|
+
};
|
|
2016
|
+
if (typeof paymaster === "object") {
|
|
2017
|
+
const { getPaymasterStubData: getPaymasterStubData2, getPaymasterData: getPaymasterData2 } = paymaster;
|
|
2018
|
+
return {
|
|
2019
|
+
getPaymasterStubData: getPaymasterData2 && getPaymasterStubData2 ? getPaymasterStubData2 : getPaymasterData2,
|
|
2020
|
+
getPaymasterData: getPaymasterData2 && getPaymasterStubData2 ? getPaymasterData2 : void 0
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
2023
|
+
return {
|
|
2024
|
+
getPaymasterStubData: void 0,
|
|
2025
|
+
getPaymasterData: void 0
|
|
2026
|
+
};
|
|
2027
|
+
})();
|
|
2028
|
+
const paymasterContext = parameters.paymasterContext ? parameters.paymasterContext : bundlerClient == null ? void 0 : bundlerClient.paymasterContext;
|
|
2029
|
+
let request = {
|
|
2030
|
+
...parameters,
|
|
2031
|
+
paymaster: paymasterAddress,
|
|
2032
|
+
sender: account.address
|
|
2033
|
+
};
|
|
2034
|
+
const [callData, factory, fees, nonce, authorization] = await Promise.all([
|
|
2035
|
+
(async () => {
|
|
2036
|
+
if (parameters.calls)
|
|
2037
|
+
return account.encodeCalls(parameters.calls.map((call_) => {
|
|
2038
|
+
const call = call_;
|
|
2039
|
+
if (call.abi)
|
|
2040
|
+
return {
|
|
2041
|
+
data: encodeFunctionData(call),
|
|
2042
|
+
to: call.to,
|
|
2043
|
+
value: call.value
|
|
2044
|
+
};
|
|
2045
|
+
return call;
|
|
2046
|
+
}));
|
|
2047
|
+
return parameters.callData;
|
|
2048
|
+
})(),
|
|
2049
|
+
(async () => {
|
|
2050
|
+
if (!properties.includes("factory"))
|
|
2051
|
+
return void 0;
|
|
2052
|
+
if (parameters.initCode)
|
|
2053
|
+
return { initCode: parameters.initCode };
|
|
2054
|
+
if (parameters.factory && parameters.factoryData) {
|
|
2055
|
+
return {
|
|
2056
|
+
factory: parameters.factory,
|
|
2057
|
+
factoryData: parameters.factoryData
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
const { factory: factory2, factoryData } = await account.getFactoryArgs();
|
|
2061
|
+
if (account.entryPoint.version === "0.6")
|
|
2062
|
+
return {
|
|
2063
|
+
initCode: factory2 && factoryData ? concat$1([factory2, factoryData]) : void 0
|
|
2064
|
+
};
|
|
2065
|
+
return {
|
|
2066
|
+
factory: factory2,
|
|
2067
|
+
factoryData
|
|
2068
|
+
};
|
|
2069
|
+
})(),
|
|
2070
|
+
(async () => {
|
|
2071
|
+
var _a2;
|
|
2072
|
+
if (!properties.includes("fees"))
|
|
2073
|
+
return void 0;
|
|
2074
|
+
if (typeof parameters.maxFeePerGas === "bigint" && typeof parameters.maxPriorityFeePerGas === "bigint")
|
|
2075
|
+
return request;
|
|
2076
|
+
if ((_a2 = bundlerClient == null ? void 0 : bundlerClient.userOperation) == null ? void 0 : _a2.estimateFeesPerGas) {
|
|
2077
|
+
const fees2 = await bundlerClient.userOperation.estimateFeesPerGas({
|
|
2078
|
+
account,
|
|
2079
|
+
bundlerClient,
|
|
2080
|
+
userOperation: request
|
|
2081
|
+
});
|
|
2082
|
+
return {
|
|
2083
|
+
...request,
|
|
2084
|
+
...fees2
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
try {
|
|
2088
|
+
const client_ = bundlerClient.client ?? client;
|
|
2089
|
+
const fees2 = await getAction(client_, estimateFeesPerGas, "estimateFeesPerGas")({
|
|
2090
|
+
chain: client_.chain,
|
|
2091
|
+
type: "eip1559"
|
|
2092
|
+
});
|
|
2093
|
+
return {
|
|
2094
|
+
maxFeePerGas: typeof parameters.maxFeePerGas === "bigint" ? parameters.maxFeePerGas : BigInt(
|
|
2095
|
+
// Bundlers unfortunately have strict rules on fee prechecks – we will need to set a generous buffer.
|
|
2096
|
+
2n * fees2.maxFeePerGas
|
|
2097
|
+
),
|
|
2098
|
+
maxPriorityFeePerGas: typeof parameters.maxPriorityFeePerGas === "bigint" ? parameters.maxPriorityFeePerGas : BigInt(
|
|
2099
|
+
// Bundlers unfortunately have strict rules on fee prechecks – we will need to set a generous buffer.
|
|
2100
|
+
2n * fees2.maxPriorityFeePerGas
|
|
2101
|
+
)
|
|
2102
|
+
};
|
|
2103
|
+
} catch {
|
|
2104
|
+
return void 0;
|
|
2105
|
+
}
|
|
2106
|
+
})(),
|
|
2107
|
+
(async () => {
|
|
2108
|
+
if (!properties.includes("nonce"))
|
|
2109
|
+
return void 0;
|
|
2110
|
+
if (typeof parameters.nonce === "bigint")
|
|
2111
|
+
return parameters.nonce;
|
|
2112
|
+
return account.getNonce();
|
|
2113
|
+
})(),
|
|
2114
|
+
(async () => {
|
|
2115
|
+
if (!properties.includes("authorization"))
|
|
2116
|
+
return void 0;
|
|
2117
|
+
if (typeof parameters.authorization === "object")
|
|
2118
|
+
return parameters.authorization;
|
|
2119
|
+
if (account.authorization && !await account.isDeployed()) {
|
|
2120
|
+
const authorization2 = await prepareAuthorization(account.client, account.authorization);
|
|
2121
|
+
return {
|
|
2122
|
+
...authorization2,
|
|
2123
|
+
r: "0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",
|
|
2124
|
+
s: "0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
2125
|
+
yParity: 1
|
|
2126
|
+
};
|
|
2127
|
+
}
|
|
2128
|
+
return void 0;
|
|
2129
|
+
})()
|
|
2130
|
+
]);
|
|
2131
|
+
if (typeof callData !== "undefined")
|
|
2132
|
+
request.callData = callData;
|
|
2133
|
+
if (typeof factory !== "undefined")
|
|
2134
|
+
request = { ...request, ...factory };
|
|
2135
|
+
if (typeof fees !== "undefined")
|
|
2136
|
+
request = { ...request, ...fees };
|
|
2137
|
+
if (typeof nonce !== "undefined")
|
|
2138
|
+
request.nonce = nonce;
|
|
2139
|
+
if (typeof authorization !== "undefined")
|
|
2140
|
+
request.authorization = authorization;
|
|
2141
|
+
if (properties.includes("signature")) {
|
|
2142
|
+
if (typeof parameters.signature !== "undefined")
|
|
2143
|
+
request.signature = parameters.signature;
|
|
2144
|
+
else
|
|
2145
|
+
request.signature = await account.getStubSignature(request);
|
|
2146
|
+
}
|
|
2147
|
+
if (account.entryPoint.version === "0.6" && !request.initCode)
|
|
2148
|
+
request.initCode = "0x";
|
|
2149
|
+
let chainId;
|
|
2150
|
+
async function getChainId$1() {
|
|
2151
|
+
if (chainId)
|
|
2152
|
+
return chainId;
|
|
2153
|
+
if (client.chain)
|
|
2154
|
+
return client.chain.id;
|
|
2155
|
+
const chainId_ = await getAction(client, getChainId, "getChainId")({});
|
|
2156
|
+
chainId = chainId_;
|
|
2157
|
+
return chainId;
|
|
2158
|
+
}
|
|
2159
|
+
let isPaymasterPopulated = false;
|
|
2160
|
+
if (properties.includes("paymaster") && getPaymasterStubData$1 && !paymasterAddress && !parameters.paymasterAndData) {
|
|
2161
|
+
const { isFinal = false, sponsor: _, ...paymasterArgs } = await getPaymasterStubData$1({
|
|
2162
|
+
chainId: await getChainId$1(),
|
|
2163
|
+
entryPointAddress: account.entryPoint.address,
|
|
2164
|
+
context: paymasterContext,
|
|
2165
|
+
...request
|
|
2166
|
+
});
|
|
2167
|
+
isPaymasterPopulated = isFinal;
|
|
2168
|
+
request = {
|
|
2169
|
+
...request,
|
|
2170
|
+
...paymasterArgs
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
if (account.entryPoint.version === "0.6" && !request.paymasterAndData)
|
|
2174
|
+
request.paymasterAndData = "0x";
|
|
2175
|
+
if (properties.includes("gas")) {
|
|
2176
|
+
if ((_a = account.userOperation) == null ? void 0 : _a.estimateGas) {
|
|
2177
|
+
const gas = await account.userOperation.estimateGas(request);
|
|
2178
|
+
request = {
|
|
2179
|
+
...request,
|
|
2180
|
+
...gas
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
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") {
|
|
2184
|
+
const gas = await getAction(bundlerClient, estimateUserOperationGas, "estimateUserOperationGas")({
|
|
2185
|
+
account,
|
|
2186
|
+
// Some Bundlers fail if nullish gas values are provided for gas estimation :') –
|
|
2187
|
+
// so we will need to set a default zeroish value.
|
|
2188
|
+
callGasLimit: 0n,
|
|
2189
|
+
preVerificationGas: 0n,
|
|
2190
|
+
verificationGasLimit: 0n,
|
|
2191
|
+
stateOverride,
|
|
2192
|
+
...request.paymaster ? {
|
|
2193
|
+
paymasterPostOpGasLimit: 0n,
|
|
2194
|
+
paymasterVerificationGasLimit: 0n
|
|
2195
|
+
} : {},
|
|
2196
|
+
...request
|
|
2197
|
+
});
|
|
2198
|
+
request = {
|
|
2199
|
+
...request,
|
|
2200
|
+
callGasLimit: request.callGasLimit ?? gas.callGasLimit,
|
|
2201
|
+
preVerificationGas: request.preVerificationGas ?? gas.preVerificationGas,
|
|
2202
|
+
verificationGasLimit: request.verificationGasLimit ?? gas.verificationGasLimit,
|
|
2203
|
+
paymasterPostOpGasLimit: request.paymasterPostOpGasLimit ?? gas.paymasterPostOpGasLimit,
|
|
2204
|
+
paymasterVerificationGasLimit: request.paymasterVerificationGasLimit ?? gas.paymasterVerificationGasLimit
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
if (properties.includes("paymaster") && getPaymasterData$1 && !paymasterAddress && !parameters.paymasterAndData && !isPaymasterPopulated) {
|
|
2209
|
+
const paymaster2 = await getPaymasterData$1({
|
|
2210
|
+
chainId: await getChainId$1(),
|
|
2211
|
+
entryPointAddress: account.entryPoint.address,
|
|
2212
|
+
context: paymasterContext,
|
|
2213
|
+
...request
|
|
2214
|
+
});
|
|
2215
|
+
request = {
|
|
2216
|
+
...request,
|
|
2217
|
+
...paymaster2
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
delete request.calls;
|
|
2221
|
+
delete request.parameters;
|
|
2222
|
+
delete request.paymasterContext;
|
|
2223
|
+
if (typeof request.paymaster !== "string")
|
|
2224
|
+
delete request.paymaster;
|
|
2225
|
+
return request;
|
|
2226
|
+
}
|
|
2227
|
+
async function estimateUserOperationGas(client, parameters) {
|
|
2228
|
+
var _a;
|
|
2229
|
+
const { account: account_ = client.account, entryPointAddress, stateOverride } = parameters;
|
|
2230
|
+
if (!account_ && !parameters.sender)
|
|
2231
|
+
throw new AccountNotFoundError();
|
|
2232
|
+
const account = account_ ? parseAccount(account_) : void 0;
|
|
2233
|
+
const rpcStateOverride = serializeStateOverride(stateOverride);
|
|
2234
|
+
const request = account ? await getAction(client, prepareUserOperation, "prepareUserOperation")({
|
|
2235
|
+
...parameters,
|
|
2236
|
+
parameters: [
|
|
2237
|
+
"authorization",
|
|
2238
|
+
"factory",
|
|
2239
|
+
"nonce",
|
|
2240
|
+
"paymaster",
|
|
2241
|
+
"signature"
|
|
2242
|
+
]
|
|
2243
|
+
}) : parameters;
|
|
2244
|
+
try {
|
|
2245
|
+
const params = [
|
|
2246
|
+
formatUserOperationRequest(request),
|
|
2247
|
+
entryPointAddress ?? ((_a = account == null ? void 0 : account.entryPoint) == null ? void 0 : _a.address)
|
|
2248
|
+
];
|
|
2249
|
+
const result = await client.request({
|
|
2250
|
+
method: "eth_estimateUserOperationGas",
|
|
2251
|
+
params: rpcStateOverride ? [...params, rpcStateOverride] : [...params]
|
|
2252
|
+
});
|
|
2253
|
+
return formatUserOperationGas(result);
|
|
2254
|
+
} catch (error) {
|
|
2255
|
+
const calls = parameters.calls;
|
|
2256
|
+
throw getUserOperationError(error, {
|
|
2257
|
+
...request,
|
|
2258
|
+
...calls ? { calls } : {}
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
function getSupportedEntryPoints(client) {
|
|
2263
|
+
return client.request({ method: "eth_supportedEntryPoints" });
|
|
2264
|
+
}
|
|
2265
|
+
function formatUserOperation(parameters) {
|
|
2266
|
+
const userOperation = { ...parameters };
|
|
2267
|
+
if (parameters.callGasLimit)
|
|
2268
|
+
userOperation.callGasLimit = BigInt(parameters.callGasLimit);
|
|
2269
|
+
if (parameters.maxFeePerGas)
|
|
2270
|
+
userOperation.maxFeePerGas = BigInt(parameters.maxFeePerGas);
|
|
2271
|
+
if (parameters.maxPriorityFeePerGas)
|
|
2272
|
+
userOperation.maxPriorityFeePerGas = BigInt(parameters.maxPriorityFeePerGas);
|
|
2273
|
+
if (parameters.nonce)
|
|
2274
|
+
userOperation.nonce = BigInt(parameters.nonce);
|
|
2275
|
+
if (parameters.paymasterPostOpGasLimit)
|
|
2276
|
+
userOperation.paymasterPostOpGasLimit = BigInt(parameters.paymasterPostOpGasLimit);
|
|
2277
|
+
if (parameters.paymasterVerificationGasLimit)
|
|
2278
|
+
userOperation.paymasterVerificationGasLimit = BigInt(parameters.paymasterVerificationGasLimit);
|
|
2279
|
+
if (parameters.preVerificationGas)
|
|
2280
|
+
userOperation.preVerificationGas = BigInt(parameters.preVerificationGas);
|
|
2281
|
+
if (parameters.verificationGasLimit)
|
|
2282
|
+
userOperation.verificationGasLimit = BigInt(parameters.verificationGasLimit);
|
|
2283
|
+
return userOperation;
|
|
2284
|
+
}
|
|
2285
|
+
async function getUserOperation(client, { hash }) {
|
|
2286
|
+
const result = await client.request({
|
|
2287
|
+
method: "eth_getUserOperationByHash",
|
|
2288
|
+
params: [hash]
|
|
2289
|
+
}, { dedupe: true });
|
|
2290
|
+
if (!result)
|
|
2291
|
+
throw new UserOperationNotFoundError({ hash });
|
|
2292
|
+
const { blockHash, blockNumber, entryPoint, transactionHash, userOperation } = result;
|
|
2293
|
+
return {
|
|
2294
|
+
blockHash,
|
|
2295
|
+
blockNumber: BigInt(blockNumber),
|
|
2296
|
+
entryPoint,
|
|
2297
|
+
transactionHash,
|
|
2298
|
+
userOperation: formatUserOperation(userOperation)
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2301
|
+
function formatUserOperationReceipt(parameters) {
|
|
2302
|
+
const receipt = { ...parameters };
|
|
2303
|
+
if (parameters.actualGasCost)
|
|
2304
|
+
receipt.actualGasCost = BigInt(parameters.actualGasCost);
|
|
2305
|
+
if (parameters.actualGasUsed)
|
|
2306
|
+
receipt.actualGasUsed = BigInt(parameters.actualGasUsed);
|
|
2307
|
+
if (parameters.logs)
|
|
2308
|
+
receipt.logs = parameters.logs.map((log) => formatLog(log));
|
|
2309
|
+
if (parameters.receipt)
|
|
2310
|
+
receipt.receipt = formatTransactionReceipt(receipt.receipt);
|
|
2311
|
+
return receipt;
|
|
2312
|
+
}
|
|
2313
|
+
async function getUserOperationReceipt(client, { hash }) {
|
|
2314
|
+
const receipt = await client.request({
|
|
2315
|
+
method: "eth_getUserOperationReceipt",
|
|
2316
|
+
params: [hash]
|
|
2317
|
+
}, { dedupe: true });
|
|
2318
|
+
if (!receipt)
|
|
2319
|
+
throw new UserOperationReceiptNotFoundError({ hash });
|
|
2320
|
+
return formatUserOperationReceipt(receipt);
|
|
2321
|
+
}
|
|
2322
|
+
async function sendUserOperation(client, parameters) {
|
|
2323
|
+
var _a, _b;
|
|
2324
|
+
const { account: account_ = client.account, entryPointAddress } = parameters;
|
|
2325
|
+
if (!account_ && !parameters.sender)
|
|
2326
|
+
throw new AccountNotFoundError();
|
|
2327
|
+
const account = account_ ? parseAccount(account_) : void 0;
|
|
2328
|
+
const request = account ? await getAction(client, prepareUserOperation, "prepareUserOperation")(parameters) : parameters;
|
|
2329
|
+
const signature = parameters.signature || await ((_a = account == null ? void 0 : account.signUserOperation) == null ? void 0 : _a.call(account, request));
|
|
2330
|
+
const rpcParameters = formatUserOperationRequest({
|
|
2331
|
+
...request,
|
|
2332
|
+
signature
|
|
2333
|
+
});
|
|
2334
|
+
try {
|
|
2335
|
+
return await client.request({
|
|
2336
|
+
method: "eth_sendUserOperation",
|
|
2337
|
+
params: [
|
|
2338
|
+
rpcParameters,
|
|
2339
|
+
entryPointAddress ?? ((_b = account == null ? void 0 : account.entryPoint) == null ? void 0 : _b.address)
|
|
2340
|
+
]
|
|
2341
|
+
}, { retryCount: 0 });
|
|
2342
|
+
} catch (error) {
|
|
2343
|
+
const calls = parameters.calls;
|
|
2344
|
+
throw getUserOperationError(error, {
|
|
2345
|
+
...request,
|
|
2346
|
+
...calls ? { calls } : {},
|
|
2347
|
+
signature
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
function waitForUserOperationReceipt(client, parameters) {
|
|
2352
|
+
const { hash, pollingInterval = client.pollingInterval, retryCount, timeout = 12e4 } = parameters;
|
|
2353
|
+
let count = 0;
|
|
2354
|
+
const observerId = stringify$1([
|
|
2355
|
+
"waitForUserOperationReceipt",
|
|
2356
|
+
client.uid,
|
|
2357
|
+
hash
|
|
2358
|
+
]);
|
|
2359
|
+
return new Promise((resolve, reject) => {
|
|
2360
|
+
const unobserve = observe(observerId, { resolve, reject }, (emit) => {
|
|
2361
|
+
const done = (fn) => {
|
|
2362
|
+
unpoll();
|
|
2363
|
+
fn();
|
|
2364
|
+
unobserve();
|
|
2365
|
+
};
|
|
2366
|
+
const timeoutId = timeout ? setTimeout(() => done(() => emit.reject(new WaitForUserOperationReceiptTimeoutError({ hash }))), timeout) : void 0;
|
|
2367
|
+
const unpoll = poll(async () => {
|
|
2368
|
+
if (retryCount && count >= retryCount) {
|
|
2369
|
+
clearTimeout(timeoutId);
|
|
2370
|
+
done(() => emit.reject(new WaitForUserOperationReceiptTimeoutError({ hash })));
|
|
2371
|
+
}
|
|
2372
|
+
try {
|
|
2373
|
+
const receipt = await getAction(client, getUserOperationReceipt, "getUserOperationReceipt")({ hash });
|
|
2374
|
+
clearTimeout(timeoutId);
|
|
2375
|
+
done(() => emit.resolve(receipt));
|
|
2376
|
+
} catch (err) {
|
|
2377
|
+
const error = err;
|
|
2378
|
+
if (error.name !== "UserOperationReceiptNotFoundError") {
|
|
2379
|
+
clearTimeout(timeoutId);
|
|
2380
|
+
done(() => emit.reject(error));
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
count++;
|
|
2384
|
+
}, {
|
|
2385
|
+
emitOnBegin: true,
|
|
2386
|
+
interval: pollingInterval
|
|
2387
|
+
});
|
|
2388
|
+
return unpoll;
|
|
2389
|
+
});
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
function bundlerActions(client) {
|
|
2393
|
+
return {
|
|
2394
|
+
estimateUserOperationGas: (parameters) => estimateUserOperationGas(client, parameters),
|
|
2395
|
+
getChainId: () => getChainId(client),
|
|
2396
|
+
getSupportedEntryPoints: () => getSupportedEntryPoints(client),
|
|
2397
|
+
getUserOperation: (parameters) => getUserOperation(client, parameters),
|
|
2398
|
+
getUserOperationReceipt: (parameters) => getUserOperationReceipt(client, parameters),
|
|
2399
|
+
prepareUserOperation: (parameters) => prepareUserOperation(client, parameters),
|
|
2400
|
+
sendUserOperation: (parameters) => sendUserOperation(client, parameters),
|
|
2401
|
+
waitForUserOperationReceipt: (parameters) => waitForUserOperationReceipt(client, parameters)
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
function createBundlerClient(parameters) {
|
|
2405
|
+
const { client: client_, key = "bundler", name = "Bundler Client", paymaster, paymasterContext, transport, userOperation } = parameters;
|
|
2406
|
+
const client = Object.assign(createClient({
|
|
2407
|
+
...parameters,
|
|
2408
|
+
chain: parameters.chain ?? (client_ == null ? void 0 : client_.chain),
|
|
2409
|
+
key,
|
|
2410
|
+
name,
|
|
2411
|
+
transport,
|
|
2412
|
+
type: "bundlerClient"
|
|
2413
|
+
}), { client: client_, paymaster, paymasterContext, userOperation });
|
|
2414
|
+
return client.extend(bundlerActions);
|
|
2415
|
+
}
|
|
2416
|
+
const version = "0.1.1";
|
|
2417
|
+
function getVersion() {
|
|
2418
|
+
return version;
|
|
2419
|
+
}
|
|
2420
|
+
class BaseError extends Error {
|
|
2421
|
+
constructor(shortMessage, options = {}) {
|
|
2422
|
+
const details = (() => {
|
|
2423
|
+
var _a;
|
|
2424
|
+
if (options.cause instanceof BaseError) {
|
|
2425
|
+
if (options.cause.details)
|
|
2426
|
+
return options.cause.details;
|
|
2427
|
+
if (options.cause.shortMessage)
|
|
2428
|
+
return options.cause.shortMessage;
|
|
2429
|
+
}
|
|
2430
|
+
if ((_a = options.cause) == null ? void 0 : _a.message)
|
|
2431
|
+
return options.cause.message;
|
|
2432
|
+
return options.details;
|
|
2433
|
+
})();
|
|
2434
|
+
const docsPath = (() => {
|
|
2435
|
+
if (options.cause instanceof BaseError)
|
|
2436
|
+
return options.cause.docsPath || options.docsPath;
|
|
2437
|
+
return options.docsPath;
|
|
2438
|
+
})();
|
|
2439
|
+
const docsBaseUrl = "https://oxlib.sh";
|
|
2440
|
+
const docs = `${docsBaseUrl}${docsPath ?? ""}`;
|
|
2441
|
+
const message = [
|
|
2442
|
+
shortMessage || "An error occurred.",
|
|
2443
|
+
...options.metaMessages ? ["", ...options.metaMessages] : [],
|
|
2444
|
+
...details || docsPath ? [
|
|
2445
|
+
"",
|
|
2446
|
+
details ? `Details: ${details}` : void 0,
|
|
2447
|
+
docsPath ? `See: ${docs}` : void 0
|
|
2448
|
+
] : []
|
|
2449
|
+
].filter((x) => typeof x === "string").join("\n");
|
|
2450
|
+
super(message, options.cause ? { cause: options.cause } : void 0);
|
|
2451
|
+
Object.defineProperty(this, "details", {
|
|
2452
|
+
enumerable: true,
|
|
2453
|
+
configurable: true,
|
|
2454
|
+
writable: true,
|
|
2455
|
+
value: void 0
|
|
2456
|
+
});
|
|
2457
|
+
Object.defineProperty(this, "docs", {
|
|
2458
|
+
enumerable: true,
|
|
2459
|
+
configurable: true,
|
|
2460
|
+
writable: true,
|
|
2461
|
+
value: void 0
|
|
2462
|
+
});
|
|
2463
|
+
Object.defineProperty(this, "docsPath", {
|
|
2464
|
+
enumerable: true,
|
|
2465
|
+
configurable: true,
|
|
2466
|
+
writable: true,
|
|
2467
|
+
value: void 0
|
|
2468
|
+
});
|
|
2469
|
+
Object.defineProperty(this, "shortMessage", {
|
|
2470
|
+
enumerable: true,
|
|
2471
|
+
configurable: true,
|
|
2472
|
+
writable: true,
|
|
2473
|
+
value: void 0
|
|
2474
|
+
});
|
|
2475
|
+
Object.defineProperty(this, "cause", {
|
|
2476
|
+
enumerable: true,
|
|
2477
|
+
configurable: true,
|
|
2478
|
+
writable: true,
|
|
2479
|
+
value: void 0
|
|
2480
|
+
});
|
|
2481
|
+
Object.defineProperty(this, "name", {
|
|
2482
|
+
enumerable: true,
|
|
2483
|
+
configurable: true,
|
|
2484
|
+
writable: true,
|
|
2485
|
+
value: "BaseError"
|
|
2486
|
+
});
|
|
2487
|
+
Object.defineProperty(this, "version", {
|
|
2488
|
+
enumerable: true,
|
|
2489
|
+
configurable: true,
|
|
2490
|
+
writable: true,
|
|
2491
|
+
value: `ox@${getVersion()}`
|
|
2492
|
+
});
|
|
2493
|
+
this.cause = options.cause;
|
|
2494
|
+
this.details = details;
|
|
2495
|
+
this.docs = docs;
|
|
2496
|
+
this.docsPath = docsPath;
|
|
2497
|
+
this.shortMessage = shortMessage;
|
|
2498
|
+
}
|
|
2499
|
+
walk(fn) {
|
|
2500
|
+
return walk(this, fn);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
function walk(err, fn) {
|
|
2504
|
+
if (fn == null ? void 0 : fn(err))
|
|
2505
|
+
return err;
|
|
2506
|
+
if (err && typeof err === "object" && "cause" in err && err.cause)
|
|
2507
|
+
return walk(err.cause, fn);
|
|
2508
|
+
return fn ? null : err;
|
|
2509
|
+
}
|
|
2510
|
+
const bigIntSuffix = "#__bigint";
|
|
2511
|
+
function stringify(value, replacer, space) {
|
|
2512
|
+
return JSON.stringify(value, (key, value2) => {
|
|
2513
|
+
if (typeof value2 === "bigint")
|
|
2514
|
+
return value2.toString() + bigIntSuffix;
|
|
2515
|
+
return value2;
|
|
2516
|
+
}, space);
|
|
2517
|
+
}
|
|
2518
|
+
function assertSize$1(bytes, size_) {
|
|
2519
|
+
if (size(bytes) > size_)
|
|
2520
|
+
throw new SizeOverflowError2({
|
|
2521
|
+
givenSize: size(bytes),
|
|
2522
|
+
maxSize: size_
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
function assertStartOffset$1(value, start) {
|
|
2526
|
+
if (typeof start === "number" && start > 0 && start > size(value) - 1)
|
|
2527
|
+
throw new SliceOffsetOutOfBoundsError2({
|
|
2528
|
+
offset: start,
|
|
2529
|
+
position: "start",
|
|
2530
|
+
size: size(value)
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
function assertEndOffset$1(value, start, end) {
|
|
2534
|
+
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
|
|
2535
|
+
throw new SliceOffsetOutOfBoundsError2({
|
|
2536
|
+
offset: end,
|
|
2537
|
+
position: "end",
|
|
2538
|
+
size: size(value)
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
const charCodeMap = {
|
|
2543
|
+
zero: 48,
|
|
2544
|
+
nine: 57,
|
|
2545
|
+
A: 65,
|
|
2546
|
+
F: 70,
|
|
2547
|
+
a: 97,
|
|
2548
|
+
f: 102
|
|
2549
|
+
};
|
|
2550
|
+
function charCodeToBase16(char) {
|
|
2551
|
+
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
2552
|
+
return char - charCodeMap.zero;
|
|
2553
|
+
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
2554
|
+
return char - (charCodeMap.A - 10);
|
|
2555
|
+
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
2556
|
+
return char - (charCodeMap.a - 10);
|
|
2557
|
+
return void 0;
|
|
2558
|
+
}
|
|
2559
|
+
function assertSize(hex, size_) {
|
|
2560
|
+
if (size$1(hex) > size_)
|
|
2561
|
+
throw new SizeOverflowError$1({
|
|
2562
|
+
givenSize: size$1(hex),
|
|
2563
|
+
maxSize: size_
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
function assertStartOffset(value, start) {
|
|
2567
|
+
if (typeof start === "number" && start > 0 && start > size$1(value) - 1)
|
|
2568
|
+
throw new SliceOffsetOutOfBoundsError$1({
|
|
2569
|
+
offset: start,
|
|
2570
|
+
position: "start",
|
|
2571
|
+
size: size$1(value)
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
function assertEndOffset(value, start, end) {
|
|
2575
|
+
if (typeof start === "number" && typeof end === "number" && size$1(value) !== end - start) {
|
|
2576
|
+
throw new SliceOffsetOutOfBoundsError$1({
|
|
2577
|
+
offset: end,
|
|
2578
|
+
position: "end",
|
|
2579
|
+
size: size$1(value)
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
function pad(hex_, options = {}) {
|
|
2584
|
+
const { dir, size: size2 = 32 } = options;
|
|
2585
|
+
if (size2 === 0)
|
|
2586
|
+
return hex_;
|
|
2587
|
+
const hex = hex_.replace("0x", "");
|
|
2588
|
+
if (hex.length > size2 * 2)
|
|
2589
|
+
throw new SizeExceedsPaddingSizeError({
|
|
2590
|
+
size: Math.ceil(hex.length / 2),
|
|
2591
|
+
targetSize: size2,
|
|
2592
|
+
type: "Hex"
|
|
2593
|
+
});
|
|
2594
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
|
|
2595
|
+
}
|
|
2596
|
+
const encoder = /* @__PURE__ */ new TextEncoder();
|
|
2597
|
+
const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
2598
|
+
function assert$3(value, options = {}) {
|
|
2599
|
+
const { strict = false } = options;
|
|
2600
|
+
if (!value)
|
|
2601
|
+
throw new InvalidHexTypeError(value);
|
|
2602
|
+
if (typeof value !== "string")
|
|
2603
|
+
throw new InvalidHexTypeError(value);
|
|
2604
|
+
if (strict) {
|
|
2605
|
+
if (!/^0x[0-9a-fA-F]*$/.test(value))
|
|
2606
|
+
throw new InvalidHexValueError(value);
|
|
2607
|
+
}
|
|
2608
|
+
if (!value.startsWith("0x"))
|
|
2609
|
+
throw new InvalidHexValueError(value);
|
|
2610
|
+
}
|
|
2611
|
+
function concat(...values) {
|
|
2612
|
+
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
2613
|
+
}
|
|
2614
|
+
function from$2(value) {
|
|
2615
|
+
if (value instanceof Uint8Array)
|
|
2616
|
+
return fromBytes$2(value);
|
|
2617
|
+
if (Array.isArray(value))
|
|
2618
|
+
return fromBytes$2(new Uint8Array(value));
|
|
2619
|
+
return value;
|
|
2620
|
+
}
|
|
2621
|
+
function fromBytes$2(value, options = {}) {
|
|
2622
|
+
let string = "";
|
|
2623
|
+
for (let i = 0; i < value.length; i++)
|
|
2624
|
+
string += hexes[value[i]];
|
|
2625
|
+
const hex = `0x${string}`;
|
|
2626
|
+
if (typeof options.size === "number") {
|
|
2627
|
+
assertSize(hex, options.size);
|
|
2628
|
+
return padRight(hex, options.size);
|
|
2629
|
+
}
|
|
2630
|
+
return hex;
|
|
2631
|
+
}
|
|
2632
|
+
function fromNumber(value, options = {}) {
|
|
2633
|
+
const { signed, size: size2 } = options;
|
|
2634
|
+
const value_ = BigInt(value);
|
|
2635
|
+
let maxValue;
|
|
2636
|
+
if (size2) {
|
|
2637
|
+
if (signed)
|
|
2638
|
+
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
|
|
2639
|
+
else
|
|
2640
|
+
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
|
|
2641
|
+
} else if (typeof value === "number") {
|
|
2642
|
+
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
2643
|
+
}
|
|
2644
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
2645
|
+
if (maxValue && value_ > maxValue || value_ < minValue) {
|
|
2646
|
+
const suffix = typeof value === "bigint" ? "n" : "";
|
|
2647
|
+
throw new IntegerOutOfRangeError({
|
|
2648
|
+
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
2649
|
+
min: `${minValue}${suffix}`,
|
|
2650
|
+
signed,
|
|
2651
|
+
size: size2,
|
|
2652
|
+
value: `${value}${suffix}`
|
|
2653
|
+
});
|
|
2654
|
+
}
|
|
2655
|
+
const stringValue = (signed && value_ < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value_) : value_).toString(16);
|
|
2656
|
+
const hex = `0x${stringValue}`;
|
|
2657
|
+
if (size2)
|
|
2658
|
+
return padLeft(hex, size2);
|
|
2659
|
+
return hex;
|
|
2660
|
+
}
|
|
2661
|
+
function fromString(value, options = {}) {
|
|
2662
|
+
return fromBytes$2(encoder.encode(value), options);
|
|
2663
|
+
}
|
|
2664
|
+
function padLeft(value, size2) {
|
|
2665
|
+
return pad(value, { dir: "left", size: size2 });
|
|
2666
|
+
}
|
|
2667
|
+
function padRight(value, size2) {
|
|
2668
|
+
return pad(value, { dir: "right", size: size2 });
|
|
2669
|
+
}
|
|
2670
|
+
function slice$1(value, start, end, options = {}) {
|
|
2671
|
+
const { strict } = options;
|
|
2672
|
+
assertStartOffset(value, start);
|
|
2673
|
+
const value_ = `0x${value.replace("0x", "").slice((start ?? 0) * 2, (end ?? value.length) * 2)}`;
|
|
2674
|
+
if (strict)
|
|
2675
|
+
assertEndOffset(value_, start, end);
|
|
2676
|
+
return value_;
|
|
2677
|
+
}
|
|
2678
|
+
function size$1(value) {
|
|
2679
|
+
return Math.ceil((value.length - 2) / 2);
|
|
2680
|
+
}
|
|
2681
|
+
function toBigInt$1(hex, options = {}) {
|
|
2682
|
+
const { signed } = options;
|
|
2683
|
+
if (options.size)
|
|
2684
|
+
assertSize(hex, options.size);
|
|
2685
|
+
const value = BigInt(hex);
|
|
2686
|
+
if (!signed)
|
|
2687
|
+
return value;
|
|
2688
|
+
const size2 = (hex.length - 2) / 2;
|
|
2689
|
+
const max_unsigned = (1n << BigInt(size2) * 8n) - 1n;
|
|
2690
|
+
const max_signed = max_unsigned >> 1n;
|
|
2691
|
+
if (value <= max_signed)
|
|
2692
|
+
return value;
|
|
2693
|
+
return value - max_unsigned - 1n;
|
|
2694
|
+
}
|
|
2695
|
+
function validate$1(value, options = {}) {
|
|
2696
|
+
const { strict = false } = options;
|
|
2697
|
+
try {
|
|
2698
|
+
assert$3(value, { strict });
|
|
2699
|
+
return true;
|
|
2700
|
+
} catch {
|
|
2701
|
+
return false;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
class IntegerOutOfRangeError extends BaseError {
|
|
2705
|
+
constructor({ max, min, signed, size: size2, value }) {
|
|
2706
|
+
super(`Number \`${value}\` is not in safe${size2 ? ` ${size2 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
|
|
2707
|
+
Object.defineProperty(this, "name", {
|
|
2708
|
+
enumerable: true,
|
|
2709
|
+
configurable: true,
|
|
2710
|
+
writable: true,
|
|
2711
|
+
value: "Hex.IntegerOutOfRangeError"
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
class InvalidHexTypeError extends BaseError {
|
|
2716
|
+
constructor(value) {
|
|
2717
|
+
super(`Value \`${typeof value === "object" ? stringify(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, {
|
|
2718
|
+
metaMessages: ['Hex types must be represented as `"0x${string}"`.']
|
|
2719
|
+
});
|
|
2720
|
+
Object.defineProperty(this, "name", {
|
|
2721
|
+
enumerable: true,
|
|
2722
|
+
configurable: true,
|
|
2723
|
+
writable: true,
|
|
2724
|
+
value: "Hex.InvalidHexTypeError"
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
class InvalidHexValueError extends BaseError {
|
|
2729
|
+
constructor(value) {
|
|
2730
|
+
super(`Value \`${value}\` is an invalid hex value.`, {
|
|
2731
|
+
metaMessages: [
|
|
2732
|
+
'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
|
|
2733
|
+
]
|
|
2734
|
+
});
|
|
2735
|
+
Object.defineProperty(this, "name", {
|
|
2736
|
+
enumerable: true,
|
|
2737
|
+
configurable: true,
|
|
2738
|
+
writable: true,
|
|
2739
|
+
value: "Hex.InvalidHexValueError"
|
|
2740
|
+
});
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
let SizeOverflowError$1 = class SizeOverflowError extends BaseError {
|
|
2744
|
+
constructor({ givenSize, maxSize }) {
|
|
2745
|
+
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
2746
|
+
Object.defineProperty(this, "name", {
|
|
2747
|
+
enumerable: true,
|
|
2748
|
+
configurable: true,
|
|
2749
|
+
writable: true,
|
|
2750
|
+
value: "Hex.SizeOverflowError"
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
};
|
|
2754
|
+
let SliceOffsetOutOfBoundsError$1 = class SliceOffsetOutOfBoundsError extends BaseError {
|
|
2755
|
+
constructor({ offset, position, size: size2 }) {
|
|
2756
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size2}\`).`);
|
|
2757
|
+
Object.defineProperty(this, "name", {
|
|
2758
|
+
enumerable: true,
|
|
2759
|
+
configurable: true,
|
|
2760
|
+
writable: true,
|
|
2761
|
+
value: "Hex.SliceOffsetOutOfBoundsError"
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
class SizeExceedsPaddingSizeError extends BaseError {
|
|
2766
|
+
constructor({ size: size2, targetSize, type }) {
|
|
2767
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size2}\`) exceeds padding size (\`${targetSize}\`).`);
|
|
2768
|
+
Object.defineProperty(this, "name", {
|
|
2769
|
+
enumerable: true,
|
|
2770
|
+
configurable: true,
|
|
2771
|
+
writable: true,
|
|
2772
|
+
value: "Hex.SizeExceedsPaddingSizeError"
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
function assert$2(value) {
|
|
2777
|
+
if (value instanceof Uint8Array)
|
|
2778
|
+
return;
|
|
2779
|
+
if (!value)
|
|
2780
|
+
throw new InvalidBytesTypeError(value);
|
|
2781
|
+
if (typeof value !== "object")
|
|
2782
|
+
throw new InvalidBytesTypeError(value);
|
|
2783
|
+
if (!("BYTES_PER_ELEMENT" in value))
|
|
2784
|
+
throw new InvalidBytesTypeError(value);
|
|
2785
|
+
if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
|
|
2786
|
+
throw new InvalidBytesTypeError(value);
|
|
2787
|
+
}
|
|
2788
|
+
function from$1(value) {
|
|
2789
|
+
if (value instanceof Uint8Array)
|
|
2790
|
+
return value;
|
|
2791
|
+
if (typeof value === "string")
|
|
2792
|
+
return fromHex$3(value);
|
|
2793
|
+
return fromArray(value);
|
|
2794
|
+
}
|
|
2795
|
+
function fromArray(value) {
|
|
2796
|
+
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
2797
|
+
}
|
|
2798
|
+
function fromHex$3(value, options = {}) {
|
|
2799
|
+
const { size: size2 } = options;
|
|
2800
|
+
let hex = value;
|
|
2801
|
+
if (size2) {
|
|
2802
|
+
assertSize(value, size2);
|
|
2803
|
+
hex = padRight(value, size2);
|
|
2804
|
+
}
|
|
2805
|
+
let hexString = hex.slice(2);
|
|
2806
|
+
if (hexString.length % 2)
|
|
2807
|
+
hexString = `0${hexString}`;
|
|
2808
|
+
const length = hexString.length / 2;
|
|
2809
|
+
const bytes = new Uint8Array(length);
|
|
2810
|
+
for (let index = 0, j = 0; index < length; index++) {
|
|
2811
|
+
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
|
|
2812
|
+
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
|
|
2813
|
+
if (nibbleLeft === void 0 || nibbleRight === void 0) {
|
|
2814
|
+
throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
|
|
2815
|
+
}
|
|
2816
|
+
bytes[index] = nibbleLeft * 16 + nibbleRight;
|
|
2817
|
+
}
|
|
2818
|
+
return bytes;
|
|
2819
|
+
}
|
|
2820
|
+
function size(value) {
|
|
2821
|
+
return value.length;
|
|
2822
|
+
}
|
|
2823
|
+
function slice(value, start, end, options = {}) {
|
|
2824
|
+
const { strict } = options;
|
|
2825
|
+
assertStartOffset$1(value, start);
|
|
2826
|
+
const value_ = value.slice(start, end);
|
|
2827
|
+
if (strict)
|
|
2828
|
+
assertEndOffset$1(value_, start, end);
|
|
2829
|
+
return value_;
|
|
2830
|
+
}
|
|
2831
|
+
function toBigInt(bytes, options = {}) {
|
|
2832
|
+
const { size: size2 } = options;
|
|
2833
|
+
if (typeof size2 !== "undefined")
|
|
2834
|
+
assertSize$1(bytes, size2);
|
|
2835
|
+
const hex = fromBytes$2(bytes, options);
|
|
2836
|
+
return toBigInt$1(hex, options);
|
|
2837
|
+
}
|
|
2838
|
+
function validate(value) {
|
|
2839
|
+
try {
|
|
2840
|
+
assert$2(value);
|
|
2841
|
+
return true;
|
|
2842
|
+
} catch {
|
|
2843
|
+
return false;
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
class InvalidBytesTypeError extends BaseError {
|
|
2847
|
+
constructor(value) {
|
|
2848
|
+
super(`Value \`${typeof value === "object" ? stringify(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value.`, {
|
|
2849
|
+
metaMessages: ["Bytes values must be of type `Bytes`."]
|
|
2850
|
+
});
|
|
2851
|
+
Object.defineProperty(this, "name", {
|
|
2852
|
+
enumerable: true,
|
|
2853
|
+
configurable: true,
|
|
2854
|
+
writable: true,
|
|
2855
|
+
value: "Bytes.InvalidBytesTypeError"
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
class SizeOverflowError2 extends BaseError {
|
|
2860
|
+
constructor({ givenSize, maxSize }) {
|
|
2861
|
+
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
2862
|
+
Object.defineProperty(this, "name", {
|
|
2863
|
+
enumerable: true,
|
|
2864
|
+
configurable: true,
|
|
2865
|
+
writable: true,
|
|
2866
|
+
value: "Bytes.SizeOverflowError"
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
class SliceOffsetOutOfBoundsError2 extends BaseError {
|
|
2871
|
+
constructor({ offset, position, size: size2 }) {
|
|
2872
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size2}\`).`);
|
|
2873
|
+
Object.defineProperty(this, "name", {
|
|
2874
|
+
enumerable: true,
|
|
2875
|
+
configurable: true,
|
|
2876
|
+
writable: true,
|
|
2877
|
+
value: "Bytes.SliceOffsetOutOfBoundsError"
|
|
2878
|
+
});
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
function sha256(value, options = {}) {
|
|
2882
|
+
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options;
|
|
2883
|
+
const bytes = sha256$1(from$1(value));
|
|
2884
|
+
if (as === "Bytes")
|
|
2885
|
+
return bytes;
|
|
2886
|
+
return fromBytes$2(bytes);
|
|
2887
|
+
}
|
|
2888
|
+
function assert$1(publicKey, options = {}) {
|
|
2889
|
+
const { compressed } = options;
|
|
2890
|
+
const { prefix, x, y } = publicKey;
|
|
2891
|
+
if (compressed === false || typeof x === "bigint" && typeof y === "bigint") {
|
|
2892
|
+
if (prefix !== 4)
|
|
2893
|
+
throw new InvalidPrefixError({
|
|
2894
|
+
prefix,
|
|
2895
|
+
cause: new InvalidUncompressedPrefixError()
|
|
2896
|
+
});
|
|
2897
|
+
return;
|
|
2898
|
+
}
|
|
2899
|
+
if (compressed === true || typeof x === "bigint" && typeof y === "undefined") {
|
|
2900
|
+
if (prefix !== 3 && prefix !== 2)
|
|
2901
|
+
throw new InvalidPrefixError({
|
|
2902
|
+
prefix,
|
|
2903
|
+
cause: new InvalidCompressedPrefixError()
|
|
2904
|
+
});
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2907
|
+
throw new InvalidError({ publicKey });
|
|
2908
|
+
}
|
|
2909
|
+
function from(value) {
|
|
2910
|
+
const publicKey = (() => {
|
|
2911
|
+
if (validate$1(value))
|
|
2912
|
+
return fromHex$2(value);
|
|
2913
|
+
if (validate(value))
|
|
2914
|
+
return fromBytes$1(value);
|
|
2915
|
+
const { prefix, x, y } = value;
|
|
2916
|
+
if (typeof x === "bigint" && typeof y === "bigint")
|
|
2917
|
+
return { prefix: prefix ?? 4, x, y };
|
|
2918
|
+
return { prefix, x };
|
|
2919
|
+
})();
|
|
2920
|
+
assert$1(publicKey);
|
|
2921
|
+
return publicKey;
|
|
2922
|
+
}
|
|
2923
|
+
function fromBytes$1(publicKey) {
|
|
2924
|
+
return fromHex$2(fromBytes$2(publicKey));
|
|
2925
|
+
}
|
|
2926
|
+
function fromHex$2(publicKey) {
|
|
2927
|
+
if (publicKey.length !== 132 && publicKey.length !== 130 && publicKey.length !== 68)
|
|
2928
|
+
throw new InvalidSerializedSizeError$1({ publicKey });
|
|
2929
|
+
if (publicKey.length === 130) {
|
|
2930
|
+
const x2 = BigInt(slice$1(publicKey, 0, 32));
|
|
2931
|
+
const y = BigInt(slice$1(publicKey, 32, 64));
|
|
2932
|
+
return {
|
|
2933
|
+
prefix: 4,
|
|
2934
|
+
x: x2,
|
|
2935
|
+
y
|
|
2936
|
+
};
|
|
2937
|
+
}
|
|
2938
|
+
if (publicKey.length === 132) {
|
|
2939
|
+
const prefix2 = Number(slice$1(publicKey, 0, 1));
|
|
2940
|
+
const x2 = BigInt(slice$1(publicKey, 1, 33));
|
|
2941
|
+
const y = BigInt(slice$1(publicKey, 33, 65));
|
|
2942
|
+
return {
|
|
2943
|
+
prefix: prefix2,
|
|
2944
|
+
x: x2,
|
|
2945
|
+
y
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
const prefix = Number(slice$1(publicKey, 0, 1));
|
|
2949
|
+
const x = BigInt(slice$1(publicKey, 1, 33));
|
|
2950
|
+
return {
|
|
2951
|
+
prefix,
|
|
2952
|
+
x
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
function toHex$1(publicKey, options = {}) {
|
|
2956
|
+
assert$1(publicKey);
|
|
2957
|
+
const { prefix, x, y } = publicKey;
|
|
2958
|
+
const { includePrefix = true } = options;
|
|
2959
|
+
const publicKey_ = concat(
|
|
2960
|
+
includePrefix ? fromNumber(prefix, { size: 1 }) : "0x",
|
|
2961
|
+
fromNumber(x, { size: 32 }),
|
|
2962
|
+
// If the public key is not compressed, add the y coordinate.
|
|
2963
|
+
typeof y === "bigint" ? fromNumber(y, { size: 32 }) : "0x"
|
|
2964
|
+
);
|
|
2965
|
+
return publicKey_;
|
|
2966
|
+
}
|
|
2967
|
+
class InvalidError extends BaseError {
|
|
2968
|
+
constructor({ publicKey }) {
|
|
2969
|
+
super(`Value \`${stringify(publicKey)}\` is not a valid public key.`, {
|
|
2970
|
+
metaMessages: [
|
|
2971
|
+
"Public key must contain:",
|
|
2972
|
+
"- an `x` and `prefix` value (compressed)",
|
|
2973
|
+
"- an `x`, `y`, and `prefix` value (uncompressed)"
|
|
2974
|
+
]
|
|
2975
|
+
});
|
|
2976
|
+
Object.defineProperty(this, "name", {
|
|
2977
|
+
enumerable: true,
|
|
2978
|
+
configurable: true,
|
|
2979
|
+
writable: true,
|
|
2980
|
+
value: "PublicKey.InvalidError"
|
|
2981
|
+
});
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
class InvalidPrefixError extends BaseError {
|
|
2985
|
+
constructor({ prefix, cause }) {
|
|
2986
|
+
super(`Prefix "${prefix}" is invalid.`, {
|
|
2987
|
+
cause
|
|
2988
|
+
});
|
|
2989
|
+
Object.defineProperty(this, "name", {
|
|
2990
|
+
enumerable: true,
|
|
2991
|
+
configurable: true,
|
|
2992
|
+
writable: true,
|
|
2993
|
+
value: "PublicKey.InvalidPrefixError"
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
class InvalidCompressedPrefixError extends BaseError {
|
|
2998
|
+
constructor() {
|
|
2999
|
+
super("Prefix must be 2 or 3 for compressed public keys.");
|
|
3000
|
+
Object.defineProperty(this, "name", {
|
|
3001
|
+
enumerable: true,
|
|
3002
|
+
configurable: true,
|
|
3003
|
+
writable: true,
|
|
3004
|
+
value: "PublicKey.InvalidCompressedPrefixError"
|
|
3005
|
+
});
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
class InvalidUncompressedPrefixError extends BaseError {
|
|
3009
|
+
constructor() {
|
|
3010
|
+
super("Prefix must be 4 for uncompressed public keys.");
|
|
3011
|
+
Object.defineProperty(this, "name", {
|
|
3012
|
+
enumerable: true,
|
|
3013
|
+
configurable: true,
|
|
3014
|
+
writable: true,
|
|
3015
|
+
value: "PublicKey.InvalidUncompressedPrefixError"
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
let InvalidSerializedSizeError$1 = class InvalidSerializedSizeError extends BaseError {
|
|
3020
|
+
constructor({ publicKey }) {
|
|
3021
|
+
super(`Value \`${publicKey}\` is an invalid public key size.`, {
|
|
3022
|
+
metaMessages: [
|
|
3023
|
+
"Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",
|
|
3024
|
+
`Received ${size$1(from$2(publicKey))} bytes.`
|
|
3025
|
+
]
|
|
3026
|
+
});
|
|
3027
|
+
Object.defineProperty(this, "name", {
|
|
3028
|
+
enumerable: true,
|
|
3029
|
+
configurable: true,
|
|
3030
|
+
writable: true,
|
|
3031
|
+
value: "PublicKey.InvalidSerializedSizeError"
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
};
|
|
3035
|
+
const maxUint256 = 2n ** 256n - 1n;
|
|
3036
|
+
function assert(signature, options = {}) {
|
|
3037
|
+
const { recovered } = options;
|
|
3038
|
+
if (typeof signature.r === "undefined")
|
|
3039
|
+
throw new MissingPropertiesError({ signature });
|
|
3040
|
+
if (typeof signature.s === "undefined")
|
|
3041
|
+
throw new MissingPropertiesError({ signature });
|
|
3042
|
+
if (recovered && typeof signature.yParity === "undefined")
|
|
3043
|
+
throw new MissingPropertiesError({ signature });
|
|
3044
|
+
if (signature.r < 0n || signature.r > maxUint256)
|
|
3045
|
+
throw new InvalidRError({ value: signature.r });
|
|
3046
|
+
if (signature.s < 0n || signature.s > maxUint256)
|
|
3047
|
+
throw new InvalidSError({ value: signature.s });
|
|
3048
|
+
if (typeof signature.yParity === "number" && signature.yParity !== 0 && signature.yParity !== 1)
|
|
3049
|
+
throw new InvalidYParityError({ value: signature.yParity });
|
|
3050
|
+
}
|
|
3051
|
+
function fromHex$1(signature) {
|
|
3052
|
+
if (signature.length !== 130 && signature.length !== 132)
|
|
3053
|
+
throw new InvalidSerializedSizeError2({ signature });
|
|
3054
|
+
const r = BigInt(slice$1(signature, 0, 32));
|
|
3055
|
+
const s = BigInt(slice$1(signature, 32, 64));
|
|
3056
|
+
const yParity = (() => {
|
|
3057
|
+
const yParity2 = Number(`0x${signature.slice(130)}`);
|
|
3058
|
+
if (Number.isNaN(yParity2))
|
|
3059
|
+
return void 0;
|
|
3060
|
+
try {
|
|
3061
|
+
return vToYParity(yParity2);
|
|
3062
|
+
} catch {
|
|
3063
|
+
throw new InvalidYParityError({ value: yParity2 });
|
|
3064
|
+
}
|
|
3065
|
+
})();
|
|
3066
|
+
if (typeof yParity === "undefined")
|
|
3067
|
+
return {
|
|
3068
|
+
r,
|
|
3069
|
+
s
|
|
3070
|
+
};
|
|
3071
|
+
return {
|
|
3072
|
+
r,
|
|
3073
|
+
s,
|
|
3074
|
+
yParity
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3077
|
+
function toHex(signature) {
|
|
3078
|
+
assert(signature);
|
|
3079
|
+
const r = signature.r;
|
|
3080
|
+
const s = signature.s;
|
|
3081
|
+
const signature_ = concat(
|
|
3082
|
+
fromNumber(r, { size: 32 }),
|
|
3083
|
+
fromNumber(s, { size: 32 }),
|
|
3084
|
+
// If the signature is recovered, add the recovery byte to the signature.
|
|
3085
|
+
typeof signature.yParity === "number" ? fromNumber(yParityToV(signature.yParity), { size: 1 }) : "0x"
|
|
3086
|
+
);
|
|
3087
|
+
return signature_;
|
|
3088
|
+
}
|
|
3089
|
+
function vToYParity(v) {
|
|
3090
|
+
if (v === 0 || v === 27)
|
|
3091
|
+
return 0;
|
|
3092
|
+
if (v === 1 || v === 28)
|
|
3093
|
+
return 1;
|
|
3094
|
+
if (v >= 35)
|
|
3095
|
+
return v % 2 === 0 ? 1 : 0;
|
|
3096
|
+
throw new InvalidVError({ value: v });
|
|
3097
|
+
}
|
|
3098
|
+
function yParityToV(yParity) {
|
|
3099
|
+
if (yParity === 0)
|
|
3100
|
+
return 27;
|
|
3101
|
+
if (yParity === 1)
|
|
3102
|
+
return 28;
|
|
3103
|
+
throw new InvalidYParityError({ value: yParity });
|
|
3104
|
+
}
|
|
3105
|
+
class InvalidSerializedSizeError2 extends BaseError {
|
|
3106
|
+
constructor({ signature }) {
|
|
3107
|
+
super(`Value \`${signature}\` is an invalid signature size.`, {
|
|
3108
|
+
metaMessages: [
|
|
3109
|
+
"Expected: 64 bytes or 65 bytes.",
|
|
3110
|
+
`Received ${size$1(from$2(signature))} bytes.`
|
|
3111
|
+
]
|
|
3112
|
+
});
|
|
3113
|
+
Object.defineProperty(this, "name", {
|
|
3114
|
+
enumerable: true,
|
|
3115
|
+
configurable: true,
|
|
3116
|
+
writable: true,
|
|
3117
|
+
value: "Signature.InvalidSerializedSizeError"
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
class MissingPropertiesError extends BaseError {
|
|
3122
|
+
constructor({ signature }) {
|
|
3123
|
+
super(`Signature \`${stringify(signature)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`);
|
|
3124
|
+
Object.defineProperty(this, "name", {
|
|
3125
|
+
enumerable: true,
|
|
3126
|
+
configurable: true,
|
|
3127
|
+
writable: true,
|
|
3128
|
+
value: "Signature.MissingPropertiesError"
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
class InvalidRError extends BaseError {
|
|
3133
|
+
constructor({ value }) {
|
|
3134
|
+
super(`Value \`${value}\` is an invalid r value. r must be a positive integer less than 2^256.`);
|
|
3135
|
+
Object.defineProperty(this, "name", {
|
|
3136
|
+
enumerable: true,
|
|
3137
|
+
configurable: true,
|
|
3138
|
+
writable: true,
|
|
3139
|
+
value: "Signature.InvalidRError"
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
class InvalidSError extends BaseError {
|
|
3144
|
+
constructor({ value }) {
|
|
3145
|
+
super(`Value \`${value}\` is an invalid s value. s must be a positive integer less than 2^256.`);
|
|
3146
|
+
Object.defineProperty(this, "name", {
|
|
3147
|
+
enumerable: true,
|
|
3148
|
+
configurable: true,
|
|
3149
|
+
writable: true,
|
|
3150
|
+
value: "Signature.InvalidSError"
|
|
3151
|
+
});
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
class InvalidYParityError extends BaseError {
|
|
3155
|
+
constructor({ value }) {
|
|
3156
|
+
super(`Value \`${value}\` is an invalid y-parity value. Y-parity must be 0 or 1.`);
|
|
3157
|
+
Object.defineProperty(this, "name", {
|
|
3158
|
+
enumerable: true,
|
|
3159
|
+
configurable: true,
|
|
3160
|
+
writable: true,
|
|
3161
|
+
value: "Signature.InvalidYParityError"
|
|
3162
|
+
});
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
class InvalidVError extends BaseError {
|
|
3166
|
+
constructor({ value }) {
|
|
3167
|
+
super(`Value \`${value}\` is an invalid v value. v must be 27, 28 or >=35.`);
|
|
3168
|
+
Object.defineProperty(this, "name", {
|
|
3169
|
+
enumerable: true,
|
|
3170
|
+
configurable: true,
|
|
3171
|
+
writable: true,
|
|
3172
|
+
value: "Signature.InvalidVError"
|
|
3173
|
+
});
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
const decoder = /* @__PURE__ */ new TextDecoder();
|
|
3177
|
+
const integerToCharacter = /* @__PURE__ */ Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((a, i) => [i, a.charCodeAt(0)]));
|
|
3178
|
+
({
|
|
3179
|
+
...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((a, i) => [a.charCodeAt(0), i]))
|
|
3180
|
+
});
|
|
3181
|
+
function fromBytes(value, options = {}) {
|
|
3182
|
+
const { pad: pad2 = true, url = false } = options;
|
|
3183
|
+
const encoded = new Uint8Array(Math.ceil(value.length / 3) * 4);
|
|
3184
|
+
for (let i = 0, j = 0; j < value.length; i += 4, j += 3) {
|
|
3185
|
+
const y = (value[j] << 16) + (value[j + 1] << 8) + (value[j + 2] | 0);
|
|
3186
|
+
encoded[i] = integerToCharacter[y >> 18];
|
|
3187
|
+
encoded[i + 1] = integerToCharacter[y >> 12 & 63];
|
|
3188
|
+
encoded[i + 2] = integerToCharacter[y >> 6 & 63];
|
|
3189
|
+
encoded[i + 3] = integerToCharacter[y & 63];
|
|
3190
|
+
}
|
|
3191
|
+
const k = value.length % 3;
|
|
3192
|
+
const end = Math.floor(value.length / 3) * 4 + (k && k + 1);
|
|
3193
|
+
let base64 = decoder.decode(new Uint8Array(encoded.buffer, 0, end));
|
|
3194
|
+
if (pad2 && k === 1)
|
|
3195
|
+
base64 += "==";
|
|
3196
|
+
if (pad2 && k === 2)
|
|
3197
|
+
base64 += "=";
|
|
3198
|
+
if (url)
|
|
3199
|
+
base64 = base64.replaceAll("+", "-").replaceAll("/", "_");
|
|
3200
|
+
return base64;
|
|
3201
|
+
}
|
|
3202
|
+
function fromHex(value, options = {}) {
|
|
3203
|
+
return fromBytes(fromHex$3(value), options);
|
|
3204
|
+
}
|
|
3205
|
+
Uint8Array.from([
|
|
3206
|
+
105,
|
|
3207
|
+
171,
|
|
3208
|
+
180,
|
|
3209
|
+
181,
|
|
3210
|
+
160,
|
|
3211
|
+
222,
|
|
3212
|
+
75,
|
|
3213
|
+
198,
|
|
3214
|
+
42,
|
|
3215
|
+
42,
|
|
3216
|
+
32,
|
|
3217
|
+
31,
|
|
3218
|
+
141,
|
|
3219
|
+
37,
|
|
3220
|
+
186,
|
|
3221
|
+
233
|
|
3222
|
+
]);
|
|
3223
|
+
function getAuthenticatorData(options = {}) {
|
|
3224
|
+
const { flag = 5, rpId = window.location.hostname, signCount = 0 } = options;
|
|
3225
|
+
const rpIdHash = sha256(fromString(rpId));
|
|
3226
|
+
const flag_bytes = fromNumber(flag, { size: 1 });
|
|
3227
|
+
const signCount_bytes = fromNumber(signCount, { size: 4 });
|
|
3228
|
+
return concat(rpIdHash, flag_bytes, signCount_bytes);
|
|
3229
|
+
}
|
|
3230
|
+
function getClientDataJSON(options) {
|
|
3231
|
+
const { challenge, crossOrigin = false, extraClientData, origin = window.location.origin } = options;
|
|
3232
|
+
return JSON.stringify({
|
|
3233
|
+
type: "webauthn.get",
|
|
3234
|
+
challenge: fromHex(challenge, { url: true, pad: false }),
|
|
3235
|
+
origin,
|
|
3236
|
+
crossOrigin,
|
|
3237
|
+
...extraClientData
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
function getSignPayload(options) {
|
|
3241
|
+
const { challenge, crossOrigin, extraClientData, flag, origin, rpId, signCount, userVerification = "required" } = options;
|
|
3242
|
+
const authenticatorData = getAuthenticatorData({
|
|
3243
|
+
flag,
|
|
3244
|
+
rpId,
|
|
3245
|
+
signCount
|
|
3246
|
+
});
|
|
3247
|
+
const clientDataJSON = getClientDataJSON({
|
|
3248
|
+
challenge,
|
|
3249
|
+
crossOrigin,
|
|
3250
|
+
extraClientData,
|
|
3251
|
+
origin
|
|
3252
|
+
});
|
|
3253
|
+
const clientDataJSONHash = sha256(fromString(clientDataJSON));
|
|
3254
|
+
const challengeIndex = clientDataJSON.indexOf('"challenge"');
|
|
3255
|
+
const typeIndex = clientDataJSON.indexOf('"type"');
|
|
3256
|
+
const metadata = {
|
|
3257
|
+
authenticatorData,
|
|
3258
|
+
clientDataJSON,
|
|
3259
|
+
challengeIndex,
|
|
3260
|
+
typeIndex,
|
|
3261
|
+
userVerificationRequired: userVerification === "required"
|
|
3262
|
+
};
|
|
3263
|
+
const payload = concat(authenticatorData, clientDataJSONHash);
|
|
3264
|
+
return { metadata, payload };
|
|
3265
|
+
}
|
|
3266
|
+
async function createKeyPair(options = {}) {
|
|
3267
|
+
const { extractable = false } = options;
|
|
3268
|
+
const keypair = await globalThis.crypto.subtle.generateKey({
|
|
3269
|
+
name: "ECDSA",
|
|
3270
|
+
namedCurve: "P-256"
|
|
3271
|
+
}, extractable, ["sign", "verify"]);
|
|
3272
|
+
const publicKey_raw = await globalThis.crypto.subtle.exportKey("raw", keypair.publicKey);
|
|
3273
|
+
const publicKey = from(new Uint8Array(publicKey_raw));
|
|
3274
|
+
return {
|
|
3275
|
+
privateKey: keypair.privateKey,
|
|
3276
|
+
publicKey
|
|
3277
|
+
};
|
|
3278
|
+
}
|
|
3279
|
+
async function sign(options) {
|
|
3280
|
+
const { payload, privateKey } = options;
|
|
3281
|
+
const signature = await globalThis.crypto.subtle.sign({
|
|
3282
|
+
name: "ECDSA",
|
|
3283
|
+
hash: "SHA-256"
|
|
3284
|
+
}, privateKey, from$1(payload));
|
|
3285
|
+
const signature_bytes = fromArray(new Uint8Array(signature));
|
|
3286
|
+
const r = toBigInt(slice(signature_bytes, 0, 32));
|
|
3287
|
+
let s = toBigInt(slice(signature_bytes, 32, 64));
|
|
3288
|
+
if (s > p256.CURVE.n / 2n)
|
|
3289
|
+
s = p256.CURVE.n - s;
|
|
3290
|
+
return { r, s };
|
|
3291
|
+
}
|
|
3292
|
+
export {
|
|
3293
|
+
sign as a,
|
|
3294
|
+
toHex as b,
|
|
3295
|
+
createBundlerClient as c,
|
|
3296
|
+
createKeyPair as d,
|
|
3297
|
+
toSmartAccount as e,
|
|
3298
|
+
fromHex$1 as f,
|
|
3299
|
+
getSignPayload as g,
|
|
3300
|
+
entryPoint06Address as h,
|
|
3301
|
+
entryPoint06Abi as i,
|
|
3302
|
+
getUserOperationHash as j,
|
|
3303
|
+
slice$1 as s,
|
|
3304
|
+
toHex$1 as t
|
|
3305
|
+
};
|
|
3306
|
+
//# sourceMappingURL=WebCryptoP256-C3tULCeM.js.map
|