@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,2402 @@
|
|
|
1
|
+
import { eg as parseAbiParameter$1, eh as modifiers, cE as parseStructs, cF as isStructSignature, ei as InvalidAbiParameterError, cL as getAction, df as readContract, ej as writeContract, cJ as toBytes, H as getAddress, dn as pad, aF as keccak256, a9 as slice, $ as concat, ek as toRlp, el as InvalidHexValueError, dv as hexToBytes, em as createCursor, aD as bytesToHex, T as BaseError, a2 as isHex, aE as size, en as ripemd160$1, aL as toHex, e8 as createBatchScheduler, L as withTimeout, du as TimeoutError, eo as SocketClosedError, ep as WebSocketRequestError, d7 as sliceHex, eq as validate, ad as decodeAbiParameters, er as unwrap, K as numberToHex, es as recoverAddress, et as wrap, Z as isAddressEqual, d4 as hexToNumber, eu as InvalidSerializedTransactionTypeError, ev as InvalidSerializedTransactionError, d2 as hexToBigInt, ew as assertTransactionEIP1559, ex as assertTransactionEIP2930, ey as toBlobSidecars, ez as assertTransactionEIP4844, eA as assertTransactionEIP7702, eB as assertTransactionLegacy, eC as InvalidLegacyVError, aH as isAddress, aI as InvalidAddressError, d6 as trim, eD as padHex, eE as parseUnits, eF as etherUnits, eG as gweiUnits, dj as formatTransactionRequest, dk as extract, e5 as createClient, eH as encodeDeployData, d1 as sendTransaction, eI as checksumAddress, cN as parseAccount, e6 as AccountNotFoundError, di as assertRequest, eJ as recoverAuthorizationAddress, e2 as getChainId, eK as assertCurrentChain, ds as LruMap, dU as waitForTransactionReceipt, dR as TransactionReceiptRevertedError, dW as prepareTransactionRequest, eL as defaultParameters, eM as AccountTypeNotSupportedError, d3 as getTransactionError, eN as signMessage, dV as sendRawTransaction, dZ as fillTransaction, e7 as createTransport, eO as TransactionRejectedRpcError, U as UserRejectedRequestError, eP as ExecutionRevertedError, eQ as wait, e9 as RpcRequestError, eR as AbiConstructorNotFoundError, eS as AbiConstructorParamsNotFoundError, eT as commitmentToVersionedHash, ea as secp256k1, eU as serializeTransaction, eV as AbiDecodingDataSizeInvalidError, eW as AbiDecodingDataSizeTooSmallError, dA as AbiDecodingZeroDataError, eX as AbiEncodingArrayLengthMismatchError, eY as AbiEncodingBytesSizeMismatchError, dm as AbiEncodingLengthMismatchError, ag as AbiErrorInputsNotFoundError, af as AbiErrorNotFoundError, eZ as AbiErrorSignatureNotFoundError, cH as AbiEventNotFoundError, e_ as AbiEventSignatureEmptyTopicsError, e$ as AbiEventSignatureNotFoundError, ai as AbiFunctionNotFoundError, aj as AbiFunctionOutputsNotFoundError, ac as AbiFunctionSignatureNotFoundError, f0 as AccountStateConflictError, f1 as AtomicReadyWalletRejectedUpgradeError, d0 as AtomicityNotSupportedError, f2 as BaseFeeScalarError, f3 as BlockNotFoundError, f4 as BundleTooLargeError, aK as BytesSizeMismatchError, f5 as CallExecutionError, f6 as ChainDisconnectedError, f7 as ChainDoesNotSupportContract, f8 as ChainMismatchError, f9 as ChainNotFoundError, fa as CircularReferenceError, fb as ClientChainNotConfiguredError, fc as ContractFunctionExecutionError, da as ContractFunctionRevertedError, fd as ContractFunctionZeroDataError, fe as CounterfactualDeploymentFailedError, cZ as DecodeLogDataMismatch, c_ as DecodeLogTopicsMismatch, ff as DuplicateIdError, fg as Eip1559FeesNotSupportedError, fh as EstimateGasExecutionError, fi as FeeCapTooHighError, fj as FeeCapTooLowError, fk as FeeConflictError, a1 as HttpRequestError, fl as InsufficientFundsError, fm as IntegerOutOfRangeError, fn as InternalRpcError, fo as IntrinsicGasTooHighError, fp as IntrinsicGasTooLowError, fq as InvalidAbiDecodingTypeError, fr as InvalidAbiEncodingTypeError, cG as InvalidAbiItemError, fs as InvalidAbiParametersError, ft as InvalidAbiTypeParameterError, ak as InvalidArrayError, fu as InvalidBytesBooleanError, fv as InvalidChainIdError, fw as InvalidDecimalNumberError, fx as InvalidDefinitionTypeError, fy as InvalidFunctionModifierError, fz as InvalidHexBooleanError, cW as InvalidInputRpcError, fA as InvalidModifierError, fB as InvalidParameterError, fC as InvalidParamsRpcError, fD as InvalidParenthesisError, fE as InvalidRequestRpcError, fF as InvalidSerializableTransactionError, fG as InvalidSignatureError, fH as InvalidStorageKeySizeError, fI as InvalidStructSignatureError, fJ as JsonRpcVersionUnsupportedError, fK as LimitExceededRpcError, fL as MaxFeePerGasTooLowError, fM as MethodNotFoundRpcError, fN as MethodNotSupportedRpcError, fO as NonceMaxValueError, fP as NonceTooHighError, fQ as NonceTooLowError, fR as ParseRpcError, fS as ProviderDisconnectedError, fT as ProviderRpcError$1, dB as RawContractError, fU as ResourceNotFoundRpcError, fV as ResourceUnavailableRpcError, fW as RpcError, fX as SizeExceedsPaddingSizeError, fY as SizeOverflowError, fZ as SliceOffsetOutOfBoundsError, f_ as SolidityProtectedKeywordError, f$ as StateAssignmentConflictError, I as SwitchChainError, g0 as TipAboveFeeCapError, g1 as TransactionExecutionError, g2 as TransactionNotFoundError, g3 as TransactionReceiptNotFoundError, g4 as TransactionTypeNotSupportedError, g5 as UnauthorizedProviderError, g6 as UnknownBundleIdError, dD as UnknownNodeError, g7 as UnknownRpcError, g8 as UnknownSignatureError, g9 as UnknownTypeError, ga as UnsupportedChainIdError, c$ as UnsupportedNonOptionalCapabilityError, dr as UnsupportedPackedAbiType, gb as UnsupportedProviderMethodError, gc as WaitForTransactionReceiptTimeoutError, gd as blobsToCommitments, ge as blobsToProofs, gf as boolToBytes, dp as boolToHex, gg as bytesToBigInt, gh as bytesToBool, gi as bytesToNumber, gj as bytesToRlp, gk as bytesToString, gl as commitmentsToVersionedHashes, gm as concatBytes, ah as concatHex, gn as custom, Y as decodeErrorResult, cY as decodeEventLog, cR as decodeFunctionResult, go as defineBlock, gp as defineChain, gq as defineTransaction, gr as defineTransactionReceipt, gs as defineTransactionRequest, dN as deploylessCallViaBytecodeBytecode, gt as deploylessCallViaFactoryBytecode, a0 as encodeAbiParameters, b4 as encodeFunctionData, gu as erc1155Abi, gv as erc20Abi, gw as erc20Abi_bytes32, gx as erc4626Abi, gy as erc6492SignatureValidatorAbi, gz as erc6492SignatureValidatorByteCode, gA as erc721Abi, gB as extendSchema, dz as formatBlock, gC as formatEther, gD as formatGwei, cP as formatLog, gE as formatTransaction, dQ as formatTransactionReceipt, gF as formatUnits, gG as fromBytes, gH as fromHex, ae as getAbiItem, dc as getChainContractAddress, cO as getContractError, cI as toEventSelector, gI as toSignature, aa as toFunctionSelector, gJ as getTransactionType, gK as hexToBool, gL as hexToRlp, gM as hexToString, gN as maxInt104, gO as maxInt112, gP as maxInt120, gQ as maxInt128, gR as maxInt136, gS as maxInt144, gT as maxInt152, gU as maxInt16, gV as maxInt160, gW as maxInt168, gX as maxInt176, gY as maxInt184, gZ as maxInt192, g_ as maxInt200, g$ as maxInt208, h0 as maxInt216, h1 as maxInt224, h2 as maxInt232, h3 as maxInt24, h4 as maxInt240, h5 as maxInt248, h6 as maxInt256, h7 as maxInt32, h8 as maxInt40, h9 as maxInt48, ha as maxInt56, hb as maxInt64, hc as maxInt72, hd as maxInt8, he as maxInt80, hf as maxInt88, hg as maxInt96, hh as maxUint104, hi as maxUint112, hj as maxUint120, hk as maxUint128, hl as maxUint136, hm as maxUint144, hn as maxUint152, ho as maxUint16, hp as maxUint160, hq as maxUint168, hr as maxUint176, hs as maxUint184, ht as maxUint192, hu as maxUint200, hv as maxUint208, hw as maxUint216, hx as maxUint224, hy as maxUint232, hz as maxUint24, hA as maxUint240, hB as maxUint248, hC as maxUint256, hD as maxUint32, hE as maxUint40, hF as maxUint48, hG as maxUint56, hH as maxUint64, hI as maxUint72, hJ as maxUint8, hK as maxUint80, hL as maxUint88, hM as maxUint96, hN as minInt104, hO as minInt112, hP as minInt120, hQ as minInt128, hR as minInt136, hS as minInt144, hT as minInt152, hU as minInt16, hV as minInt160, hW as minInt168, hX as minInt176, hY as minInt184, hZ as minInt192, h_ as minInt200, h$ as minInt208, i0 as minInt216, i1 as minInt224, i2 as minInt232, i3 as minInt24, i4 as minInt240, i5 as minInt248, i6 as minInt256, i7 as minInt32, i8 as minInt40, i9 as minInt48, ia as minInt56, ib as minInt64, ic as minInt72, id as minInt8, ie as minInt80, ig as minInt88, ih as minInt96, ii as multicall3Abi, ij as numberToBytes, ik as padBytes, il as parseAbi, im as parseAbiParameters, cQ as parseEventLogs, io as prepareEncodeFunctionData, ip as recoverPublicKey, iq as rpcSchema, ir as rpcTransactionType, is as serializeAccessList, it as serializeSignature, iu as setErrorConfig, iv as sha256, iw as sliceBytes, db as stringToBytes, aC as stringToHex, X as stringify, ix as toBlobs, iy as toSignatureHash, iz as transactionType, iA as weiUnits, iB as withCache, d9 as withRetry } from "./appkit-8yrMZRW-.js";
|
|
2
|
+
import { s as simulateContract, c as createContractEventFilter, g as getContractEvents, w as watchContractEvent, e as estimateContractGas, i as idCache, a as erc6492MagicBytes, b as sendCalls, d as waitForCallsStatus, f as sendRawTransactionSync, p as prepareAuthorization, h as getCallsStatus, U as UrlRequiredError, E as EnsInvalidChainIdError, B as BundleFailedError, j as EnsAvatarInvalidNftUriError, k as EnsAvatarUnsupportedNamespaceError, l as EnsAvatarUriResolutionError, F as FilterTypeNotSupportedError, W as WaitForCallsStatusTimeoutError, m as createNonceManager, n as createPublicClient, o as encodeEventTopics, q as encodePacked, r as ethAddress, t as parseSignature, u as http, v as labelhash, x as namehash, y as nonceManager, z as parseAbiItem, A as publicActions, C as serializeErc6492Signature, D as zeroAddress, G as zeroHash } from "./parseSignature-CV_ULbSZ.js";
|
|
3
|
+
import { h as hashMessage, a as hashTypedData, g as getTypesForEIP712Domain, v as validateTypedData, s as serializeTypedData, I as InvalidDomainError, b as InvalidPrimaryTypeError, c as InvalidStructTypeError, d as domainSeparator, e as hashDomain, f as hashStruct, p as presignMessagePrefix, t as toPrefixedMessage } from "./hashTypedData-CGPAwUvI.js";
|
|
4
|
+
import { d as decodeFunctionData, e as encodeErrorResult, b as encodeFunctionResult } from "./localBatchGatewayRequest-BP_oqSkW.js";
|
|
5
|
+
import { ccipRequest, offchainLookup, offchainLookupAbiItem, offchainLookupSignature } from "./ccip-CelHgeHp.js";
|
|
6
|
+
function parseAbiParameter(param) {
|
|
7
|
+
let abiParameter;
|
|
8
|
+
if (typeof param === "string")
|
|
9
|
+
abiParameter = parseAbiParameter$1(param, {
|
|
10
|
+
modifiers
|
|
11
|
+
});
|
|
12
|
+
else {
|
|
13
|
+
const structs = parseStructs(param);
|
|
14
|
+
const length = param.length;
|
|
15
|
+
for (let i = 0; i < length; i++) {
|
|
16
|
+
const signature = param[i];
|
|
17
|
+
if (isStructSignature(signature))
|
|
18
|
+
continue;
|
|
19
|
+
abiParameter = parseAbiParameter$1(signature, { modifiers, structs });
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!abiParameter)
|
|
24
|
+
throw new InvalidAbiParameterError({ param });
|
|
25
|
+
return abiParameter;
|
|
26
|
+
}
|
|
27
|
+
function getContract({ abi, address, client: client_ }) {
|
|
28
|
+
const client = client_;
|
|
29
|
+
const [publicClient, walletClient] = (() => {
|
|
30
|
+
if (!client)
|
|
31
|
+
return [void 0, void 0];
|
|
32
|
+
if ("public" in client && "wallet" in client)
|
|
33
|
+
return [client.public, client.wallet];
|
|
34
|
+
if ("public" in client)
|
|
35
|
+
return [client.public, void 0];
|
|
36
|
+
if ("wallet" in client)
|
|
37
|
+
return [void 0, client.wallet];
|
|
38
|
+
return [client, client];
|
|
39
|
+
})();
|
|
40
|
+
const hasPublicClient = publicClient !== void 0 && publicClient !== null;
|
|
41
|
+
const hasWalletClient = walletClient !== void 0 && walletClient !== null;
|
|
42
|
+
const contract = {};
|
|
43
|
+
let hasReadFunction = false;
|
|
44
|
+
let hasWriteFunction = false;
|
|
45
|
+
let hasEvent = false;
|
|
46
|
+
for (const item of abi) {
|
|
47
|
+
if (item.type === "function")
|
|
48
|
+
if (item.stateMutability === "view" || item.stateMutability === "pure")
|
|
49
|
+
hasReadFunction = true;
|
|
50
|
+
else
|
|
51
|
+
hasWriteFunction = true;
|
|
52
|
+
else if (item.type === "event")
|
|
53
|
+
hasEvent = true;
|
|
54
|
+
if (hasReadFunction && hasWriteFunction && hasEvent)
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (hasPublicClient) {
|
|
58
|
+
if (hasReadFunction)
|
|
59
|
+
contract.read = new Proxy({}, {
|
|
60
|
+
get(_, functionName) {
|
|
61
|
+
return (...parameters) => {
|
|
62
|
+
const { args, options } = getFunctionParameters(parameters);
|
|
63
|
+
return getAction(publicClient, readContract, "readContract")({
|
|
64
|
+
abi,
|
|
65
|
+
address,
|
|
66
|
+
functionName,
|
|
67
|
+
args,
|
|
68
|
+
...options
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (hasWriteFunction)
|
|
74
|
+
contract.simulate = new Proxy({}, {
|
|
75
|
+
get(_, functionName) {
|
|
76
|
+
return (...parameters) => {
|
|
77
|
+
const { args, options } = getFunctionParameters(parameters);
|
|
78
|
+
return getAction(publicClient, simulateContract, "simulateContract")({
|
|
79
|
+
abi,
|
|
80
|
+
address,
|
|
81
|
+
functionName,
|
|
82
|
+
args,
|
|
83
|
+
...options
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (hasEvent) {
|
|
89
|
+
contract.createEventFilter = new Proxy({}, {
|
|
90
|
+
get(_, eventName) {
|
|
91
|
+
return (...parameters) => {
|
|
92
|
+
const abiEvent = abi.find((x) => x.type === "event" && x.name === eventName);
|
|
93
|
+
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
94
|
+
return getAction(publicClient, createContractEventFilter, "createContractEventFilter")({
|
|
95
|
+
abi,
|
|
96
|
+
address,
|
|
97
|
+
eventName,
|
|
98
|
+
args,
|
|
99
|
+
...options
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
contract.getEvents = new Proxy({}, {
|
|
105
|
+
get(_, eventName) {
|
|
106
|
+
return (...parameters) => {
|
|
107
|
+
const abiEvent = abi.find((x) => x.type === "event" && x.name === eventName);
|
|
108
|
+
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
109
|
+
return getAction(publicClient, getContractEvents, "getContractEvents")({
|
|
110
|
+
abi,
|
|
111
|
+
address,
|
|
112
|
+
eventName,
|
|
113
|
+
args,
|
|
114
|
+
...options
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
contract.watchEvent = new Proxy({}, {
|
|
120
|
+
get(_, eventName) {
|
|
121
|
+
return (...parameters) => {
|
|
122
|
+
const abiEvent = abi.find((x) => x.type === "event" && x.name === eventName);
|
|
123
|
+
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
124
|
+
return getAction(publicClient, watchContractEvent, "watchContractEvent")({
|
|
125
|
+
abi,
|
|
126
|
+
address,
|
|
127
|
+
eventName,
|
|
128
|
+
args,
|
|
129
|
+
...options
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (hasWalletClient) {
|
|
137
|
+
if (hasWriteFunction)
|
|
138
|
+
contract.write = new Proxy({}, {
|
|
139
|
+
get(_, functionName) {
|
|
140
|
+
return (...parameters) => {
|
|
141
|
+
const { args, options } = getFunctionParameters(parameters);
|
|
142
|
+
return getAction(walletClient, writeContract, "writeContract")({
|
|
143
|
+
abi,
|
|
144
|
+
address,
|
|
145
|
+
functionName,
|
|
146
|
+
args,
|
|
147
|
+
...options
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (hasPublicClient || hasWalletClient) {
|
|
154
|
+
if (hasWriteFunction)
|
|
155
|
+
contract.estimateGas = new Proxy({}, {
|
|
156
|
+
get(_, functionName) {
|
|
157
|
+
return (...parameters) => {
|
|
158
|
+
const { args, options } = getFunctionParameters(parameters);
|
|
159
|
+
const client2 = publicClient ?? walletClient;
|
|
160
|
+
return getAction(client2, estimateContractGas, "estimateContractGas")({
|
|
161
|
+
abi,
|
|
162
|
+
address,
|
|
163
|
+
functionName,
|
|
164
|
+
args,
|
|
165
|
+
...options,
|
|
166
|
+
account: options.account ?? walletClient.account
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
contract.address = address;
|
|
173
|
+
contract.abi = abi;
|
|
174
|
+
return contract;
|
|
175
|
+
}
|
|
176
|
+
function getFunctionParameters(values) {
|
|
177
|
+
const hasArgs = values.length && Array.isArray(values[0]);
|
|
178
|
+
const args = hasArgs ? values[0] : [];
|
|
179
|
+
const options = (hasArgs ? values[1] : values[0]) ?? {};
|
|
180
|
+
return { args, options };
|
|
181
|
+
}
|
|
182
|
+
function getEventParameters(values, abiEvent) {
|
|
183
|
+
let hasArgs = false;
|
|
184
|
+
if (Array.isArray(values[0]))
|
|
185
|
+
hasArgs = true;
|
|
186
|
+
else if (values.length === 1) {
|
|
187
|
+
hasArgs = abiEvent.inputs.some((x) => x.indexed);
|
|
188
|
+
} else if (values.length === 2) {
|
|
189
|
+
hasArgs = true;
|
|
190
|
+
}
|
|
191
|
+
const args = hasArgs ? values[0] : void 0;
|
|
192
|
+
const options = (hasArgs ? values[1] : values[0]) ?? {};
|
|
193
|
+
return { args, options };
|
|
194
|
+
}
|
|
195
|
+
function isBytes(value) {
|
|
196
|
+
if (!value)
|
|
197
|
+
return false;
|
|
198
|
+
if (typeof value !== "object")
|
|
199
|
+
return false;
|
|
200
|
+
if (!("BYTES_PER_ELEMENT" in value))
|
|
201
|
+
return false;
|
|
202
|
+
return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
|
|
203
|
+
}
|
|
204
|
+
function getContractAddress(opts) {
|
|
205
|
+
if (opts.opcode === "CREATE2")
|
|
206
|
+
return getCreate2Address(opts);
|
|
207
|
+
return getCreateAddress(opts);
|
|
208
|
+
}
|
|
209
|
+
function getCreateAddress(opts) {
|
|
210
|
+
const from = toBytes(getAddress(opts.from));
|
|
211
|
+
let nonce = toBytes(opts.nonce);
|
|
212
|
+
if (nonce[0] === 0)
|
|
213
|
+
nonce = new Uint8Array([]);
|
|
214
|
+
return getAddress(`0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`);
|
|
215
|
+
}
|
|
216
|
+
function getCreate2Address(opts) {
|
|
217
|
+
const from = toBytes(getAddress(opts.from));
|
|
218
|
+
const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
|
|
219
|
+
size: 32
|
|
220
|
+
});
|
|
221
|
+
const bytecodeHash = (() => {
|
|
222
|
+
if ("bytecodeHash" in opts) {
|
|
223
|
+
if (isBytes(opts.bytecodeHash))
|
|
224
|
+
return opts.bytecodeHash;
|
|
225
|
+
return toBytes(opts.bytecodeHash);
|
|
226
|
+
}
|
|
227
|
+
return keccak256(opts.bytecode, "bytes");
|
|
228
|
+
})();
|
|
229
|
+
return getAddress(slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12));
|
|
230
|
+
}
|
|
231
|
+
function extractChain({ chains, id }) {
|
|
232
|
+
return chains.find((chain) => chain.id === id);
|
|
233
|
+
}
|
|
234
|
+
function fromRlp(value, to = "hex") {
|
|
235
|
+
const bytes = (() => {
|
|
236
|
+
if (typeof value === "string") {
|
|
237
|
+
if (value.length > 3 && value.length % 2 !== 0)
|
|
238
|
+
throw new InvalidHexValueError(value);
|
|
239
|
+
return hexToBytes(value);
|
|
240
|
+
}
|
|
241
|
+
return value;
|
|
242
|
+
})();
|
|
243
|
+
const cursor = createCursor(bytes, {
|
|
244
|
+
recursiveReadLimit: Number.POSITIVE_INFINITY
|
|
245
|
+
});
|
|
246
|
+
const result = fromRlpCursor(cursor, to);
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
function fromRlpCursor(cursor, to = "hex") {
|
|
250
|
+
if (cursor.bytes.length === 0)
|
|
251
|
+
return to === "hex" ? bytesToHex(cursor.bytes) : cursor.bytes;
|
|
252
|
+
const prefix = cursor.readByte();
|
|
253
|
+
if (prefix < 128)
|
|
254
|
+
cursor.decrementPosition(1);
|
|
255
|
+
if (prefix < 192) {
|
|
256
|
+
const length2 = readLength(cursor, prefix, 128);
|
|
257
|
+
const bytes = cursor.readBytes(length2);
|
|
258
|
+
return to === "hex" ? bytesToHex(bytes) : bytes;
|
|
259
|
+
}
|
|
260
|
+
const length = readLength(cursor, prefix, 192);
|
|
261
|
+
return readList(cursor, length, to);
|
|
262
|
+
}
|
|
263
|
+
function readLength(cursor, prefix, offset) {
|
|
264
|
+
if (offset === 128 && prefix < 128)
|
|
265
|
+
return 1;
|
|
266
|
+
if (prefix <= offset + 55)
|
|
267
|
+
return prefix - offset;
|
|
268
|
+
if (prefix === offset + 55 + 1)
|
|
269
|
+
return cursor.readUint8();
|
|
270
|
+
if (prefix === offset + 55 + 2)
|
|
271
|
+
return cursor.readUint16();
|
|
272
|
+
if (prefix === offset + 55 + 3)
|
|
273
|
+
return cursor.readUint24();
|
|
274
|
+
if (prefix === offset + 55 + 4)
|
|
275
|
+
return cursor.readUint32();
|
|
276
|
+
throw new BaseError("Invalid RLP prefix");
|
|
277
|
+
}
|
|
278
|
+
function readList(cursor, length, to) {
|
|
279
|
+
const position = cursor.position;
|
|
280
|
+
const value = [];
|
|
281
|
+
while (cursor.position - position < length)
|
|
282
|
+
value.push(fromRlpCursor(cursor, to));
|
|
283
|
+
return value;
|
|
284
|
+
}
|
|
285
|
+
function isHash(hash) {
|
|
286
|
+
return isHex(hash) && size(hash) === 32;
|
|
287
|
+
}
|
|
288
|
+
function ripemd160(value, to_) {
|
|
289
|
+
const to = to_ || "hex";
|
|
290
|
+
const bytes = ripemd160$1(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
291
|
+
if (to === "bytes")
|
|
292
|
+
return bytes;
|
|
293
|
+
return toHex(bytes);
|
|
294
|
+
}
|
|
295
|
+
const socketClientCache = /* @__PURE__ */ new Map();
|
|
296
|
+
async function getSocketRpcClient(parameters) {
|
|
297
|
+
const { getSocket: getSocket2, keepAlive = true, key = "socket", reconnect = true, url } = parameters;
|
|
298
|
+
const { interval: keepAliveInterval = 3e4 } = typeof keepAlive === "object" ? keepAlive : {};
|
|
299
|
+
const { attempts = 5, delay = 2e3 } = typeof reconnect === "object" ? reconnect : {};
|
|
300
|
+
const id = JSON.stringify({ keepAlive, key, url, reconnect });
|
|
301
|
+
let socketClient = socketClientCache.get(id);
|
|
302
|
+
if (socketClient)
|
|
303
|
+
return socketClient;
|
|
304
|
+
let reconnectCount = 0;
|
|
305
|
+
const { schedule } = createBatchScheduler({
|
|
306
|
+
id,
|
|
307
|
+
fn: async () => {
|
|
308
|
+
const requests = /* @__PURE__ */ new Map();
|
|
309
|
+
const subscriptions = /* @__PURE__ */ new Map();
|
|
310
|
+
let error;
|
|
311
|
+
let socket;
|
|
312
|
+
let keepAliveTimer;
|
|
313
|
+
let reconnectInProgress = false;
|
|
314
|
+
function attemptReconnect() {
|
|
315
|
+
if (reconnect && reconnectCount < attempts) {
|
|
316
|
+
if (reconnectInProgress)
|
|
317
|
+
return;
|
|
318
|
+
reconnectInProgress = true;
|
|
319
|
+
reconnectCount++;
|
|
320
|
+
socket == null ? void 0 : socket.close();
|
|
321
|
+
setTimeout(async () => {
|
|
322
|
+
await setup().catch(console.error);
|
|
323
|
+
reconnectInProgress = false;
|
|
324
|
+
}, delay);
|
|
325
|
+
} else {
|
|
326
|
+
requests.clear();
|
|
327
|
+
subscriptions.clear();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async function setup() {
|
|
331
|
+
const result = await getSocket2({
|
|
332
|
+
onClose() {
|
|
333
|
+
var _a, _b;
|
|
334
|
+
for (const request of requests.values())
|
|
335
|
+
(_a = request.onError) == null ? void 0 : _a.call(request, new SocketClosedError({ url }));
|
|
336
|
+
for (const subscription of subscriptions.values())
|
|
337
|
+
(_b = subscription.onError) == null ? void 0 : _b.call(subscription, new SocketClosedError({ url }));
|
|
338
|
+
attemptReconnect();
|
|
339
|
+
},
|
|
340
|
+
onError(error_) {
|
|
341
|
+
var _a, _b;
|
|
342
|
+
error = error_;
|
|
343
|
+
for (const request of requests.values())
|
|
344
|
+
(_a = request.onError) == null ? void 0 : _a.call(request, error);
|
|
345
|
+
for (const subscription of subscriptions.values())
|
|
346
|
+
(_b = subscription.onError) == null ? void 0 : _b.call(subscription, error);
|
|
347
|
+
attemptReconnect();
|
|
348
|
+
},
|
|
349
|
+
onOpen() {
|
|
350
|
+
error = void 0;
|
|
351
|
+
reconnectCount = 0;
|
|
352
|
+
},
|
|
353
|
+
onResponse(data) {
|
|
354
|
+
const isSubscription = data.method === "eth_subscription";
|
|
355
|
+
const id2 = isSubscription ? data.params.subscription : data.id;
|
|
356
|
+
const cache = isSubscription ? subscriptions : requests;
|
|
357
|
+
const callback = cache.get(id2);
|
|
358
|
+
if (callback)
|
|
359
|
+
callback.onResponse(data);
|
|
360
|
+
if (!isSubscription)
|
|
361
|
+
cache.delete(id2);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
socket = result;
|
|
365
|
+
if (keepAlive) {
|
|
366
|
+
if (keepAliveTimer)
|
|
367
|
+
clearInterval(keepAliveTimer);
|
|
368
|
+
keepAliveTimer = setInterval(() => {
|
|
369
|
+
var _a;
|
|
370
|
+
return (_a = socket.ping) == null ? void 0 : _a.call(socket);
|
|
371
|
+
}, keepAliveInterval);
|
|
372
|
+
}
|
|
373
|
+
if (reconnect && subscriptions.size > 0) {
|
|
374
|
+
const subscriptionEntries = subscriptions.entries();
|
|
375
|
+
for (const [key2, { onResponse, body, onError }] of subscriptionEntries) {
|
|
376
|
+
if (!body)
|
|
377
|
+
continue;
|
|
378
|
+
subscriptions.delete(key2);
|
|
379
|
+
socketClient == null ? void 0 : socketClient.request({ body, onResponse, onError });
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
await setup();
|
|
385
|
+
error = void 0;
|
|
386
|
+
socketClient = {
|
|
387
|
+
close() {
|
|
388
|
+
keepAliveTimer && clearInterval(keepAliveTimer);
|
|
389
|
+
socket.close();
|
|
390
|
+
socketClientCache.delete(id);
|
|
391
|
+
},
|
|
392
|
+
get socket() {
|
|
393
|
+
return socket;
|
|
394
|
+
},
|
|
395
|
+
request({ body, onError, onResponse }) {
|
|
396
|
+
var _a;
|
|
397
|
+
if (error && onError)
|
|
398
|
+
onError(error);
|
|
399
|
+
const id2 = body.id ?? idCache.take();
|
|
400
|
+
const callback = (response) => {
|
|
401
|
+
if (typeof response.id === "number" && id2 !== response.id)
|
|
402
|
+
return;
|
|
403
|
+
if (body.method === "eth_subscribe" && typeof response.result === "string")
|
|
404
|
+
subscriptions.set(response.result, {
|
|
405
|
+
onResponse: callback,
|
|
406
|
+
onError,
|
|
407
|
+
body
|
|
408
|
+
});
|
|
409
|
+
onResponse(response);
|
|
410
|
+
};
|
|
411
|
+
if (body.method === "eth_unsubscribe")
|
|
412
|
+
subscriptions.delete((_a = body.params) == null ? void 0 : _a[0]);
|
|
413
|
+
requests.set(id2, { onResponse: callback, onError });
|
|
414
|
+
try {
|
|
415
|
+
socket.request({
|
|
416
|
+
body: {
|
|
417
|
+
jsonrpc: "2.0",
|
|
418
|
+
id: id2,
|
|
419
|
+
...body
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
} catch (error2) {
|
|
423
|
+
onError == null ? void 0 : onError(error2);
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
requestAsync({ body, timeout = 1e4 }) {
|
|
427
|
+
return withTimeout(() => new Promise((onResponse, onError) => this.request({
|
|
428
|
+
body,
|
|
429
|
+
onError,
|
|
430
|
+
onResponse
|
|
431
|
+
})), {
|
|
432
|
+
errorInstance: new TimeoutError({ body, url }),
|
|
433
|
+
timeout
|
|
434
|
+
});
|
|
435
|
+
},
|
|
436
|
+
requests,
|
|
437
|
+
subscriptions,
|
|
438
|
+
url
|
|
439
|
+
};
|
|
440
|
+
socketClientCache.set(id, socketClient);
|
|
441
|
+
return [socketClient];
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
const [_, [socketClient_]] = await schedule();
|
|
445
|
+
return socketClient_;
|
|
446
|
+
}
|
|
447
|
+
async function getWebSocketRpcClient(url, options = {}) {
|
|
448
|
+
const { keepAlive, reconnect } = options;
|
|
449
|
+
return getSocketRpcClient({
|
|
450
|
+
async getSocket({ onClose, onError, onOpen, onResponse }) {
|
|
451
|
+
const WebSocket = await import("./native-CMPA4OCm.js").then((module) => module.WebSocket);
|
|
452
|
+
const socket = new WebSocket(url);
|
|
453
|
+
function onClose_() {
|
|
454
|
+
socket.removeEventListener("close", onClose_);
|
|
455
|
+
socket.removeEventListener("message", onMessage);
|
|
456
|
+
socket.removeEventListener("error", onError);
|
|
457
|
+
socket.removeEventListener("open", onOpen);
|
|
458
|
+
onClose();
|
|
459
|
+
}
|
|
460
|
+
function onMessage({ data }) {
|
|
461
|
+
if (typeof data === "string" && data.trim().length === 0)
|
|
462
|
+
return;
|
|
463
|
+
try {
|
|
464
|
+
const _data = JSON.parse(data);
|
|
465
|
+
onResponse(_data);
|
|
466
|
+
} catch (error) {
|
|
467
|
+
onError(error);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
socket.addEventListener("close", onClose_);
|
|
471
|
+
socket.addEventListener("message", onMessage);
|
|
472
|
+
socket.addEventListener("error", onError);
|
|
473
|
+
socket.addEventListener("open", onOpen);
|
|
474
|
+
if (socket.readyState === WebSocket.CONNECTING) {
|
|
475
|
+
await new Promise((resolve, reject) => {
|
|
476
|
+
if (!socket)
|
|
477
|
+
return;
|
|
478
|
+
socket.onopen = resolve;
|
|
479
|
+
socket.onerror = reject;
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
const { close: close_ } = socket;
|
|
483
|
+
return Object.assign(socket, {
|
|
484
|
+
close() {
|
|
485
|
+
close_.bind(socket)();
|
|
486
|
+
onClose_();
|
|
487
|
+
},
|
|
488
|
+
ping() {
|
|
489
|
+
try {
|
|
490
|
+
if (socket.readyState === socket.CLOSED || socket.readyState === socket.CLOSING)
|
|
491
|
+
throw new WebSocketRequestError({
|
|
492
|
+
url: socket.url,
|
|
493
|
+
cause: new SocketClosedError({ url: socket.url })
|
|
494
|
+
});
|
|
495
|
+
const body = {
|
|
496
|
+
jsonrpc: "2.0",
|
|
497
|
+
id: null,
|
|
498
|
+
method: "net_version",
|
|
499
|
+
params: []
|
|
500
|
+
};
|
|
501
|
+
socket.send(JSON.stringify(body));
|
|
502
|
+
} catch (error) {
|
|
503
|
+
onError(error);
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
request({ body }) {
|
|
507
|
+
if (socket.readyState === socket.CLOSED || socket.readyState === socket.CLOSING)
|
|
508
|
+
throw new WebSocketRequestError({
|
|
509
|
+
body,
|
|
510
|
+
url: socket.url,
|
|
511
|
+
cause: new SocketClosedError({ url: socket.url })
|
|
512
|
+
});
|
|
513
|
+
return socket.send(JSON.stringify(body));
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
keepAlive,
|
|
518
|
+
reconnect,
|
|
519
|
+
url
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
async function getSocket(url) {
|
|
523
|
+
const client = await getWebSocketRpcClient(url);
|
|
524
|
+
return Object.assign(client.socket, {
|
|
525
|
+
requests: client.requests,
|
|
526
|
+
subscriptions: client.subscriptions
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
function isErc6492Signature(signature) {
|
|
530
|
+
return sliceHex(signature, -32) === erc6492MagicBytes;
|
|
531
|
+
}
|
|
532
|
+
function isErc8010Signature(signature) {
|
|
533
|
+
return validate(signature);
|
|
534
|
+
}
|
|
535
|
+
function parseErc6492Signature(signature) {
|
|
536
|
+
if (!isErc6492Signature(signature))
|
|
537
|
+
return { signature };
|
|
538
|
+
const [address, data, signature_] = decodeAbiParameters([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], signature);
|
|
539
|
+
return { address, data, signature: signature_ };
|
|
540
|
+
}
|
|
541
|
+
function parseErc8010Signature(signature) {
|
|
542
|
+
if (!isErc8010Signature(signature))
|
|
543
|
+
return { signature };
|
|
544
|
+
const { authorization: authorization_ox, to, ...rest } = unwrap(signature);
|
|
545
|
+
return {
|
|
546
|
+
authorization: {
|
|
547
|
+
address: authorization_ox.address,
|
|
548
|
+
chainId: authorization_ox.chainId,
|
|
549
|
+
nonce: Number(authorization_ox.nonce),
|
|
550
|
+
r: numberToHex(authorization_ox.r, { size: 32 }),
|
|
551
|
+
s: numberToHex(authorization_ox.s, { size: 32 }),
|
|
552
|
+
yParity: authorization_ox.yParity
|
|
553
|
+
},
|
|
554
|
+
...to ? { address: to } : {},
|
|
555
|
+
...rest
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
async function recoverMessageAddress({ message, signature }) {
|
|
559
|
+
return recoverAddress({ hash: hashMessage(message), signature });
|
|
560
|
+
}
|
|
561
|
+
async function recoverTypedDataAddress(parameters) {
|
|
562
|
+
const { domain, message, primaryType, signature, types } = parameters;
|
|
563
|
+
return recoverAddress({
|
|
564
|
+
hash: hashTypedData({
|
|
565
|
+
domain,
|
|
566
|
+
message,
|
|
567
|
+
primaryType,
|
|
568
|
+
types
|
|
569
|
+
}),
|
|
570
|
+
signature
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
function serializeErc8010Signature(parameters) {
|
|
574
|
+
const { address, data, signature, to = "hex" } = parameters;
|
|
575
|
+
const signature_ = wrap({
|
|
576
|
+
authorization: {
|
|
577
|
+
address: parameters.authorization.address,
|
|
578
|
+
chainId: parameters.authorization.chainId,
|
|
579
|
+
nonce: BigInt(parameters.authorization.nonce),
|
|
580
|
+
r: BigInt(parameters.authorization.r),
|
|
581
|
+
s: BigInt(parameters.authorization.s),
|
|
582
|
+
yParity: parameters.authorization.yParity
|
|
583
|
+
},
|
|
584
|
+
data,
|
|
585
|
+
signature,
|
|
586
|
+
to: address
|
|
587
|
+
});
|
|
588
|
+
if (to === "hex")
|
|
589
|
+
return signature_;
|
|
590
|
+
return hexToBytes(signature_);
|
|
591
|
+
}
|
|
592
|
+
async function verifyHash({ address, hash, signature }) {
|
|
593
|
+
return isAddressEqual(getAddress(address), await recoverAddress({ hash, signature }));
|
|
594
|
+
}
|
|
595
|
+
async function verifyMessage({ address, message, signature }) {
|
|
596
|
+
return isAddressEqual(getAddress(address), await recoverMessageAddress({ message, signature }));
|
|
597
|
+
}
|
|
598
|
+
async function verifyTypedData(parameters) {
|
|
599
|
+
const { address, domain, message, primaryType, signature, types } = parameters;
|
|
600
|
+
return isAddressEqual(getAddress(address), await recoverTypedDataAddress({
|
|
601
|
+
domain,
|
|
602
|
+
message,
|
|
603
|
+
primaryType,
|
|
604
|
+
signature,
|
|
605
|
+
types
|
|
606
|
+
}));
|
|
607
|
+
}
|
|
608
|
+
function getSerializedTransactionType(serializedTransaction) {
|
|
609
|
+
const serializedType = sliceHex(serializedTransaction, 0, 1);
|
|
610
|
+
if (serializedType === "0x04")
|
|
611
|
+
return "eip7702";
|
|
612
|
+
if (serializedType === "0x03")
|
|
613
|
+
return "eip4844";
|
|
614
|
+
if (serializedType === "0x02")
|
|
615
|
+
return "eip1559";
|
|
616
|
+
if (serializedType === "0x01")
|
|
617
|
+
return "eip2930";
|
|
618
|
+
if (serializedType !== "0x" && hexToNumber(serializedType) >= 192)
|
|
619
|
+
return "legacy";
|
|
620
|
+
throw new InvalidSerializedTransactionTypeError({ serializedType });
|
|
621
|
+
}
|
|
622
|
+
function parseTransaction(serializedTransaction) {
|
|
623
|
+
const type = getSerializedTransactionType(serializedTransaction);
|
|
624
|
+
if (type === "eip1559")
|
|
625
|
+
return parseTransactionEIP1559(serializedTransaction);
|
|
626
|
+
if (type === "eip2930")
|
|
627
|
+
return parseTransactionEIP2930(serializedTransaction);
|
|
628
|
+
if (type === "eip4844")
|
|
629
|
+
return parseTransactionEIP4844(serializedTransaction);
|
|
630
|
+
if (type === "eip7702")
|
|
631
|
+
return parseTransactionEIP7702(serializedTransaction);
|
|
632
|
+
return parseTransactionLegacy(serializedTransaction);
|
|
633
|
+
}
|
|
634
|
+
function parseTransactionEIP7702(serializedTransaction) {
|
|
635
|
+
const transactionArray = toTransactionArray(serializedTransaction);
|
|
636
|
+
const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList, authorizationList, v, r, s] = transactionArray;
|
|
637
|
+
if (transactionArray.length !== 10 && transactionArray.length !== 13)
|
|
638
|
+
throw new InvalidSerializedTransactionError({
|
|
639
|
+
attributes: {
|
|
640
|
+
chainId,
|
|
641
|
+
nonce,
|
|
642
|
+
maxPriorityFeePerGas,
|
|
643
|
+
maxFeePerGas,
|
|
644
|
+
gas,
|
|
645
|
+
to,
|
|
646
|
+
value,
|
|
647
|
+
data,
|
|
648
|
+
accessList,
|
|
649
|
+
authorizationList,
|
|
650
|
+
...transactionArray.length > 9 ? {
|
|
651
|
+
v,
|
|
652
|
+
r,
|
|
653
|
+
s
|
|
654
|
+
} : {}
|
|
655
|
+
},
|
|
656
|
+
serializedTransaction,
|
|
657
|
+
type: "eip7702"
|
|
658
|
+
});
|
|
659
|
+
const transaction = {
|
|
660
|
+
chainId: hexToNumber(chainId),
|
|
661
|
+
type: "eip7702"
|
|
662
|
+
};
|
|
663
|
+
if (isHex(to) && to !== "0x")
|
|
664
|
+
transaction.to = to;
|
|
665
|
+
if (isHex(gas) && gas !== "0x")
|
|
666
|
+
transaction.gas = hexToBigInt(gas);
|
|
667
|
+
if (isHex(data) && data !== "0x")
|
|
668
|
+
transaction.data = data;
|
|
669
|
+
if (isHex(nonce))
|
|
670
|
+
transaction.nonce = nonce === "0x" ? 0 : hexToNumber(nonce);
|
|
671
|
+
if (isHex(value) && value !== "0x")
|
|
672
|
+
transaction.value = hexToBigInt(value);
|
|
673
|
+
if (isHex(maxFeePerGas) && maxFeePerGas !== "0x")
|
|
674
|
+
transaction.maxFeePerGas = hexToBigInt(maxFeePerGas);
|
|
675
|
+
if (isHex(maxPriorityFeePerGas) && maxPriorityFeePerGas !== "0x")
|
|
676
|
+
transaction.maxPriorityFeePerGas = hexToBigInt(maxPriorityFeePerGas);
|
|
677
|
+
if (accessList.length !== 0 && accessList !== "0x")
|
|
678
|
+
transaction.accessList = parseAccessList(accessList);
|
|
679
|
+
if (authorizationList.length !== 0 && authorizationList !== "0x")
|
|
680
|
+
transaction.authorizationList = parseAuthorizationList(authorizationList);
|
|
681
|
+
assertTransactionEIP7702(transaction);
|
|
682
|
+
const signature = transactionArray.length === 13 ? parseEIP155Signature(transactionArray) : void 0;
|
|
683
|
+
return { ...signature, ...transaction };
|
|
684
|
+
}
|
|
685
|
+
function parseTransactionEIP4844(serializedTransaction) {
|
|
686
|
+
const transactionOrWrapperArray = toTransactionArray(serializedTransaction);
|
|
687
|
+
const hasNetworkWrapper = transactionOrWrapperArray.length === 4;
|
|
688
|
+
const transactionArray = hasNetworkWrapper ? transactionOrWrapperArray[0] : transactionOrWrapperArray;
|
|
689
|
+
const wrapperArray = hasNetworkWrapper ? transactionOrWrapperArray.slice(1) : [];
|
|
690
|
+
const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes, v, r, s] = transactionArray;
|
|
691
|
+
const [blobs, commitments, proofs] = wrapperArray;
|
|
692
|
+
if (!(transactionArray.length === 11 || transactionArray.length === 14))
|
|
693
|
+
throw new InvalidSerializedTransactionError({
|
|
694
|
+
attributes: {
|
|
695
|
+
chainId,
|
|
696
|
+
nonce,
|
|
697
|
+
maxPriorityFeePerGas,
|
|
698
|
+
maxFeePerGas,
|
|
699
|
+
gas,
|
|
700
|
+
to,
|
|
701
|
+
value,
|
|
702
|
+
data,
|
|
703
|
+
accessList,
|
|
704
|
+
...transactionArray.length > 9 ? {
|
|
705
|
+
v,
|
|
706
|
+
r,
|
|
707
|
+
s
|
|
708
|
+
} : {}
|
|
709
|
+
},
|
|
710
|
+
serializedTransaction,
|
|
711
|
+
type: "eip4844"
|
|
712
|
+
});
|
|
713
|
+
const transaction = {
|
|
714
|
+
blobVersionedHashes,
|
|
715
|
+
chainId: hexToNumber(chainId),
|
|
716
|
+
to,
|
|
717
|
+
type: "eip4844"
|
|
718
|
+
};
|
|
719
|
+
if (isHex(gas) && gas !== "0x")
|
|
720
|
+
transaction.gas = hexToBigInt(gas);
|
|
721
|
+
if (isHex(data) && data !== "0x")
|
|
722
|
+
transaction.data = data;
|
|
723
|
+
if (isHex(nonce))
|
|
724
|
+
transaction.nonce = nonce === "0x" ? 0 : hexToNumber(nonce);
|
|
725
|
+
if (isHex(value) && value !== "0x")
|
|
726
|
+
transaction.value = hexToBigInt(value);
|
|
727
|
+
if (isHex(maxFeePerBlobGas) && maxFeePerBlobGas !== "0x")
|
|
728
|
+
transaction.maxFeePerBlobGas = hexToBigInt(maxFeePerBlobGas);
|
|
729
|
+
if (isHex(maxFeePerGas) && maxFeePerGas !== "0x")
|
|
730
|
+
transaction.maxFeePerGas = hexToBigInt(maxFeePerGas);
|
|
731
|
+
if (isHex(maxPriorityFeePerGas) && maxPriorityFeePerGas !== "0x")
|
|
732
|
+
transaction.maxPriorityFeePerGas = hexToBigInt(maxPriorityFeePerGas);
|
|
733
|
+
if (accessList.length !== 0 && accessList !== "0x")
|
|
734
|
+
transaction.accessList = parseAccessList(accessList);
|
|
735
|
+
if (blobs && commitments && proofs)
|
|
736
|
+
transaction.sidecars = toBlobSidecars({
|
|
737
|
+
blobs,
|
|
738
|
+
commitments,
|
|
739
|
+
proofs
|
|
740
|
+
});
|
|
741
|
+
assertTransactionEIP4844(transaction);
|
|
742
|
+
const signature = transactionArray.length === 14 ? parseEIP155Signature(transactionArray) : void 0;
|
|
743
|
+
return { ...signature, ...transaction };
|
|
744
|
+
}
|
|
745
|
+
function parseTransactionEIP1559(serializedTransaction) {
|
|
746
|
+
const transactionArray = toTransactionArray(serializedTransaction);
|
|
747
|
+
const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList, v, r, s] = transactionArray;
|
|
748
|
+
if (!(transactionArray.length === 9 || transactionArray.length === 12))
|
|
749
|
+
throw new InvalidSerializedTransactionError({
|
|
750
|
+
attributes: {
|
|
751
|
+
chainId,
|
|
752
|
+
nonce,
|
|
753
|
+
maxPriorityFeePerGas,
|
|
754
|
+
maxFeePerGas,
|
|
755
|
+
gas,
|
|
756
|
+
to,
|
|
757
|
+
value,
|
|
758
|
+
data,
|
|
759
|
+
accessList,
|
|
760
|
+
...transactionArray.length > 9 ? {
|
|
761
|
+
v,
|
|
762
|
+
r,
|
|
763
|
+
s
|
|
764
|
+
} : {}
|
|
765
|
+
},
|
|
766
|
+
serializedTransaction,
|
|
767
|
+
type: "eip1559"
|
|
768
|
+
});
|
|
769
|
+
const transaction = {
|
|
770
|
+
chainId: hexToNumber(chainId),
|
|
771
|
+
type: "eip1559"
|
|
772
|
+
};
|
|
773
|
+
if (isHex(to) && to !== "0x")
|
|
774
|
+
transaction.to = to;
|
|
775
|
+
if (isHex(gas) && gas !== "0x")
|
|
776
|
+
transaction.gas = hexToBigInt(gas);
|
|
777
|
+
if (isHex(data) && data !== "0x")
|
|
778
|
+
transaction.data = data;
|
|
779
|
+
if (isHex(nonce))
|
|
780
|
+
transaction.nonce = nonce === "0x" ? 0 : hexToNumber(nonce);
|
|
781
|
+
if (isHex(value) && value !== "0x")
|
|
782
|
+
transaction.value = hexToBigInt(value);
|
|
783
|
+
if (isHex(maxFeePerGas) && maxFeePerGas !== "0x")
|
|
784
|
+
transaction.maxFeePerGas = hexToBigInt(maxFeePerGas);
|
|
785
|
+
if (isHex(maxPriorityFeePerGas) && maxPriorityFeePerGas !== "0x")
|
|
786
|
+
transaction.maxPriorityFeePerGas = hexToBigInt(maxPriorityFeePerGas);
|
|
787
|
+
if (accessList.length !== 0 && accessList !== "0x")
|
|
788
|
+
transaction.accessList = parseAccessList(accessList);
|
|
789
|
+
assertTransactionEIP1559(transaction);
|
|
790
|
+
const signature = transactionArray.length === 12 ? parseEIP155Signature(transactionArray) : void 0;
|
|
791
|
+
return { ...signature, ...transaction };
|
|
792
|
+
}
|
|
793
|
+
function parseTransactionEIP2930(serializedTransaction) {
|
|
794
|
+
const transactionArray = toTransactionArray(serializedTransaction);
|
|
795
|
+
const [chainId, nonce, gasPrice, gas, to, value, data, accessList, v, r, s] = transactionArray;
|
|
796
|
+
if (!(transactionArray.length === 8 || transactionArray.length === 11))
|
|
797
|
+
throw new InvalidSerializedTransactionError({
|
|
798
|
+
attributes: {
|
|
799
|
+
chainId,
|
|
800
|
+
nonce,
|
|
801
|
+
gasPrice,
|
|
802
|
+
gas,
|
|
803
|
+
to,
|
|
804
|
+
value,
|
|
805
|
+
data,
|
|
806
|
+
accessList,
|
|
807
|
+
...transactionArray.length > 8 ? {
|
|
808
|
+
v,
|
|
809
|
+
r,
|
|
810
|
+
s
|
|
811
|
+
} : {}
|
|
812
|
+
},
|
|
813
|
+
serializedTransaction,
|
|
814
|
+
type: "eip2930"
|
|
815
|
+
});
|
|
816
|
+
const transaction = {
|
|
817
|
+
chainId: hexToNumber(chainId),
|
|
818
|
+
type: "eip2930"
|
|
819
|
+
};
|
|
820
|
+
if (isHex(to) && to !== "0x")
|
|
821
|
+
transaction.to = to;
|
|
822
|
+
if (isHex(gas) && gas !== "0x")
|
|
823
|
+
transaction.gas = hexToBigInt(gas);
|
|
824
|
+
if (isHex(data) && data !== "0x")
|
|
825
|
+
transaction.data = data;
|
|
826
|
+
if (isHex(nonce))
|
|
827
|
+
transaction.nonce = nonce === "0x" ? 0 : hexToNumber(nonce);
|
|
828
|
+
if (isHex(value) && value !== "0x")
|
|
829
|
+
transaction.value = hexToBigInt(value);
|
|
830
|
+
if (isHex(gasPrice) && gasPrice !== "0x")
|
|
831
|
+
transaction.gasPrice = hexToBigInt(gasPrice);
|
|
832
|
+
if (accessList.length !== 0 && accessList !== "0x")
|
|
833
|
+
transaction.accessList = parseAccessList(accessList);
|
|
834
|
+
assertTransactionEIP2930(transaction);
|
|
835
|
+
const signature = transactionArray.length === 11 ? parseEIP155Signature(transactionArray) : void 0;
|
|
836
|
+
return { ...signature, ...transaction };
|
|
837
|
+
}
|
|
838
|
+
function parseTransactionLegacy(serializedTransaction) {
|
|
839
|
+
const transactionArray = fromRlp(serializedTransaction, "hex");
|
|
840
|
+
const [nonce, gasPrice, gas, to, value, data, chainIdOrV_, r, s] = transactionArray;
|
|
841
|
+
if (!(transactionArray.length === 6 || transactionArray.length === 9))
|
|
842
|
+
throw new InvalidSerializedTransactionError({
|
|
843
|
+
attributes: {
|
|
844
|
+
nonce,
|
|
845
|
+
gasPrice,
|
|
846
|
+
gas,
|
|
847
|
+
to,
|
|
848
|
+
value,
|
|
849
|
+
data,
|
|
850
|
+
...transactionArray.length > 6 ? {
|
|
851
|
+
v: chainIdOrV_,
|
|
852
|
+
r,
|
|
853
|
+
s
|
|
854
|
+
} : {}
|
|
855
|
+
},
|
|
856
|
+
serializedTransaction,
|
|
857
|
+
type: "legacy"
|
|
858
|
+
});
|
|
859
|
+
const transaction = {
|
|
860
|
+
type: "legacy"
|
|
861
|
+
};
|
|
862
|
+
if (isHex(to) && to !== "0x")
|
|
863
|
+
transaction.to = to;
|
|
864
|
+
if (isHex(gas) && gas !== "0x")
|
|
865
|
+
transaction.gas = hexToBigInt(gas);
|
|
866
|
+
if (isHex(data) && data !== "0x")
|
|
867
|
+
transaction.data = data;
|
|
868
|
+
if (isHex(nonce))
|
|
869
|
+
transaction.nonce = nonce === "0x" ? 0 : hexToNumber(nonce);
|
|
870
|
+
if (isHex(value) && value !== "0x")
|
|
871
|
+
transaction.value = hexToBigInt(value);
|
|
872
|
+
if (isHex(gasPrice) && gasPrice !== "0x")
|
|
873
|
+
transaction.gasPrice = hexToBigInt(gasPrice);
|
|
874
|
+
assertTransactionLegacy(transaction);
|
|
875
|
+
if (transactionArray.length === 6)
|
|
876
|
+
return transaction;
|
|
877
|
+
const chainIdOrV = isHex(chainIdOrV_) && chainIdOrV_ !== "0x" ? hexToBigInt(chainIdOrV_) : 0n;
|
|
878
|
+
if (s === "0x" && r === "0x") {
|
|
879
|
+
if (chainIdOrV > 0)
|
|
880
|
+
transaction.chainId = Number(chainIdOrV);
|
|
881
|
+
return transaction;
|
|
882
|
+
}
|
|
883
|
+
const v = chainIdOrV;
|
|
884
|
+
const chainId = Number((v - 35n) / 2n);
|
|
885
|
+
if (chainId > 0)
|
|
886
|
+
transaction.chainId = chainId;
|
|
887
|
+
else if (v !== 27n && v !== 28n)
|
|
888
|
+
throw new InvalidLegacyVError({ v });
|
|
889
|
+
transaction.v = v;
|
|
890
|
+
transaction.s = s;
|
|
891
|
+
transaction.r = r;
|
|
892
|
+
transaction.yParity = v % 2n === 0n ? 1 : 0;
|
|
893
|
+
return transaction;
|
|
894
|
+
}
|
|
895
|
+
function toTransactionArray(serializedTransaction) {
|
|
896
|
+
return fromRlp(`0x${serializedTransaction.slice(4)}`, "hex");
|
|
897
|
+
}
|
|
898
|
+
function parseAccessList(accessList_) {
|
|
899
|
+
const accessList = [];
|
|
900
|
+
for (let i = 0; i < accessList_.length; i++) {
|
|
901
|
+
const [address, storageKeys] = accessList_[i];
|
|
902
|
+
if (!isAddress(address, { strict: false }))
|
|
903
|
+
throw new InvalidAddressError({ address });
|
|
904
|
+
accessList.push({
|
|
905
|
+
address,
|
|
906
|
+
storageKeys: storageKeys.map((key) => isHash(key) ? key : trim(key))
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
return accessList;
|
|
910
|
+
}
|
|
911
|
+
function parseAuthorizationList(serializedAuthorizationList) {
|
|
912
|
+
const authorizationList = [];
|
|
913
|
+
for (let i = 0; i < serializedAuthorizationList.length; i++) {
|
|
914
|
+
const [chainId, address, nonce, yParity, r, s] = serializedAuthorizationList[i];
|
|
915
|
+
authorizationList.push({
|
|
916
|
+
address,
|
|
917
|
+
chainId: chainId === "0x" ? 0 : hexToNumber(chainId),
|
|
918
|
+
nonce: nonce === "0x" ? 0 : hexToNumber(nonce),
|
|
919
|
+
...parseEIP155Signature([yParity, r, s])
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
return authorizationList;
|
|
923
|
+
}
|
|
924
|
+
function parseEIP155Signature(transactionArray) {
|
|
925
|
+
const signature = transactionArray.slice(-3);
|
|
926
|
+
const v = signature[0] === "0x" || hexToBigInt(signature[0]) === 0n ? 27n : 28n;
|
|
927
|
+
return {
|
|
928
|
+
r: padHex(signature[1], { size: 32 }),
|
|
929
|
+
s: padHex(signature[2], { size: 32 }),
|
|
930
|
+
v,
|
|
931
|
+
yParity: v === 27n ? 0 : 1
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
function parseEther(ether, unit = "wei") {
|
|
935
|
+
return parseUnits(ether, etherUnits[unit]);
|
|
936
|
+
}
|
|
937
|
+
function parseGwei(ether, unit = "wei") {
|
|
938
|
+
return parseUnits(ether, gweiUnits[unit]);
|
|
939
|
+
}
|
|
940
|
+
async function dropTransaction(client, { hash }) {
|
|
941
|
+
await client.request({
|
|
942
|
+
method: `${client.mode}_dropTransaction`,
|
|
943
|
+
params: [hash]
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
async function dumpState(client) {
|
|
947
|
+
return client.request({
|
|
948
|
+
method: `${client.mode}_dumpState`
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
async function getAutomine(client) {
|
|
952
|
+
if (client.mode === "ganache")
|
|
953
|
+
return await client.request({
|
|
954
|
+
method: "eth_mining"
|
|
955
|
+
});
|
|
956
|
+
return await client.request({
|
|
957
|
+
method: `${client.mode}_getAutomine`
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
async function getTxpoolContent(client) {
|
|
961
|
+
return await client.request({
|
|
962
|
+
method: "txpool_content"
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
async function getTxpoolStatus(client) {
|
|
966
|
+
const { pending, queued } = await client.request({
|
|
967
|
+
method: "txpool_status"
|
|
968
|
+
});
|
|
969
|
+
return {
|
|
970
|
+
pending: hexToNumber(pending),
|
|
971
|
+
queued: hexToNumber(queued)
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
async function impersonateAccount(client, { address }) {
|
|
975
|
+
await client.request({
|
|
976
|
+
method: `${client.mode}_impersonateAccount`,
|
|
977
|
+
params: [address]
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
async function increaseTime(client, { seconds }) {
|
|
981
|
+
return await client.request({
|
|
982
|
+
method: "evm_increaseTime",
|
|
983
|
+
params: [numberToHex(seconds)]
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
async function inspectTxpool(client) {
|
|
987
|
+
return await client.request({
|
|
988
|
+
method: "txpool_inspect"
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
async function loadState(client, { state }) {
|
|
992
|
+
await client.request({
|
|
993
|
+
method: `${client.mode}_loadState`,
|
|
994
|
+
params: [state]
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
async function mine(client, { blocks, interval }) {
|
|
998
|
+
if (client.mode === "ganache")
|
|
999
|
+
await client.request({
|
|
1000
|
+
method: "evm_mine",
|
|
1001
|
+
params: [{ blocks: numberToHex(blocks) }]
|
|
1002
|
+
});
|
|
1003
|
+
else
|
|
1004
|
+
await client.request({
|
|
1005
|
+
method: `${client.mode}_mine`,
|
|
1006
|
+
params: [numberToHex(blocks), numberToHex(interval || 0)]
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
async function removeBlockTimestampInterval(client) {
|
|
1010
|
+
await client.request({
|
|
1011
|
+
method: `${client.mode}_removeBlockTimestampInterval`
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
async function reset(client, { blockNumber, jsonRpcUrl } = {}) {
|
|
1015
|
+
await client.request({
|
|
1016
|
+
method: `${client.mode}_reset`,
|
|
1017
|
+
params: [{ forking: { blockNumber: Number(blockNumber), jsonRpcUrl } }]
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
async function revert(client, { id }) {
|
|
1021
|
+
await client.request({
|
|
1022
|
+
method: "evm_revert",
|
|
1023
|
+
params: [id]
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
async function sendUnsignedTransaction(client, args) {
|
|
1027
|
+
var _a, _b, _c;
|
|
1028
|
+
const { accessList, data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest } = args;
|
|
1029
|
+
const chainFormat = (_c = (_b = (_a = client.chain) == null ? void 0 : _a.formatters) == null ? void 0 : _b.transactionRequest) == null ? void 0 : _c.format;
|
|
1030
|
+
const format = chainFormat || formatTransactionRequest;
|
|
1031
|
+
const request = format({
|
|
1032
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
1033
|
+
...extract(rest, { format: chainFormat }),
|
|
1034
|
+
accessList,
|
|
1035
|
+
data,
|
|
1036
|
+
from,
|
|
1037
|
+
gas,
|
|
1038
|
+
gasPrice,
|
|
1039
|
+
maxFeePerGas,
|
|
1040
|
+
maxPriorityFeePerGas,
|
|
1041
|
+
nonce,
|
|
1042
|
+
to,
|
|
1043
|
+
value
|
|
1044
|
+
}, "sendUnsignedTransaction");
|
|
1045
|
+
const hash = await client.request({
|
|
1046
|
+
method: "eth_sendUnsignedTransaction",
|
|
1047
|
+
params: [request]
|
|
1048
|
+
});
|
|
1049
|
+
return hash;
|
|
1050
|
+
}
|
|
1051
|
+
async function setAutomine(client, enabled) {
|
|
1052
|
+
if (client.mode === "ganache") {
|
|
1053
|
+
if (enabled)
|
|
1054
|
+
await client.request({ method: "miner_start" });
|
|
1055
|
+
else
|
|
1056
|
+
await client.request({ method: "miner_stop" });
|
|
1057
|
+
} else
|
|
1058
|
+
await client.request({
|
|
1059
|
+
method: "evm_setAutomine",
|
|
1060
|
+
params: [enabled]
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
async function setBalance(client, { address, value }) {
|
|
1064
|
+
if (client.mode === "ganache")
|
|
1065
|
+
await client.request({
|
|
1066
|
+
method: "evm_setAccountBalance",
|
|
1067
|
+
params: [address, numberToHex(value)]
|
|
1068
|
+
});
|
|
1069
|
+
else
|
|
1070
|
+
await client.request({
|
|
1071
|
+
method: `${client.mode}_setBalance`,
|
|
1072
|
+
params: [address, numberToHex(value)]
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
async function setBlockGasLimit(client, { gasLimit }) {
|
|
1076
|
+
await client.request({
|
|
1077
|
+
method: "evm_setBlockGasLimit",
|
|
1078
|
+
params: [numberToHex(gasLimit)]
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
async function setBlockTimestampInterval(client, { interval }) {
|
|
1082
|
+
const interval_ = (() => {
|
|
1083
|
+
if (client.mode === "hardhat")
|
|
1084
|
+
return interval * 1e3;
|
|
1085
|
+
return interval;
|
|
1086
|
+
})();
|
|
1087
|
+
await client.request({
|
|
1088
|
+
method: `${client.mode}_setBlockTimestampInterval`,
|
|
1089
|
+
params: [interval_]
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
async function setCode(client, { address, bytecode }) {
|
|
1093
|
+
if (client.mode === "ganache")
|
|
1094
|
+
await client.request({
|
|
1095
|
+
method: "evm_setAccountCode",
|
|
1096
|
+
params: [address, bytecode]
|
|
1097
|
+
});
|
|
1098
|
+
else
|
|
1099
|
+
await client.request({
|
|
1100
|
+
method: `${client.mode}_setCode`,
|
|
1101
|
+
params: [address, bytecode]
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
async function setCoinbase(client, { address }) {
|
|
1105
|
+
await client.request({
|
|
1106
|
+
method: `${client.mode}_setCoinbase`,
|
|
1107
|
+
params: [address]
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
async function setIntervalMining(client, { interval }) {
|
|
1111
|
+
const interval_ = (() => {
|
|
1112
|
+
if (client.mode === "hardhat")
|
|
1113
|
+
return interval * 1e3;
|
|
1114
|
+
return interval;
|
|
1115
|
+
})();
|
|
1116
|
+
await client.request({
|
|
1117
|
+
method: "evm_setIntervalMining",
|
|
1118
|
+
params: [interval_]
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
async function setLoggingEnabled(client, enabled) {
|
|
1122
|
+
await client.request({
|
|
1123
|
+
method: `${client.mode}_setLoggingEnabled`,
|
|
1124
|
+
params: [enabled]
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
async function setMinGasPrice(client, { gasPrice }) {
|
|
1128
|
+
await client.request({
|
|
1129
|
+
method: `${client.mode}_setMinGasPrice`,
|
|
1130
|
+
params: [numberToHex(gasPrice)]
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
async function setNextBlockBaseFeePerGas(client, { baseFeePerGas }) {
|
|
1134
|
+
await client.request({
|
|
1135
|
+
method: `${client.mode}_setNextBlockBaseFeePerGas`,
|
|
1136
|
+
params: [numberToHex(baseFeePerGas)]
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
async function setNextBlockTimestamp(client, { timestamp }) {
|
|
1140
|
+
await client.request({
|
|
1141
|
+
method: "evm_setNextBlockTimestamp",
|
|
1142
|
+
params: [numberToHex(timestamp)]
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
async function setNonce(client, { address, nonce }) {
|
|
1146
|
+
await client.request({
|
|
1147
|
+
method: `${client.mode}_setNonce`,
|
|
1148
|
+
params: [address, numberToHex(nonce)]
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
async function setRpcUrl(client, jsonRpcUrl) {
|
|
1152
|
+
await client.request({
|
|
1153
|
+
method: `${client.mode}_setRpcUrl`,
|
|
1154
|
+
params: [jsonRpcUrl]
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
async function setStorageAt(client, { address, index, value }) {
|
|
1158
|
+
await client.request({
|
|
1159
|
+
method: `${client.mode}_setStorageAt`,
|
|
1160
|
+
params: [
|
|
1161
|
+
address,
|
|
1162
|
+
typeof index === "number" ? numberToHex(index) : index,
|
|
1163
|
+
value
|
|
1164
|
+
]
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
async function snapshot(client) {
|
|
1168
|
+
return await client.request({
|
|
1169
|
+
method: "evm_snapshot"
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
async function stopImpersonatingAccount(client, { address }) {
|
|
1173
|
+
await client.request({
|
|
1174
|
+
method: `${client.mode}_stopImpersonatingAccount`,
|
|
1175
|
+
params: [address]
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function testActions({ mode }) {
|
|
1179
|
+
return (client_) => {
|
|
1180
|
+
const client = client_.extend(() => ({
|
|
1181
|
+
mode
|
|
1182
|
+
}));
|
|
1183
|
+
return {
|
|
1184
|
+
dropTransaction: (args) => dropTransaction(client, args),
|
|
1185
|
+
dumpState: () => dumpState(client),
|
|
1186
|
+
getAutomine: () => getAutomine(client),
|
|
1187
|
+
getTxpoolContent: () => getTxpoolContent(client),
|
|
1188
|
+
getTxpoolStatus: () => getTxpoolStatus(client),
|
|
1189
|
+
impersonateAccount: (args) => impersonateAccount(client, args),
|
|
1190
|
+
increaseTime: (args) => increaseTime(client, args),
|
|
1191
|
+
inspectTxpool: () => inspectTxpool(client),
|
|
1192
|
+
loadState: (args) => loadState(client, args),
|
|
1193
|
+
mine: (args) => mine(client, args),
|
|
1194
|
+
removeBlockTimestampInterval: () => removeBlockTimestampInterval(client),
|
|
1195
|
+
reset: (args) => reset(client, args),
|
|
1196
|
+
revert: (args) => revert(client, args),
|
|
1197
|
+
sendUnsignedTransaction: (args) => sendUnsignedTransaction(client, args),
|
|
1198
|
+
setAutomine: (args) => setAutomine(client, args),
|
|
1199
|
+
setBalance: (args) => setBalance(client, args),
|
|
1200
|
+
setBlockGasLimit: (args) => setBlockGasLimit(client, args),
|
|
1201
|
+
setBlockTimestampInterval: (args) => setBlockTimestampInterval(client, args),
|
|
1202
|
+
setCode: (args) => setCode(client, args),
|
|
1203
|
+
setCoinbase: (args) => setCoinbase(client, args),
|
|
1204
|
+
setIntervalMining: (args) => setIntervalMining(client, args),
|
|
1205
|
+
setLoggingEnabled: (args) => setLoggingEnabled(client, args),
|
|
1206
|
+
setMinGasPrice: (args) => setMinGasPrice(client, args),
|
|
1207
|
+
setNextBlockBaseFeePerGas: (args) => setNextBlockBaseFeePerGas(client, args),
|
|
1208
|
+
setNextBlockTimestamp: (args) => setNextBlockTimestamp(client, args),
|
|
1209
|
+
setNonce: (args) => setNonce(client, args),
|
|
1210
|
+
setRpcUrl: (args) => setRpcUrl(client, args),
|
|
1211
|
+
setStorageAt: (args) => setStorageAt(client, args),
|
|
1212
|
+
snapshot: () => snapshot(client),
|
|
1213
|
+
stopImpersonatingAccount: (args) => stopImpersonatingAccount(client, args)
|
|
1214
|
+
};
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function createTestClient(parameters) {
|
|
1218
|
+
const { key = "test", name = "Test Client", mode } = parameters;
|
|
1219
|
+
const client = createClient({
|
|
1220
|
+
...parameters,
|
|
1221
|
+
key,
|
|
1222
|
+
name,
|
|
1223
|
+
type: "testClient"
|
|
1224
|
+
});
|
|
1225
|
+
return client.extend((config) => ({
|
|
1226
|
+
mode,
|
|
1227
|
+
...testActions({ mode })(config)
|
|
1228
|
+
}));
|
|
1229
|
+
}
|
|
1230
|
+
async function addChain(client, { chain }) {
|
|
1231
|
+
const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain;
|
|
1232
|
+
await client.request({
|
|
1233
|
+
method: "wallet_addEthereumChain",
|
|
1234
|
+
params: [
|
|
1235
|
+
{
|
|
1236
|
+
chainId: numberToHex(id),
|
|
1237
|
+
chainName: name,
|
|
1238
|
+
nativeCurrency,
|
|
1239
|
+
rpcUrls: rpcUrls.default.http,
|
|
1240
|
+
blockExplorerUrls: blockExplorers ? Object.values(blockExplorers).map(({ url }) => url) : void 0
|
|
1241
|
+
}
|
|
1242
|
+
]
|
|
1243
|
+
}, { dedupe: true, retryCount: 0 });
|
|
1244
|
+
}
|
|
1245
|
+
function deployContract(walletClient, parameters) {
|
|
1246
|
+
const { abi, args, bytecode, ...request } = parameters;
|
|
1247
|
+
const calldata = encodeDeployData({ abi, args, bytecode });
|
|
1248
|
+
return sendTransaction(walletClient, {
|
|
1249
|
+
...request,
|
|
1250
|
+
...request.authorizationList ? { to: null } : {},
|
|
1251
|
+
data: calldata
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
async function getAddresses(client) {
|
|
1255
|
+
var _a;
|
|
1256
|
+
if (((_a = client.account) == null ? void 0 : _a.type) === "local")
|
|
1257
|
+
return [client.account.address];
|
|
1258
|
+
const addresses = await client.request({ method: "eth_accounts" }, { dedupe: true });
|
|
1259
|
+
return addresses.map((address) => checksumAddress(address));
|
|
1260
|
+
}
|
|
1261
|
+
async function getCapabilities(client, parameters = {}) {
|
|
1262
|
+
const { account = client.account, chainId } = parameters;
|
|
1263
|
+
const account_ = account ? parseAccount(account) : void 0;
|
|
1264
|
+
const params = chainId ? [account_ == null ? void 0 : account_.address, [numberToHex(chainId)]] : [account_ == null ? void 0 : account_.address];
|
|
1265
|
+
const capabilities_raw = await client.request({
|
|
1266
|
+
method: "wallet_getCapabilities",
|
|
1267
|
+
params
|
|
1268
|
+
});
|
|
1269
|
+
const capabilities = {};
|
|
1270
|
+
for (const [chainId2, capabilities_] of Object.entries(capabilities_raw)) {
|
|
1271
|
+
capabilities[Number(chainId2)] = {};
|
|
1272
|
+
for (let [key, value] of Object.entries(capabilities_)) {
|
|
1273
|
+
if (key === "addSubAccount")
|
|
1274
|
+
key = "unstable_addSubAccount";
|
|
1275
|
+
capabilities[Number(chainId2)][key] = value;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return typeof chainId === "number" ? capabilities[chainId] : capabilities;
|
|
1279
|
+
}
|
|
1280
|
+
async function getPermissions(client) {
|
|
1281
|
+
const permissions = await client.request({ method: "wallet_getPermissions" }, { dedupe: true });
|
|
1282
|
+
return permissions;
|
|
1283
|
+
}
|
|
1284
|
+
async function requestAddresses(client) {
|
|
1285
|
+
const addresses = await client.request({ method: "eth_requestAccounts" }, { dedupe: true, retryCount: 0 });
|
|
1286
|
+
return addresses.map((address) => getAddress(address));
|
|
1287
|
+
}
|
|
1288
|
+
async function requestPermissions(client, permissions) {
|
|
1289
|
+
return client.request({
|
|
1290
|
+
method: "wallet_requestPermissions",
|
|
1291
|
+
params: [permissions]
|
|
1292
|
+
}, { retryCount: 0 });
|
|
1293
|
+
}
|
|
1294
|
+
async function sendCallsSync(client, parameters) {
|
|
1295
|
+
const { chain = client.chain } = parameters;
|
|
1296
|
+
const timeout = parameters.timeout ?? Math.max(((chain == null ? void 0 : chain.blockTime) ?? 0) * 3, 5e3);
|
|
1297
|
+
const result = await sendCalls(client, parameters);
|
|
1298
|
+
const status = await waitForCallsStatus(client, {
|
|
1299
|
+
...parameters,
|
|
1300
|
+
id: result.id,
|
|
1301
|
+
timeout
|
|
1302
|
+
});
|
|
1303
|
+
return status;
|
|
1304
|
+
}
|
|
1305
|
+
const supportsWalletNamespace = new LruMap(128);
|
|
1306
|
+
async function sendTransactionSync(client, parameters) {
|
|
1307
|
+
var _a, _b, _c, _d;
|
|
1308
|
+
const { account: account_ = client.account, chain = client.chain, accessList, authorizationList, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, pollingInterval, throwOnReceiptRevert, type, value, ...rest } = parameters;
|
|
1309
|
+
const timeout = parameters.timeout ?? Math.max(((chain == null ? void 0 : chain.blockTime) ?? 0) * 3, 5e3);
|
|
1310
|
+
if (typeof account_ === "undefined")
|
|
1311
|
+
throw new AccountNotFoundError({
|
|
1312
|
+
docsPath: "/docs/actions/wallet/sendTransactionSync"
|
|
1313
|
+
});
|
|
1314
|
+
const account = account_ ? parseAccount(account_) : null;
|
|
1315
|
+
try {
|
|
1316
|
+
assertRequest(parameters);
|
|
1317
|
+
const to = await (async () => {
|
|
1318
|
+
if (parameters.to)
|
|
1319
|
+
return parameters.to;
|
|
1320
|
+
if (parameters.to === null)
|
|
1321
|
+
return void 0;
|
|
1322
|
+
if (authorizationList && authorizationList.length > 0)
|
|
1323
|
+
return await recoverAuthorizationAddress({
|
|
1324
|
+
authorization: authorizationList[0]
|
|
1325
|
+
}).catch(() => {
|
|
1326
|
+
throw new BaseError("`to` is required. Could not infer from `authorizationList`.");
|
|
1327
|
+
});
|
|
1328
|
+
return void 0;
|
|
1329
|
+
})();
|
|
1330
|
+
if ((account == null ? void 0 : account.type) === "json-rpc" || account === null) {
|
|
1331
|
+
let chainId;
|
|
1332
|
+
if (chain !== null) {
|
|
1333
|
+
chainId = await getAction(client, getChainId, "getChainId")({});
|
|
1334
|
+
assertCurrentChain({
|
|
1335
|
+
currentChainId: chainId,
|
|
1336
|
+
chain
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
const chainFormat = (_c = (_b = (_a = client.chain) == null ? void 0 : _a.formatters) == null ? void 0 : _b.transactionRequest) == null ? void 0 : _c.format;
|
|
1340
|
+
const format = chainFormat || formatTransactionRequest;
|
|
1341
|
+
const request = format({
|
|
1342
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
1343
|
+
...extract(rest, { format: chainFormat }),
|
|
1344
|
+
accessList,
|
|
1345
|
+
account,
|
|
1346
|
+
authorizationList,
|
|
1347
|
+
blobs,
|
|
1348
|
+
chainId,
|
|
1349
|
+
data,
|
|
1350
|
+
gas,
|
|
1351
|
+
gasPrice,
|
|
1352
|
+
maxFeePerBlobGas,
|
|
1353
|
+
maxFeePerGas,
|
|
1354
|
+
maxPriorityFeePerGas,
|
|
1355
|
+
nonce,
|
|
1356
|
+
to,
|
|
1357
|
+
type,
|
|
1358
|
+
value
|
|
1359
|
+
}, "sendTransaction");
|
|
1360
|
+
const isWalletNamespaceSupported = supportsWalletNamespace.get(client.uid);
|
|
1361
|
+
const method = isWalletNamespaceSupported ? "wallet_sendTransaction" : "eth_sendTransaction";
|
|
1362
|
+
const hash = await (async () => {
|
|
1363
|
+
try {
|
|
1364
|
+
return await client.request({
|
|
1365
|
+
method,
|
|
1366
|
+
params: [request]
|
|
1367
|
+
}, { retryCount: 0 });
|
|
1368
|
+
} catch (e) {
|
|
1369
|
+
if (isWalletNamespaceSupported === false)
|
|
1370
|
+
throw e;
|
|
1371
|
+
const error = e;
|
|
1372
|
+
if (error.name === "InvalidInputRpcError" || error.name === "InvalidParamsRpcError" || error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError") {
|
|
1373
|
+
return await client.request({
|
|
1374
|
+
method: "wallet_sendTransaction",
|
|
1375
|
+
params: [request]
|
|
1376
|
+
}, { retryCount: 0 }).then((hash2) => {
|
|
1377
|
+
supportsWalletNamespace.set(client.uid, true);
|
|
1378
|
+
return hash2;
|
|
1379
|
+
}).catch((e2) => {
|
|
1380
|
+
const walletNamespaceError = e2;
|
|
1381
|
+
if (walletNamespaceError.name === "MethodNotFoundRpcError" || walletNamespaceError.name === "MethodNotSupportedRpcError") {
|
|
1382
|
+
supportsWalletNamespace.set(client.uid, false);
|
|
1383
|
+
throw error;
|
|
1384
|
+
}
|
|
1385
|
+
throw walletNamespaceError;
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
throw error;
|
|
1389
|
+
}
|
|
1390
|
+
})();
|
|
1391
|
+
const receipt = await getAction(client, waitForTransactionReceipt, "waitForTransactionReceipt")({
|
|
1392
|
+
checkReplacement: false,
|
|
1393
|
+
hash,
|
|
1394
|
+
pollingInterval,
|
|
1395
|
+
timeout
|
|
1396
|
+
});
|
|
1397
|
+
if (throwOnReceiptRevert && receipt.status === "reverted")
|
|
1398
|
+
throw new TransactionReceiptRevertedError({ receipt });
|
|
1399
|
+
return receipt;
|
|
1400
|
+
}
|
|
1401
|
+
if ((account == null ? void 0 : account.type) === "local") {
|
|
1402
|
+
const request = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
|
|
1403
|
+
account,
|
|
1404
|
+
accessList,
|
|
1405
|
+
authorizationList,
|
|
1406
|
+
blobs,
|
|
1407
|
+
chain,
|
|
1408
|
+
data,
|
|
1409
|
+
gas,
|
|
1410
|
+
gasPrice,
|
|
1411
|
+
maxFeePerBlobGas,
|
|
1412
|
+
maxFeePerGas,
|
|
1413
|
+
maxPriorityFeePerGas,
|
|
1414
|
+
nonce,
|
|
1415
|
+
nonceManager: account.nonceManager,
|
|
1416
|
+
parameters: [...defaultParameters, "sidecars"],
|
|
1417
|
+
type,
|
|
1418
|
+
value,
|
|
1419
|
+
...rest,
|
|
1420
|
+
to
|
|
1421
|
+
});
|
|
1422
|
+
const serializer = (_d = chain == null ? void 0 : chain.serializers) == null ? void 0 : _d.transaction;
|
|
1423
|
+
const serializedTransaction = await account.signTransaction(request, {
|
|
1424
|
+
serializer
|
|
1425
|
+
});
|
|
1426
|
+
return await getAction(client, sendRawTransactionSync, "sendRawTransactionSync")({
|
|
1427
|
+
serializedTransaction,
|
|
1428
|
+
throwOnReceiptRevert
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
if ((account == null ? void 0 : account.type) === "smart")
|
|
1432
|
+
throw new AccountTypeNotSupportedError({
|
|
1433
|
+
metaMessages: [
|
|
1434
|
+
"Consider using the `sendUserOperation` Action instead."
|
|
1435
|
+
],
|
|
1436
|
+
docsPath: "/docs/actions/bundler/sendUserOperation",
|
|
1437
|
+
type: "smart"
|
|
1438
|
+
});
|
|
1439
|
+
throw new AccountTypeNotSupportedError({
|
|
1440
|
+
docsPath: "/docs/actions/wallet/sendTransactionSync",
|
|
1441
|
+
type: account == null ? void 0 : account.type
|
|
1442
|
+
});
|
|
1443
|
+
} catch (err) {
|
|
1444
|
+
if (err instanceof AccountTypeNotSupportedError)
|
|
1445
|
+
throw err;
|
|
1446
|
+
throw getTransactionError(err, {
|
|
1447
|
+
...parameters,
|
|
1448
|
+
account,
|
|
1449
|
+
chain: parameters.chain || void 0
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
async function showCallsStatus(client, parameters) {
|
|
1454
|
+
const { id } = parameters;
|
|
1455
|
+
await client.request({
|
|
1456
|
+
method: "wallet_showCallsStatus",
|
|
1457
|
+
params: [id]
|
|
1458
|
+
});
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
async function signAuthorization(client, parameters) {
|
|
1462
|
+
const { account: account_ = client.account } = parameters;
|
|
1463
|
+
if (!account_)
|
|
1464
|
+
throw new AccountNotFoundError({
|
|
1465
|
+
docsPath: "/docs/eip7702/signAuthorization"
|
|
1466
|
+
});
|
|
1467
|
+
const account = parseAccount(account_);
|
|
1468
|
+
if (!account.signAuthorization)
|
|
1469
|
+
throw new AccountTypeNotSupportedError({
|
|
1470
|
+
docsPath: "/docs/eip7702/signAuthorization",
|
|
1471
|
+
metaMessages: [
|
|
1472
|
+
"The `signAuthorization` Action does not support JSON-RPC Accounts."
|
|
1473
|
+
],
|
|
1474
|
+
type: account.type
|
|
1475
|
+
});
|
|
1476
|
+
const authorization = await prepareAuthorization(client, parameters);
|
|
1477
|
+
return account.signAuthorization(authorization);
|
|
1478
|
+
}
|
|
1479
|
+
async function signTransaction(client, parameters) {
|
|
1480
|
+
var _a, _b, _c, _d;
|
|
1481
|
+
const { account: account_ = client.account, chain = client.chain, ...transaction } = parameters;
|
|
1482
|
+
if (!account_)
|
|
1483
|
+
throw new AccountNotFoundError({
|
|
1484
|
+
docsPath: "/docs/actions/wallet/signTransaction"
|
|
1485
|
+
});
|
|
1486
|
+
const account = parseAccount(account_);
|
|
1487
|
+
assertRequest({
|
|
1488
|
+
account,
|
|
1489
|
+
...parameters
|
|
1490
|
+
});
|
|
1491
|
+
const chainId = await getAction(client, getChainId, "getChainId")({});
|
|
1492
|
+
if (chain !== null)
|
|
1493
|
+
assertCurrentChain({
|
|
1494
|
+
currentChainId: chainId,
|
|
1495
|
+
chain
|
|
1496
|
+
});
|
|
1497
|
+
const formatters = (chain == null ? void 0 : chain.formatters) || ((_a = client.chain) == null ? void 0 : _a.formatters);
|
|
1498
|
+
const format = ((_b = formatters == null ? void 0 : formatters.transactionRequest) == null ? void 0 : _b.format) || formatTransactionRequest;
|
|
1499
|
+
if (account.signTransaction)
|
|
1500
|
+
return account.signTransaction({
|
|
1501
|
+
...transaction,
|
|
1502
|
+
chainId
|
|
1503
|
+
}, { serializer: (_d = (_c = client.chain) == null ? void 0 : _c.serializers) == null ? void 0 : _d.transaction });
|
|
1504
|
+
return await client.request({
|
|
1505
|
+
method: "eth_signTransaction",
|
|
1506
|
+
params: [
|
|
1507
|
+
{
|
|
1508
|
+
...format({
|
|
1509
|
+
...transaction,
|
|
1510
|
+
account
|
|
1511
|
+
}, "signTransaction"),
|
|
1512
|
+
chainId: numberToHex(chainId),
|
|
1513
|
+
from: account.address
|
|
1514
|
+
}
|
|
1515
|
+
]
|
|
1516
|
+
}, { retryCount: 0 });
|
|
1517
|
+
}
|
|
1518
|
+
async function signTypedData(client, parameters) {
|
|
1519
|
+
const { account: account_ = client.account, domain, message, primaryType } = parameters;
|
|
1520
|
+
if (!account_)
|
|
1521
|
+
throw new AccountNotFoundError({
|
|
1522
|
+
docsPath: "/docs/actions/wallet/signTypedData"
|
|
1523
|
+
});
|
|
1524
|
+
const account = parseAccount(account_);
|
|
1525
|
+
const types = {
|
|
1526
|
+
EIP712Domain: getTypesForEIP712Domain({ domain }),
|
|
1527
|
+
...parameters.types
|
|
1528
|
+
};
|
|
1529
|
+
validateTypedData({ domain, message, primaryType, types });
|
|
1530
|
+
if (account.signTypedData)
|
|
1531
|
+
return account.signTypedData({ domain, message, primaryType, types });
|
|
1532
|
+
const typedData = serializeTypedData({ domain, message, primaryType, types });
|
|
1533
|
+
return client.request({
|
|
1534
|
+
method: "eth_signTypedData_v4",
|
|
1535
|
+
params: [account.address, typedData]
|
|
1536
|
+
}, { retryCount: 0 });
|
|
1537
|
+
}
|
|
1538
|
+
async function switchChain(client, { id }) {
|
|
1539
|
+
await client.request({
|
|
1540
|
+
method: "wallet_switchEthereumChain",
|
|
1541
|
+
params: [
|
|
1542
|
+
{
|
|
1543
|
+
chainId: numberToHex(id)
|
|
1544
|
+
}
|
|
1545
|
+
]
|
|
1546
|
+
}, { retryCount: 0 });
|
|
1547
|
+
}
|
|
1548
|
+
async function watchAsset(client, params) {
|
|
1549
|
+
const added = await client.request({
|
|
1550
|
+
method: "wallet_watchAsset",
|
|
1551
|
+
params
|
|
1552
|
+
}, { retryCount: 0 });
|
|
1553
|
+
return added;
|
|
1554
|
+
}
|
|
1555
|
+
async function writeContractSync(client, parameters) {
|
|
1556
|
+
return writeContract.internal(client, sendTransactionSync, "sendTransactionSync", parameters);
|
|
1557
|
+
}
|
|
1558
|
+
function walletActions(client) {
|
|
1559
|
+
return {
|
|
1560
|
+
addChain: (args) => addChain(client, args),
|
|
1561
|
+
deployContract: (args) => deployContract(client, args),
|
|
1562
|
+
fillTransaction: (args) => fillTransaction(client, args),
|
|
1563
|
+
getAddresses: () => getAddresses(client),
|
|
1564
|
+
getCallsStatus: (args) => getCallsStatus(client, args),
|
|
1565
|
+
getCapabilities: (args) => getCapabilities(client, args),
|
|
1566
|
+
getChainId: () => getChainId(client),
|
|
1567
|
+
getPermissions: () => getPermissions(client),
|
|
1568
|
+
prepareAuthorization: (args) => prepareAuthorization(client, args),
|
|
1569
|
+
prepareTransactionRequest: (args) => prepareTransactionRequest(client, args),
|
|
1570
|
+
requestAddresses: () => requestAddresses(client),
|
|
1571
|
+
requestPermissions: (args) => requestPermissions(client, args),
|
|
1572
|
+
sendCalls: (args) => sendCalls(client, args),
|
|
1573
|
+
sendCallsSync: (args) => sendCallsSync(client, args),
|
|
1574
|
+
sendRawTransaction: (args) => sendRawTransaction(client, args),
|
|
1575
|
+
sendRawTransactionSync: (args) => sendRawTransactionSync(client, args),
|
|
1576
|
+
sendTransaction: (args) => sendTransaction(client, args),
|
|
1577
|
+
sendTransactionSync: (args) => sendTransactionSync(client, args),
|
|
1578
|
+
showCallsStatus: (args) => showCallsStatus(client, args),
|
|
1579
|
+
signAuthorization: (args) => signAuthorization(client, args),
|
|
1580
|
+
signMessage: (args) => signMessage(client, args),
|
|
1581
|
+
signTransaction: (args) => signTransaction(client, args),
|
|
1582
|
+
signTypedData: (args) => signTypedData(client, args),
|
|
1583
|
+
switchChain: (args) => switchChain(client, args),
|
|
1584
|
+
waitForCallsStatus: (args) => waitForCallsStatus(client, args),
|
|
1585
|
+
watchAsset: (args) => watchAsset(client, args),
|
|
1586
|
+
writeContract: (args) => writeContract(client, args),
|
|
1587
|
+
writeContractSync: (args) => writeContractSync(client, args)
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
function createWalletClient(parameters) {
|
|
1591
|
+
const { key = "wallet", name = "Wallet Client", transport } = parameters;
|
|
1592
|
+
const client = createClient({
|
|
1593
|
+
...parameters,
|
|
1594
|
+
key,
|
|
1595
|
+
name,
|
|
1596
|
+
transport,
|
|
1597
|
+
type: "walletClient"
|
|
1598
|
+
});
|
|
1599
|
+
return client.extend(walletActions);
|
|
1600
|
+
}
|
|
1601
|
+
function fallback(transports_, config = {}) {
|
|
1602
|
+
const { key = "fallback", name = "Fallback", rank = false, shouldThrow: shouldThrow_ = shouldThrow, retryCount, retryDelay } = config;
|
|
1603
|
+
return (({ chain, pollingInterval = 4e3, timeout, ...rest }) => {
|
|
1604
|
+
let transports = transports_;
|
|
1605
|
+
let onResponse = () => {
|
|
1606
|
+
};
|
|
1607
|
+
const transport = createTransport({
|
|
1608
|
+
key,
|
|
1609
|
+
name,
|
|
1610
|
+
async request({ method, params }) {
|
|
1611
|
+
let includes;
|
|
1612
|
+
const fetch = async (i = 0) => {
|
|
1613
|
+
const transport2 = transports[i]({
|
|
1614
|
+
...rest,
|
|
1615
|
+
chain,
|
|
1616
|
+
retryCount: 0,
|
|
1617
|
+
timeout
|
|
1618
|
+
});
|
|
1619
|
+
try {
|
|
1620
|
+
const response = await transport2.request({
|
|
1621
|
+
method,
|
|
1622
|
+
params
|
|
1623
|
+
});
|
|
1624
|
+
onResponse({
|
|
1625
|
+
method,
|
|
1626
|
+
params,
|
|
1627
|
+
response,
|
|
1628
|
+
transport: transport2,
|
|
1629
|
+
status: "success"
|
|
1630
|
+
});
|
|
1631
|
+
return response;
|
|
1632
|
+
} catch (err) {
|
|
1633
|
+
onResponse({
|
|
1634
|
+
error: err,
|
|
1635
|
+
method,
|
|
1636
|
+
params,
|
|
1637
|
+
transport: transport2,
|
|
1638
|
+
status: "error"
|
|
1639
|
+
});
|
|
1640
|
+
if (shouldThrow_(err))
|
|
1641
|
+
throw err;
|
|
1642
|
+
if (i === transports.length - 1)
|
|
1643
|
+
throw err;
|
|
1644
|
+
includes ?? (includes = transports.slice(i + 1).some((transport3) => {
|
|
1645
|
+
const { include, exclude } = transport3({ chain }).config.methods || {};
|
|
1646
|
+
if (include)
|
|
1647
|
+
return include.includes(method);
|
|
1648
|
+
if (exclude)
|
|
1649
|
+
return !exclude.includes(method);
|
|
1650
|
+
return true;
|
|
1651
|
+
}));
|
|
1652
|
+
if (!includes)
|
|
1653
|
+
throw err;
|
|
1654
|
+
return fetch(i + 1);
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
return fetch();
|
|
1658
|
+
},
|
|
1659
|
+
retryCount,
|
|
1660
|
+
retryDelay,
|
|
1661
|
+
type: "fallback"
|
|
1662
|
+
}, {
|
|
1663
|
+
onResponse: (fn) => onResponse = fn,
|
|
1664
|
+
transports: transports.map((fn) => fn({ chain, retryCount: 0 }))
|
|
1665
|
+
});
|
|
1666
|
+
if (rank) {
|
|
1667
|
+
const rankOptions = typeof rank === "object" ? rank : {};
|
|
1668
|
+
rankTransports({
|
|
1669
|
+
chain,
|
|
1670
|
+
interval: rankOptions.interval ?? pollingInterval,
|
|
1671
|
+
onTransports: (transports_2) => transports = transports_2,
|
|
1672
|
+
ping: rankOptions.ping,
|
|
1673
|
+
sampleCount: rankOptions.sampleCount,
|
|
1674
|
+
timeout: rankOptions.timeout,
|
|
1675
|
+
transports,
|
|
1676
|
+
weights: rankOptions.weights
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
return transport;
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
function shouldThrow(error) {
|
|
1683
|
+
if ("code" in error && typeof error.code === "number") {
|
|
1684
|
+
if (error.code === TransactionRejectedRpcError.code || error.code === UserRejectedRequestError.code || ExecutionRevertedError.nodeMessage.test(error.message) || error.code === 5e3)
|
|
1685
|
+
return true;
|
|
1686
|
+
}
|
|
1687
|
+
return false;
|
|
1688
|
+
}
|
|
1689
|
+
function rankTransports({ chain, interval = 4e3, onTransports, ping, sampleCount = 10, timeout = 1e3, transports, weights = {} }) {
|
|
1690
|
+
const { stability: stabilityWeight = 0.7, latency: latencyWeight = 0.3 } = weights;
|
|
1691
|
+
const samples = [];
|
|
1692
|
+
const rankTransports_ = async () => {
|
|
1693
|
+
const sample = await Promise.all(transports.map(async (transport) => {
|
|
1694
|
+
const transport_ = transport({ chain, retryCount: 0, timeout });
|
|
1695
|
+
const start = Date.now();
|
|
1696
|
+
let end;
|
|
1697
|
+
let success;
|
|
1698
|
+
try {
|
|
1699
|
+
await (ping ? ping({ transport: transport_ }) : transport_.request({ method: "net_listening" }));
|
|
1700
|
+
success = 1;
|
|
1701
|
+
} catch {
|
|
1702
|
+
success = 0;
|
|
1703
|
+
} finally {
|
|
1704
|
+
end = Date.now();
|
|
1705
|
+
}
|
|
1706
|
+
const latency = end - start;
|
|
1707
|
+
return { latency, success };
|
|
1708
|
+
}));
|
|
1709
|
+
samples.push(sample);
|
|
1710
|
+
if (samples.length > sampleCount)
|
|
1711
|
+
samples.shift();
|
|
1712
|
+
const maxLatency = Math.max(...samples.map((sample2) => Math.max(...sample2.map(({ latency }) => latency))));
|
|
1713
|
+
const scores = transports.map((_, i) => {
|
|
1714
|
+
const latencies = samples.map((sample2) => sample2[i].latency);
|
|
1715
|
+
const meanLatency = latencies.reduce((acc, latency) => acc + latency, 0) / latencies.length;
|
|
1716
|
+
const latencyScore = 1 - meanLatency / maxLatency;
|
|
1717
|
+
const successes = samples.map((sample2) => sample2[i].success);
|
|
1718
|
+
const stabilityScore = successes.reduce((acc, success) => acc + success, 0) / successes.length;
|
|
1719
|
+
if (stabilityScore === 0)
|
|
1720
|
+
return [0, i];
|
|
1721
|
+
return [
|
|
1722
|
+
latencyWeight * latencyScore + stabilityWeight * stabilityScore,
|
|
1723
|
+
i
|
|
1724
|
+
];
|
|
1725
|
+
}).sort((a, b) => b[0] - a[0]);
|
|
1726
|
+
onTransports(scores.map(([, i]) => transports[i]));
|
|
1727
|
+
await wait(interval);
|
|
1728
|
+
rankTransports_();
|
|
1729
|
+
};
|
|
1730
|
+
rankTransports_();
|
|
1731
|
+
}
|
|
1732
|
+
function webSocket(url, config = {}) {
|
|
1733
|
+
const { keepAlive, key = "webSocket", methods, name = "WebSocket JSON-RPC", reconnect, retryDelay } = config;
|
|
1734
|
+
return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {
|
|
1735
|
+
var _a;
|
|
1736
|
+
const retryCount = config.retryCount ?? retryCount_;
|
|
1737
|
+
const timeout = timeout_ ?? config.timeout ?? 1e4;
|
|
1738
|
+
const url_ = url || ((_a = chain == null ? void 0 : chain.rpcUrls.default.webSocket) == null ? void 0 : _a[0]);
|
|
1739
|
+
const wsRpcClientOpts = { keepAlive, reconnect };
|
|
1740
|
+
if (!url_)
|
|
1741
|
+
throw new UrlRequiredError();
|
|
1742
|
+
return createTransport({
|
|
1743
|
+
key,
|
|
1744
|
+
methods,
|
|
1745
|
+
name,
|
|
1746
|
+
async request({ method, params }) {
|
|
1747
|
+
const body = { method, params };
|
|
1748
|
+
const rpcClient = await getWebSocketRpcClient(url_, wsRpcClientOpts);
|
|
1749
|
+
const { error, result } = await rpcClient.requestAsync({
|
|
1750
|
+
body,
|
|
1751
|
+
timeout
|
|
1752
|
+
});
|
|
1753
|
+
if (error)
|
|
1754
|
+
throw new RpcRequestError({
|
|
1755
|
+
body,
|
|
1756
|
+
error,
|
|
1757
|
+
url: url_
|
|
1758
|
+
});
|
|
1759
|
+
return result;
|
|
1760
|
+
},
|
|
1761
|
+
retryCount,
|
|
1762
|
+
retryDelay,
|
|
1763
|
+
timeout,
|
|
1764
|
+
type: "webSocket"
|
|
1765
|
+
}, {
|
|
1766
|
+
getSocket() {
|
|
1767
|
+
return getSocket(url_);
|
|
1768
|
+
},
|
|
1769
|
+
getRpcClient() {
|
|
1770
|
+
return getWebSocketRpcClient(url_, wsRpcClientOpts);
|
|
1771
|
+
},
|
|
1772
|
+
async subscribe({ params, onData, onError }) {
|
|
1773
|
+
const rpcClient = await getWebSocketRpcClient(url_, wsRpcClientOpts);
|
|
1774
|
+
const { result: subscriptionId } = await new Promise((resolve, reject) => rpcClient.request({
|
|
1775
|
+
body: {
|
|
1776
|
+
method: "eth_subscribe",
|
|
1777
|
+
params
|
|
1778
|
+
},
|
|
1779
|
+
onError(error) {
|
|
1780
|
+
reject(error);
|
|
1781
|
+
onError == null ? void 0 : onError(error);
|
|
1782
|
+
return;
|
|
1783
|
+
},
|
|
1784
|
+
onResponse(response) {
|
|
1785
|
+
if (response.error) {
|
|
1786
|
+
reject(response.error);
|
|
1787
|
+
onError == null ? void 0 : onError(response.error);
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
if (typeof response.id === "number") {
|
|
1791
|
+
resolve(response);
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
if (response.method !== "eth_subscription")
|
|
1795
|
+
return;
|
|
1796
|
+
onData(response.params);
|
|
1797
|
+
}
|
|
1798
|
+
}));
|
|
1799
|
+
return {
|
|
1800
|
+
subscriptionId,
|
|
1801
|
+
async unsubscribe() {
|
|
1802
|
+
return new Promise((resolve) => rpcClient.request({
|
|
1803
|
+
body: {
|
|
1804
|
+
method: "eth_unsubscribe",
|
|
1805
|
+
params: [subscriptionId]
|
|
1806
|
+
},
|
|
1807
|
+
onResponse: resolve
|
|
1808
|
+
}));
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
class ProviderRpcError extends Error {
|
|
1816
|
+
constructor(code, message) {
|
|
1817
|
+
super(message);
|
|
1818
|
+
Object.defineProperty(this, "code", {
|
|
1819
|
+
enumerable: true,
|
|
1820
|
+
configurable: true,
|
|
1821
|
+
writable: true,
|
|
1822
|
+
value: void 0
|
|
1823
|
+
});
|
|
1824
|
+
Object.defineProperty(this, "details", {
|
|
1825
|
+
enumerable: true,
|
|
1826
|
+
configurable: true,
|
|
1827
|
+
writable: true,
|
|
1828
|
+
value: void 0
|
|
1829
|
+
});
|
|
1830
|
+
this.code = code;
|
|
1831
|
+
this.details = message;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
const docsPath = "/docs/contract/decodeDeployData";
|
|
1835
|
+
function decodeDeployData(parameters) {
|
|
1836
|
+
const { abi, bytecode, data } = parameters;
|
|
1837
|
+
if (data === bytecode)
|
|
1838
|
+
return { bytecode };
|
|
1839
|
+
const description = abi.find((x) => "type" in x && x.type === "constructor");
|
|
1840
|
+
if (!description)
|
|
1841
|
+
throw new AbiConstructorNotFoundError({ docsPath });
|
|
1842
|
+
if (!("inputs" in description))
|
|
1843
|
+
throw new AbiConstructorParamsNotFoundError({ docsPath });
|
|
1844
|
+
if (!description.inputs || description.inputs.length === 0)
|
|
1845
|
+
throw new AbiConstructorParamsNotFoundError({ docsPath });
|
|
1846
|
+
const args = decodeAbiParameters(description.inputs, `0x${data.replace(bytecode, "")}`);
|
|
1847
|
+
return { args, bytecode };
|
|
1848
|
+
}
|
|
1849
|
+
function fromBlobs(parameters) {
|
|
1850
|
+
const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
|
|
1851
|
+
const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
|
|
1852
|
+
const length = blobs.reduce((length2, blob) => length2 + blob.length, 0);
|
|
1853
|
+
const data = createCursor(new Uint8Array(length));
|
|
1854
|
+
let active = true;
|
|
1855
|
+
for (const blob of blobs) {
|
|
1856
|
+
const cursor = createCursor(blob);
|
|
1857
|
+
while (active && cursor.position < blob.length) {
|
|
1858
|
+
cursor.incrementPosition(1);
|
|
1859
|
+
let consume = 31;
|
|
1860
|
+
if (blob.length - cursor.position < 31)
|
|
1861
|
+
consume = blob.length - cursor.position;
|
|
1862
|
+
for (const _ in Array.from({ length: consume })) {
|
|
1863
|
+
const byte = cursor.readByte();
|
|
1864
|
+
const isTerminator = byte === 128 && !cursor.inspectBytes(cursor.remaining).includes(128);
|
|
1865
|
+
if (isTerminator) {
|
|
1866
|
+
active = false;
|
|
1867
|
+
break;
|
|
1868
|
+
}
|
|
1869
|
+
data.pushByte(byte);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
const trimmedData = data.bytes.slice(0, data.position);
|
|
1874
|
+
return to === "hex" ? bytesToHex(trimmedData) : trimmedData;
|
|
1875
|
+
}
|
|
1876
|
+
function sidecarsToVersionedHashes(parameters) {
|
|
1877
|
+
const { sidecars, version } = parameters;
|
|
1878
|
+
const to = parameters.to ?? (typeof sidecars[0].blob === "string" ? "hex" : "bytes");
|
|
1879
|
+
const hashes = [];
|
|
1880
|
+
for (const { commitment } of sidecars) {
|
|
1881
|
+
hashes.push(commitmentToVersionedHash({
|
|
1882
|
+
commitment,
|
|
1883
|
+
to,
|
|
1884
|
+
version
|
|
1885
|
+
}));
|
|
1886
|
+
}
|
|
1887
|
+
return hashes;
|
|
1888
|
+
}
|
|
1889
|
+
const SLIP44_MSB = 2147483648;
|
|
1890
|
+
function toCoinType(chainId) {
|
|
1891
|
+
if (chainId === 1)
|
|
1892
|
+
return 60n;
|
|
1893
|
+
if (chainId >= SLIP44_MSB || chainId < 0)
|
|
1894
|
+
throw new EnsInvalidChainIdError({ chainId });
|
|
1895
|
+
return BigInt((2147483648 | chainId) >>> 0);
|
|
1896
|
+
}
|
|
1897
|
+
function defineKzg({ blobToKzgCommitment, computeBlobKzgProof }) {
|
|
1898
|
+
return {
|
|
1899
|
+
blobToKzgCommitment,
|
|
1900
|
+
computeBlobKzgProof
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
function setupKzg(parameters, path) {
|
|
1904
|
+
try {
|
|
1905
|
+
parameters.loadTrustedSetup(path);
|
|
1906
|
+
} catch (e) {
|
|
1907
|
+
const error = e;
|
|
1908
|
+
if (!error.message.includes("trusted setup is already loaded"))
|
|
1909
|
+
throw error;
|
|
1910
|
+
}
|
|
1911
|
+
return defineKzg(parameters);
|
|
1912
|
+
}
|
|
1913
|
+
function compactSignatureToSignature({ r, yParityAndS }) {
|
|
1914
|
+
const yParityAndS_bytes = hexToBytes(yParityAndS);
|
|
1915
|
+
const yParity = yParityAndS_bytes[0] & 128 ? 1 : 0;
|
|
1916
|
+
const s = yParityAndS_bytes;
|
|
1917
|
+
if (yParity === 1)
|
|
1918
|
+
s[0] &= 127;
|
|
1919
|
+
return { r, s: bytesToHex(s), yParity };
|
|
1920
|
+
}
|
|
1921
|
+
function parseCompactSignature(signatureHex) {
|
|
1922
|
+
const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));
|
|
1923
|
+
return {
|
|
1924
|
+
r: numberToHex(r, { size: 32 }),
|
|
1925
|
+
yParityAndS: numberToHex(s, { size: 32 })
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
async function recoverTransactionAddress(parameters) {
|
|
1929
|
+
const { serializedTransaction, signature: signature_ } = parameters;
|
|
1930
|
+
const transaction = parseTransaction(serializedTransaction);
|
|
1931
|
+
const signature = signature_ ?? {
|
|
1932
|
+
r: transaction.r,
|
|
1933
|
+
s: transaction.s,
|
|
1934
|
+
v: transaction.v,
|
|
1935
|
+
yParity: transaction.yParity
|
|
1936
|
+
};
|
|
1937
|
+
const serialized = serializeTransaction({
|
|
1938
|
+
...transaction,
|
|
1939
|
+
r: void 0,
|
|
1940
|
+
s: void 0,
|
|
1941
|
+
v: void 0,
|
|
1942
|
+
yParity: void 0,
|
|
1943
|
+
sidecars: void 0
|
|
1944
|
+
});
|
|
1945
|
+
return await recoverAddress({
|
|
1946
|
+
hash: keccak256(serialized),
|
|
1947
|
+
signature
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
function serializeCompactSignature({ r, yParityAndS }) {
|
|
1951
|
+
return `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(yParityAndS)).toCompactHex()}`;
|
|
1952
|
+
}
|
|
1953
|
+
function signatureToCompactSignature(signature) {
|
|
1954
|
+
const { r, s, v, yParity } = signature;
|
|
1955
|
+
const yParity_ = Number(yParity ?? v - 27n);
|
|
1956
|
+
let yParityAndS = s;
|
|
1957
|
+
if (yParity_ === 1) {
|
|
1958
|
+
const bytes = hexToBytes(s);
|
|
1959
|
+
bytes[0] |= 128;
|
|
1960
|
+
yParityAndS = bytesToHex(bytes);
|
|
1961
|
+
}
|
|
1962
|
+
return { r, yParityAndS };
|
|
1963
|
+
}
|
|
1964
|
+
const _esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1965
|
+
__proto__: null,
|
|
1966
|
+
AbiConstructorNotFoundError,
|
|
1967
|
+
AbiConstructorParamsNotFoundError,
|
|
1968
|
+
AbiDecodingDataSizeInvalidError,
|
|
1969
|
+
AbiDecodingDataSizeTooSmallError,
|
|
1970
|
+
AbiDecodingZeroDataError,
|
|
1971
|
+
AbiEncodingArrayLengthMismatchError,
|
|
1972
|
+
AbiEncodingBytesSizeMismatchError,
|
|
1973
|
+
AbiEncodingLengthMismatchError,
|
|
1974
|
+
AbiErrorInputsNotFoundError,
|
|
1975
|
+
AbiErrorNotFoundError,
|
|
1976
|
+
AbiErrorSignatureNotFoundError,
|
|
1977
|
+
AbiEventNotFoundError,
|
|
1978
|
+
AbiEventSignatureEmptyTopicsError,
|
|
1979
|
+
AbiEventSignatureNotFoundError,
|
|
1980
|
+
AbiFunctionNotFoundError,
|
|
1981
|
+
AbiFunctionOutputsNotFoundError,
|
|
1982
|
+
AbiFunctionSignatureNotFoundError,
|
|
1983
|
+
AccountStateConflictError,
|
|
1984
|
+
AtomicReadyWalletRejectedUpgradeError,
|
|
1985
|
+
AtomicityNotSupportedError,
|
|
1986
|
+
BaseError,
|
|
1987
|
+
BaseFeeScalarError,
|
|
1988
|
+
BlockNotFoundError,
|
|
1989
|
+
BundleFailedError,
|
|
1990
|
+
BundleTooLargeError,
|
|
1991
|
+
BytesSizeMismatchError,
|
|
1992
|
+
CallExecutionError,
|
|
1993
|
+
ChainDisconnectedError,
|
|
1994
|
+
ChainDoesNotSupportContract,
|
|
1995
|
+
ChainMismatchError,
|
|
1996
|
+
ChainNotFoundError,
|
|
1997
|
+
CircularReferenceError,
|
|
1998
|
+
ClientChainNotConfiguredError,
|
|
1999
|
+
ContractFunctionExecutionError,
|
|
2000
|
+
ContractFunctionRevertedError,
|
|
2001
|
+
ContractFunctionZeroDataError,
|
|
2002
|
+
CounterfactualDeploymentFailedError,
|
|
2003
|
+
DecodeLogDataMismatch,
|
|
2004
|
+
DecodeLogTopicsMismatch,
|
|
2005
|
+
DuplicateIdError,
|
|
2006
|
+
EIP1193ProviderRpcError: ProviderRpcError,
|
|
2007
|
+
Eip1559FeesNotSupportedError,
|
|
2008
|
+
EnsAvatarInvalidNftUriError,
|
|
2009
|
+
EnsAvatarUnsupportedNamespaceError,
|
|
2010
|
+
EnsAvatarUriResolutionError,
|
|
2011
|
+
EnsInvalidChainIdError,
|
|
2012
|
+
EstimateGasExecutionError,
|
|
2013
|
+
ExecutionRevertedError,
|
|
2014
|
+
FeeCapTooHighError,
|
|
2015
|
+
FeeCapTooLowError,
|
|
2016
|
+
FeeConflictError,
|
|
2017
|
+
FilterTypeNotSupportedError,
|
|
2018
|
+
HttpRequestError,
|
|
2019
|
+
InsufficientFundsError,
|
|
2020
|
+
IntegerOutOfRangeError,
|
|
2021
|
+
InternalRpcError,
|
|
2022
|
+
IntrinsicGasTooHighError,
|
|
2023
|
+
IntrinsicGasTooLowError,
|
|
2024
|
+
InvalidAbiDecodingTypeError,
|
|
2025
|
+
InvalidAbiEncodingTypeError,
|
|
2026
|
+
InvalidAbiItemError,
|
|
2027
|
+
InvalidAbiParameterError,
|
|
2028
|
+
InvalidAbiParametersError,
|
|
2029
|
+
InvalidAbiTypeParameterError,
|
|
2030
|
+
InvalidAddressError,
|
|
2031
|
+
InvalidArrayError,
|
|
2032
|
+
InvalidBytesBooleanError,
|
|
2033
|
+
InvalidChainIdError,
|
|
2034
|
+
InvalidDecimalNumberError,
|
|
2035
|
+
InvalidDefinitionTypeError,
|
|
2036
|
+
InvalidDomainError,
|
|
2037
|
+
InvalidFunctionModifierError,
|
|
2038
|
+
InvalidHexBooleanError,
|
|
2039
|
+
InvalidHexValueError,
|
|
2040
|
+
InvalidInputRpcError,
|
|
2041
|
+
InvalidLegacyVError,
|
|
2042
|
+
InvalidModifierError,
|
|
2043
|
+
InvalidParameterError,
|
|
2044
|
+
InvalidParamsRpcError,
|
|
2045
|
+
InvalidParenthesisError,
|
|
2046
|
+
InvalidPrimaryTypeError,
|
|
2047
|
+
InvalidRequestRpcError,
|
|
2048
|
+
InvalidSerializableTransactionError,
|
|
2049
|
+
InvalidSerializedTransactionError,
|
|
2050
|
+
InvalidSerializedTransactionTypeError,
|
|
2051
|
+
InvalidSignatureError,
|
|
2052
|
+
InvalidStorageKeySizeError,
|
|
2053
|
+
InvalidStructSignatureError,
|
|
2054
|
+
InvalidStructTypeError,
|
|
2055
|
+
JsonRpcVersionUnsupportedError,
|
|
2056
|
+
LimitExceededRpcError,
|
|
2057
|
+
MaxFeePerGasTooLowError,
|
|
2058
|
+
MethodNotFoundRpcError,
|
|
2059
|
+
MethodNotSupportedRpcError,
|
|
2060
|
+
NonceMaxValueError,
|
|
2061
|
+
NonceTooHighError,
|
|
2062
|
+
NonceTooLowError,
|
|
2063
|
+
ParseRpcError,
|
|
2064
|
+
ProviderDisconnectedError,
|
|
2065
|
+
ProviderRpcError: ProviderRpcError$1,
|
|
2066
|
+
RawContractError,
|
|
2067
|
+
ResourceNotFoundRpcError,
|
|
2068
|
+
ResourceUnavailableRpcError,
|
|
2069
|
+
RpcError,
|
|
2070
|
+
RpcRequestError,
|
|
2071
|
+
SizeExceedsPaddingSizeError,
|
|
2072
|
+
SizeOverflowError,
|
|
2073
|
+
SliceOffsetOutOfBoundsError,
|
|
2074
|
+
SocketClosedError,
|
|
2075
|
+
SolidityProtectedKeywordError,
|
|
2076
|
+
StateAssignmentConflictError,
|
|
2077
|
+
SwitchChainError,
|
|
2078
|
+
TimeoutError,
|
|
2079
|
+
TipAboveFeeCapError,
|
|
2080
|
+
TransactionExecutionError,
|
|
2081
|
+
TransactionNotFoundError,
|
|
2082
|
+
TransactionReceiptNotFoundError,
|
|
2083
|
+
TransactionRejectedRpcError,
|
|
2084
|
+
TransactionTypeNotSupportedError,
|
|
2085
|
+
UnauthorizedProviderError,
|
|
2086
|
+
UnknownBundleIdError,
|
|
2087
|
+
UnknownNodeError,
|
|
2088
|
+
UnknownRpcError,
|
|
2089
|
+
UnknownSignatureError,
|
|
2090
|
+
UnknownTypeError,
|
|
2091
|
+
UnsupportedChainIdError,
|
|
2092
|
+
UnsupportedNonOptionalCapabilityError,
|
|
2093
|
+
UnsupportedPackedAbiType,
|
|
2094
|
+
UnsupportedProviderMethodError,
|
|
2095
|
+
UrlRequiredError,
|
|
2096
|
+
UserRejectedRequestError,
|
|
2097
|
+
WaitForCallsStatusTimeoutError,
|
|
2098
|
+
WaitForTransactionReceiptTimeoutError,
|
|
2099
|
+
WebSocketRequestError,
|
|
2100
|
+
assertCurrentChain,
|
|
2101
|
+
assertRequest,
|
|
2102
|
+
assertTransactionEIP1559,
|
|
2103
|
+
assertTransactionEIP2930,
|
|
2104
|
+
assertTransactionLegacy,
|
|
2105
|
+
blobsToCommitments,
|
|
2106
|
+
blobsToProofs,
|
|
2107
|
+
boolToBytes,
|
|
2108
|
+
boolToHex,
|
|
2109
|
+
bytesToBigInt,
|
|
2110
|
+
bytesToBool,
|
|
2111
|
+
bytesToHex,
|
|
2112
|
+
bytesToNumber,
|
|
2113
|
+
bytesToRlp,
|
|
2114
|
+
bytesToString,
|
|
2115
|
+
ccipFetch: ccipRequest,
|
|
2116
|
+
ccipRequest,
|
|
2117
|
+
checksumAddress,
|
|
2118
|
+
commitmentToVersionedHash,
|
|
2119
|
+
commitmentsToVersionedHashes,
|
|
2120
|
+
compactSignatureToHex: serializeCompactSignature,
|
|
2121
|
+
compactSignatureToSignature,
|
|
2122
|
+
concat,
|
|
2123
|
+
concatBytes,
|
|
2124
|
+
concatHex,
|
|
2125
|
+
createClient,
|
|
2126
|
+
createNonceManager,
|
|
2127
|
+
createPublicClient,
|
|
2128
|
+
createTestClient,
|
|
2129
|
+
createTransport,
|
|
2130
|
+
createWalletClient,
|
|
2131
|
+
custom,
|
|
2132
|
+
decodeAbiParameters,
|
|
2133
|
+
decodeDeployData,
|
|
2134
|
+
decodeErrorResult,
|
|
2135
|
+
decodeEventLog,
|
|
2136
|
+
decodeFunctionData,
|
|
2137
|
+
decodeFunctionResult,
|
|
2138
|
+
defineBlock,
|
|
2139
|
+
defineChain,
|
|
2140
|
+
defineKzg,
|
|
2141
|
+
defineTransaction,
|
|
2142
|
+
defineTransactionReceipt,
|
|
2143
|
+
defineTransactionRequest,
|
|
2144
|
+
deploylessCallViaBytecodeBytecode,
|
|
2145
|
+
deploylessCallViaFactoryBytecode,
|
|
2146
|
+
domainSeparator,
|
|
2147
|
+
encodeAbiParameters,
|
|
2148
|
+
encodeDeployData,
|
|
2149
|
+
encodeErrorResult,
|
|
2150
|
+
encodeEventTopics,
|
|
2151
|
+
encodeFunctionData,
|
|
2152
|
+
encodeFunctionResult,
|
|
2153
|
+
encodePacked,
|
|
2154
|
+
erc1155Abi,
|
|
2155
|
+
erc20Abi,
|
|
2156
|
+
erc20Abi_bytes32,
|
|
2157
|
+
erc4626Abi,
|
|
2158
|
+
erc6492SignatureValidatorAbi,
|
|
2159
|
+
erc6492SignatureValidatorByteCode,
|
|
2160
|
+
erc721Abi,
|
|
2161
|
+
ethAddress,
|
|
2162
|
+
etherUnits,
|
|
2163
|
+
extendSchema,
|
|
2164
|
+
extractChain,
|
|
2165
|
+
fallback,
|
|
2166
|
+
formatBlock,
|
|
2167
|
+
formatEther,
|
|
2168
|
+
formatGwei,
|
|
2169
|
+
formatLog,
|
|
2170
|
+
formatTransaction,
|
|
2171
|
+
formatTransactionReceipt,
|
|
2172
|
+
formatTransactionRequest,
|
|
2173
|
+
formatUnits,
|
|
2174
|
+
fromBlobs,
|
|
2175
|
+
fromBytes,
|
|
2176
|
+
fromHex,
|
|
2177
|
+
fromRlp,
|
|
2178
|
+
getAbiItem,
|
|
2179
|
+
getAddress,
|
|
2180
|
+
getChainContractAddress,
|
|
2181
|
+
getContract,
|
|
2182
|
+
getContractAddress,
|
|
2183
|
+
getContractError,
|
|
2184
|
+
getCreate2Address,
|
|
2185
|
+
getCreateAddress,
|
|
2186
|
+
getEventSelector: toEventSelector,
|
|
2187
|
+
getEventSignature: toSignature,
|
|
2188
|
+
getFunctionSelector: toFunctionSelector,
|
|
2189
|
+
getFunctionSignature: toSignature,
|
|
2190
|
+
getSerializedTransactionType,
|
|
2191
|
+
getTransactionType,
|
|
2192
|
+
getTypesForEIP712Domain,
|
|
2193
|
+
gweiUnits,
|
|
2194
|
+
hashDomain,
|
|
2195
|
+
hashMessage,
|
|
2196
|
+
hashStruct,
|
|
2197
|
+
hashTypedData,
|
|
2198
|
+
hexToBigInt,
|
|
2199
|
+
hexToBool,
|
|
2200
|
+
hexToBytes,
|
|
2201
|
+
hexToCompactSignature: parseCompactSignature,
|
|
2202
|
+
hexToNumber,
|
|
2203
|
+
hexToRlp,
|
|
2204
|
+
hexToSignature: parseSignature,
|
|
2205
|
+
hexToString,
|
|
2206
|
+
http,
|
|
2207
|
+
isAddress,
|
|
2208
|
+
isAddressEqual,
|
|
2209
|
+
isBytes,
|
|
2210
|
+
isErc6492Signature,
|
|
2211
|
+
isErc8010Signature,
|
|
2212
|
+
isHash,
|
|
2213
|
+
isHex,
|
|
2214
|
+
keccak256,
|
|
2215
|
+
labelhash,
|
|
2216
|
+
maxInt104,
|
|
2217
|
+
maxInt112,
|
|
2218
|
+
maxInt120,
|
|
2219
|
+
maxInt128,
|
|
2220
|
+
maxInt136,
|
|
2221
|
+
maxInt144,
|
|
2222
|
+
maxInt152,
|
|
2223
|
+
maxInt16,
|
|
2224
|
+
maxInt160,
|
|
2225
|
+
maxInt168,
|
|
2226
|
+
maxInt176,
|
|
2227
|
+
maxInt184,
|
|
2228
|
+
maxInt192,
|
|
2229
|
+
maxInt200,
|
|
2230
|
+
maxInt208,
|
|
2231
|
+
maxInt216,
|
|
2232
|
+
maxInt224,
|
|
2233
|
+
maxInt232,
|
|
2234
|
+
maxInt24,
|
|
2235
|
+
maxInt240,
|
|
2236
|
+
maxInt248,
|
|
2237
|
+
maxInt256,
|
|
2238
|
+
maxInt32,
|
|
2239
|
+
maxInt40,
|
|
2240
|
+
maxInt48,
|
|
2241
|
+
maxInt56,
|
|
2242
|
+
maxInt64,
|
|
2243
|
+
maxInt72,
|
|
2244
|
+
maxInt8,
|
|
2245
|
+
maxInt80,
|
|
2246
|
+
maxInt88,
|
|
2247
|
+
maxInt96,
|
|
2248
|
+
maxUint104,
|
|
2249
|
+
maxUint112,
|
|
2250
|
+
maxUint120,
|
|
2251
|
+
maxUint128,
|
|
2252
|
+
maxUint136,
|
|
2253
|
+
maxUint144,
|
|
2254
|
+
maxUint152,
|
|
2255
|
+
maxUint16,
|
|
2256
|
+
maxUint160,
|
|
2257
|
+
maxUint168,
|
|
2258
|
+
maxUint176,
|
|
2259
|
+
maxUint184,
|
|
2260
|
+
maxUint192,
|
|
2261
|
+
maxUint200,
|
|
2262
|
+
maxUint208,
|
|
2263
|
+
maxUint216,
|
|
2264
|
+
maxUint224,
|
|
2265
|
+
maxUint232,
|
|
2266
|
+
maxUint24,
|
|
2267
|
+
maxUint240,
|
|
2268
|
+
maxUint248,
|
|
2269
|
+
maxUint256,
|
|
2270
|
+
maxUint32,
|
|
2271
|
+
maxUint40,
|
|
2272
|
+
maxUint48,
|
|
2273
|
+
maxUint56,
|
|
2274
|
+
maxUint64,
|
|
2275
|
+
maxUint72,
|
|
2276
|
+
maxUint8,
|
|
2277
|
+
maxUint80,
|
|
2278
|
+
maxUint88,
|
|
2279
|
+
maxUint96,
|
|
2280
|
+
minInt104,
|
|
2281
|
+
minInt112,
|
|
2282
|
+
minInt120,
|
|
2283
|
+
minInt128,
|
|
2284
|
+
minInt136,
|
|
2285
|
+
minInt144,
|
|
2286
|
+
minInt152,
|
|
2287
|
+
minInt16,
|
|
2288
|
+
minInt160,
|
|
2289
|
+
minInt168,
|
|
2290
|
+
minInt176,
|
|
2291
|
+
minInt184,
|
|
2292
|
+
minInt192,
|
|
2293
|
+
minInt200,
|
|
2294
|
+
minInt208,
|
|
2295
|
+
minInt216,
|
|
2296
|
+
minInt224,
|
|
2297
|
+
minInt232,
|
|
2298
|
+
minInt24,
|
|
2299
|
+
minInt240,
|
|
2300
|
+
minInt248,
|
|
2301
|
+
minInt256,
|
|
2302
|
+
minInt32,
|
|
2303
|
+
minInt40,
|
|
2304
|
+
minInt48,
|
|
2305
|
+
minInt56,
|
|
2306
|
+
minInt64,
|
|
2307
|
+
minInt72,
|
|
2308
|
+
minInt8,
|
|
2309
|
+
minInt80,
|
|
2310
|
+
minInt88,
|
|
2311
|
+
minInt96,
|
|
2312
|
+
multicall3Abi,
|
|
2313
|
+
namehash,
|
|
2314
|
+
nonceManager,
|
|
2315
|
+
numberToBytes,
|
|
2316
|
+
numberToHex,
|
|
2317
|
+
offchainLookup,
|
|
2318
|
+
offchainLookupAbiItem,
|
|
2319
|
+
offchainLookupSignature,
|
|
2320
|
+
pad,
|
|
2321
|
+
padBytes,
|
|
2322
|
+
padHex,
|
|
2323
|
+
parseAbi,
|
|
2324
|
+
parseAbiItem,
|
|
2325
|
+
parseAbiParameter,
|
|
2326
|
+
parseAbiParameters,
|
|
2327
|
+
parseCompactSignature,
|
|
2328
|
+
parseErc6492Signature,
|
|
2329
|
+
parseErc8010Signature,
|
|
2330
|
+
parseEther,
|
|
2331
|
+
parseEventLogs,
|
|
2332
|
+
parseGwei,
|
|
2333
|
+
parseSignature,
|
|
2334
|
+
parseTransaction,
|
|
2335
|
+
parseUnits,
|
|
2336
|
+
prepareEncodeFunctionData,
|
|
2337
|
+
presignMessagePrefix,
|
|
2338
|
+
publicActions,
|
|
2339
|
+
recoverAddress,
|
|
2340
|
+
recoverMessageAddress,
|
|
2341
|
+
recoverPublicKey,
|
|
2342
|
+
recoverTransactionAddress,
|
|
2343
|
+
recoverTypedDataAddress,
|
|
2344
|
+
ripemd160,
|
|
2345
|
+
rpcSchema,
|
|
2346
|
+
rpcTransactionType,
|
|
2347
|
+
serializeAccessList,
|
|
2348
|
+
serializeCompactSignature,
|
|
2349
|
+
serializeErc6492Signature,
|
|
2350
|
+
serializeErc8010Signature,
|
|
2351
|
+
serializeSignature,
|
|
2352
|
+
serializeTransaction,
|
|
2353
|
+
serializeTypedData,
|
|
2354
|
+
setErrorConfig,
|
|
2355
|
+
setupKzg,
|
|
2356
|
+
sha256,
|
|
2357
|
+
shouldThrow,
|
|
2358
|
+
sidecarsToVersionedHashes,
|
|
2359
|
+
signatureToCompactSignature,
|
|
2360
|
+
signatureToHex: serializeSignature,
|
|
2361
|
+
size,
|
|
2362
|
+
slice,
|
|
2363
|
+
sliceBytes,
|
|
2364
|
+
sliceHex,
|
|
2365
|
+
stringToBytes,
|
|
2366
|
+
stringToHex,
|
|
2367
|
+
stringify,
|
|
2368
|
+
testActions,
|
|
2369
|
+
toBlobSidecars,
|
|
2370
|
+
toBlobs,
|
|
2371
|
+
toBytes,
|
|
2372
|
+
toCoinType,
|
|
2373
|
+
toEventHash: toSignatureHash,
|
|
2374
|
+
toEventSelector,
|
|
2375
|
+
toEventSignature: toSignature,
|
|
2376
|
+
toFunctionHash: toSignatureHash,
|
|
2377
|
+
toFunctionSelector,
|
|
2378
|
+
toFunctionSignature: toSignature,
|
|
2379
|
+
toHex,
|
|
2380
|
+
toPrefixedMessage,
|
|
2381
|
+
toRlp,
|
|
2382
|
+
transactionType,
|
|
2383
|
+
trim,
|
|
2384
|
+
universalSignatureValidatorAbi: erc6492SignatureValidatorAbi,
|
|
2385
|
+
universalSignatureValidatorByteCode: erc6492SignatureValidatorByteCode,
|
|
2386
|
+
validateTypedData,
|
|
2387
|
+
verifyHash,
|
|
2388
|
+
verifyMessage,
|
|
2389
|
+
verifyTypedData,
|
|
2390
|
+
walletActions,
|
|
2391
|
+
webSocket,
|
|
2392
|
+
weiUnits,
|
|
2393
|
+
withCache,
|
|
2394
|
+
withRetry,
|
|
2395
|
+
withTimeout,
|
|
2396
|
+
zeroAddress,
|
|
2397
|
+
zeroHash
|
|
2398
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2399
|
+
export {
|
|
2400
|
+
_esm as _
|
|
2401
|
+
};
|
|
2402
|
+
//# sourceMappingURL=index-QqIUi-wY.js.map
|