@dcl/shop 1.13.0 → 1.13.1-35083402807.commit-39ddde0
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/_assets/Activity-A2FtvwQ_.js +389 -0
- package/_assets/{AnimatedBackground-BnW4jNQ_.js → AnimatedBackground-C3tM2Y2N.js} +2 -2
- package/_assets/{Assets-CamziJEW.js → Assets-azk9tREK.js} +11 -11
- package/_assets/{Authorizations-qhSo3l9v.js → Authorizations-K359qq_w.js} +12 -12
- package/_assets/{Cart-BdU4pPj2.js → Cart-u2vM0tsP.js} +9 -9
- package/_assets/{Collection-EQ6zO1YD.js → Collection-CTe_NjZz.js} +11 -11
- package/_assets/{CollectionCarousel-Crm-0uNM.js → CollectionCarousel-SoxQcZ3j.js} +9 -9
- package/_assets/{Confetti-BqpIfMO9.js → Confetti-CtXiiXzp.js} +4 -4
- package/_assets/{ConstantsUtil-BCzF6n74.js → ConstantsUtil-Bl790kKf.js} +2 -2
- package/_assets/{ContentClient-DJLeN-Hu.js → ContentClient-h2HMRGJL.js} +2 -2
- package/_assets/{Creator-C1ewJ_rt.js → Creator-BplrmoUA.js} +29 -29
- package/_assets/{DeploymentBuilder-CtSJAkCg.js → DeploymentBuilder-D3rGBRDa.js} +3 -3
- package/_assets/{EmotePlaybackBar-DJ1CBzQj.js → EmotePlaybackBar-C6EykJ-K.js} +3 -3
- package/_assets/{ErrorNotice-DFD2N4ZG.js → ErrorNotice-De_TScoD.js} +2 -2
- package/_assets/{Event-CGEg1Njh.js → Event-ByQZcSHm.js} +2 -2
- package/_assets/{ExchangeController-LNJTGsI4.js → ExchangeController-woCK-BHp.js} +2 -2
- package/_assets/{Faq-DBi3GpFN.js → Faq-DfEZY-mU.js} +3 -3
- package/_assets/{GetCredits-CilUrWIp.js → GetCredits-DnzU_iyw.js} +14 -14
- package/_assets/{Grow-DSgnoOPE.js → Grow-BsCarE6p.js} +2 -2
- package/_assets/HelpersUtil-E53_JkeW.js +63 -0
- package/_assets/ItemDetail-vMxrJTfh.js +3778 -0
- package/_assets/LoadMore-D5mf9f7D.js +8 -0
- package/_assets/{ManaPricingBanner.styles-CiQXNidr.js → ManaPricingBanner.styles-CesM3W8u.js} +2 -2
- package/_assets/{MyAssets-D1kA_br4.js → MyAssets-hQhUOzVy.js} +7 -7
- package/_assets/{MyFavorites-Bg2VKyPe.js → MyFavorites-BKsvTjxK.js} +6 -6
- package/_assets/{NetworkUtil-D1Xckx5t.js → NetworkUtil-DY5iDBkb.js} +2 -2
- package/_assets/NotFound-CIk-MZOg.js +18 -0
- package/_assets/{NotificationsBell-DwmpPTnq.js → NotificationsBell-Bw9Fnp4E.js} +2 -2
- package/_assets/{OutfitDetail-kCQ6HeTm.js → OutfitDetail-CBxhR4M3.js} +5 -5
- package/_assets/OutfitPreview-Dkyq4iZq.js +7 -0
- package/_assets/{OutfitStudio-BO_xeG9Z.js → OutfitStudio-3VuUmRR2.js} +24 -24
- package/_assets/{PhArrowCircleDown-BQf7a7tx.js → PhArrowCircleDown-Bmy0XPqd.js} +5 -5
- package/_assets/{PhArrowClockwise-tl_iVvce.js → PhArrowClockwise-Bklo7MBV.js} +3 -3
- package/_assets/{PhArrowDown-Nx8skxB1.js → PhArrowDown-CBjJCstB.js} +3 -3
- package/_assets/{PhArrowLeft-B2FOU46g.js → PhArrowLeft-BCeYPtMx.js} +2 -2
- package/_assets/PhArrowRight-Ch61WxZn.js +15 -0
- package/_assets/{PhArrowSquareOut-Cwvs2k2I.js → PhArrowSquareOut-Bk5nSBoz.js} +5 -5
- package/_assets/{PhArrowUp-Ddpjrupw.js → PhArrowUp-CzPwFe1F.js} +5 -5
- package/_assets/{PhArrowUpRight-GR9jLk0j.js → PhArrowUpRight-DF87CEc7.js} +3 -3
- package/_assets/{PhArrowsClockwise-DiFALoYE.js → PhArrowsClockwise-D5XWB216.js} +5 -5
- package/_assets/{PhArrowsDownUp-C5MsaDSU.js → PhArrowsDownUp-CVtoWYS-.js} +5 -5
- package/_assets/{PhArrowsLeftRight-CVSlwL5f.js → PhArrowsLeftRight-Cu83Wp7y.js} +3 -3
- package/_assets/{PhBank-JlgXqj6a.js → PhBank-BjB_uqsX.js} +3 -3
- package/_assets/{PhBrowser-BAuOLdYK.js → PhBrowser-CW3ZGiB7.js} +5 -5
- package/_assets/PhCaretDown-PT_hkshh.js +15 -0
- package/_assets/{PhCaretLeft-CuCRXELD.js → PhCaretLeft-DPSFahQA.js} +3 -3
- package/_assets/{PhCaretRight-Dh12cPi2.js → PhCaretRight-EEBUAb9H.js} +4 -4
- package/_assets/{PhCaretUp-D_YSLbRZ.js → PhCaretUp-Bit2hvKo.js} +4 -4
- package/_assets/{PhCheck-DM-Xw6Og.js → PhCheck-BHmNQJ6P.js} +3 -3
- package/_assets/{PhCircleHalf-B_a7PTBj.js → PhCircleHalf-AD4oTWoj.js} +5 -5
- package/_assets/{PhClock-C6uHGxHX.js → PhClock-3t4anT3D.js} +5 -5
- package/_assets/{PhCompass-BCBQfuVk.js → PhCompass-DpvhkfDj.js} +3 -3
- package/_assets/{PhCopy-CuJFaD8W.js → PhCopy-We2XYWCm.js} +5 -5
- package/_assets/{PhCreditCard-j7mRfOWb.js → PhCreditCard-BBnTMXbe.js} +4 -4
- package/_assets/{PhCurrencyDollar-BHK_WZqp.js → PhCurrencyDollar-dPV4byY8.js} +4 -4
- package/_assets/{PhDesktop-yP_Shy1c.js → PhDesktop-DVuLe5q1.js} +3 -3
- package/_assets/{PhDeviceMobile-MCjovOoQ.js → PhDeviceMobile-D6knI_PD.js} +3 -3
- package/_assets/{PhDotsThree-B-8MklB_.js → PhDotsThree-D_uTiViU.js} +4 -4
- package/_assets/{PhEnvelope-BVMpBzL8.js → PhEnvelope-Bkk7fDMT.js} +3 -3
- package/_assets/{PhFunnelSimple-Xip53NJe.js → PhFunnelSimple-BVx2yoJC.js} +3 -3
- package/_assets/{PhGlobe-DTLd7vq3.js → PhGlobe-BUa1rAnN.js} +2 -2
- package/_assets/{PhIdentificationCard-Owvtcfl8.js → PhIdentificationCard-D7mCEldI.js} +5 -5
- package/_assets/{PhImage-gpASuR3P.js → PhImage-DN8upEaC.js} +2 -2
- package/_assets/{PhInfo-By_MexxN.js → PhInfo-BRv5JqkG.js} +3 -3
- package/_assets/{PhLightbulb-D9di92yf.js → PhLightbulb-LZ8Bksrw.js} +3 -3
- package/_assets/{PhMagnifyingGlass-DDgrWTCc.js → PhMagnifyingGlass-Nlml1ksU.js} +5 -5
- package/_assets/{PhPaperPlaneRight-DQP_XqUF.js → PhPaperPlaneRight-QfFyGr7O.js} +3 -3
- package/_assets/{PhPlus-l3KhxySr.js → PhPlus-C6YKBVJU.js} +4 -4
- package/_assets/{PhPower-Cr4gqDwx.js → PhPower-BtHcdIUq.js} +4 -4
- package/_assets/{PhPuzzlePiece-BVKd_9LG.js → PhPuzzlePiece-D5mYYrHE.js} +4 -4
- package/_assets/{PhQrCode-C2-pxwu5.js → PhQrCode-MfgEx90-.js} +2 -2
- package/_assets/{PhQuestion-hJFyp5y_.js → PhQuestion-BHeGiiUF.js} +3 -3
- package/_assets/{PhQuestionMark-BIf3aP5-.js → PhQuestionMark-DNtDU6-_.js} +4 -4
- package/_assets/{PhSealCheck-DYwmEsuV.js → PhSealCheck-CDWno5AE.js} +2 -2
- package/_assets/{PhSignOut-D4m3HfaH.js → PhSignOut-BWUfOWAY.js} +4 -4
- package/_assets/{PhSpinner-CQO82DfI.js → PhSpinner-Chbk-Rrh.js} +4 -4
- package/_assets/{PhTrash-BcF8SoSu.js → PhTrash-CknzCMhK.js} +2 -2
- package/_assets/{PhUser-TbE-uvug.js → PhUser-DBmpCM-x.js} +4 -4
- package/_assets/{PhVault-DN8MSFv_.js → PhVault-B_-lceT6.js} +2 -2
- package/_assets/{PhWallet-DZOB7Naf.js → PhWallet-DzHci4bI.js} +5 -5
- package/_assets/{PhWarning-BioUNSl5.js → PhWarning-DNajgYKH.js} +3 -3
- package/_assets/{PhWarningCircle-B1qANwXx.js → PhWarningCircle-DaWHEJd0.js} +5 -5
- package/_assets/{PhX-C2MAMi7o.js → PhX-o_0aqvnZ.js} +3 -3
- package/_assets/Spinner-Byhp92PJ.js +50 -0
- package/_assets/StoreSettings-BJ7vrwr2.js +196 -0
- package/_assets/{Success-BOXdwFix.js → Success-Cmh_aMVs.js} +13 -13
- package/_assets/{SwapController-7Q3mgAr3.js → SwapController-T4xCrgJ1.js} +2 -2
- package/_assets/{TradeService-DoF1sJfB.js → TradeService-0T_PrP4j.js} +2 -2
- package/_assets/{W3MFrameProviderSingleton-BLGKJTAV.js → W3MFrameProviderSingleton-C-8Y7xjF.js} +4 -4
- package/_assets/{WebCryptoP256-DY58fkES.js → WebCryptoP256-BYRHrFVR.js} +2 -2
- package/_assets/{add-CHjzJko0.js → add-DMqlCS_5.js} +2 -2
- package/_assets/{all-wallets-iP9kf8IH.js → all-wallets-jltIqTjt.js} +2 -2
- package/_assets/{app-store-KBtXJUZW.js → app-store-8U-XnKiq.js} +2 -2
- package/_assets/{apple-1wsuvzH8.js → apple-DqtIUOT7.js} +3 -3
- package/_assets/{arrow-bottom-g-rIpj6-.js → arrow-bottom-PA3nOuzV.js} +2 -2
- package/_assets/{arrow-bottom-circle-CgTwGRtZ.js → arrow-bottom-circle-C-CSXtk9.js} +3 -3
- package/_assets/arrow-left-Cddzsk1s.js +9 -0
- package/_assets/arrow-right-FkB0kPcW.js +9 -0
- package/_assets/{arrow-top-tB4xV8bo.js → arrow-top-BAZtnW6A.js} +3 -3
- package/_assets/{async-directive-B7SDFDfN.js → async-directive-C0XTxdV5.js} +3 -3
- package/_assets/{authorizations-j1Fdv_CY.js → authorizations-C-jpuNgV.js} +2 -2
- package/_assets/{bank-Bq57T_gs.js → bank-C-8Jh-Iw.js} +2 -2
- package/_assets/{basic-ikWsaw57.js → basic-B6MIyd9X.js} +2 -2
- package/_assets/{biconomy-D7jszzZX.js → biconomy-BrpMknWI.js} +2 -2
- package/_assets/{browseLayout.styles-CzgQMQ68.js → browseLayout.styles-YSNLTP_3.js} +8 -8
- package/_assets/{browser-Dhl29U0F.js → browser-BUB32I2r.js} +2 -2
- package/_assets/{browser-B8dgFdTL.js → browser-BXKNeaZx.js} +2 -2
- package/_assets/{browser-BYr_ioqH.js → browser-Nma7xZsq.js} +2 -2
- package/_assets/{browser-ponyfill-DgxLup8s.js → browser-ponyfill-Dc2JIprt.js} +2 -2
- package/_assets/builder-BPg18stB.js +2 -0
- package/_assets/buy-C907Akhk.js +2 -0
- package/_assets/buy-gasless-DAqBRu8G.js +2 -0
- package/_assets/{card-SS6BCQlD.js → card-Uc0KebvL.js} +2 -2
- package/_assets/{categories-D8j8Cra5.js → categories-BV1kj1JI.js} +3 -3
- package/_assets/{ccip-DUsbF98O.js → ccip-El6kUyRL.js} +2 -2
- package/_assets/{ccip-BFtRvUNC.js → ccip-ZUoh32pI.js} +2 -2
- package/_assets/{chains-ZMlAuLDk.js → chains-CJQdRA26.js} +2 -2
- package/_assets/{checkmark-Ce_V05yL.js → checkmark-7uWcPB0u.js} +2 -2
- package/_assets/{checkmark-bold-H9kfGvBU.js → checkmark-bold-BwTefyx7.js} +3 -3
- package/_assets/chevron-bottom-CJ9Wl9Xm.js +9 -0
- package/_assets/chevron-left-DKH1P9Pf.js +9 -0
- package/_assets/{chevron-right-BeBDYBiH.js → chevron-right-DeNTJHBI.js} +3 -3
- package/_assets/chevron-top-Dn0py8bk.js +9 -0
- package/_assets/{chrome-store-PMcYx52p.js → chrome-store-DUbm69Gl.js} +3 -3
- package/_assets/{class-map-D0tzaS-h.js → class-map-C7I-HYAi.js} +2 -2
- package/_assets/{clock-BiZp9Ggi.js → clock-CMav6VuQ.js} +2 -2
- package/_assets/{close-BFw77kzc.js → close-Byftwzmc.js} +2 -2
- package/_assets/{coinPlaceholder-B9YzaxY6.js → coinPlaceholder-C0F4r6oU.js} +2 -2
- package/_assets/collectionPage.styles-D16ZUo4B.js +41 -0
- package/_assets/common-BrbHEwZh.js +2 -0
- package/_assets/{compass-BqXmuVKk.js → compass-CPDOuTyF.js} +2 -2
- package/_assets/controller-bGmkrAKG.js +3 -0
- package/_assets/{copy-DNAdNuz_.js → copy-CjXNbdx3.js} +2 -2
- package/_assets/{core-CoWTi1UJ.js → core-cVeH5faZ.js} +5 -5
- package/_assets/{createSvgIcon-BiPKRVst.js → createSvgIcon-CIA6-oNz.js} +4 -4
- package/_assets/crumbs.styles-r3pFGk-h.js +10 -0
- package/_assets/cursor-D-SkqFO5.js +4 -0
- package/_assets/{cursor-transparent-BUUXFhiw.js → cursor-transparent-RE6Zec8w.js} +3 -3
- package/_assets/{custom-DkR7MyWb.js → custom-DJcPO2TV.js} +2 -2
- package/_assets/{data-capture-C0QIYOtX.js → data-capture-BBNa0uaC.js} +2 -2
- package/_assets/{dcl-schemas-CEEV5Gwi.js → dcl-schemas-DslZmh30.js} +2 -2
- package/_assets/decimals-DJwTod5z.js +2 -0
- package/_assets/decimals-cgoFs-EH.js +2 -0
- package/_assets/{desktop-BV-CpCPh.js → desktop-tp0dY4sR.js} +3 -3
- package/_assets/detectExtension-sB7QDKcb.js +2 -0
- package/_assets/{disconnect-C5A_Ulh-.js → disconnect-PN0ATTQe.js} +3 -3
- package/_assets/{discord-DFEpyKvH.js → discord-ISYEjXZK.js} +3 -3
- package/_assets/{disposePreview-Bfh9aU_J.js → disposePreview-xloThKVm.js} +2 -2
- package/_assets/{email-C0rayVJd.js → email-BvTnL5CF.js} +2 -2
- package/_assets/{embedded-wallet-5MeCyUdE.js → embedded-wallet-GTzLJ-Zv.js} +2 -2
- package/_assets/{emotion-styled.browser.esm-LN9zOfwH.js → emotion-styled.browser.esm-oIIM2LZw.js} +2 -2
- package/_assets/{engine-Cf1QmTJQ.js → engine-BHD4hBH0.js} +2 -2
- package/_assets/errors-z4kE-uRk.js +2 -0
- package/_assets/estimate-l1-fee-DFUyaNED.js +2 -0
- package/_assets/eth_estimateGas-B2SxlaTG.js +2 -0
- package/_assets/eth_getStorageAt-BZrAmG-r.js +2 -0
- package/_assets/eth_getTransactionCount-BT501yAg.js +2 -0
- package/_assets/ethereum-BPV2jSj3.js +2 -0
- package/_assets/{ethers-BfnXvuxS.js → ethers-DeUFwKFN.js} +2 -2
- package/_assets/{etherscan-DjB6vSIQ.js → etherscan-CjB1AtvG.js} +3 -3
- package/_assets/{events-DOXOcxVW.js → events-D_yhp3Xa.js} +2 -2
- package/_assets/{exclamation-triangle-BigqO5zC.js → exclamation-triangle-Vw_jmJIs.js} +2 -2
- package/_assets/{execute-R31vI0PP.js → execute-sbSj-emH.js} +3 -3
- package/_assets/{extension-DrkmxAqx.js → extension-p5vqJTq0.js} +3 -3
- package/_assets/{external-link-CbNALei9.js → external-link-6l8BDrnZ.js} +3 -3
- package/_assets/{extractIPFS-Bg2FU7gW.js → extractIPFS-DhCxXWeV.js} +2 -2
- package/_assets/{facebook-DaDSqQru.js → facebook-BdpnpvkK.js} +3 -3
- package/_assets/{farcaster-Do6RB5zR.js → farcaster-DyedtTLV.js} +3 -3
- package/_assets/{features-DqkSLGWe.js → features-he8LBGx_.js} +2 -2
- package/_assets/fetchTokenMetadata-BSezisTz.js +3 -0
- package/_assets/{field.styles-BeUcGp3j.js → field.styles-Bhzclyze.js} +2 -2
- package/_assets/{filters-ZGEyDIFh.js → filters-CMt2xly-.js} +3 -3
- package/_assets/{fortmatic-BeVunzky.js → fortmatic-BygNSlcE.js} +2 -2
- package/_assets/{get-bytecode-BpKcUepk.js → get-bytecode-BQRF3kbv.js} +2 -2
- package/_assets/get-ecosystem-wallet-info-2ZAESy6u.js +2 -0
- package/_assets/{getBalance-UTTv1le_.js → getBalance-CR3rz94g.js} +3 -3
- package/_assets/getInstalledModules-BzAKOr8j.js +2 -0
- package/_assets/getNFT-8nptVMO3.js +3 -0
- package/_assets/getNFT-Ds3Cfy-C.js +2 -0
- package/_assets/{github-CoYfnUKi.js → github-DpuVIU6C.js} +2 -2
- package/_assets/{google-BvNO-5zV.js → google-BwS7c7G5.js} +2 -2
- package/_assets/grid.styles-CmYj-L00.js +15 -0
- package/_assets/{hashTypedData-DVQd-ytO.js → hashTypedData-C77kpNNe.js} +2 -2
- package/_assets/{hashTypedData-mvCKC6OS.js → hashTypedData-QvIyMwPF.js} +2 -2
- package/_assets/{help-circle-CS_fIGWE.js → help-circle-D4e71YxP.js} +3 -3
- package/_assets/{id-BctfRKQ1.js → id-CkCU8Jqk.js} +3 -3
- package/_assets/{image-5sWR7BDC.js → image-BgNr9PHW.js} +2 -2
- package/_assets/import-D-e8W30A.js +2 -0
- package/_assets/{in-app-D7v4pJbk.js → in-app-DAUhIC9M.js} +2 -2
- package/_assets/in-app-wallet-calls-DEQ8zUPL.js +2 -0
- package/_assets/{index-DV2ikJ7P.js → index-3LtI8p1K.js} +2 -2
- package/_assets/{index-CQi6hJSY.js → index-8etAaA-6.js} +2 -2
- package/_assets/{index-BiOyGp0x.js → index-B15fH7F8.js} +2 -2
- package/_assets/{index-BvE5kQP5.js → index-B3-0nuPf.js} +2 -2
- package/_assets/{index-C9m77YrW.js → index-B5VT2K_t.js} +9 -9
- package/_assets/index-BDW05jsC.js +2 -0
- package/_assets/{index-CFWOoo0n.js → index-BIIUpjqk.js} +2 -2
- package/_assets/{index-C7JAEpsR.js → index-BInx1-F7.js} +2 -2
- package/_assets/{index-Bpnh2mhD.js → index-BKB9jLXH.js} +4 -4
- package/_assets/{index-Br346hMc.js → index-BMkIJXzs.js} +4 -4
- package/_assets/{index-Y6LX2zPm.js → index-BNxhN-PE.js} +2 -2
- package/_assets/{index-B3kapPCX.js → index-BUuTOE6d.js} +2 -2
- package/_assets/{index-R_aZBTVq.js → index-BZsDhPnN.js} +2 -2
- package/_assets/{index-_o4B93Wv.js → index-BiWL_dC0.js} +2 -2
- package/_assets/{index-DTDLF1_e.js → index-BmVxaJ7H.js} +2 -2
- package/_assets/{index-BzsMKIPi.js → index-Bn1vI7g7.js} +2 -2
- package/_assets/{index-Dw660D76.js → index-BoY04MqE.js} +3 -3
- package/_assets/{index-nZh7HqkX.js → index-BsGy1-Sz.js} +4 -4
- package/_assets/{index-C6MOg2oW.js → index-BuGGaA9M.js} +2 -2
- package/_assets/{index-C-3S-aR_.js → index-C-HGfu-L.js} +4 -4
- package/_assets/{index-C9F2T2G5.js → index-C8PhXcLK.js} +6 -6
- package/_assets/{index-aTHzb-UU.js → index-C8R0wIHC.js} +2 -2
- package/_assets/{index-C7Ns1jUN.js → index-CEHJ4Zxj.js} +2 -2
- package/_assets/{index-DmPseRWb.js → index-CFNCKm4k.js} +2 -2
- package/_assets/{index-CzHeD3Wi.js → index-CUBP0H9u.js} +2 -2
- package/_assets/index-CWlaJrqK.js +28 -0
- package/_assets/{index-N6jOuY9E.js → index-CYXkJBzB.js} +2 -2
- package/_assets/{index-Bn9MxyNx.js → index-Ch2YcG96.js} +64 -144
- package/_assets/{index-DC12bna3.js → index-CmYkZHxf.js} +6 -6
- package/_assets/{index-D-fNU-mX.js → index-CmtEE1yn.js} +3 -3
- package/_assets/{index-B3qB_Szq.js → index-CqIP6yY4.js} +2 -2
- package/_assets/{index-Cg1q_1rC.js → index-Cxyjs4LG.js} +2 -2
- package/_assets/{index-D3An-1P9.js → index-CyVUYZzc.js} +4 -4
- package/_assets/{index-BUhRMj0k.js → index-D-ek1Pvv.js} +3 -3
- package/_assets/{index-C2gDgpYx.js → index-D9cXyBTK.js} +2 -2
- package/_assets/{index-V2l1pvfO.js → index-DDaFppj2.js} +2 -2
- package/_assets/{index-C4BR3a3M.js → index-DDw343To.js} +4 -4
- package/_assets/{index-CRi7V83H.js → index-DFZUBMdj.js} +3 -3
- package/_assets/{index-BA3YuPkE.js → index-DGKKW9p_.js} +2 -2
- package/_assets/{index-vRZTC-Kx.js → index-DT_pKKbG.js} +5 -5
- package/_assets/{index-8a4ejD-E.js → index-DTv-aDjt.js} +2 -2
- package/_assets/{index-CiZNMvJ9.js → index-DV7bWNzQ.js} +2 -2
- package/_assets/{index-DNJCrjPc.js → index-DVxT_aDK.js} +2 -2
- package/_assets/{index-CktWkqok.js → index-DWQ8OGZQ.js} +2 -2
- package/_assets/{index-CZoaQxuM.js → index-DXOXV6F9.js} +9 -9
- package/_assets/{index-D0CCESX5.js → index-DZsSmiPJ.js} +2 -2
- package/_assets/{index-DLA2XG0B.js → index-DbKn7gRG.js} +2 -2
- package/_assets/{index-D15i9Snb.js → index-Db_uxTxZ.js} +2 -2
- package/_assets/{index-7EA3n-EN.js → index-DqK-gj4i.js} +4 -4
- package/_assets/{index-DckWaHRB.js → index-DqsOjgVt.js} +3 -3
- package/_assets/{index-u07BnOHT.js → index-DuAh5t7H.js} +2 -2
- package/_assets/{index-DmkxnRhi.js → index-Dy0QHUy_.js} +2 -2
- package/_assets/{index-CmHI48j2.js → index-EX_0X2u5.js} +2 -2
- package/_assets/{index-BXSuEdHw.js → index-KWCLRwqD.js} +4 -4
- package/_assets/{index-qLV9obfb.js → index-MhgOdCuN.js} +4 -4
- package/_assets/{index-C38OW2pe.js → index-QJxkg6HJ.js} +9 -9
- package/_assets/index-S5YYeBud.js +4288 -0
- package/_assets/{index-DJDZ2D_0.js → index-U0FJSC8l.js} +2 -2
- package/_assets/{index-DAgkANiI.js → index-UXwlfzDr.js} +4 -4
- package/_assets/index-Uqsfnm5F.js +2 -0
- package/_assets/index-VPT5QlB0.css +1 -0
- package/_assets/{index-f-rhyCiZ.js → index-dEMztkzp.js} +2 -2
- package/_assets/{index-Dwm1aZW_.js → index-fNZ_c6vc.js} +4 -4
- package/_assets/{index-CQTuHkt6.js → index-q7jg-oA_.js} +4 -4
- package/_assets/{index-DLdrzeCo.js → index-qYr6zV4J.js} +2 -2
- package/_assets/{index-CnTq-D0F.js → index-s5S8oEjL.js} +2 -2
- package/_assets/{index-BFGJWrau.js → index-wQDpXCtu.js} +4 -4
- package/_assets/{index-BjhkePbM.js → index-z3rGOO2O.js} +4 -4
- package/_assets/{index.es-d0bre8FY.js → index.es-BEVMBMrG.js} +2 -2
- package/_assets/{index.es-B8O7hyLV.js → index.es-BJ9LWCeM.js} +2 -2
- package/_assets/{index.es-BPHop57M.js → index.es-CsP78NVi.js} +2 -2
- package/_assets/{index.es-Cfi7R05N.js → index.es-DEs09rLj.js} +5 -5
- package/_assets/{info-B7xrwD1T.js → info-CULnZZaj.js} +2 -2
- package/_assets/{info-circle-g_FLkwEH.js → info-circle-lLJ-CNp2.js} +3 -3
- package/_assets/items-empty-9f6KRmmM.js +2 -0
- package/_assets/jsxRuntime.module-gjtb1wYS.js +2 -0
- package/_assets/{jump-ZJB-DBny.js → jump-_BLelYPP.js} +2 -2
- package/_assets/{lightbulb-BEdzTqhe.js → lightbulb-4T7s9a-o.js} +3 -3
- package/_assets/linkAccount-cqqKV9wt.js +2 -0
- package/_assets/{localBatchGatewayRequest-aw27Bp6C.js → localBatchGatewayRequest-a3DmH1Ia.js} +2 -2
- package/_assets/{mail-B5y2UAYP.js → mail-DhJDk7cH.js} +2 -2
- package/_assets/{mobile-Px_F4xuu.js → mobile-CydJ5WdV.js} +2 -2
- package/_assets/modal.styles-BJJCeLdB.js +112 -0
- package/_assets/{more-vjJSeJc6.js → more-Dg2B8rio.js} +3 -3
- package/_assets/{native-D_b-Jjxn.js → native-CPRRjP_f.js} +2 -2
- package/_assets/{network-placeholder-BT0DMZpT.js → network-placeholder-h8TrKQkX.js} +2 -2
- package/_assets/{networks-Cz_KXKTD.js → networks-BzBuBnys.js} +2 -2
- package/_assets/{nftPlaceholder-Dv1GbIku.js → nftPlaceholder-B4g7qDN6.js} +3 -3
- package/_assets/{off-BIRJlzsd.js → off-UwuZMWU-.js} +3 -3
- package/_assets/{onramp-BgSxVi_X.js → onramp-DNktOoQt.js} +2 -2
- package/_assets/openzeppelin-4qY0EMMO.js +2 -0
- package/_assets/ownerOf-2xbqyujG.js +2 -0
- package/_assets/parseNft-BfJYfy9U.js +3 -0
- package/_assets/{parseSignature-BgAg7p_1.js → parseSignature-BUVisyv1.js} +2 -2
- package/_assets/{parseSignature-DvERMuu5.js → parseSignature-DLLtA2PU.js} +4 -4
- package/_assets/{passkeys-Cz2GemtB.js → passkeys-BYHFLF4m.js} +2 -2
- package/_assets/{pay-with-exchange-CqWdb7la.js → pay-with-exchange-BWe0u_VY.js} +2 -2
- package/_assets/{play-store-BQbH9juS.js → play-store-B1ADa5-a.js} +2 -2
- package/_assets/{plus-CRN7wFaf.js → plus-CkIDGwOx.js} +2 -2
- package/_assets/{prepare-contract-call-DWYd_dpp.js → prepare-contract-call-BETrvoaQ.js} +2 -2
- package/_assets/{qr-code-D3CPi7o-.js → qr-code-DInpw8H9.js} +3 -3
- package/_assets/{qr-overlay-D0QgP5Gm.js → qr-overlay-DysHPL05.js} +4 -4
- package/_assets/{react-CfmD1IrY.js → react-CHXQAvvP.js} +2 -2
- package/_assets/{receive-DX9IzAKR.js → receive-DDbTnVPw.js} +2 -2
- package/_assets/{recycle-horizontal-2b5C-1KE.js → recycle-horizontal-frlUVLoe.js} +2 -2
- package/_assets/{ref-aKgZQrB7.js → ref-BDtPbYkK.js} +3 -3
- package/_assets/{refresh-CxxKeQ5p.js → refresh-BJgYdDWe.js} +3 -3
- package/_assets/{reown-logo-CvtJaHLE.js → reown-logo-CptpO-OK.js} +3 -3
- package/_assets/{resolveImplementation-1LdC9vyT.js → resolveImplementation-T0nYehC8.js} +2 -2
- package/_assets/{resume-buy-DbTQ4Y00.js → resume-buy-sLn_-ToX.js} +2 -2
- package/_assets/{rpc-CS7-9nns.js → rpc-5ccW7HbA.js} +4 -4
- package/_assets/sales-empty-yRsQmIRV.js +2 -0
- package/_assets/{search-3wKI8ynJ.js → search-CovtTjFk.js} +3 -3
- package/_assets/{search-empty-BWTzk53_.js → search-empty-DnmEaZ5M.js} +2 -2
- package/_assets/{secp256k1-KrI-5aSb.js → secp256k1-CZQeYu1B.js} +2 -2
- package/_assets/{secp256k1-CkttYbi-.js → secp256k1-VJBz5NHh.js} +2 -2
- package/_assets/{secp256k1-bprmllwr.js → secp256k1-wdxI-GzS.js} +2 -2
- package/_assets/{send-afZjmQ6f.js → send-BqmhOSPb.js} +2 -2
- package/_assets/{send-D3QhjtsL.js → send-BwaOvmmU.js} +2 -2
- package/_assets/send-batch-transaction-BoN2o6ky.js +2 -0
- package/_assets/{send-eip712-transaction-D4Lq-5w3.js → send-eip712-transaction-CSiUxcFI.js} +3 -3
- package/_assets/send-gasless-transaction-Bo_jgU9N.js +3 -0
- package/_assets/send-transaction-CIIBNPf9.js +3 -0
- package/_assets/{sendMetaTransaction-C43xk9UA.js → sendMetaTransaction-CE_USVrK.js} +2 -2
- package/_assets/{sendRawTransaction-imHapPG5.js → sendRawTransaction-B1LqwDVj.js} +4 -4
- package/_assets/{sentry-TFqjegNi.js → sentry-ClHMnYE5.js} +3 -3
- package/_assets/{serializeTransaction-CxiUwXNH.js → serializeTransaction-BS3QMyct.js} +2 -2
- package/_assets/{session-proposal-DJZiGtMS.js → session-proposal-CnVqOh1y.js} +2 -2
- package/_assets/session-request-DDwsaXrF.js +3 -0
- package/_assets/{sha256-BMvUBSH_.js → sha256-BTzxwsGs.js} +2 -2
- package/_assets/{sha3-DE1CUjCa.js → sha3-CLivb23j.js} +2 -2
- package/_assets/{signing-3pb9u9PC.js → signing-CEt9elnK.js} +4 -4
- package/_assets/skeleton.styles-DIKo_4jD.js +8 -0
- package/_assets/{socials-5B1SW8BM.js → socials-Cz8P4Q0L.js} +2 -2
- package/_assets/{styled-DKHbz6uI.js → styled-BGOfEYw2.js} +3 -3
- package/_assets/{swapHorizontal-B4kcglfm.js → swapHorizontal-BzkqO77h.js} +3 -3
- package/_assets/{swapHorizontalBold-B7MRRr2N.js → swapHorizontalBold-Ci7CW-Ps.js} +2 -2
- package/_assets/{swapHorizontalMedium-C5ev_7je.js → swapHorizontalMedium-BIJFHqWY.js} +3 -3
- package/_assets/{swapHorizontalRoundedBold-zu2vwomo.js → swapHorizontalRoundedBold-DgbOKQnq.js} +2 -2
- package/_assets/{swapVertical-DpeRjJbe.js → swapVertical-AbfbZRwH.js} +2 -2
- package/_assets/{swaps-DXoDHWlZ.js → swaps-DEUugPIK.js} +2 -2
- package/_assets/{telegram-wm1axFAX.js → telegram-D7G_eJ_b.js} +3 -3
- package/_assets/{thirdweb-BXLB_paW.js → thirdweb-FIzEIyEj.js} +4 -4
- package/_assets/{three-dots-Cc2_9MPN.js → three-dots-OoMaedcW.js} +2 -2
- package/_assets/{to-serializable-transaction-FSmJ1Nj5.js → to-serializable-transaction-CEJ4iu6L.js} +3 -3
- package/_assets/totalSupply-DO4_b29r.js +2 -0
- package/_assets/{transaction-CKWKk0bi.js → transaction-BO3wjdd5.js} +2 -2
- package/_assets/{transactionReceipt-DBgTpvGb.js → transactionReceipt-DiCvi337.js} +2 -2
- package/_assets/transactions-Zbn5WY0d.js +17 -0
- package/_assets/{twitch-B46ssSkZ.js → twitch-XFZ_dW-0.js} +3 -3
- package/_assets/{twitterIcon-eHwnG6jo.js → twitterIcon-DFIrOz7L.js} +3 -3
- package/_assets/useCreditPacks-L6io_IwK.js +2 -0
- package/_assets/{useInfiniteGrid-jWb4qfov.js → useInfiniteGrid-DyNqhlw_.js} +2 -2
- package/_assets/{useStore-sOfyAYYH.js → useStore-DFroURkb.js} +3 -3
- package/_assets/useTheme-BjUS8j5J.js +2 -0
- package/_assets/{utils-TFUg72P3.js → utils-CkABEqW6.js} +2 -2
- package/_assets/{verify-D9O8bUPp.js → verify-CtqWYnsr.js} +3 -3
- package/_assets/{verify-filled-BwZg15UB.js → verify-filled-db_bDI2X.js} +2 -2
- package/_assets/{verifyHash-FEw82g1n.js → verifyHash-xlSlWMFP.js} +2 -2
- package/_assets/{w3m-modal-D8L08ctG.js → w3m-modal-BC_IKgL1.js} +2 -2
- package/_assets/{w3m-modal-KPmLwiWO.js → w3m-modal-D9Ojhdzh.js} +2 -2
- package/_assets/wait-for-tx-receipt-BGSQ0KT8.js +2 -0
- package/_assets/{wallet-t7uhZ_wp.js → wallet-C7Nkm-1r.js} +3 -3
- package/_assets/wallet-CGa4Vb9s.js +2 -0
- package/_assets/{wallet-placeholder-OuGxMvpI.js → wallet-placeholder-BAZfiJ4M.js} +3 -3
- package/_assets/{walletconnect-_sKMAvFE.js → walletconnect-jD4HJXgj.js} +5 -5
- package/_assets/{wallets-BhFxMvJm.js → wallets-C0y3R1oZ.js} +6 -6
- package/_assets/warning-circle-DG9C8ETA.js +13 -0
- package/_assets/{web-connector-CrKLYCKx.js → web-connector-DXN7zwDm.js} +4 -4
- package/_assets/{writeContract-CvBZWpQi.js → writeContract-BKBT7KZ8.js} +2 -2
- package/_assets/{x-BgKeiA5E.js → x-B-2M90IQ.js} +2 -2
- package/_assets/{zora-sepolia-H-kXK_Ns.js → zora-sepolia-B5dmeRNh.js} +2 -2
- package/_assets/{zoraTestnet-C5OnuHau.js → zoraTestnet-DyJpydQU.js} +2 -2
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Activity-DG1X3r7j.js +0 -389
- package/_assets/HelpersUtil-CN_E4fkk.js +0 -63
- package/_assets/ItemDetail-C-HJA8Wl.js +0 -3751
- package/_assets/LoadMore-C13YO4Ex.js +0 -8
- package/_assets/NotFound-Cciyw0_a.js +0 -18
- package/_assets/OutfitPreview-BHGSS1-V.js +0 -7
- package/_assets/PhArrowRight-YEtM5hEO.js +0 -15
- package/_assets/PhCaretDown-BnGAdY4m.js +0 -15
- package/_assets/StoreSettings-CjEaFFjf.js +0 -244
- package/_assets/arrow-left-DwniLz7a.js +0 -9
- package/_assets/arrow-right-DrFyKfK3.js +0 -9
- package/_assets/builder-Qpv88cHd.js +0 -2
- package/_assets/buy-BKz4g0wV.js +0 -2
- package/_assets/buy-gasless-BxHAW80t.js +0 -2
- package/_assets/chevron-bottom-BNXS4EZd.js +0 -9
- package/_assets/chevron-left-CntWv8x6.js +0 -9
- package/_assets/chevron-top-mB0Ljyp5.js +0 -9
- package/_assets/collectionPage.styles-DrR8c6dI.js +0 -41
- package/_assets/common-M02sneWF.js +0 -2
- package/_assets/controller-brAlSuK8.js +0 -3
- package/_assets/crumbs.styles-DZV0yuAO.js +0 -10
- package/_assets/cursor-C4vkS7KW.js +0 -4
- package/_assets/decimals-BmQMEd9E.js +0 -2
- package/_assets/decimals-DKsfBHpK.js +0 -2
- package/_assets/detectExtension-DGFEfcbz.js +0 -2
- package/_assets/errors-BByokafR.js +0 -2
- package/_assets/estimate-l1-fee-CcLIvwfc.js +0 -2
- package/_assets/eth_estimateGas-DdbpRto-.js +0 -2
- package/_assets/eth_getStorageAt-Ci_AjjHg.js +0 -2
- package/_assets/eth_getTransactionCount-0JPW5DGu.js +0 -2
- package/_assets/ethereum-DYUSvH6v.js +0 -2
- package/_assets/fetchTokenMetadata-COh3nbBL.js +0 -3
- package/_assets/get-ecosystem-wallet-info-CUi7n-IS.js +0 -2
- package/_assets/getInstalledModules-Ds73OBjY.js +0 -2
- package/_assets/getNFT-BhmiyvWi.js +0 -3
- package/_assets/getNFT-f75LggPF.js +0 -2
- package/_assets/grid.styles-C29Nyu4C.js +0 -15
- package/_assets/in-app-wallet-calls-CWLUbme4.js +0 -2
- package/_assets/index-7XMZRNJw.css +0 -1
- package/_assets/index-BFHMpeS5.js +0 -4245
- package/_assets/index-BwbCTrgE.js +0 -2
- package/_assets/index-D2yjRgpK.js +0 -28
- package/_assets/index-TSMki3gy.js +0 -2
- package/_assets/items-empty-Cmf8VL2A.js +0 -2
- package/_assets/jsxRuntime.module-BxsNWh0e.js +0 -2
- package/_assets/linkAccount-CagwoTkM.js +0 -2
- package/_assets/openzeppelin-HT89Dmzp.js +0 -2
- package/_assets/ownerOf-BAQuOyZw.js +0 -2
- package/_assets/parseNft-BLggk1FL.js +0 -3
- package/_assets/sales-empty-DW40FYSx.js +0 -2
- package/_assets/send-batch-transaction-hJ59Esjd.js +0 -2
- package/_assets/send-gasless-transaction-BjCUBumO.js +0 -3
- package/_assets/send-transaction-BNTrOtZy.js +0 -3
- package/_assets/session-request-DT1Fe144.js +0 -3
- package/_assets/skeleton.styles-6rsyfkX0.js +0 -8
- package/_assets/totalSupply-DlcDAex0.js +0 -2
- package/_assets/transactions-IudKghIO.js +0 -17
- package/_assets/useCreditPacks-BPkAbyaH.js +0 -2
- package/_assets/useTheme-Ds6wDviC.js +0 -2
- package/_assets/wait-for-tx-receipt-CGKLIxi9.js +0 -2
- package/_assets/wallet-BtqgAQr1.js +0 -2
- package/_assets/warning-circle-Dz6a5xi_.js +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index-
|
|
2
|
-
import{w as Me,a as We,l as Ie,C as k,o as Le,a5 as ye,F as W,a6 as J,A as D,Z as qe,t as H,O as x,a7 as $e,e as De,p as xe,b as ne,a8 as He,a9 as X,aa as j,L as Fe,a3 as Y,ab as Q,X as be,ac as Be}from"./W3MFrameProviderSingleton-
|
|
3
|
-
`),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=o,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return ke(this,ce,"m",Re).call(this,this,e)}}ce=new WeakSet,Re=function i(e,t){return t!=null&&t(e)?e:e.cause?ke(this,ce,"m",i).call(this,e.cause,t):e};class z extends O{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ht extends O{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ft extends O{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class gt extends O{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class mt extends O{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class Ct extends O{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function ue(i,e){var n;let t;if(typeof e.connector=="function"?t=i._internal.connectors.setup(e.connector):t=e.connector,t.uid===i.state.current)throw new ht;try{i.setState(c=>({...c,status:"connecting"})),t.emitter.emit("message",{type:"connecting"});const{connector:o,...s}=e,u=await t.connect(s);return t.emitter.off("connect",i._internal.events.connect),t.emitter.on("change",i._internal.events.change),t.emitter.on("disconnect",i._internal.events.disconnect),await((n=i.storage)==null?void 0:n.setItem("recentConnectorId",t.id)),i.setState(c=>({...c,connections:new Map(c.connections).set(t.uid,{accounts:s.withCapabilities?u.accounts.map(d=>typeof d=="object"?d.address:d):u.accounts,chainId:u.chainId,connector:t}),current:t.uid,status:"connected"})),{accounts:s.withCapabilities?u.accounts.map(c=>typeof c=="object"?c:{address:c,capabilities:{}}):u.accounts,chainId:u.chainId}}catch(o){throw i.setState(s=>({...s,status:s.current?"connected":"disconnected"})),o}}async function G(i,e={}){const{assertChainId:t=!0}=e;let n;if(e.connector){const{connector:r}=e;if(i.state.status==="reconnecting"&&!r.getAccounts&&!r.getChainId)throw new Ct({connector:r});const[l,g]=await Promise.all([r.getAccounts().catch(f=>{if(e.account===null)return[];throw f}),r.getChainId()]);n={accounts:l,chainId:g,connector:r}}else n=i.state.connections.get(i.state.current);if(!n)throw new ft;const o=e.chainId??n.chainId,s=await n.connector.getChainId();if(t&&s!==o)throw new mt({connectionChainId:o,connectorChainId:s});const u=n.connector;if(u.getClient)return u.getClient({chainId:o});const c=Te(e.account??n.accounts[0]);if(c&&(c.address=q(c.address)),e.account&&!n.accounts.some(r=>r.toLowerCase()===c.address.toLowerCase()))throw new gt({address:c.address,connector:u});const d=i.chains.find(r=>r.id===o),a=await n.connector.getProvider({chainId:o});return Pe({account:c,chain:d,name:"Connector Client",transport:r=>nt(a)({...r,retryCount:0})})}async function ve(i,e={}){var o,s;let t;if(e.connector)t=e.connector;else{const{connections:u,current:c}=i.state,d=u.get(c);t=d==null?void 0:d.connector}const n=i.state.connections;t&&(await t.disconnect(),t.emitter.off("change",i._internal.events.change),t.emitter.off("disconnect",i._internal.events.disconnect),t.emitter.on("connect",i._internal.events.connect),n.delete(t.uid)),i.setState(u=>{if(n.size===0)return{...u,connections:new Map,current:null,status:"disconnected"};const c=n.values().next().value;return{...u,connections:new Map(n),current:c.connector.uid}});{const u=i.state.current;if(!u)return;const c=(o=i.state.connections.get(u))==null?void 0:o.connector;if(!c)return;await((s=i.storage)==null?void 0:s.setItem("recentConnectorId",c.id))}}async function wt(i,e){const{chainId:t,connector:n,...o}=e;let s;e.account?s=e.account:s=(await G(i,{account:e.account,assertChainId:!1,chainId:t,connector:n})).account;const u=i.getClient({chainId:t});return U(u,Xe,"estimateGas")({...o,account:s})}async function pt(i,e){const{address:t,blockNumber:n,blockTag:o,chainId:s}=e,u=i.getClient({chainId:s}),d=await U(u,it,"getBalance")(n?{address:t,blockNumber:n}:{address:t,blockTag:o}),a=i.chains.find(r=>r.id===s)??u.chain;return{decimals:a.nativeCurrency.decimals,symbol:a.nativeCurrency.symbol,value:d}}function V(i,e){if(i===e)return!0;if(i&&e&&typeof i=="object"&&typeof e=="object"){if(i.constructor!==e.constructor)return!1;let t,n;if(Array.isArray(i)&&Array.isArray(e)){if(t=i.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!V(i[n],e[n]))return!1;return!0}if(typeof i.valueOf=="function"&&i.valueOf!==Object.prototype.valueOf)return i.valueOf()===e.valueOf();if(typeof i.toString=="function"&&i.toString!==Object.prototype.toString)return i.toString()===e.toString();const o=Object.keys(i);if(t=o.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!Object.hasOwn(e,o[n]))return!1;for(n=t;n--!==0;){const s=o[n];if(s&&!V(i[s],e[s]))return!1}return!0}return i!==i&&e!==e}function se(i){const e=i.state.current,t=i.state.connections.get(e),n=t==null?void 0:t.accounts,o=n==null?void 0:n[0],s=i.chains.find(c=>c.id===(t==null?void 0:t.chainId)),u=i.state.status;switch(u){case"connected":return{address:o,addresses:n,chain:s,chainId:t==null?void 0:t.chainId,connector:t==null?void 0:t.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:u};case"reconnecting":return{address:o,addresses:n,chain:s,chainId:t==null?void 0:t.chainId,connector:t==null?void 0:t.connector,isConnected:!!o,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:u};case"connecting":return{address:o,addresses:n,chain:s,chainId:t==null?void 0:t.chainId,connector:t==null?void 0:t.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:u};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:u}}}let Z=[];function M(i){const e=[...i.state.connections.values()];return i.state.status==="reconnecting"||V(Z,e)?Z:(Z=e,e)}async function It(i,e){const{account:t,chainId:n,connector:o,...s}=e;let u;return typeof t=="object"&&(t==null?void 0:t.type)==="local"?u=i.getClient({chainId:n}):u=await G(i,{account:t??void 0,assertChainId:!1,chainId:n,connector:o}),U(u,Ye,"prepareTransactionRequest")({...s,...t?{account:t}:{}})}let le=!1;async function he(i,e={}){var a,r;if(le)return[];le=!0,i.setState(l=>({...l,status:l.current?"reconnecting":"connecting"}));const t=[];if((a=e.connectors)!=null&&a.length)for(const l of e.connectors){let g;typeof l=="function"?g=i._internal.connectors.setup(l):g=l,t.push(g)}else t.push(...i.connectors);let n;try{n=await((r=i.storage)==null?void 0:r.getItem("recentConnectorId"))}catch{}const o={};for(const[,l]of i.state.connections)o[l.connector.id]=1;n&&(o[n]=0);const s=Object.keys(o).length>0?[...t].sort((l,g)=>(o[l.id]??10)-(o[g.id]??10)):t;let u=!1;const c=[],d=[];for(const l of s){const g=await l.getProvider().catch(()=>{});if(!g||d.some(m=>m===g)||!await l.isAuthorized())continue;const p=await l.connect({isReconnecting:!0}).catch(()=>null);p&&(l.emitter.off("connect",i._internal.events.connect),l.emitter.on("change",i._internal.events.change),l.emitter.on("disconnect",i._internal.events.disconnect),i.setState(m=>{const I=new Map(u?m.connections:new Map).set(l.uid,{accounts:p.accounts,chainId:p.chainId,connector:l});return{...m,current:u?m.current:l.uid,connections:I}}),c.push({accounts:p.accounts,chainId:p.chainId,connector:l}),d.push(g),u=!0)}return(i.state.status==="reconnecting"||i.state.status==="connecting")&&(u?i.setState(l=>({...l,status:"connected"})):i.setState(l=>({...l,connections:new Map,current:null,status:"disconnected"}))),le=!1,c}async function yt(i,e){const{account:t,chainId:n,connector:o,...s}=e;let u;typeof t=="object"&&(t==null?void 0:t.type)==="local"?u=i.getClient({chainId:n}):u=await G(i,{account:t??void 0,assertChainId:!1,chainId:n,connector:o});const c=(()=>{var r;return!n||((r=u.chain)==null?void 0:r.id)===n?u.chain:{id:n}})();return await U(u,at,"sendTransaction")({...s,...t?{account:t}:{},assertChainId:!!n,chain:c,gas:s.gas??void 0})}async function bt(i,e){const{account:t,connector:n,...o}=e;let s;return typeof t=="object"&&t.type==="local"?s=i.getClient():s=await G(i,{account:t,connector:n}),U(s,ut,"signMessage")({...o,...t?{account:t}:{}})}class L extends O{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class vt extends O{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Ae(i,e){var u;const{addEthereumChainParameter:t,chainId:n}=e,o=i.state.connections.get(((u=e.connector)==null?void 0:u.uid)??i.state.current);if(o){const c=o.connector;if(!c.switchChain)throw new vt({connector:c});return await c.switchChain({addEthereumChainParameter:t,chainId:n})}const s=i.chains.find(c=>c.id===n);if(!s)throw new z;return i.setState(c=>({...c,chainId:n})),s}async function At(i,e){const{chainId:t,timeout:n=0,...o}=e,s=i.getClient({chainId:t}),c=await U(s,st,"waitForTransactionReceipt")({...o,timeout:n});if(c.status==="reverted"){const d=U(s,ot,"getTransaction"),{from:a,...r}=await d({hash:c.transactionHash}),g=await U(s,Qe,"call")({...r,account:a,data:r.input,gasPrice:r.type!=="eip1559"?r.gasPrice:void 0,maxFeePerGas:r.type==="eip1559"?r.maxFeePerGas:void 0,maxPriorityFeePerGas:r.type==="eip1559"?r.maxPriorityFeePerGas:void 0}),f=g!=null&&g.data?Ge(`0x${g.data.substring(138)}`):"unknown reason";throw new Error(f)}return{...c,chainId:s.chain.id}}function Nt(i,e){const{onChange:t}=e;return i.subscribe(()=>se(i),t,{equalityFn(n,o){const{connector:s,...u}=n,{connector:c,...d}=o;return V(u,d)&&(s==null?void 0:s.id)===(c==null?void 0:c.id)&&(s==null?void 0:s.uid)===(c==null?void 0:c.uid)}})}function Et(i,e){const{onChange:t}=e;return i.subscribe(()=>M(i),t,{equalityFn:V})}function St(i,e){const{onChange:t}=e;return i._internal.connectors.subscribe((n,o)=>{t(Object.values(n),o)})}function _t(i,e){const{syncConnectedChain:t=i._internal.syncConnectedChain,...n}=e;let o;const s=d=>{o&&o();const a=i.getClient({chainId:d});return o=U(a,rt,"watchPendingTransactions")(n),o},u=s(e.chainId);let c;return t&&!e.chainId&&(c=i.subscribe(({chainId:d})=>d,async d=>s(d))),()=>{u==null||u(),c==null||c()}}async function Tt(i,e){const{account:t,chainId:n,connector:o,...s}=e;let u;typeof t=="object"&&(t==null?void 0:t.type)==="local"?u=i.getClient({chainId:n}):u=await G(i,{account:t??void 0,assertChainId:!1,chainId:n,connector:o});const c=(()=>{var r;return!n||((r=u.chain)==null?void 0:r.id)===n?u.chain:{id:n}})();return await U(u,dt,"writeContract")({...s,...t?{account:t}:{},assertChainId:!!n,chain:c})}function dn(i){return i}ae.type="injected";function ae(i={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:t}=i;function n(){const d=i.target;if(typeof d=="function"){const a=d();if(a)return a}return typeof d=="object"?d:typeof d=="string"?{...Pt[d]??{id:d,name:`${d[0].toUpperCase()}${d.slice(1)}`,provider:`is${d[0].toUpperCase()}${d.slice(1)}`}}:{id:"injected",name:"Injected",provider(a){return a==null?void 0:a.ethereum}}}let o,s,u,c;return d=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},type:ae.type,async setup(){const a=await this.getProvider();a!=null&&a.on&&i.target&&(u||(u=this.onConnect.bind(this),a.on("connect",u)),o||(o=this.onAccountsChanged.bind(this),a.on("accountsChanged",o)))},async connect({chainId:a,isReconnecting:r,withCapabilities:l}={}){var p,m,I,v,y,E;const g=await this.getProvider();if(!g)throw new L;let f=[];if(r)f=await this.getAccounts().catch(()=>[]);else if(e)try{f=(v=(I=(m=(p=(await g.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:p.caveats)==null?void 0:m[0])==null?void 0:I.value)==null?void 0:v.map(h=>q(h)),f.length>0&&(f=await this.getAccounts())}catch(N){const h=N;if(h.code===_.code)throw new _(h);if(h.code===de.code)throw h}try{!(f!=null&&f.length)&&!r&&(f=(await g.request({method:"eth_requestAccounts"})).map(C=>q(C))),u&&(g.removeListener("connect",u),u=void 0),o||(o=this.onAccountsChanged.bind(this),g.on("accountsChanged",o)),s||(s=this.onChainChanged.bind(this),g.on("chainChanged",s)),c||(c=this.onDisconnect.bind(this),g.on("disconnect",c));let N=await this.getChainId();if(a&&N!==a){const h=await this.switchChain({chainId:a}).catch(C=>{if(C.code===_.code)throw C;return{id:N}});N=(h==null?void 0:h.id)??N}return e&&await((y=d.storage)==null?void 0:y.removeItem(`${this.id}.disconnected`)),i.target||await((E=d.storage)==null?void 0:E.setItem("injected.connected",!0)),{accounts:l?f.map(h=>({address:h,capabilities:{}})):f,chainId:N}}catch(N){const h=N;throw h.code===_.code?new _(h):h.code===de.code?new de(h):h}},async disconnect(){var r,l;const a=await this.getProvider();if(!a)throw new L;s&&(a.removeListener("chainChanged",s),s=void 0),c&&(a.removeListener("disconnect",c),c=void 0),u||(u=this.onConnect.bind(this),a.on("connect",u));try{await We(()=>a.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await((r=d.storage)==null?void 0:r.setItem(`${this.id}.disconnected`,!0)),i.target||await((l=d.storage)==null?void 0:l.removeItem("injected.connected"))},async getAccounts(){const a=await this.getProvider();if(!a)throw new L;return(await a.request({method:"eth_accounts"})).map(l=>q(l))},async getChainId(){const a=await this.getProvider();if(!a)throw new L;const r=await a.request({method:"eth_chainId"});return Number(r)},async getProvider(){if(typeof window>"u")return;let a;const r=n();return typeof r.provider=="function"?a=r.provider(window):typeof r.provider=="string"?a=oe(window,r.provider):a=r.provider,a&&!a.removeListener&&("off"in a&&typeof a.off=="function"?a.removeListener=a.off:a.removeListener=()=>{}),a},async isAuthorized(){var a,r;try{if(e&&await((a=d.storage)==null?void 0:a.getItem(`${this.id}.disconnected`))||!i.target&&!await((r=d.storage)==null?void 0:r.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(t!==void 0&&t!==!1){const p=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",p),!!await this.getProvider()),m=typeof t=="number"?t:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(v=>window.addEventListener("ethereum#initialized",()=>v(p()),{once:!0}))]:[],new Promise(v=>setTimeout(()=>v(p()),m))]))return!0}throw new L}return!!(await Me(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:a,chainId:r}){var p,m,I,v;const l=await this.getProvider();if(!l)throw new L;const g=d.chains.find(y=>y.id===r);if(!g)throw new B(new z);const f=new Promise(y=>{const E=(N=>{"chainId"in N&&N.chainId===r&&(d.emitter.off("change",E),y())});d.emitter.on("change",E)});try{return await Promise.all([l.request({method:"wallet_switchEthereumChain",params:[{chainId:re(r)}]}).then(async()=>{await this.getChainId()===r&&d.emitter.emit("change",{chainId:r})}),f]),g}catch(y){const E=y;if(E.code===4902||((m=(p=E==null?void 0:E.data)==null?void 0:p.originalError)==null?void 0:m.code)===4902)try{const{default:N,...h}=g.blockExplorers??{};let C;a!=null&&a.blockExplorerUrls?C=a.blockExplorerUrls:N&&(C=[N.url,...Object.values(h).map(b=>b.url)]);let w;(I=a==null?void 0:a.rpcUrls)!=null&&I.length?w=a.rpcUrls:w=[((v=g.rpcUrls.default)==null?void 0:v.http[0])??""];const A={blockExplorerUrls:C,chainId:re(r),chainName:(a==null?void 0:a.chainName)??g.name,iconUrls:a==null?void 0:a.iconUrls,nativeCurrency:(a==null?void 0:a.nativeCurrency)??g.nativeCurrency,rpcUrls:w};return await Promise.all([l.request({method:"wallet_addEthereumChain",params:[A]}).then(async()=>{if(await this.getChainId()===r)d.emitter.emit("change",{chainId:r});else throw new _(new Error("User rejected switch after adding network."))}),f]),g}catch(N){throw new _(N)}throw E.code===_.code?new _(E):new B(E)}},async onAccountsChanged(a){var r;if(a.length===0)this.onDisconnect();else if(d.emitter.listenerCount("connect")){const l=(await this.getChainId()).toString();this.onConnect({chainId:l}),e&&await((r=d.storage)==null?void 0:r.removeItem(`${this.id}.disconnected`))}else d.emitter.emit("change",{accounts:a.map(l=>q(l))})},onChainChanged(a){const r=Number(a);d.emitter.emit("change",{chainId:r})},async onConnect(a){const r=await this.getAccounts();if(r.length===0)return;const l=Number(a.chainId);d.emitter.emit("connect",{accounts:r,chainId:l});const g=await this.getProvider();g&&(u&&(g.removeListener("connect",u),u=void 0),o||(o=this.onAccountsChanged.bind(this),g.on("accountsChanged",o)),s||(s=this.onChainChanged.bind(this),g.on("chainChanged",s)),c||(c=this.onDisconnect.bind(this),g.on("disconnect",c)))},async onDisconnect(a){const r=await this.getProvider();a&&a.code===1013&&r&&(await this.getAccounts()).length||(d.emitter.emit("disconnect"),r&&(s&&(r.removeListener("chainChanged",s),s=void 0),c&&(r.removeListener("disconnect",c),c=void 0),u||(u=this.onConnect.bind(this),r.on("connect",u))))}})}const Pt={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(i){return i!=null&&i.coinbaseWalletExtension?i.coinbaseWalletExtension:oe(i,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(i){return oe(i,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const t=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of t)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(i){var e,t;return(e=i==null?void 0:i.phantom)!=null&&e.ethereum?(t=i.phantom)==null?void 0:t.ethereum:oe(i,"isPhantom")}}};function oe(i,e){function t(o){return typeof e=="function"?e(o):typeof e=="string"?o[e]:!0}const n=i.ethereum;if(n!=null&&n.providers)return n.providers.find(o=>t(o));if(n&&t(n))return n}const kt=i=>(e,t,n)=>{const o=n.subscribe;return n.subscribe=(u,c,d)=>{let a=u;if(c){const r=(d==null?void 0:d.equalityFn)||Object.is;let l=u(n.getState());a=g=>{const f=u(g);if(!r(l,f)){const p=l;c(l=f,p)}},d!=null&&d.fireImmediately&&c(l,l)}return o(a)},i(e,t,n)},Rt=kt;function Ot(i,e){let t;try{t=i()}catch{return}return{getItem:o=>{var s;const u=d=>d===null?null:JSON.parse(d,void 0),c=(s=t.getItem(o))!=null?s:null;return c instanceof Promise?c.then(u):u(c)},setItem:(o,s)=>t.setItem(o,JSON.stringify(s,void 0)),removeItem:o=>t.removeItem(o)}}const me=i=>e=>{try{const t=i(e);return t instanceof Promise?t:{then(n){return me(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return me(n)(t)}}}},Ut=(i,e)=>(t,n,o)=>{let s={storage:Ot(()=>localStorage),partialize:m=>m,version:0,merge:(m,I)=>({...I,...m}),...e},u=!1;const c=new Set,d=new Set;let a=s.storage;if(!a)return i((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),t(...m)},n,o);const r=()=>{const m=s.partialize({...n()});return a.setItem(s.name,{state:m,version:s.version})},l=o.setState;o.setState=(m,I)=>{l(m,I),r()};const g=i((...m)=>{t(...m),r()},n,o);o.getInitialState=()=>g;let f;const p=()=>{var m,I;if(!a)return;u=!1,c.forEach(y=>{var E;return y((E=n())!=null?E:g)});const v=((I=s.onRehydrateStorage)==null?void 0:I.call(s,(m=n())!=null?m:g))||void 0;return me(a.getItem.bind(a))(s.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==s.version){if(s.migrate)return[!0,s.migrate(y.state,y.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var E;const[N,h]=y;if(f=s.merge(h,(E=n())!=null?E:g),t(f,!0),N)return r()}).then(()=>{v==null||v(f,void 0),f=n(),u=!0,d.forEach(y=>y(f))}).catch(y=>{v==null||v(void 0,y)})};return o.persist={setOptions:m=>{s={...s,...m},m.storage&&(a=m.storage)},clearStorage:()=>{a==null||a.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>p(),hasHydrated:()=>u,onHydrate:m=>(c.add(m),()=>{c.delete(m)}),onFinishHydration:m=>(d.add(m),()=>{d.delete(m)})},s.skipHydration||p(),f||g},jt=Ut,Ne=i=>{let e;const t=new Set,n=(a,r)=>{const l=typeof a=="function"?a(e):a;if(!Object.is(l,e)){const g=e;e=r??(typeof l!="object"||l===null)?l:Object.assign({},e,l),t.forEach(f=>f(e,g))}},o=()=>e,c={setState:n,getState:o,getInitialState:()=>d,subscribe:a=>(t.add(a),()=>t.delete(a))},d=e=i(n,o,c);return c},fe=i=>i?Ne(i):Ne;class Mt{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new et})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){const n=t[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function Wt(i){return new Mt(i)}function Lt(i,e){return JSON.parse(i,(t,n)=>{let o=n;return(o==null?void 0:o.__type)==="bigint"&&(o=BigInt(o.value)),(o==null?void 0:o.__type)==="Map"&&(o=new Map(o.value)),(e==null?void 0:e(t,o))??o})}function Ee(i,e){return i.slice(0,e).join(".")||"."}function Se(i,e){const{length:t}=i;for(let n=0;n<t;++n)if(i[n]===e)return n+1;return 0}function qt(i,e){const t=typeof i=="function",n=typeof e=="function",o=[],s=[];return function(c,d){if(typeof d=="object")if(o.length){const a=Se(o,this);a===0?o[o.length]=this:(o.splice(a),s.splice(a)),s[s.length]=c;const r=Se(o,d);if(r!==0)return n?e.call(this,c,d,Ee(s,r)):`[ref=${Ee(s,r)}]`}else o[0]=d,s[0]=c;return t?i.call(this,c,d):d}}function $t(i,e,t,n){return JSON.stringify(i,qt((o,s)=>{let u=s;return typeof u=="bigint"&&(u={__type:"bigint",value:s.toString()}),u instanceof Map&&(u={__type:"Map",value:Array.from(s.entries())}),(e==null?void 0:e(o,u))??u},n),t??void 0)}function Dt(i){const{deserialize:e=Lt,key:t="wagmi",serialize:n=$t,storage:o=Oe}=i;function s(u){return u instanceof Promise?u.then(c=>c).catch(()=>null):u}return{...o,key:t,async getItem(u,c){const d=o.getItem(`${t}.${u}`),a=await s(d);return a?e(a)??null:c??null},async setItem(u,c){const d=`${t}.${u}`;c===null?await s(o.removeItem(d)):await s(o.setItem(d,n(c)))},async removeItem(u){await s(o.removeItem(`${t}.${u}`))}}}const Oe={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function xt(){const i=typeof window<"u"&&window.localStorage?window.localStorage:Oe;return{getItem(e){return i.getItem(e)},removeItem(e){i.removeItem(e)},setItem(e,t){try{i.setItem(e,t)}catch{}}}}const Ce=256;let ee=Ce,te;function Ht(i=11){if(!te||ee+i>Ce*2){te="",ee=0;for(let e=0;e<Ce;e++)te+=(256+Math.random()*256|0).toString(16).substring(1)}return te.substring(ee,ee+++i)}function Ft(i){const{multiInjectedProviderDiscovery:e=!0,storage:t=Dt({storage:xt()}),syncConnectedChain:n=!0,ssr:o=!1,...s}=i,u=typeof window<"u"&&e?tt():void 0,c=fe(()=>s.chains),d=fe(()=>{const h=[],C=new Set;for(const w of s.connectors??[]){const A=a(w);if(h.push(A),!o&&A.rdns){const b=typeof A.rdns=="string"?[A.rdns]:A.rdns;for(const T of b)C.add(T)}}if(!o&&u){const w=u.getProviders();for(const A of w)C.has(A.info.rdns)||h.push(a(r(A)))}return h});function a(h){var b;const C=Wt(Ht());let w;const A={...h({emitter:C,chains:c.getState(),get providers(){if(!u||!w)return[];const T=typeof w=="string"?[w]:w,R=u.getProviders();return T.flatMap(K=>R.filter(P=>P.info.rdns===K))},storage:t,transports:s.transports}),emitter:C,uid:C.uid};return w=A.rdns,C.on("connect",E),(b=A.setup)==null||b.call(A),A}function r(h){const{info:C}=h,w=h.provider;return ae({target:{...C,id:C.rdns,provider:w}})}const l=new Map;function g(h={}){const C=h.chainId??I.getState().chainId,w=c.getState().find(b=>b.id===C);if(h.chainId&&!w)throw new z;{const b=l.get(I.getState().chainId);if(b&&!w)return b;if(!w)throw new z}{const b=l.get(C);if(b)return b}let A;if(s.client)A=s.client({chain:w});else{const b=w.id,T=c.getState().map(P=>P.id),R={},K=Object.entries(s);for(const[P,$]of K)if(!(P==="chains"||P==="client"||P==="connectors"||P==="transports"))if(typeof $=="object")if(b in $)R[P]=$[b];else{if(T.some(je=>je in $))continue;R[P]=$}else R[P]=$;A=Pe({...R,chain:w,batch:R.batch??{multicall:!0},transport:P=>s.transports[b]({...P,connectors:d})})}return l.set(C,A),A}function f(){return{chainId:c.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let p;const m="0.0.0-canary-";ie.startsWith(m)?p=Number.parseInt(ie.replace(m,""),10):p=Number.parseInt(ie.split(".")[0]??"0",10);const I=fe(Rt(t?jt(f,{migrate(h,C){if(C===p)return h;const w=f(),A=v(h,w.chainId);return{...w,chainId:A}},name:"store",partialize(h){return{connections:{__type:"Map",value:Array.from(h.connections.entries()).map(([C,w])=>{const{id:A,name:b,type:T,uid:R}=w.connector;return[C,{...w,connector:{id:A,name:b,type:T,uid:R}}]})},chainId:h.chainId,current:h.current}},merge(h,C){typeof h=="object"&&h&&"status"in h&&delete h.status;const w=v(h,C.chainId);return{...C,...h,chainId:w}},skipHydration:o,storage:t,version:p}):f));I.setState(f());function v(h,C){return h&&typeof h=="object"&&"chainId"in h&&typeof h.chainId=="number"&&c.getState().some(w=>w.id===h.chainId)?h.chainId:C}n&&I.subscribe(({connections:h,current:C})=>{var w;return C?(w=h.get(C))==null?void 0:w.chainId:void 0},h=>{if(c.getState().some(w=>w.id===h))return I.setState(w=>({...w,chainId:h??w.chainId}))}),u==null||u.subscribe(h=>{const C=new Set,w=new Set;for(const b of d.getState())if(C.add(b.id),b.rdns){const T=typeof b.rdns=="string"?[b.rdns]:b.rdns;for(const R of T)w.add(R)}const A=[];for(const b of h){if(w.has(b.info.rdns))continue;const T=a(r(b));C.has(T.id)||A.push(T)}t&&!I.persist.hasHydrated()||d.setState(b=>[...b,...A],!0)});function y(h){I.setState(C=>{const w=C.connections.get(h.uid);return w?{...C,connections:new Map(C.connections).set(h.uid,{accounts:h.accounts??w.accounts,chainId:h.chainId??w.chainId,connector:w.connector})}:C})}function E(h){I.getState().status==="connecting"||I.getState().status==="reconnecting"||I.setState(C=>{const w=d.getState().find(A=>A.uid===h.uid);return w?(w.emitter.listenerCount("connect")&&w.emitter.off("connect",y),w.emitter.listenerCount("change")||w.emitter.on("change",y),w.emitter.listenerCount("disconnect")||w.emitter.on("disconnect",N),{...C,connections:new Map(C.connections).set(h.uid,{accounts:h.accounts,chainId:h.chainId,connector:w}),current:h.uid,status:"connected"}):C})}function N(h){I.setState(C=>{const w=C.connections.get(h.uid);if(w){const b=w.connector;b.emitter.listenerCount("change")&&w.connector.emitter.off("change",y),b.emitter.listenerCount("disconnect")&&w.connector.emitter.off("disconnect",N),b.emitter.listenerCount("connect")||w.connector.emitter.on("connect",E)}if(C.connections.delete(h.uid),C.connections.size===0)return{...C,connections:new Map,current:null,status:"disconnected"};const A=C.connections.values().next().value;return{...C,connections:new Map(C.connections),current:A.connector.uid}})}return{get chains(){return c.getState()},get connectors(){return d.getState()},storage:t,getClient:g,get state(){return I.getState()},setState(h){let C;typeof h=="function"?C=h(I.getState()):C=h;const w=f();typeof C!="object"&&(C=w),Object.keys(w).some(b=>!(b in C))&&(C=w),I.setState(C,!0)},subscribe(h,C,w){return I.subscribe(h,C,w?{...w,fireImmediately:w.emitImmediately}:void 0)},_internal:{mipd:u,async revalidate(){const h=I.getState(),C=h.connections;let w=h.current;for(const[,A]of C){const b=A.connector;b.isAuthorized&&await b.isAuthorized()||(C.delete(b.uid),w===b.uid&&(w=null))}I.setState(A=>({...A,connections:C,current:w}))},store:I,ssr:!!o,syncConnectedChain:n,transports:s.transports,chains:{setState(h){const C=typeof h=="function"?h(c.getState()):h;if(C.length!==0)return c.setState(C,!0)},subscribe(h){return c.subscribe(h)}},connectors:{providerDetailToConnector:r,setup:a,setState(h){return d.setState(typeof h=="function"?h(d.getState()):h,!0)},subscribe(h){return d.subscribe(h)}},events:{change:y,connect:E,disconnect:N}}}}function Ue(i){let e=[],t,n;function o(c){var r,l;const d=k.getCaipNetworks(S.CHAIN.EVM);let a=Number(ge.parseEvmChainId(c));if(!d.some(g=>String(g.id)===String(c))){const g=((r=k.getActiveCaipNetwork(S.CHAIN.EVM))==null?void 0:r.id)||((l=d[0])==null?void 0:l.id);g&&Number.isInteger(Number(g))&&(a=Number(g))}if(!a)throw new Error("ChainId not found in networks");return a}function s(){var c;return t||(t=ye.getInstance({projectId:i.options.projectId,chainId:(c=J())==null?void 0:c.caipNetworkId,enableLogger:i.options.enableAuthLogger,onTimeout:d=>{d==="iframe_load_failed"?D.open(W.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):d==="iframe_request_timeout"?D.open(W.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):d==="unverified_domain"&&D.open(W.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},abortController:W.EmbeddedWalletAbortController,getActiveCaipNetwork:d=>J(d),getCaipNetworks:d=>k.getCaipNetworks(d)})),t}async function u(c={}){var m;const d=s();let a=c.chainId;if(c.isReconnecting){const I=ge.parseEvmChainId(d.getLastUsedChainId()||""),v=(m=i.chains)==null?void 0:m[0].id;if(a=I||v,!a)throw new Error("ChainId not found in provider")}const r=Ie("eip155"),{address:l,chainId:g,accounts:f}=await qe.authConnectorAuthenticate({authConnector:d,chainId:a,preferredAccountType:r,socialUri:c.socialUri,chainNamespace:S.CHAIN.EVM});e=(f==null?void 0:f.map(I=>I.address))||[l];const p=o(g);return{accounts:e,account:l,chainId:p,chain:{id:p,unsupported:!1}}}return c=>({id:S.CONNECTOR_ID.AUTH,name:S.CONNECTOR_NAMES.AUTH,type:"AUTH",chain:S.CHAIN.EVM,async connect(d={}){if(n){const r=await n;return{accounts:d.withCapabilities?r.accounts.map(l=>({address:l,capabilities:{}})):r.accounts,chainId:r.chainId}}n||(n=new Promise(r=>{r(u(d))}));const a=await n;return n=void 0,{accounts:d.withCapabilities?a.accounts.map(r=>({address:r,capabilities:{}})):a.accounts,chainId:a.chainId}},async disconnect(){await(await this.getProvider()).disconnect()},getAccounts(){return e!=null&&e.length?(c.emitter.emit("change",{accounts:e}),Promise.resolve(e)):Promise.resolve([])},async getProvider(){var d;return this.provider||(this.provider=ye.getInstance({projectId:i.options.projectId,chainId:(d=J())==null?void 0:d.caipNetworkId,enableLogger:i.options.enableAuthLogger,abortController:W.EmbeddedWalletAbortController,onTimeout:a=>{a==="iframe_load_failed"?D.open(W.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):a==="iframe_request_timeout"?D.open(W.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):a==="unverified_domain"&&D.open(W.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:a=>J(a),getCaipNetworks:a=>k.getCaipNetworks(a)})),Promise.resolve(this.provider)},async getChainId(){const d=await this.getProvider(),{chainId:a}=await d.getChainId();return o(a)},async isAuthorized(){const a=k.state.activeChain===S.CHAIN.EVM;if(S.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(g=>Le.getConnectorId(g)===S.CONNECTOR_ID.AUTH)&&!a)return!1;const l=await this.getProvider();return Promise.resolve(l.getLoginEmailUsed())},async switchChain({chainId:d}){var a;try{const r=c.chains.find(p=>p.id===d);if(!r)throw new B(new Error("chain not found on connector."));const l=await this.getProvider(),g=Ie("eip155"),f=await l.connect({chainId:d,preferredAccountType:g});return e=((a=f==null?void 0:f.accounts)==null?void 0:a.map(p=>p.address))||[f.address],c.emitter.emit("change",{chainId:Number(d),accounts:e}),r}catch(r){throw r instanceof Error?new B(r):r}},onAccountsChanged(d){d.length===0?this.onDisconnect():c.emitter.emit("change",{accounts:d.map(q)})},onChainChanged(d){const a=Number(d);c.emitter.emit("change",{chainId:a})},async onDisconnect(d){await(await this.getProvider()).disconnect()}})}pe.type="walletConnect";function pe(i){const e=i.isNewChainsStale??!0;let t,n,o,s,u,c,d;return a=>({id:"walletConnect",name:"WalletConnect",type:pe.type,provider:i.universalProvider,async setup(){const r=await this.getProvider().catch(()=>null);r&&(s||(s=this.onConnect.bind(this),r.on("connect",s)),c||(c=this.onSessionDelete.bind(this),r.on("session_delete",c)))},async connect({...r}={}){var l,g,f;try{const p=k.getCaipNetworks(),m=await this.getProvider();if(!m)throw new L;u||(u=this.onDisplayUri,m.on("display_uri",u));const I=await this.isChainsStale();m.session&&I&&await m.disconnect();const v=x.state.universalProviderConfigOverride;if(!m.session||I){const A=$e.createNamespaces(p,v);await m.connect({optionalNamespaces:A,..."pairingTopic"in r?{pairingTopic:r.pairingTopic}:{}}),this.setRequestedChainsIds(p.map(b=>Number(b.id)))}const y=await this.getAccounts(),E=await this.getChainId(),N=(f=(g=(l=m.session)==null?void 0:l.namespaces)==null?void 0:g.eip155)==null?void 0:f.chains,h=N==null?void 0:N.some(A=>Number(A.split(":")[1])===E);let C=1;h?C=E:N!=null&&N[0]&&(C=Number(N[0].split(":")[1])),u&&(m.removeListener("display_uri",u),u=void 0),s&&(m.removeListener("connect",s),s=void 0),n||(n=this.onAccountsChanged.bind(this),m.on("accountsChanged",n)),o||(o=this.onChainChanged.bind(this),m.on("chainChanged",o)),d||(d=this.onDisconnect.bind(this),m.on("disconnect",d)),c||(c=this.onSessionDelete.bind(this),m.on("session_delete",c));const w=v==null?void 0:v.defaultChain;return m.setDefaultChain(w??`eip155:${C}`),{accounts:y,chainId:C}}catch(p){throw/(user rejected|connection request reset)/i.test(p==null?void 0:p.message)?new _(p):p}},async disconnect(){const r=await this.getProvider();try{await(r==null?void 0:r.disconnect())}catch(l){if(!/No matching key/i.test(l.message))throw l}finally{o&&(r==null||r.removeListener("chainChanged",o),o=void 0),d&&(r==null||r.removeListener("disconnect",d),d=void 0),s||(s=this.onConnect.bind(this),r==null||r.on("connect",s)),n&&(r==null||r.removeListener("accountsChanged",n),n=void 0),c&&(r==null||r.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){var m,I,v;const r=await this.getProvider();if(!((m=r==null?void 0:r.session)!=null&&m.namespaces))return[];const l=(v=(I=r==null?void 0:r.session)==null?void 0:I.namespaces[S.CHAIN.EVM])==null?void 0:v.accounts,g=(l==null?void 0:l.map(y=>y.split(":")[2]))??[],f=new Set;return g.filter(y=>{const E=y==null?void 0:y.toLowerCase();return f.has(E)?!1:(f.add(E),!0)})},async getProvider({chainId:r}={}){var f,p;t||(t=i.universalProvider,t==null||t.events.setMaxListeners(Number.POSITIVE_INFINITY));const l=H.getActiveNamespace(),g=(f=k.getActiveCaipNetwork())==null?void 0:f.id;if(r&&g!==r&&l){const m=H.getStoredActiveCaipNetworkId(),I=l?k.getCaipNetworks(l):[],v=I==null?void 0:I.find(y=>y.id===m);v&&v.chainNamespace===S.CHAIN.EVM&&await((p=this.switchChain)==null?void 0:p.call(this,{chainId:Number(v.id)}))}return t},async getChainId(){var p,m,I,v;const r=(p=k.getActiveCaipNetwork(S.CHAIN.EVM))==null?void 0:p.id;if(r)return r;const g=(v=(I=(m=(await this.getProvider()).session)==null?void 0:m.namespaces[S.CHAIN.EVM])==null?void 0:I.chains)==null?void 0:v[0],f=k.getCaipNetworks().find(y=>y.id===g);return f==null?void 0:f.id},async isAuthorized(){try{const[r,l]=await Promise.all([this.getAccounts(),this.getProvider()]);return r.length?await this.isChainsStale()&&l.session?(await l.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:r,chainId:l}){var p,m,I,v;const g=await this.getProvider();if(!g)throw new L;const f=k.getCaipNetworks().find(y=>y.id===l);if(!f)throw new B(new z);try{await g.request({method:"wallet_switchEthereumChain",params:[{chainId:re(l)}]}),f!=null&&f.caipNetworkId&&g.setDefaultChain(f==null?void 0:f.caipNetworkId),a.emitter.emit("change",{chainId:Number(l)});const y=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...y,l]),{...f,id:f.id}}catch(y){const E=y;if(/(?:user rejected)/iu.test(E.message))throw new _(E);try{let N;r!=null&&r.blockExplorerUrls?N=r.blockExplorerUrls:N=(p=f.blockExplorers)!=null&&p.default.url?[(m=f.blockExplorers)==null?void 0:m.default.url]:[];const h=((v=(I=f.rpcUrls)==null?void 0:I.chainDefault)==null?void 0:v.http)||[],C={blockExplorerUrls:N,chainId:re(l),chainName:f.name,iconUrls:r==null?void 0:r.iconUrls,nativeCurrency:f.nativeCurrency,rpcUrls:h};await g.request({method:"wallet_addEthereumChain",params:[C]});const w=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...w,l]),{...f,id:f.id}}catch(N){throw new _(N)}}},onAccountsChanged(r){r.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:r.map(l=>q(l))})},onChainChanged(r){const l=Number(r);a.emitter.emit("change",{chainId:l})},onConnect(r){this.setRequestedChainsIds(k.getCaipNetworks().map(l=>Number(l.id)))},async onDisconnect(r){this.setRequestedChainsIds([]),a.emitter.emit("disconnect");const l=await this.getProvider();n&&(l.removeListener("accountsChanged",n),n=void 0),o&&(l.removeListener("chainChanged",o),o=void 0),d&&(l.removeListener("disconnect",d),d=void 0),c&&(l.removeListener("session_delete",c),c=void 0),s||(s=this.onConnect.bind(this),l.on("connect",s))},onDisplayUri(r){a.emitter.emit("message",{type:"display_uri",data:r})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var g,f,p;if(!((g=t==null?void 0:t.session)!=null&&g.namespaces))return[];const r=(p=(f=t==null?void 0:t.session)==null?void 0:f.namespaces[S.CHAIN.EVM])==null?void 0:p.accounts;return(r==null?void 0:r.map(m=>Number.parseInt(m.split(":")[1]??"")))??[]},async getRequestedChainsIds(){var l;const r=await((l=a.storage)==null?void 0:l.getItem(this.requestedChainsStorageKey))??[];return[...new Set(r)]},async isChainsStale(){if(!e)return!1;const r=a.chains.map(f=>f.id),l=this.getNamespaceChainsIds();if(l.length&&!l.some(f=>r.includes(f)))return!1;const g=await this.getRequestedChainsIds();return!r.every(f=>g.includes(Number(f)))},async setRequestedChainsIds(r){var l;await((l=a.storage)==null?void 0:l.setItem(this.requestedChainsStorageKey,r))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}const F=xe({pendingTransactions:0}),_e={state:F,subscribeKey(i,e){return De(F,i,e)},increase(i){F[i]+=1},decrease(i){F[i]-=1},reset(i){F[i]=0}};async function Bt(i){if(ne.isSafeApp()){const{safe:e}=await we(async()=>{const{safe:t}=await import("./index-CRi7V83H.js");return{safe:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(e&&!i.some(t=>t.type==="safe"))return e()}return null}async function zt(i){try{const{baseAccount:e}=await we(async()=>{const{baseAccount:t}=await import("./index-CRi7V83H.js");return{baseAccount:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(e&&!i.some(t=>t.id==="baseAccount"))return e()}catch(e){console.error("Failed to import Base Account SDK:",e)}return null}async function Vt(i){try{const{coinbaseWallet:e}=await we(async()=>{const{coinbaseWallet:t}=await import("./index-CRi7V83H.js");return{coinbaseWallet:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(e&&!i.some(t=>t.id==="coinbaseWallet"))return e()}catch(e){console.error("Failed to import Coinbase Wallet SDK:",e)}return null}const Gt={enable:!1,pollingInterval:3e4};class Kt extends He{constructor(e){const t=X.extendCaipNetworks(e.networks,{projectId:e.projectId,customNetworkImageUrls:{},customRpcUrls:e.customRpcUrls});super(),this.balancePromises={},this.namespace=S.CHAIN.EVM,this.adapterType=S.ADAPTER_TYPES.WAGMI,this.projectId=e.projectId,this.pendingTransactionsFilter={...Gt,...e.pendingTransactionsFilter??{}},this.createConfig({...e,networks:t}),this.checkChainId()}construct(e){this.checkChainId(),this.setupWatchers()}async getAccounts(e){const t=this.getWagmiConnector(e.id);if(!t)return{accounts:[]};if(t.id===S.CONNECTOR_ID.AUTH){const u=await t.getProvider();if(!(u!=null&&u.user))return{accounts:[]};const{address:c,accounts:d,chainId:a}=u.user;return Promise.resolve({accounts:(d||[{address:c,type:"eoa"}]).map(r=>ne.createAccount({caipAddress:`eip155:${a}:${r.address}`,type:r.type}))})}const{addresses:n,address:o,chainId:s}=se(this.wagmiConfig);return Promise.resolve({accounts:s?[...new Set(n||[o])].map(u=>ne.createAccount({caipAddress:`eip155:${s}:${u||""}`,type:"eoa"})):[]})}checkChainId(){const{chainId:e}=se(this.wagmiConfig);e&&this.emit("switchNetwork",{chainId:e})}getWagmiConnector(e){return this.wagmiConfig.connectors.find(t=>t.id===e)}createConfig(e){this.wagmiChains=e.networks.filter(o=>o.chainNamespace===S.CHAIN.EVM);const t={},n=[...e.connectors??[]];this.wagmiChains.forEach(o=>{var c,d;const s=(c=e.transports)==null?void 0:c[o.id],u=X.getCaipNetworkId(o);s?t[o.id]=X.extendWagmiTransports(o,e.projectId,s):t[o.id]=X.getViemTransport(o,e.projectId,(d=e.customRpcUrls)==null?void 0:d[u])}),this.wagmiConfig=Ft({...e,chains:this.wagmiChains,connectors:n,transports:t})}setupWatchPendingTransactions(){if(!this.pendingTransactionsFilter.enable||this.unwatchPendingTransactions)return;this.unwatchPendingTransactions=_t(this.wagmiConfig,{pollingInterval:this.pendingTransactionsFilter.pollingInterval,onError:()=>{},onTransactions:()=>{this.emit("pendingTransactions"),_e.increase("pendingTransactions")}});const e=_e.subscribeKey("pendingTransactions",t=>{var n;t>=S.LIMITS.PENDING_TRANSACTIONS&&((n=this.unwatchPendingTransactions)==null||n.call(this),e())})}setupWatchers(){Et(this.wagmiConfig,{onChange:e=>{this.clearConnections(),this.addConnection(...e.map(t=>{const n=this.getCaipNetworks().find(s=>s.id===t.chainId),o=t.connector.id===S.CONNECTOR_ID.AUTH;return{accounts:t.accounts.map(s=>({address:this.toChecksummedAddress(s)})),caipNetwork:n,connectorId:t.connector.id,auth:o?{name:H.getConnectedSocialProvider(),username:H.getConnectedSocialUsername()}:void 0}}))}}),Nt(this.wagmiConfig,{onChange:(e,t)=>{var n;if(e.status==="disconnected"&&t.address&&this.emit("disconnect"),e!=null&&e.chainId&&(e==null?void 0:e.chainId)!==(t==null?void 0:t.chainId)&&this.emit("switchNetwork",{chainId:e.chainId}),e.status==="connected"){const o=e.address!==(t==null?void 0:t.address),s=e.connector.id!==((n=t.connector)==null?void 0:n.id),u=t.status!=="connected";(o||s||u)&&(this.setupWatchPendingTransactions(),this.handleAccountChanged({address:e.address,chainId:e.chainId,connector:e.connector}))}}})}async addThirdPartyConnectors(){const e=[],{enableCoinbase:t,enableBaseAccount:n}=x.state||{};if(n!==!1){const s=await zt(this.wagmiConfig.connectors);s&&e.push(s)}if(t!==!1){const s=await Vt(this.wagmiConfig.connectors);s&&e.push(s)}const o=await Bt(this.wagmiConfig.connectors);o&&e.push(o),await Promise.all(e.map(s=>{const u=this.configureInternalConnector(s);return this.addWagmiConnector(u)}))}addWagmiConnectors(){const e=[];x.state.enableInjected!==!1&&e.push(ae({shimDisconnect:!0}));const{features:t,remoteFeatures:n,projectId:o,enableAuthLogger:s}=x.state,u=(n==null?void 0:n.email)??(t==null?void 0:t.email)??!0,c=(n==null?void 0:n.socials)??(t==null?void 0:t.socials),d=Array.isArray(c)&&(c==null?void 0:c.length)>0;(u||d)&&e.push(Ue({chains:this.wagmiChains,options:{projectId:o,enableAuthLogger:s}})),e.forEach(a=>{this.configureInternalConnector(a)})}configureInternalConnector(e){const t=this.wagmiConfig._internal.connectors.setup(e);return this.wagmiConfig._internal.connectors.setState(n=>[...n,t]),t}async handleAccountChanged({address:e,chainId:t,connector:n}){if(!this.namespace)throw new Error("WagmiAdapter:handleAccountChanged - namespace is required");const o=await n.getProvider().catch(()=>{});this.emit("accountChanged",{address:this.toChecksummedAddress(e),chainId:t,connector:{id:n.id,name:j.ConnectorNamesMap[n.id]??n.name,imageId:j.ConnectorImageIds[n.id],type:j.ConnectorTypesMap[n.type]??"EXTERNAL",info:n.id===S.CONNECTOR_ID.INJECTED?void 0:{rdns:n.id},provider:o,chain:this.namespace,chains:[]}})}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async signMessage(e){try{return{signature:await bt(this.wagmiConfig,{message:e.message,account:e.address})}}catch{throw new Error("WagmiAdapter:signMessage - Sign message failed")}}async sendTransaction(e){var c;const{chainId:t,address:n}=se(this.wagmiConfig),o=(c=this.wagmiChains)==null?void 0:c.find(d=>d.id===t),s={account:n,to:e.to,value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,data:e.data,chain:o,type:"legacy",parameters:["nonce"]};await It(this.wagmiConfig,s);const u=await yt(this.wagmiConfig,s);return await At(this.wagmiConfig,{hash:u,timeout:25e3}),{hash:u}}async writeContract(e){var c;const{caipNetwork:t,...n}=e,o=Number(ge.caipNetworkIdToNumber(t.caipNetworkId)),s=(c=this.wagmiChains)==null?void 0:c.find(d=>d.id===o);return{hash:await Tt(this.wagmiConfig,{chain:s,address:n.tokenAddress,account:n.fromAddress,abi:n.abi,functionName:n.method,args:n.args,__mode:"prepared"})}}async estimateGas(e){try{return{gas:await wt(this.wagmiConfig,{account:e.address,to:e.to,data:e.data,type:"legacy"})}}catch{throw new Error("WagmiAdapter:estimateGas - error estimating gas")}}parseUnits(e){return ct(e.value,e.decimals)}formatUnits(e){return Ke(e.value,e.decimals)}async addWagmiConnector(e){if(!this.namespace)throw new Error("WagmiAdapter:addWagmiConnector - namespace is required");const{enableEIP6963:t,enableInjected:n}=x.state||{},o=e.type===S.CONNECTOR_ID.INJECTED,s=e.id===S.CONNECTOR_ID.INJECTED,u=o&&!s;if(s&&n===!1||u&&t===!1||e.id===S.CONNECTOR_ID.AUTH||e.id===S.CONNECTOR_ID.WALLET_CONNECT)return;let c;e.id!==S.CONNECTOR_ID.BASE_ACCOUNT&&(c=await e.getProvider().catch(()=>{}));const d=Fe.state.connectorImages;this.addConnector({id:e.id,explorerId:j.ConnectorExplorerIds[e.id]??j.ConnectorExplorerIds[e.name],imageUrl:(d==null?void 0:d[e.id])??e.icon,name:j.ConnectorNamesMap[e.id]??e.name,imageId:j.ConnectorImageIds[e.id],type:j.ConnectorTypesMap[e.type]??"EXTERNAL",info:e.id===S.CONNECTOR_ID.INJECTED?void 0:{rdns:e.id},provider:c,chain:this.namespace,chains:[]})}async syncConnectors(){St(this.wagmiConfig,{onChange:e=>{e.forEach(t=>this.addWagmiConnector(t))}}),this.addWagmiConnectors(),await Promise.all(this.wagmiConfig.connectors.map(e=>this.addWagmiConnector(e))),await this.addThirdPartyConnectors()}async syncConnections(){const e=this.connectors.filter(t=>{const{hasDisconnected:n,hasConnected:o}=Y.getConnectorStorageInfo(t.id,this.namespace);return!n&&o}).map(t=>this.getWagmiConnector(t.id)).filter(Boolean);await he(this.wagmiConfig,{connectors:e})}async syncConnection(e){var a,r;const{id:t,chainId:n}=e,s=M(this.wagmiConfig).find(l=>l.connector.id===t),u=this.getWagmiConnector(t),c=await(u==null?void 0:u.getProvider());if(ne.isSafeApp()&&t===S.CONNECTOR_ID.SAFE&&!(s!=null&&s.accounts.length)){const l=this.getWagmiConnector("safe");if(l){const g=await ue(this.wagmiConfig,{connector:l,chainId:Number(n)}),f=await l.getProvider();return{chainId:Number(n),address:this.toChecksummedAddress(g.accounts[0]),provider:f,type:(a=s==null?void 0:s.connector.type)==null?void 0:a.toUpperCase(),id:s==null?void 0:s.connector.id}}}return{chainId:Number(s==null?void 0:s.chainId),address:this.toChecksummedAddress(s==null?void 0:s.accounts[0]),provider:c,type:(r=s==null?void 0:s.connector.type)==null?void 0:r.toUpperCase(),id:s==null?void 0:s.connector.id}}async connectWalletConnect(e){try{const t=this.getWalletConnectConnector();await t.authenticate();const n=this.getWagmiConnector("walletConnect");if(!n)throw new Error("UniversalAdapter:connectWalletConnect - connector not found");const o=await ue(this.wagmiConfig,{connector:n,chainId:e?Number(e):void 0});return o.chainId!==Number(e)&&await Ae(this.wagmiConfig,{chainId:o.chainId}),{clientId:await t.provider.client.core.crypto.getClientId()}}catch(t){throw t instanceof _?new Q(t):be.isUserRejectedRequestError(t)?new Q(t):t}}async connect(e){var t,n,o,s,u;try{const{id:c,address:d,provider:a,type:r,info:l,chainId:g,socialUri:f}=e,p=this.getWagmiConnector(c);if(!p)throw new Error("connectionControllerClient:connectExternal - connector is undefined");a&&l&&p.id===S.CONNECTOR_ID.EIP6963&&((t=p.setEip6963Wallet)==null||t.call(p,{provider:a,info:l}));const m=(o=(n=this.wagmiConfig.state)==null?void 0:n.connections)==null?void 0:o.get(p.uid);if(m){await((s=this.wagmiConfig.storage)==null?void 0:s.setItem("recentConnectorId",p.id));const y=[...m.accounts].sort((E,N)=>Y.isLowerCaseMatch(E,d)?-1:Y.isLowerCaseMatch(N,d)?1:0);return(u=this.wagmiConfig)==null||u.setState(E=>({...E,connections:new Map(E.connections).set(p.uid,{accounts:y,chainId:m.chainId,connector:m.connector}),current:p.uid,status:"connected"})),{address:this.toChecksummedAddress(y[0]),chainId:m.chainId,provider:a,type:r,id:c}}const I=await ue(this.wagmiConfig,{connector:p,chainId:g?Number(g):void 0,socialUri:f}),v=a??await p.getProvider();return{address:this.toChecksummedAddress(I.accounts[0]),chainId:I.chainId,provider:v,type:r,id:c}}catch(c){throw c instanceof _?new Q(c):be.isUserRejectedRequestError(c)?new Q(c):c}}get connections(){return Array.from(this.wagmiConfig.state.connections.values()).map(e=>({accounts:e.accounts.map(t=>({address:this.toChecksummedAddress(t)})),connectorId:e.connector.id}))}async reconnect(e){const{id:t}=e,n=this.getWagmiConnector(t);if(!n)throw new Error("connectionControllerClient:connectExternal - connector is undefined");await he(this.wagmiConfig,{connectors:[n]})}async getBalance(e){const t=e.address,n=this.getCaipNetworks().find(o=>o.id===e.chainId);if(!t)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(n&&this.wagmiConfig){const o=`${n.caipNetworkId}:${e.address}`,s=this.balancePromises[o];if(s)return s;const u=H.getNativeBalanceCacheForCaipAddress(o);return u?{balance:u.balance,symbol:u.symbol}:(this.balancePromises[o]=new Promise(async c=>{var d,a;try{const r=Number(e.chainId),l=await pt(this.wagmiConfig,{address:e.address,chainId:r,token:(a=(d=e.tokens)==null?void 0:d[n.caipNetworkId])==null?void 0:a.address});H.updateNativeBalanceCache({caipAddress:o,balance:l.formatted,symbol:l.symbol,timestamp:Date.now()}),c({balance:l.formatted,symbol:l.symbol})}catch(r){console.warn("Appkit:WagmiAdapter:getBalance - Error getting balance",r),c({balance:"0.00",symbol:"ETH"})}}).finally(()=>{delete this.balancePromises[o]}),this.balancePromises[o]||{balance:"0.00",symbol:"ETH"})}return{balance:"",symbol:""}}getWalletConnectProvider(){var e;return(e=this.getWagmiConnector("walletConnect"))==null?void 0:e.provider}async disconnect(e){if(e.id){const t=this.getWagmiConnector(e.id),o=M(this.wagmiConfig).find(s=>Y.isLowerCaseMatch(s.connector.id,e.id));return await ve(this.wagmiConfig,{connector:t}),x.state.enableReconnect===!1&&this.deleteConnection(e.id),o?{connections:[{accounts:o.accounts.map(s=>({address:this.toChecksummedAddress(s)})),connectorId:o.connector.id}]}:{connections:[]}}return this.disconnectAll()}async disconnectAll(){const e=M(this.wagmiConfig),t=await Promise.allSettled(e.map(async n=>{const o=this.getWagmiConnector(n.connector.id);return o&&await ve(this.wagmiConfig,{connector:o}),n}));return this.wagmiConfig.state.connections.clear(),{connections:t.filter(n=>n.status==="fulfilled").map(({value:n})=>({accounts:n.accounts.map(o=>({address:this.toChecksummedAddress(o)})),connectorId:n.connector.id}))}}async switchNetwork(e){var f,p,m,I,v;const{caipNetwork:t}=e,n=this.wagmiConfig.chains.find(y=>y.id.toString()===t.id.toString());if(!n)throw new Error("connectionControllerClient:switchNetwork - wagmiChain is undefined");const{name:o,nativeCurrency:s,rpcUrls:u,blockExplorers:c,id:d}=n,a=((m=(p=(f=t.rpcUrls)==null?void 0:f.chainDefault)==null?void 0:p.http)==null?void 0:m[0])??u.default.http[0]??"",r=(c==null?void 0:c.default.url)??((v=(I=t.blockExplorers)==null?void 0:I.default)==null?void 0:v.url)??"",l=s??t.nativeCurrency,g=o??t.name;await Ae(this.wagmiConfig,{chainId:d,addEthereumChainParameter:{chainName:g,nativeCurrency:l,rpcUrls:[a],blockExplorerUrls:[r]}}),await super.switchNetwork(e)}async getCapabilities(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:getCapabilities - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:getCapabilities - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");return await s.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:grantPermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:grantPermissions - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return s.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:revokePermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:revokePermissions - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:revokePermissions - provider is undefined");return s.request({method:"wallet_revokePermissions",params:e})}async walletGetAssets(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:walletGetAssets - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:walletGetAssets - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:walletGetAssets - provider is undefined");return s.request({method:"wallet_getAssets",params:[e]})}setAuthProvider(e){if(!this.namespace)throw new Error("WagmiAdapter:setAuthProvider - namespace is required");this.addConnector({id:S.CONNECTOR_ID.AUTH,type:"AUTH",name:S.CONNECTOR_NAMES.AUTH,provider:e,imageId:j.ConnectorImageIds[S.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}async setUniversalProvider(e){e.on("connect",()=>{const n=M(this.wagmiConfig),o=this.getWagmiConnector("walletConnect");if(o&&!n.find(s=>s.connector.id===o.id)){if(k.state.activeChain==="eip155")return;he(this.wagmiConfig,{connectors:[o]})}});const t=pe({universalProvider:e});return this.configureInternalConnector(t),this.addConnector(new Be({provider:e,caipNetworks:this.getCaipNetworks(),namespace:"eip155"})),Promise.resolve()}toChecksummedAddress(e){if(!e)return e;try{return Ze(e.toLowerCase())}catch{return e}}}const un=Object.freeze(Object.defineProperty({__proto__:null,WagmiAdapter:Kt,authConnector:Ue},Symbol.toStringTag,{value:"Module"}));export{z as C,L as P,ft as a,un as b,dn as c,ae as i};
|
|
4
|
-
//# sourceMappingURL=index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index-DFZUBMdj.js","_assets/index-S5YYeBud.js","_assets/react-CHXQAvvP.js","_assets/dcl-schemas-DslZmh30.js","_assets/sentry-ClHMnYE5.js","_assets/ethers-DeUFwKFN.js","_assets/intl-AKLEHPeO.js","_assets/index-VPT5QlB0.css","_assets/sendRawTransaction-B1LqwDVj.js","_assets/NetworkUtil-DY5iDBkb.js","_assets/W3MFrameProviderSingleton-C-8Y7xjF.js","_assets/index-Cxyjs4LG.js","_assets/index-BoY04MqE.js","_assets/events-D_yhp3Xa.js","_assets/browser-ponyfill-Dc2JIprt.js","_assets/custom-DJcPO2TV.js","_assets/index-Uqsfnm5F.js","_assets/index-CFNCKm4k.js","_assets/store-80QKZ2rN.js","_assets/writeContract-BKBT7KZ8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{w as Me,a as We,l as Ie,C as k,o as Le,a5 as ye,F as W,a6 as J,A as D,Z as qe,t as H,O as x,a7 as $e,e as De,p as xe,b as ne,a8 as He,a9 as X,aa as j,L as Fe,a3 as Y,ab as Q,X as be,ac as Be}from"./W3MFrameProviderSingleton-C-8Y7xjF.js";import{al as ze,ao as Ve,ab as Ge,x as B,af as re,Y as _,r as de,au as S,az as ge,a4 as Ke}from"./NetworkUtil-DY5iDBkb.js";import{b7 as Je,bh as Te,aI as q,cv as Xe,bc as Ye,bi as Qe,ah as Ze}from"./sendRawTransaction-B1LqwDVj.js";import"./dcl-schemas-DslZmh30.js";import"./index-Cxyjs4LG.js";import"./index-BoY04MqE.js";import"./browser-ponyfill-Dc2JIprt.js";import{_ as we}from"./index-S5YYeBud.js";import{E as et}from"./index-Uqsfnm5F.js";import{c as tt}from"./store-80QKZ2rN.js";import{c as Pe,a as nt,g as it,b as st,d as ot,e as rt,p as ct}from"./custom-DJcPO2TV.js";import{s as at,w as dt}from"./writeContract-BKBT7KZ8.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="1ea6ffae-4f50-4473-ada9-a0342c30edf7",i._sentryDebugIdIdentifier="sentry-dbid-1ea6ffae-4f50-4473-ada9-a0342c30edf7")}catch{}})();async function ut(i,{account:e=i.account,message:t}){if(!e)throw new Je({docsPath:"/docs/actions/wallet/signMessage"});const n=Te(e);if(n.signMessage)return n.signMessage({message:t});const o=typeof t=="string"?ze(t):t.raw instanceof Uint8Array?Ve(t.raw):t.raw;return i.request({method:"personal_sign",params:[o,n.address]},{retryCount:0})}function U(i,e,t){const n=i[e.name];if(typeof n=="function")return n;const o=i[t];return typeof o=="function"?o:s=>e(i,s)}const ie="3.5.5",lt=()=>`@wagmi/core@${ie}`;var ke=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},ce,Re;class O extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return lt()}constructor(e,t={}){var s;super(),ce.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=t.cause instanceof O?t.cause.details:(s=t.cause)!=null&&s.message?t.cause.message:t.details,o=t.cause instanceof O&&t.cause.docsPath||t.docsPath;this.message=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...o?[`Docs: ${this.docsBaseUrl}${o}.html${t.docsSlug?`#${t.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(`
|
|
3
|
+
`),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=o,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return ke(this,ce,"m",Re).call(this,this,e)}}ce=new WeakSet,Re=function i(e,t){return t!=null&&t(e)?e:e.cause?ke(this,ce,"m",i).call(this,e.cause,t):e};class z extends O{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ht extends O{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ft extends O{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class gt extends O{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class mt extends O{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class Ct extends O{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function ue(i,e){var n;let t;if(typeof e.connector=="function"?t=i._internal.connectors.setup(e.connector):t=e.connector,t.uid===i.state.current)throw new ht;try{i.setState(c=>({...c,status:"connecting"})),t.emitter.emit("message",{type:"connecting"});const{connector:o,...s}=e,u=await t.connect(s);return t.emitter.off("connect",i._internal.events.connect),t.emitter.on("change",i._internal.events.change),t.emitter.on("disconnect",i._internal.events.disconnect),await((n=i.storage)==null?void 0:n.setItem("recentConnectorId",t.id)),i.setState(c=>({...c,connections:new Map(c.connections).set(t.uid,{accounts:s.withCapabilities?u.accounts.map(d=>typeof d=="object"?d.address:d):u.accounts,chainId:u.chainId,connector:t}),current:t.uid,status:"connected"})),{accounts:s.withCapabilities?u.accounts.map(c=>typeof c=="object"?c:{address:c,capabilities:{}}):u.accounts,chainId:u.chainId}}catch(o){throw i.setState(s=>({...s,status:s.current?"connected":"disconnected"})),o}}async function G(i,e={}){const{assertChainId:t=!0}=e;let n;if(e.connector){const{connector:r}=e;if(i.state.status==="reconnecting"&&!r.getAccounts&&!r.getChainId)throw new Ct({connector:r});const[l,g]=await Promise.all([r.getAccounts().catch(f=>{if(e.account===null)return[];throw f}),r.getChainId()]);n={accounts:l,chainId:g,connector:r}}else n=i.state.connections.get(i.state.current);if(!n)throw new ft;const o=e.chainId??n.chainId,s=await n.connector.getChainId();if(t&&s!==o)throw new mt({connectionChainId:o,connectorChainId:s});const u=n.connector;if(u.getClient)return u.getClient({chainId:o});const c=Te(e.account??n.accounts[0]);if(c&&(c.address=q(c.address)),e.account&&!n.accounts.some(r=>r.toLowerCase()===c.address.toLowerCase()))throw new gt({address:c.address,connector:u});const d=i.chains.find(r=>r.id===o),a=await n.connector.getProvider({chainId:o});return Pe({account:c,chain:d,name:"Connector Client",transport:r=>nt(a)({...r,retryCount:0})})}async function ve(i,e={}){var o,s;let t;if(e.connector)t=e.connector;else{const{connections:u,current:c}=i.state,d=u.get(c);t=d==null?void 0:d.connector}const n=i.state.connections;t&&(await t.disconnect(),t.emitter.off("change",i._internal.events.change),t.emitter.off("disconnect",i._internal.events.disconnect),t.emitter.on("connect",i._internal.events.connect),n.delete(t.uid)),i.setState(u=>{if(n.size===0)return{...u,connections:new Map,current:null,status:"disconnected"};const c=n.values().next().value;return{...u,connections:new Map(n),current:c.connector.uid}});{const u=i.state.current;if(!u)return;const c=(o=i.state.connections.get(u))==null?void 0:o.connector;if(!c)return;await((s=i.storage)==null?void 0:s.setItem("recentConnectorId",c.id))}}async function wt(i,e){const{chainId:t,connector:n,...o}=e;let s;e.account?s=e.account:s=(await G(i,{account:e.account,assertChainId:!1,chainId:t,connector:n})).account;const u=i.getClient({chainId:t});return U(u,Xe,"estimateGas")({...o,account:s})}async function pt(i,e){const{address:t,blockNumber:n,blockTag:o,chainId:s}=e,u=i.getClient({chainId:s}),d=await U(u,it,"getBalance")(n?{address:t,blockNumber:n}:{address:t,blockTag:o}),a=i.chains.find(r=>r.id===s)??u.chain;return{decimals:a.nativeCurrency.decimals,symbol:a.nativeCurrency.symbol,value:d}}function V(i,e){if(i===e)return!0;if(i&&e&&typeof i=="object"&&typeof e=="object"){if(i.constructor!==e.constructor)return!1;let t,n;if(Array.isArray(i)&&Array.isArray(e)){if(t=i.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!V(i[n],e[n]))return!1;return!0}if(typeof i.valueOf=="function"&&i.valueOf!==Object.prototype.valueOf)return i.valueOf()===e.valueOf();if(typeof i.toString=="function"&&i.toString!==Object.prototype.toString)return i.toString()===e.toString();const o=Object.keys(i);if(t=o.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!Object.hasOwn(e,o[n]))return!1;for(n=t;n--!==0;){const s=o[n];if(s&&!V(i[s],e[s]))return!1}return!0}return i!==i&&e!==e}function se(i){const e=i.state.current,t=i.state.connections.get(e),n=t==null?void 0:t.accounts,o=n==null?void 0:n[0],s=i.chains.find(c=>c.id===(t==null?void 0:t.chainId)),u=i.state.status;switch(u){case"connected":return{address:o,addresses:n,chain:s,chainId:t==null?void 0:t.chainId,connector:t==null?void 0:t.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:u};case"reconnecting":return{address:o,addresses:n,chain:s,chainId:t==null?void 0:t.chainId,connector:t==null?void 0:t.connector,isConnected:!!o,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:u};case"connecting":return{address:o,addresses:n,chain:s,chainId:t==null?void 0:t.chainId,connector:t==null?void 0:t.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:u};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:u}}}let Z=[];function M(i){const e=[...i.state.connections.values()];return i.state.status==="reconnecting"||V(Z,e)?Z:(Z=e,e)}async function It(i,e){const{account:t,chainId:n,connector:o,...s}=e;let u;return typeof t=="object"&&(t==null?void 0:t.type)==="local"?u=i.getClient({chainId:n}):u=await G(i,{account:t??void 0,assertChainId:!1,chainId:n,connector:o}),U(u,Ye,"prepareTransactionRequest")({...s,...t?{account:t}:{}})}let le=!1;async function he(i,e={}){var a,r;if(le)return[];le=!0,i.setState(l=>({...l,status:l.current?"reconnecting":"connecting"}));const t=[];if((a=e.connectors)!=null&&a.length)for(const l of e.connectors){let g;typeof l=="function"?g=i._internal.connectors.setup(l):g=l,t.push(g)}else t.push(...i.connectors);let n;try{n=await((r=i.storage)==null?void 0:r.getItem("recentConnectorId"))}catch{}const o={};for(const[,l]of i.state.connections)o[l.connector.id]=1;n&&(o[n]=0);const s=Object.keys(o).length>0?[...t].sort((l,g)=>(o[l.id]??10)-(o[g.id]??10)):t;let u=!1;const c=[],d=[];for(const l of s){const g=await l.getProvider().catch(()=>{});if(!g||d.some(m=>m===g)||!await l.isAuthorized())continue;const p=await l.connect({isReconnecting:!0}).catch(()=>null);p&&(l.emitter.off("connect",i._internal.events.connect),l.emitter.on("change",i._internal.events.change),l.emitter.on("disconnect",i._internal.events.disconnect),i.setState(m=>{const I=new Map(u?m.connections:new Map).set(l.uid,{accounts:p.accounts,chainId:p.chainId,connector:l});return{...m,current:u?m.current:l.uid,connections:I}}),c.push({accounts:p.accounts,chainId:p.chainId,connector:l}),d.push(g),u=!0)}return(i.state.status==="reconnecting"||i.state.status==="connecting")&&(u?i.setState(l=>({...l,status:"connected"})):i.setState(l=>({...l,connections:new Map,current:null,status:"disconnected"}))),le=!1,c}async function yt(i,e){const{account:t,chainId:n,connector:o,...s}=e;let u;typeof t=="object"&&(t==null?void 0:t.type)==="local"?u=i.getClient({chainId:n}):u=await G(i,{account:t??void 0,assertChainId:!1,chainId:n,connector:o});const c=(()=>{var r;return!n||((r=u.chain)==null?void 0:r.id)===n?u.chain:{id:n}})();return await U(u,at,"sendTransaction")({...s,...t?{account:t}:{},assertChainId:!!n,chain:c,gas:s.gas??void 0})}async function bt(i,e){const{account:t,connector:n,...o}=e;let s;return typeof t=="object"&&t.type==="local"?s=i.getClient():s=await G(i,{account:t,connector:n}),U(s,ut,"signMessage")({...o,...t?{account:t}:{}})}class L extends O{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class vt extends O{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Ae(i,e){var u;const{addEthereumChainParameter:t,chainId:n}=e,o=i.state.connections.get(((u=e.connector)==null?void 0:u.uid)??i.state.current);if(o){const c=o.connector;if(!c.switchChain)throw new vt({connector:c});return await c.switchChain({addEthereumChainParameter:t,chainId:n})}const s=i.chains.find(c=>c.id===n);if(!s)throw new z;return i.setState(c=>({...c,chainId:n})),s}async function At(i,e){const{chainId:t,timeout:n=0,...o}=e,s=i.getClient({chainId:t}),c=await U(s,st,"waitForTransactionReceipt")({...o,timeout:n});if(c.status==="reverted"){const d=U(s,ot,"getTransaction"),{from:a,...r}=await d({hash:c.transactionHash}),g=await U(s,Qe,"call")({...r,account:a,data:r.input,gasPrice:r.type!=="eip1559"?r.gasPrice:void 0,maxFeePerGas:r.type==="eip1559"?r.maxFeePerGas:void 0,maxPriorityFeePerGas:r.type==="eip1559"?r.maxPriorityFeePerGas:void 0}),f=g!=null&&g.data?Ge(`0x${g.data.substring(138)}`):"unknown reason";throw new Error(f)}return{...c,chainId:s.chain.id}}function Nt(i,e){const{onChange:t}=e;return i.subscribe(()=>se(i),t,{equalityFn(n,o){const{connector:s,...u}=n,{connector:c,...d}=o;return V(u,d)&&(s==null?void 0:s.id)===(c==null?void 0:c.id)&&(s==null?void 0:s.uid)===(c==null?void 0:c.uid)}})}function Et(i,e){const{onChange:t}=e;return i.subscribe(()=>M(i),t,{equalityFn:V})}function St(i,e){const{onChange:t}=e;return i._internal.connectors.subscribe((n,o)=>{t(Object.values(n),o)})}function _t(i,e){const{syncConnectedChain:t=i._internal.syncConnectedChain,...n}=e;let o;const s=d=>{o&&o();const a=i.getClient({chainId:d});return o=U(a,rt,"watchPendingTransactions")(n),o},u=s(e.chainId);let c;return t&&!e.chainId&&(c=i.subscribe(({chainId:d})=>d,async d=>s(d))),()=>{u==null||u(),c==null||c()}}async function Tt(i,e){const{account:t,chainId:n,connector:o,...s}=e;let u;typeof t=="object"&&(t==null?void 0:t.type)==="local"?u=i.getClient({chainId:n}):u=await G(i,{account:t??void 0,assertChainId:!1,chainId:n,connector:o});const c=(()=>{var r;return!n||((r=u.chain)==null?void 0:r.id)===n?u.chain:{id:n}})();return await U(u,dt,"writeContract")({...s,...t?{account:t}:{},assertChainId:!!n,chain:c})}function dn(i){return i}ae.type="injected";function ae(i={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:t}=i;function n(){const d=i.target;if(typeof d=="function"){const a=d();if(a)return a}return typeof d=="object"?d:typeof d=="string"?{...Pt[d]??{id:d,name:`${d[0].toUpperCase()}${d.slice(1)}`,provider:`is${d[0].toUpperCase()}${d.slice(1)}`}}:{id:"injected",name:"Injected",provider(a){return a==null?void 0:a.ethereum}}}let o,s,u,c;return d=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},type:ae.type,async setup(){const a=await this.getProvider();a!=null&&a.on&&i.target&&(u||(u=this.onConnect.bind(this),a.on("connect",u)),o||(o=this.onAccountsChanged.bind(this),a.on("accountsChanged",o)))},async connect({chainId:a,isReconnecting:r,withCapabilities:l}={}){var p,m,I,v,y,E;const g=await this.getProvider();if(!g)throw new L;let f=[];if(r)f=await this.getAccounts().catch(()=>[]);else if(e)try{f=(v=(I=(m=(p=(await g.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:p.caveats)==null?void 0:m[0])==null?void 0:I.value)==null?void 0:v.map(h=>q(h)),f.length>0&&(f=await this.getAccounts())}catch(N){const h=N;if(h.code===_.code)throw new _(h);if(h.code===de.code)throw h}try{!(f!=null&&f.length)&&!r&&(f=(await g.request({method:"eth_requestAccounts"})).map(C=>q(C))),u&&(g.removeListener("connect",u),u=void 0),o||(o=this.onAccountsChanged.bind(this),g.on("accountsChanged",o)),s||(s=this.onChainChanged.bind(this),g.on("chainChanged",s)),c||(c=this.onDisconnect.bind(this),g.on("disconnect",c));let N=await this.getChainId();if(a&&N!==a){const h=await this.switchChain({chainId:a}).catch(C=>{if(C.code===_.code)throw C;return{id:N}});N=(h==null?void 0:h.id)??N}return e&&await((y=d.storage)==null?void 0:y.removeItem(`${this.id}.disconnected`)),i.target||await((E=d.storage)==null?void 0:E.setItem("injected.connected",!0)),{accounts:l?f.map(h=>({address:h,capabilities:{}})):f,chainId:N}}catch(N){const h=N;throw h.code===_.code?new _(h):h.code===de.code?new de(h):h}},async disconnect(){var r,l;const a=await this.getProvider();if(!a)throw new L;s&&(a.removeListener("chainChanged",s),s=void 0),c&&(a.removeListener("disconnect",c),c=void 0),u||(u=this.onConnect.bind(this),a.on("connect",u));try{await We(()=>a.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await((r=d.storage)==null?void 0:r.setItem(`${this.id}.disconnected`,!0)),i.target||await((l=d.storage)==null?void 0:l.removeItem("injected.connected"))},async getAccounts(){const a=await this.getProvider();if(!a)throw new L;return(await a.request({method:"eth_accounts"})).map(l=>q(l))},async getChainId(){const a=await this.getProvider();if(!a)throw new L;const r=await a.request({method:"eth_chainId"});return Number(r)},async getProvider(){if(typeof window>"u")return;let a;const r=n();return typeof r.provider=="function"?a=r.provider(window):typeof r.provider=="string"?a=oe(window,r.provider):a=r.provider,a&&!a.removeListener&&("off"in a&&typeof a.off=="function"?a.removeListener=a.off:a.removeListener=()=>{}),a},async isAuthorized(){var a,r;try{if(e&&await((a=d.storage)==null?void 0:a.getItem(`${this.id}.disconnected`))||!i.target&&!await((r=d.storage)==null?void 0:r.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(t!==void 0&&t!==!1){const p=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",p),!!await this.getProvider()),m=typeof t=="number"?t:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(v=>window.addEventListener("ethereum#initialized",()=>v(p()),{once:!0}))]:[],new Promise(v=>setTimeout(()=>v(p()),m))]))return!0}throw new L}return!!(await Me(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:a,chainId:r}){var p,m,I,v;const l=await this.getProvider();if(!l)throw new L;const g=d.chains.find(y=>y.id===r);if(!g)throw new B(new z);const f=new Promise(y=>{const E=(N=>{"chainId"in N&&N.chainId===r&&(d.emitter.off("change",E),y())});d.emitter.on("change",E)});try{return await Promise.all([l.request({method:"wallet_switchEthereumChain",params:[{chainId:re(r)}]}).then(async()=>{await this.getChainId()===r&&d.emitter.emit("change",{chainId:r})}),f]),g}catch(y){const E=y;if(E.code===4902||((m=(p=E==null?void 0:E.data)==null?void 0:p.originalError)==null?void 0:m.code)===4902)try{const{default:N,...h}=g.blockExplorers??{};let C;a!=null&&a.blockExplorerUrls?C=a.blockExplorerUrls:N&&(C=[N.url,...Object.values(h).map(b=>b.url)]);let w;(I=a==null?void 0:a.rpcUrls)!=null&&I.length?w=a.rpcUrls:w=[((v=g.rpcUrls.default)==null?void 0:v.http[0])??""];const A={blockExplorerUrls:C,chainId:re(r),chainName:(a==null?void 0:a.chainName)??g.name,iconUrls:a==null?void 0:a.iconUrls,nativeCurrency:(a==null?void 0:a.nativeCurrency)??g.nativeCurrency,rpcUrls:w};return await Promise.all([l.request({method:"wallet_addEthereumChain",params:[A]}).then(async()=>{if(await this.getChainId()===r)d.emitter.emit("change",{chainId:r});else throw new _(new Error("User rejected switch after adding network."))}),f]),g}catch(N){throw new _(N)}throw E.code===_.code?new _(E):new B(E)}},async onAccountsChanged(a){var r;if(a.length===0)this.onDisconnect();else if(d.emitter.listenerCount("connect")){const l=(await this.getChainId()).toString();this.onConnect({chainId:l}),e&&await((r=d.storage)==null?void 0:r.removeItem(`${this.id}.disconnected`))}else d.emitter.emit("change",{accounts:a.map(l=>q(l))})},onChainChanged(a){const r=Number(a);d.emitter.emit("change",{chainId:r})},async onConnect(a){const r=await this.getAccounts();if(r.length===0)return;const l=Number(a.chainId);d.emitter.emit("connect",{accounts:r,chainId:l});const g=await this.getProvider();g&&(u&&(g.removeListener("connect",u),u=void 0),o||(o=this.onAccountsChanged.bind(this),g.on("accountsChanged",o)),s||(s=this.onChainChanged.bind(this),g.on("chainChanged",s)),c||(c=this.onDisconnect.bind(this),g.on("disconnect",c)))},async onDisconnect(a){const r=await this.getProvider();a&&a.code===1013&&r&&(await this.getAccounts()).length||(d.emitter.emit("disconnect"),r&&(s&&(r.removeListener("chainChanged",s),s=void 0),c&&(r.removeListener("disconnect",c),c=void 0),u||(u=this.onConnect.bind(this),r.on("connect",u))))}})}const Pt={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(i){return i!=null&&i.coinbaseWalletExtension?i.coinbaseWalletExtension:oe(i,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(i){return oe(i,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const t=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of t)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(i){var e,t;return(e=i==null?void 0:i.phantom)!=null&&e.ethereum?(t=i.phantom)==null?void 0:t.ethereum:oe(i,"isPhantom")}}};function oe(i,e){function t(o){return typeof e=="function"?e(o):typeof e=="string"?o[e]:!0}const n=i.ethereum;if(n!=null&&n.providers)return n.providers.find(o=>t(o));if(n&&t(n))return n}const kt=i=>(e,t,n)=>{const o=n.subscribe;return n.subscribe=(u,c,d)=>{let a=u;if(c){const r=(d==null?void 0:d.equalityFn)||Object.is;let l=u(n.getState());a=g=>{const f=u(g);if(!r(l,f)){const p=l;c(l=f,p)}},d!=null&&d.fireImmediately&&c(l,l)}return o(a)},i(e,t,n)},Rt=kt;function Ot(i,e){let t;try{t=i()}catch{return}return{getItem:o=>{var s;const u=d=>d===null?null:JSON.parse(d,void 0),c=(s=t.getItem(o))!=null?s:null;return c instanceof Promise?c.then(u):u(c)},setItem:(o,s)=>t.setItem(o,JSON.stringify(s,void 0)),removeItem:o=>t.removeItem(o)}}const me=i=>e=>{try{const t=i(e);return t instanceof Promise?t:{then(n){return me(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return me(n)(t)}}}},Ut=(i,e)=>(t,n,o)=>{let s={storage:Ot(()=>localStorage),partialize:m=>m,version:0,merge:(m,I)=>({...I,...m}),...e},u=!1;const c=new Set,d=new Set;let a=s.storage;if(!a)return i((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),t(...m)},n,o);const r=()=>{const m=s.partialize({...n()});return a.setItem(s.name,{state:m,version:s.version})},l=o.setState;o.setState=(m,I)=>{l(m,I),r()};const g=i((...m)=>{t(...m),r()},n,o);o.getInitialState=()=>g;let f;const p=()=>{var m,I;if(!a)return;u=!1,c.forEach(y=>{var E;return y((E=n())!=null?E:g)});const v=((I=s.onRehydrateStorage)==null?void 0:I.call(s,(m=n())!=null?m:g))||void 0;return me(a.getItem.bind(a))(s.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==s.version){if(s.migrate)return[!0,s.migrate(y.state,y.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var E;const[N,h]=y;if(f=s.merge(h,(E=n())!=null?E:g),t(f,!0),N)return r()}).then(()=>{v==null||v(f,void 0),f=n(),u=!0,d.forEach(y=>y(f))}).catch(y=>{v==null||v(void 0,y)})};return o.persist={setOptions:m=>{s={...s,...m},m.storage&&(a=m.storage)},clearStorage:()=>{a==null||a.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>p(),hasHydrated:()=>u,onHydrate:m=>(c.add(m),()=>{c.delete(m)}),onFinishHydration:m=>(d.add(m),()=>{d.delete(m)})},s.skipHydration||p(),f||g},jt=Ut,Ne=i=>{let e;const t=new Set,n=(a,r)=>{const l=typeof a=="function"?a(e):a;if(!Object.is(l,e)){const g=e;e=r??(typeof l!="object"||l===null)?l:Object.assign({},e,l),t.forEach(f=>f(e,g))}},o=()=>e,c={setState:n,getState:o,getInitialState:()=>d,subscribe:a=>(t.add(a),()=>t.delete(a))},d=e=i(n,o,c);return c},fe=i=>i?Ne(i):Ne;class Mt{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new et})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){const n=t[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function Wt(i){return new Mt(i)}function Lt(i,e){return JSON.parse(i,(t,n)=>{let o=n;return(o==null?void 0:o.__type)==="bigint"&&(o=BigInt(o.value)),(o==null?void 0:o.__type)==="Map"&&(o=new Map(o.value)),(e==null?void 0:e(t,o))??o})}function Ee(i,e){return i.slice(0,e).join(".")||"."}function Se(i,e){const{length:t}=i;for(let n=0;n<t;++n)if(i[n]===e)return n+1;return 0}function qt(i,e){const t=typeof i=="function",n=typeof e=="function",o=[],s=[];return function(c,d){if(typeof d=="object")if(o.length){const a=Se(o,this);a===0?o[o.length]=this:(o.splice(a),s.splice(a)),s[s.length]=c;const r=Se(o,d);if(r!==0)return n?e.call(this,c,d,Ee(s,r)):`[ref=${Ee(s,r)}]`}else o[0]=d,s[0]=c;return t?i.call(this,c,d):d}}function $t(i,e,t,n){return JSON.stringify(i,qt((o,s)=>{let u=s;return typeof u=="bigint"&&(u={__type:"bigint",value:s.toString()}),u instanceof Map&&(u={__type:"Map",value:Array.from(s.entries())}),(e==null?void 0:e(o,u))??u},n),t??void 0)}function Dt(i){const{deserialize:e=Lt,key:t="wagmi",serialize:n=$t,storage:o=Oe}=i;function s(u){return u instanceof Promise?u.then(c=>c).catch(()=>null):u}return{...o,key:t,async getItem(u,c){const d=o.getItem(`${t}.${u}`),a=await s(d);return a?e(a)??null:c??null},async setItem(u,c){const d=`${t}.${u}`;c===null?await s(o.removeItem(d)):await s(o.setItem(d,n(c)))},async removeItem(u){await s(o.removeItem(`${t}.${u}`))}}}const Oe={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function xt(){const i=typeof window<"u"&&window.localStorage?window.localStorage:Oe;return{getItem(e){return i.getItem(e)},removeItem(e){i.removeItem(e)},setItem(e,t){try{i.setItem(e,t)}catch{}}}}const Ce=256;let ee=Ce,te;function Ht(i=11){if(!te||ee+i>Ce*2){te="",ee=0;for(let e=0;e<Ce;e++)te+=(256+Math.random()*256|0).toString(16).substring(1)}return te.substring(ee,ee+++i)}function Ft(i){const{multiInjectedProviderDiscovery:e=!0,storage:t=Dt({storage:xt()}),syncConnectedChain:n=!0,ssr:o=!1,...s}=i,u=typeof window<"u"&&e?tt():void 0,c=fe(()=>s.chains),d=fe(()=>{const h=[],C=new Set;for(const w of s.connectors??[]){const A=a(w);if(h.push(A),!o&&A.rdns){const b=typeof A.rdns=="string"?[A.rdns]:A.rdns;for(const T of b)C.add(T)}}if(!o&&u){const w=u.getProviders();for(const A of w)C.has(A.info.rdns)||h.push(a(r(A)))}return h});function a(h){var b;const C=Wt(Ht());let w;const A={...h({emitter:C,chains:c.getState(),get providers(){if(!u||!w)return[];const T=typeof w=="string"?[w]:w,R=u.getProviders();return T.flatMap(K=>R.filter(P=>P.info.rdns===K))},storage:t,transports:s.transports}),emitter:C,uid:C.uid};return w=A.rdns,C.on("connect",E),(b=A.setup)==null||b.call(A),A}function r(h){const{info:C}=h,w=h.provider;return ae({target:{...C,id:C.rdns,provider:w}})}const l=new Map;function g(h={}){const C=h.chainId??I.getState().chainId,w=c.getState().find(b=>b.id===C);if(h.chainId&&!w)throw new z;{const b=l.get(I.getState().chainId);if(b&&!w)return b;if(!w)throw new z}{const b=l.get(C);if(b)return b}let A;if(s.client)A=s.client({chain:w});else{const b=w.id,T=c.getState().map(P=>P.id),R={},K=Object.entries(s);for(const[P,$]of K)if(!(P==="chains"||P==="client"||P==="connectors"||P==="transports"))if(typeof $=="object")if(b in $)R[P]=$[b];else{if(T.some(je=>je in $))continue;R[P]=$}else R[P]=$;A=Pe({...R,chain:w,batch:R.batch??{multicall:!0},transport:P=>s.transports[b]({...P,connectors:d})})}return l.set(C,A),A}function f(){return{chainId:c.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let p;const m="0.0.0-canary-";ie.startsWith(m)?p=Number.parseInt(ie.replace(m,""),10):p=Number.parseInt(ie.split(".")[0]??"0",10);const I=fe(Rt(t?jt(f,{migrate(h,C){if(C===p)return h;const w=f(),A=v(h,w.chainId);return{...w,chainId:A}},name:"store",partialize(h){return{connections:{__type:"Map",value:Array.from(h.connections.entries()).map(([C,w])=>{const{id:A,name:b,type:T,uid:R}=w.connector;return[C,{...w,connector:{id:A,name:b,type:T,uid:R}}]})},chainId:h.chainId,current:h.current}},merge(h,C){typeof h=="object"&&h&&"status"in h&&delete h.status;const w=v(h,C.chainId);return{...C,...h,chainId:w}},skipHydration:o,storage:t,version:p}):f));I.setState(f());function v(h,C){return h&&typeof h=="object"&&"chainId"in h&&typeof h.chainId=="number"&&c.getState().some(w=>w.id===h.chainId)?h.chainId:C}n&&I.subscribe(({connections:h,current:C})=>{var w;return C?(w=h.get(C))==null?void 0:w.chainId:void 0},h=>{if(c.getState().some(w=>w.id===h))return I.setState(w=>({...w,chainId:h??w.chainId}))}),u==null||u.subscribe(h=>{const C=new Set,w=new Set;for(const b of d.getState())if(C.add(b.id),b.rdns){const T=typeof b.rdns=="string"?[b.rdns]:b.rdns;for(const R of T)w.add(R)}const A=[];for(const b of h){if(w.has(b.info.rdns))continue;const T=a(r(b));C.has(T.id)||A.push(T)}t&&!I.persist.hasHydrated()||d.setState(b=>[...b,...A],!0)});function y(h){I.setState(C=>{const w=C.connections.get(h.uid);return w?{...C,connections:new Map(C.connections).set(h.uid,{accounts:h.accounts??w.accounts,chainId:h.chainId??w.chainId,connector:w.connector})}:C})}function E(h){I.getState().status==="connecting"||I.getState().status==="reconnecting"||I.setState(C=>{const w=d.getState().find(A=>A.uid===h.uid);return w?(w.emitter.listenerCount("connect")&&w.emitter.off("connect",y),w.emitter.listenerCount("change")||w.emitter.on("change",y),w.emitter.listenerCount("disconnect")||w.emitter.on("disconnect",N),{...C,connections:new Map(C.connections).set(h.uid,{accounts:h.accounts,chainId:h.chainId,connector:w}),current:h.uid,status:"connected"}):C})}function N(h){I.setState(C=>{const w=C.connections.get(h.uid);if(w){const b=w.connector;b.emitter.listenerCount("change")&&w.connector.emitter.off("change",y),b.emitter.listenerCount("disconnect")&&w.connector.emitter.off("disconnect",N),b.emitter.listenerCount("connect")||w.connector.emitter.on("connect",E)}if(C.connections.delete(h.uid),C.connections.size===0)return{...C,connections:new Map,current:null,status:"disconnected"};const A=C.connections.values().next().value;return{...C,connections:new Map(C.connections),current:A.connector.uid}})}return{get chains(){return c.getState()},get connectors(){return d.getState()},storage:t,getClient:g,get state(){return I.getState()},setState(h){let C;typeof h=="function"?C=h(I.getState()):C=h;const w=f();typeof C!="object"&&(C=w),Object.keys(w).some(b=>!(b in C))&&(C=w),I.setState(C,!0)},subscribe(h,C,w){return I.subscribe(h,C,w?{...w,fireImmediately:w.emitImmediately}:void 0)},_internal:{mipd:u,async revalidate(){const h=I.getState(),C=h.connections;let w=h.current;for(const[,A]of C){const b=A.connector;b.isAuthorized&&await b.isAuthorized()||(C.delete(b.uid),w===b.uid&&(w=null))}I.setState(A=>({...A,connections:C,current:w}))},store:I,ssr:!!o,syncConnectedChain:n,transports:s.transports,chains:{setState(h){const C=typeof h=="function"?h(c.getState()):h;if(C.length!==0)return c.setState(C,!0)},subscribe(h){return c.subscribe(h)}},connectors:{providerDetailToConnector:r,setup:a,setState(h){return d.setState(typeof h=="function"?h(d.getState()):h,!0)},subscribe(h){return d.subscribe(h)}},events:{change:y,connect:E,disconnect:N}}}}function Ue(i){let e=[],t,n;function o(c){var r,l;const d=k.getCaipNetworks(S.CHAIN.EVM);let a=Number(ge.parseEvmChainId(c));if(!d.some(g=>String(g.id)===String(c))){const g=((r=k.getActiveCaipNetwork(S.CHAIN.EVM))==null?void 0:r.id)||((l=d[0])==null?void 0:l.id);g&&Number.isInteger(Number(g))&&(a=Number(g))}if(!a)throw new Error("ChainId not found in networks");return a}function s(){var c;return t||(t=ye.getInstance({projectId:i.options.projectId,chainId:(c=J())==null?void 0:c.caipNetworkId,enableLogger:i.options.enableAuthLogger,onTimeout:d=>{d==="iframe_load_failed"?D.open(W.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):d==="iframe_request_timeout"?D.open(W.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):d==="unverified_domain"&&D.open(W.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},abortController:W.EmbeddedWalletAbortController,getActiveCaipNetwork:d=>J(d),getCaipNetworks:d=>k.getCaipNetworks(d)})),t}async function u(c={}){var m;const d=s();let a=c.chainId;if(c.isReconnecting){const I=ge.parseEvmChainId(d.getLastUsedChainId()||""),v=(m=i.chains)==null?void 0:m[0].id;if(a=I||v,!a)throw new Error("ChainId not found in provider")}const r=Ie("eip155"),{address:l,chainId:g,accounts:f}=await qe.authConnectorAuthenticate({authConnector:d,chainId:a,preferredAccountType:r,socialUri:c.socialUri,chainNamespace:S.CHAIN.EVM});e=(f==null?void 0:f.map(I=>I.address))||[l];const p=o(g);return{accounts:e,account:l,chainId:p,chain:{id:p,unsupported:!1}}}return c=>({id:S.CONNECTOR_ID.AUTH,name:S.CONNECTOR_NAMES.AUTH,type:"AUTH",chain:S.CHAIN.EVM,async connect(d={}){if(n){const r=await n;return{accounts:d.withCapabilities?r.accounts.map(l=>({address:l,capabilities:{}})):r.accounts,chainId:r.chainId}}n||(n=new Promise(r=>{r(u(d))}));const a=await n;return n=void 0,{accounts:d.withCapabilities?a.accounts.map(r=>({address:r,capabilities:{}})):a.accounts,chainId:a.chainId}},async disconnect(){await(await this.getProvider()).disconnect()},getAccounts(){return e!=null&&e.length?(c.emitter.emit("change",{accounts:e}),Promise.resolve(e)):Promise.resolve([])},async getProvider(){var d;return this.provider||(this.provider=ye.getInstance({projectId:i.options.projectId,chainId:(d=J())==null?void 0:d.caipNetworkId,enableLogger:i.options.enableAuthLogger,abortController:W.EmbeddedWalletAbortController,onTimeout:a=>{a==="iframe_load_failed"?D.open(W.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):a==="iframe_request_timeout"?D.open(W.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):a==="unverified_domain"&&D.open(W.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:a=>J(a),getCaipNetworks:a=>k.getCaipNetworks(a)})),Promise.resolve(this.provider)},async getChainId(){const d=await this.getProvider(),{chainId:a}=await d.getChainId();return o(a)},async isAuthorized(){const a=k.state.activeChain===S.CHAIN.EVM;if(S.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(g=>Le.getConnectorId(g)===S.CONNECTOR_ID.AUTH)&&!a)return!1;const l=await this.getProvider();return Promise.resolve(l.getLoginEmailUsed())},async switchChain({chainId:d}){var a;try{const r=c.chains.find(p=>p.id===d);if(!r)throw new B(new Error("chain not found on connector."));const l=await this.getProvider(),g=Ie("eip155"),f=await l.connect({chainId:d,preferredAccountType:g});return e=((a=f==null?void 0:f.accounts)==null?void 0:a.map(p=>p.address))||[f.address],c.emitter.emit("change",{chainId:Number(d),accounts:e}),r}catch(r){throw r instanceof Error?new B(r):r}},onAccountsChanged(d){d.length===0?this.onDisconnect():c.emitter.emit("change",{accounts:d.map(q)})},onChainChanged(d){const a=Number(d);c.emitter.emit("change",{chainId:a})},async onDisconnect(d){await(await this.getProvider()).disconnect()}})}pe.type="walletConnect";function pe(i){const e=i.isNewChainsStale??!0;let t,n,o,s,u,c,d;return a=>({id:"walletConnect",name:"WalletConnect",type:pe.type,provider:i.universalProvider,async setup(){const r=await this.getProvider().catch(()=>null);r&&(s||(s=this.onConnect.bind(this),r.on("connect",s)),c||(c=this.onSessionDelete.bind(this),r.on("session_delete",c)))},async connect({...r}={}){var l,g,f;try{const p=k.getCaipNetworks(),m=await this.getProvider();if(!m)throw new L;u||(u=this.onDisplayUri,m.on("display_uri",u));const I=await this.isChainsStale();m.session&&I&&await m.disconnect();const v=x.state.universalProviderConfigOverride;if(!m.session||I){const A=$e.createNamespaces(p,v);await m.connect({optionalNamespaces:A,..."pairingTopic"in r?{pairingTopic:r.pairingTopic}:{}}),this.setRequestedChainsIds(p.map(b=>Number(b.id)))}const y=await this.getAccounts(),E=await this.getChainId(),N=(f=(g=(l=m.session)==null?void 0:l.namespaces)==null?void 0:g.eip155)==null?void 0:f.chains,h=N==null?void 0:N.some(A=>Number(A.split(":")[1])===E);let C=1;h?C=E:N!=null&&N[0]&&(C=Number(N[0].split(":")[1])),u&&(m.removeListener("display_uri",u),u=void 0),s&&(m.removeListener("connect",s),s=void 0),n||(n=this.onAccountsChanged.bind(this),m.on("accountsChanged",n)),o||(o=this.onChainChanged.bind(this),m.on("chainChanged",o)),d||(d=this.onDisconnect.bind(this),m.on("disconnect",d)),c||(c=this.onSessionDelete.bind(this),m.on("session_delete",c));const w=v==null?void 0:v.defaultChain;return m.setDefaultChain(w??`eip155:${C}`),{accounts:y,chainId:C}}catch(p){throw/(user rejected|connection request reset)/i.test(p==null?void 0:p.message)?new _(p):p}},async disconnect(){const r=await this.getProvider();try{await(r==null?void 0:r.disconnect())}catch(l){if(!/No matching key/i.test(l.message))throw l}finally{o&&(r==null||r.removeListener("chainChanged",o),o=void 0),d&&(r==null||r.removeListener("disconnect",d),d=void 0),s||(s=this.onConnect.bind(this),r==null||r.on("connect",s)),n&&(r==null||r.removeListener("accountsChanged",n),n=void 0),c&&(r==null||r.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){var m,I,v;const r=await this.getProvider();if(!((m=r==null?void 0:r.session)!=null&&m.namespaces))return[];const l=(v=(I=r==null?void 0:r.session)==null?void 0:I.namespaces[S.CHAIN.EVM])==null?void 0:v.accounts,g=(l==null?void 0:l.map(y=>y.split(":")[2]))??[],f=new Set;return g.filter(y=>{const E=y==null?void 0:y.toLowerCase();return f.has(E)?!1:(f.add(E),!0)})},async getProvider({chainId:r}={}){var f,p;t||(t=i.universalProvider,t==null||t.events.setMaxListeners(Number.POSITIVE_INFINITY));const l=H.getActiveNamespace(),g=(f=k.getActiveCaipNetwork())==null?void 0:f.id;if(r&&g!==r&&l){const m=H.getStoredActiveCaipNetworkId(),I=l?k.getCaipNetworks(l):[],v=I==null?void 0:I.find(y=>y.id===m);v&&v.chainNamespace===S.CHAIN.EVM&&await((p=this.switchChain)==null?void 0:p.call(this,{chainId:Number(v.id)}))}return t},async getChainId(){var p,m,I,v;const r=(p=k.getActiveCaipNetwork(S.CHAIN.EVM))==null?void 0:p.id;if(r)return r;const g=(v=(I=(m=(await this.getProvider()).session)==null?void 0:m.namespaces[S.CHAIN.EVM])==null?void 0:I.chains)==null?void 0:v[0],f=k.getCaipNetworks().find(y=>y.id===g);return f==null?void 0:f.id},async isAuthorized(){try{const[r,l]=await Promise.all([this.getAccounts(),this.getProvider()]);return r.length?await this.isChainsStale()&&l.session?(await l.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:r,chainId:l}){var p,m,I,v;const g=await this.getProvider();if(!g)throw new L;const f=k.getCaipNetworks().find(y=>y.id===l);if(!f)throw new B(new z);try{await g.request({method:"wallet_switchEthereumChain",params:[{chainId:re(l)}]}),f!=null&&f.caipNetworkId&&g.setDefaultChain(f==null?void 0:f.caipNetworkId),a.emitter.emit("change",{chainId:Number(l)});const y=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...y,l]),{...f,id:f.id}}catch(y){const E=y;if(/(?:user rejected)/iu.test(E.message))throw new _(E);try{let N;r!=null&&r.blockExplorerUrls?N=r.blockExplorerUrls:N=(p=f.blockExplorers)!=null&&p.default.url?[(m=f.blockExplorers)==null?void 0:m.default.url]:[];const h=((v=(I=f.rpcUrls)==null?void 0:I.chainDefault)==null?void 0:v.http)||[],C={blockExplorerUrls:N,chainId:re(l),chainName:f.name,iconUrls:r==null?void 0:r.iconUrls,nativeCurrency:f.nativeCurrency,rpcUrls:h};await g.request({method:"wallet_addEthereumChain",params:[C]});const w=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...w,l]),{...f,id:f.id}}catch(N){throw new _(N)}}},onAccountsChanged(r){r.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:r.map(l=>q(l))})},onChainChanged(r){const l=Number(r);a.emitter.emit("change",{chainId:l})},onConnect(r){this.setRequestedChainsIds(k.getCaipNetworks().map(l=>Number(l.id)))},async onDisconnect(r){this.setRequestedChainsIds([]),a.emitter.emit("disconnect");const l=await this.getProvider();n&&(l.removeListener("accountsChanged",n),n=void 0),o&&(l.removeListener("chainChanged",o),o=void 0),d&&(l.removeListener("disconnect",d),d=void 0),c&&(l.removeListener("session_delete",c),c=void 0),s||(s=this.onConnect.bind(this),l.on("connect",s))},onDisplayUri(r){a.emitter.emit("message",{type:"display_uri",data:r})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var g,f,p;if(!((g=t==null?void 0:t.session)!=null&&g.namespaces))return[];const r=(p=(f=t==null?void 0:t.session)==null?void 0:f.namespaces[S.CHAIN.EVM])==null?void 0:p.accounts;return(r==null?void 0:r.map(m=>Number.parseInt(m.split(":")[1]??"")))??[]},async getRequestedChainsIds(){var l;const r=await((l=a.storage)==null?void 0:l.getItem(this.requestedChainsStorageKey))??[];return[...new Set(r)]},async isChainsStale(){if(!e)return!1;const r=a.chains.map(f=>f.id),l=this.getNamespaceChainsIds();if(l.length&&!l.some(f=>r.includes(f)))return!1;const g=await this.getRequestedChainsIds();return!r.every(f=>g.includes(Number(f)))},async setRequestedChainsIds(r){var l;await((l=a.storage)==null?void 0:l.setItem(this.requestedChainsStorageKey,r))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}const F=xe({pendingTransactions:0}),_e={state:F,subscribeKey(i,e){return De(F,i,e)},increase(i){F[i]+=1},decrease(i){F[i]-=1},reset(i){F[i]=0}};async function Bt(i){if(ne.isSafeApp()){const{safe:e}=await we(async()=>{const{safe:t}=await import("./index-DFZUBMdj.js");return{safe:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(e&&!i.some(t=>t.type==="safe"))return e()}return null}async function zt(i){try{const{baseAccount:e}=await we(async()=>{const{baseAccount:t}=await import("./index-DFZUBMdj.js");return{baseAccount:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(e&&!i.some(t=>t.id==="baseAccount"))return e()}catch(e){console.error("Failed to import Base Account SDK:",e)}return null}async function Vt(i){try{const{coinbaseWallet:e}=await we(async()=>{const{coinbaseWallet:t}=await import("./index-DFZUBMdj.js");return{coinbaseWallet:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));if(e&&!i.some(t=>t.id==="coinbaseWallet"))return e()}catch(e){console.error("Failed to import Coinbase Wallet SDK:",e)}return null}const Gt={enable:!1,pollingInterval:3e4};class Kt extends He{constructor(e){const t=X.extendCaipNetworks(e.networks,{projectId:e.projectId,customNetworkImageUrls:{},customRpcUrls:e.customRpcUrls});super(),this.balancePromises={},this.namespace=S.CHAIN.EVM,this.adapterType=S.ADAPTER_TYPES.WAGMI,this.projectId=e.projectId,this.pendingTransactionsFilter={...Gt,...e.pendingTransactionsFilter??{}},this.createConfig({...e,networks:t}),this.checkChainId()}construct(e){this.checkChainId(),this.setupWatchers()}async getAccounts(e){const t=this.getWagmiConnector(e.id);if(!t)return{accounts:[]};if(t.id===S.CONNECTOR_ID.AUTH){const u=await t.getProvider();if(!(u!=null&&u.user))return{accounts:[]};const{address:c,accounts:d,chainId:a}=u.user;return Promise.resolve({accounts:(d||[{address:c,type:"eoa"}]).map(r=>ne.createAccount({caipAddress:`eip155:${a}:${r.address}`,type:r.type}))})}const{addresses:n,address:o,chainId:s}=se(this.wagmiConfig);return Promise.resolve({accounts:s?[...new Set(n||[o])].map(u=>ne.createAccount({caipAddress:`eip155:${s}:${u||""}`,type:"eoa"})):[]})}checkChainId(){const{chainId:e}=se(this.wagmiConfig);e&&this.emit("switchNetwork",{chainId:e})}getWagmiConnector(e){return this.wagmiConfig.connectors.find(t=>t.id===e)}createConfig(e){this.wagmiChains=e.networks.filter(o=>o.chainNamespace===S.CHAIN.EVM);const t={},n=[...e.connectors??[]];this.wagmiChains.forEach(o=>{var c,d;const s=(c=e.transports)==null?void 0:c[o.id],u=X.getCaipNetworkId(o);s?t[o.id]=X.extendWagmiTransports(o,e.projectId,s):t[o.id]=X.getViemTransport(o,e.projectId,(d=e.customRpcUrls)==null?void 0:d[u])}),this.wagmiConfig=Ft({...e,chains:this.wagmiChains,connectors:n,transports:t})}setupWatchPendingTransactions(){if(!this.pendingTransactionsFilter.enable||this.unwatchPendingTransactions)return;this.unwatchPendingTransactions=_t(this.wagmiConfig,{pollingInterval:this.pendingTransactionsFilter.pollingInterval,onError:()=>{},onTransactions:()=>{this.emit("pendingTransactions"),_e.increase("pendingTransactions")}});const e=_e.subscribeKey("pendingTransactions",t=>{var n;t>=S.LIMITS.PENDING_TRANSACTIONS&&((n=this.unwatchPendingTransactions)==null||n.call(this),e())})}setupWatchers(){Et(this.wagmiConfig,{onChange:e=>{this.clearConnections(),this.addConnection(...e.map(t=>{const n=this.getCaipNetworks().find(s=>s.id===t.chainId),o=t.connector.id===S.CONNECTOR_ID.AUTH;return{accounts:t.accounts.map(s=>({address:this.toChecksummedAddress(s)})),caipNetwork:n,connectorId:t.connector.id,auth:o?{name:H.getConnectedSocialProvider(),username:H.getConnectedSocialUsername()}:void 0}}))}}),Nt(this.wagmiConfig,{onChange:(e,t)=>{var n;if(e.status==="disconnected"&&t.address&&this.emit("disconnect"),e!=null&&e.chainId&&(e==null?void 0:e.chainId)!==(t==null?void 0:t.chainId)&&this.emit("switchNetwork",{chainId:e.chainId}),e.status==="connected"){const o=e.address!==(t==null?void 0:t.address),s=e.connector.id!==((n=t.connector)==null?void 0:n.id),u=t.status!=="connected";(o||s||u)&&(this.setupWatchPendingTransactions(),this.handleAccountChanged({address:e.address,chainId:e.chainId,connector:e.connector}))}}})}async addThirdPartyConnectors(){const e=[],{enableCoinbase:t,enableBaseAccount:n}=x.state||{};if(n!==!1){const s=await zt(this.wagmiConfig.connectors);s&&e.push(s)}if(t!==!1){const s=await Vt(this.wagmiConfig.connectors);s&&e.push(s)}const o=await Bt(this.wagmiConfig.connectors);o&&e.push(o),await Promise.all(e.map(s=>{const u=this.configureInternalConnector(s);return this.addWagmiConnector(u)}))}addWagmiConnectors(){const e=[];x.state.enableInjected!==!1&&e.push(ae({shimDisconnect:!0}));const{features:t,remoteFeatures:n,projectId:o,enableAuthLogger:s}=x.state,u=(n==null?void 0:n.email)??(t==null?void 0:t.email)??!0,c=(n==null?void 0:n.socials)??(t==null?void 0:t.socials),d=Array.isArray(c)&&(c==null?void 0:c.length)>0;(u||d)&&e.push(Ue({chains:this.wagmiChains,options:{projectId:o,enableAuthLogger:s}})),e.forEach(a=>{this.configureInternalConnector(a)})}configureInternalConnector(e){const t=this.wagmiConfig._internal.connectors.setup(e);return this.wagmiConfig._internal.connectors.setState(n=>[...n,t]),t}async handleAccountChanged({address:e,chainId:t,connector:n}){if(!this.namespace)throw new Error("WagmiAdapter:handleAccountChanged - namespace is required");const o=await n.getProvider().catch(()=>{});this.emit("accountChanged",{address:this.toChecksummedAddress(e),chainId:t,connector:{id:n.id,name:j.ConnectorNamesMap[n.id]??n.name,imageId:j.ConnectorImageIds[n.id],type:j.ConnectorTypesMap[n.type]??"EXTERNAL",info:n.id===S.CONNECTOR_ID.INJECTED?void 0:{rdns:n.id},provider:o,chain:this.namespace,chains:[]}})}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async signMessage(e){try{return{signature:await bt(this.wagmiConfig,{message:e.message,account:e.address})}}catch{throw new Error("WagmiAdapter:signMessage - Sign message failed")}}async sendTransaction(e){var c;const{chainId:t,address:n}=se(this.wagmiConfig),o=(c=this.wagmiChains)==null?void 0:c.find(d=>d.id===t),s={account:n,to:e.to,value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,data:e.data,chain:o,type:"legacy",parameters:["nonce"]};await It(this.wagmiConfig,s);const u=await yt(this.wagmiConfig,s);return await At(this.wagmiConfig,{hash:u,timeout:25e3}),{hash:u}}async writeContract(e){var c;const{caipNetwork:t,...n}=e,o=Number(ge.caipNetworkIdToNumber(t.caipNetworkId)),s=(c=this.wagmiChains)==null?void 0:c.find(d=>d.id===o);return{hash:await Tt(this.wagmiConfig,{chain:s,address:n.tokenAddress,account:n.fromAddress,abi:n.abi,functionName:n.method,args:n.args,__mode:"prepared"})}}async estimateGas(e){try{return{gas:await wt(this.wagmiConfig,{account:e.address,to:e.to,data:e.data,type:"legacy"})}}catch{throw new Error("WagmiAdapter:estimateGas - error estimating gas")}}parseUnits(e){return ct(e.value,e.decimals)}formatUnits(e){return Ke(e.value,e.decimals)}async addWagmiConnector(e){if(!this.namespace)throw new Error("WagmiAdapter:addWagmiConnector - namespace is required");const{enableEIP6963:t,enableInjected:n}=x.state||{},o=e.type===S.CONNECTOR_ID.INJECTED,s=e.id===S.CONNECTOR_ID.INJECTED,u=o&&!s;if(s&&n===!1||u&&t===!1||e.id===S.CONNECTOR_ID.AUTH||e.id===S.CONNECTOR_ID.WALLET_CONNECT)return;let c;e.id!==S.CONNECTOR_ID.BASE_ACCOUNT&&(c=await e.getProvider().catch(()=>{}));const d=Fe.state.connectorImages;this.addConnector({id:e.id,explorerId:j.ConnectorExplorerIds[e.id]??j.ConnectorExplorerIds[e.name],imageUrl:(d==null?void 0:d[e.id])??e.icon,name:j.ConnectorNamesMap[e.id]??e.name,imageId:j.ConnectorImageIds[e.id],type:j.ConnectorTypesMap[e.type]??"EXTERNAL",info:e.id===S.CONNECTOR_ID.INJECTED?void 0:{rdns:e.id},provider:c,chain:this.namespace,chains:[]})}async syncConnectors(){St(this.wagmiConfig,{onChange:e=>{e.forEach(t=>this.addWagmiConnector(t))}}),this.addWagmiConnectors(),await Promise.all(this.wagmiConfig.connectors.map(e=>this.addWagmiConnector(e))),await this.addThirdPartyConnectors()}async syncConnections(){const e=this.connectors.filter(t=>{const{hasDisconnected:n,hasConnected:o}=Y.getConnectorStorageInfo(t.id,this.namespace);return!n&&o}).map(t=>this.getWagmiConnector(t.id)).filter(Boolean);await he(this.wagmiConfig,{connectors:e})}async syncConnection(e){var a,r;const{id:t,chainId:n}=e,s=M(this.wagmiConfig).find(l=>l.connector.id===t),u=this.getWagmiConnector(t),c=await(u==null?void 0:u.getProvider());if(ne.isSafeApp()&&t===S.CONNECTOR_ID.SAFE&&!(s!=null&&s.accounts.length)){const l=this.getWagmiConnector("safe");if(l){const g=await ue(this.wagmiConfig,{connector:l,chainId:Number(n)}),f=await l.getProvider();return{chainId:Number(n),address:this.toChecksummedAddress(g.accounts[0]),provider:f,type:(a=s==null?void 0:s.connector.type)==null?void 0:a.toUpperCase(),id:s==null?void 0:s.connector.id}}}return{chainId:Number(s==null?void 0:s.chainId),address:this.toChecksummedAddress(s==null?void 0:s.accounts[0]),provider:c,type:(r=s==null?void 0:s.connector.type)==null?void 0:r.toUpperCase(),id:s==null?void 0:s.connector.id}}async connectWalletConnect(e){try{const t=this.getWalletConnectConnector();await t.authenticate();const n=this.getWagmiConnector("walletConnect");if(!n)throw new Error("UniversalAdapter:connectWalletConnect - connector not found");const o=await ue(this.wagmiConfig,{connector:n,chainId:e?Number(e):void 0});return o.chainId!==Number(e)&&await Ae(this.wagmiConfig,{chainId:o.chainId}),{clientId:await t.provider.client.core.crypto.getClientId()}}catch(t){throw t instanceof _?new Q(t):be.isUserRejectedRequestError(t)?new Q(t):t}}async connect(e){var t,n,o,s,u;try{const{id:c,address:d,provider:a,type:r,info:l,chainId:g,socialUri:f}=e,p=this.getWagmiConnector(c);if(!p)throw new Error("connectionControllerClient:connectExternal - connector is undefined");a&&l&&p.id===S.CONNECTOR_ID.EIP6963&&((t=p.setEip6963Wallet)==null||t.call(p,{provider:a,info:l}));const m=(o=(n=this.wagmiConfig.state)==null?void 0:n.connections)==null?void 0:o.get(p.uid);if(m){await((s=this.wagmiConfig.storage)==null?void 0:s.setItem("recentConnectorId",p.id));const y=[...m.accounts].sort((E,N)=>Y.isLowerCaseMatch(E,d)?-1:Y.isLowerCaseMatch(N,d)?1:0);return(u=this.wagmiConfig)==null||u.setState(E=>({...E,connections:new Map(E.connections).set(p.uid,{accounts:y,chainId:m.chainId,connector:m.connector}),current:p.uid,status:"connected"})),{address:this.toChecksummedAddress(y[0]),chainId:m.chainId,provider:a,type:r,id:c}}const I=await ue(this.wagmiConfig,{connector:p,chainId:g?Number(g):void 0,socialUri:f}),v=a??await p.getProvider();return{address:this.toChecksummedAddress(I.accounts[0]),chainId:I.chainId,provider:v,type:r,id:c}}catch(c){throw c instanceof _?new Q(c):be.isUserRejectedRequestError(c)?new Q(c):c}}get connections(){return Array.from(this.wagmiConfig.state.connections.values()).map(e=>({accounts:e.accounts.map(t=>({address:this.toChecksummedAddress(t)})),connectorId:e.connector.id}))}async reconnect(e){const{id:t}=e,n=this.getWagmiConnector(t);if(!n)throw new Error("connectionControllerClient:connectExternal - connector is undefined");await he(this.wagmiConfig,{connectors:[n]})}async getBalance(e){const t=e.address,n=this.getCaipNetworks().find(o=>o.id===e.chainId);if(!t)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(n&&this.wagmiConfig){const o=`${n.caipNetworkId}:${e.address}`,s=this.balancePromises[o];if(s)return s;const u=H.getNativeBalanceCacheForCaipAddress(o);return u?{balance:u.balance,symbol:u.symbol}:(this.balancePromises[o]=new Promise(async c=>{var d,a;try{const r=Number(e.chainId),l=await pt(this.wagmiConfig,{address:e.address,chainId:r,token:(a=(d=e.tokens)==null?void 0:d[n.caipNetworkId])==null?void 0:a.address});H.updateNativeBalanceCache({caipAddress:o,balance:l.formatted,symbol:l.symbol,timestamp:Date.now()}),c({balance:l.formatted,symbol:l.symbol})}catch(r){console.warn("Appkit:WagmiAdapter:getBalance - Error getting balance",r),c({balance:"0.00",symbol:"ETH"})}}).finally(()=>{delete this.balancePromises[o]}),this.balancePromises[o]||{balance:"0.00",symbol:"ETH"})}return{balance:"",symbol:""}}getWalletConnectProvider(){var e;return(e=this.getWagmiConnector("walletConnect"))==null?void 0:e.provider}async disconnect(e){if(e.id){const t=this.getWagmiConnector(e.id),o=M(this.wagmiConfig).find(s=>Y.isLowerCaseMatch(s.connector.id,e.id));return await ve(this.wagmiConfig,{connector:t}),x.state.enableReconnect===!1&&this.deleteConnection(e.id),o?{connections:[{accounts:o.accounts.map(s=>({address:this.toChecksummedAddress(s)})),connectorId:o.connector.id}]}:{connections:[]}}return this.disconnectAll()}async disconnectAll(){const e=M(this.wagmiConfig),t=await Promise.allSettled(e.map(async n=>{const o=this.getWagmiConnector(n.connector.id);return o&&await ve(this.wagmiConfig,{connector:o}),n}));return this.wagmiConfig.state.connections.clear(),{connections:t.filter(n=>n.status==="fulfilled").map(({value:n})=>({accounts:n.accounts.map(o=>({address:this.toChecksummedAddress(o)})),connectorId:n.connector.id}))}}async switchNetwork(e){var f,p,m,I,v;const{caipNetwork:t}=e,n=this.wagmiConfig.chains.find(y=>y.id.toString()===t.id.toString());if(!n)throw new Error("connectionControllerClient:switchNetwork - wagmiChain is undefined");const{name:o,nativeCurrency:s,rpcUrls:u,blockExplorers:c,id:d}=n,a=((m=(p=(f=t.rpcUrls)==null?void 0:f.chainDefault)==null?void 0:p.http)==null?void 0:m[0])??u.default.http[0]??"",r=(c==null?void 0:c.default.url)??((v=(I=t.blockExplorers)==null?void 0:I.default)==null?void 0:v.url)??"",l=s??t.nativeCurrency,g=o??t.name;await Ae(this.wagmiConfig,{chainId:d,addEthereumChainParameter:{chainName:g,nativeCurrency:l,rpcUrls:[a],blockExplorerUrls:[r]}}),await super.switchNetwork(e)}async getCapabilities(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:getCapabilities - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:getCapabilities - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");return await s.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:grantPermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:grantPermissions - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return s.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:revokePermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:revokePermissions - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:revokePermissions - provider is undefined");return s.request({method:"wallet_revokePermissions",params:e})}async walletGetAssets(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:walletGetAssets - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],o=n?this.getWagmiConnector(n.connector.id):null;if(!o)throw new Error("connectionControllerClient:walletGetAssets - connector is undefined");const s=await o.getProvider();if(!s)throw new Error("connectionControllerClient:walletGetAssets - provider is undefined");return s.request({method:"wallet_getAssets",params:[e]})}setAuthProvider(e){if(!this.namespace)throw new Error("WagmiAdapter:setAuthProvider - namespace is required");this.addConnector({id:S.CONNECTOR_ID.AUTH,type:"AUTH",name:S.CONNECTOR_NAMES.AUTH,provider:e,imageId:j.ConnectorImageIds[S.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}async setUniversalProvider(e){e.on("connect",()=>{const n=M(this.wagmiConfig),o=this.getWagmiConnector("walletConnect");if(o&&!n.find(s=>s.connector.id===o.id)){if(k.state.activeChain==="eip155")return;he(this.wagmiConfig,{connectors:[o]})}});const t=pe({universalProvider:e});return this.configureInternalConnector(t),this.addConnector(new Be({provider:e,caipNetworks:this.getCaipNetworks(),namespace:"eip155"})),Promise.resolve()}toChecksummedAddress(e){if(!e)return e;try{return Ze(e.toLowerCase())}catch{return e}}}const un=Object.freeze(Object.defineProperty({__proto__:null,WagmiAdapter:Kt,authConnector:Ue},Symbol.toStringTag,{value:"Module"}));export{z as C,L as P,ft as a,un as b,dn as c,ae as i};
|
|
4
|
+
//# sourceMappingURL=index-z3rGOO2O.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as v}from"./index-
|
|
2
|
-
//# sourceMappingURL=index.es-
|
|
1
|
+
import{e as v}from"./index-BoY04MqE.js";import{o}from"./browser-ponyfill-Dc2JIprt.js";import{i as a,s as l,a as b,f as u,p as y}from"./index-Bn1vI7g7.js";import"./index-Cxyjs4LG.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="554a93f0-4b9d-4554-92ee-d2aa5bfad6a1",s._sentryDebugIdIdentifier="sentry-dbid-554a93f0-4b9d-4554-92ee-d2aa5bfad6a1")}catch{}})();var m=Object.defineProperty,w=Object.defineProperties,P=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,c=(s,e,t)=>e in s?m(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,d=(s,e)=>{for(var t in e||(e={}))E.call(e,t)&&c(s,t,e[t]);if(h)for(var t of h(e))O.call(e,t)&&c(s,t,e[t]);return s},f=(s,e)=>w(s,P(e));const L={Accept:"application/json","Content-Type":"application/json"},j="POST",p={headers:L,method:j},g=10;class M{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new v.EventEmitter,this.isAvailable=!1,this.registering=!1,!a(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=l(e),r=await(await o(this.url,f(d({},p),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!a(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((r,i)=>{this.events.once("register_error",n=>{this.resetMaxListeners(),i(n)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));r()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=l({id:1,jsonrpc:"2.0",method:"test",params:[]});await o(e,f(d({},p),{body:t}))}this.onOpen()}catch(t){const r=this.parseError(t);throw this.events.emit("register_error",r),this.onClose(),r}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?b(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),i=r.message||r.toString(),n=u(e,i);this.events.emit("payload",n)}parseError(e,t=this.url){return y(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g&&this.events.setMaxListeners(g)}}export{M as f};
|
|
2
|
+
//# sourceMappingURL=index.es-BEVMBMrG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as M}from"./dcl-schemas-CEEV5Gwi.js";import{B as Tt,m as Mt,K as ot,o as J,q as Bt,Y as F,P as $t,F as B,V as R,r as z,t as At,u as Lt}from"./wallets-BhFxMvJm.js";import"./index-Cg1q_1rC.js";import{b as Jt,o as g,c as Et}from"./index-BzsMKIPi.js";import{f as P}from"./index.es-d0bre8FY.js";import{N as zt}from"./index-Dw660D76.js";import"./react-CfmD1IrY.js";import"./signing-3pb9u9PC.js";import"./prepare-contract-call-DWYd_dpp.js";import"./utils-TFUg72P3.js";import"./sentry-TFqjegNi.js";import"./index-BFHMpeS5.js";import"./ethers-BfnXvuxS.js";import"./intl-AKLEHPeO.js";import"./to-serializable-transaction-FSmJ1Nj5.js";import"./transaction-CKWKk0bi.js";import"./get-bytecode-BpKcUepk.js";import"./execute-R31vI0PP.js";import"./detectExtension-DGFEfcbz.js";import"./linkAccount-CagwoTkM.js";import"./index-CQTuHkt6.js";import"./ethereum-DYUSvH6v.js";import"./types-BeDU9GfL.js";import"./store-80QKZ2rN.js";import"./hashTypedData-DVQd-ytO.js";import"./send-transaction-BNTrOtZy.js";import"./eth_sendRawTransaction-DYAsy3sS.js";import"./index-OpYIGLSa.js";import"./index-BvE5kQP5.js";import"./index-CktWkqok.js";import"./browser-ponyfill-DgxLup8s.js";import"./events-DOXOcxVW.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new i.Error().stack;t&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[t]="a0538e5c-c7a1-4520-9a7a-67d22c5a6bc1",i._sentryDebugIdIdentifier="sentry-dbid-a0538e5c-c7a1-4520-9a7a-67d22c5a6bc1")}catch{}})();const ct="error",Gt="wss://relay.walletconnect.org",Vt="wc",Kt="universal_provider",x=`${Vt}@2:${Kt}:`,St="https://rpc.walletconnect.org/v1/",qt="generic",Wt=`${St}bundler`,_="call_status",Yt=86400,v={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function it(i){return i==null||typeof i!="object"&&typeof i!="function"}function Nt(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Dt(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Qt="[object RegExp]",_t="[object String]",Ft="[object Number]",Rt="[object Boolean]",xt="[object Arguments]",Xt="[object Symbol]",Zt="[object Date]",te="[object Map]",ee="[object Set]",ie="[object Array]",se="[object ArrayBuffer]",re="[object Object]",ne="[object DataView]",ae="[object Uint8Array]",oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",he="[object Uint32Array]",pe="[object Int8Array]",ue="[object Int16Array]",le="[object Int32Array]",de="[object Float32Array]",fe="[object Float64Array]";function st(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function me(i,t){return D(i,void 0,i,new Map,t)}function D(i,t,e,s=new Map,n=void 0){const a=n==null?void 0:n(i,t,e,s);if(a!=null)return a;if(it(i))return i;if(s.has(i))return s.get(i);if(Array.isArray(i)){const r=new Array(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return Object.hasOwn(i,"index")&&(r.index=i.index),Object.hasOwn(i,"input")&&(r.input=i.input),r}if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){const r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof Map){const r=new Map;s.set(i,r);for(const[o,c]of i)r.set(o,D(c,o,e,s,n));return r}if(i instanceof Set){const r=new Set;s.set(i,r);for(const o of i)r.add(D(o,void 0,e,s,n));return r}if(typeof M<"u"&&M.isBuffer(i))return i.subarray();if(st(i)){const r=new(Object.getPrototypeOf(i)).constructor(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return r}if(i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);if(i instanceof DataView){const r=new DataView(i.buffer.slice(0),i.byteOffset,i.byteLength);return s.set(i,r),y(r,i,e,s,n),r}if(typeof File<"u"&&i instanceof File){const r=new File([i],i.name,{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Blob){const r=new Blob([i],{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Error){const r=new i.constructor;return s.set(i,r),r.message=i.message,r.name=i.name,r.stack=i.stack,r.cause=i.cause,y(r,i,e,s,n),r}if(typeof i=="object"&&ve(i)){const r=Object.create(Object.getPrototypeOf(i));return s.set(i,r),y(r,i,e,s,n),r}return i}function y(i,t,e=i,s,n){const a=[...Object.keys(t),...Nt(t)];for(let r=0;r<a.length;r++){const o=a[r],c=Object.getOwnPropertyDescriptor(i,o);(c==null||c.writable)&&(i[o]=D(t[o],o,e,s,n))}}function ve(i){switch(Dt(i)){case xt:case ie:case se:case ne:case Rt:case Zt:case de:case fe:case pe:case ue:case le:case te:case Ft:case re:case Qt:case ee:case _t:case Xt:case ae:case oe:case ce:case he:return!0;default:return!1}}function ge(i,t){return me(i,(e,s,n,a)=>{if(typeof i=="object")switch(Object.prototype.toString.call(i)){case Ft:case _t:case Rt:{const r=new i.constructor(i==null?void 0:i.valueOf());return y(r,i),r}case xt:{const r={};return y(r,i),r.length=i.length,r[Symbol.iterator]=i[Symbol.iterator],r}default:return}})}function ht(i){return ge(i)}function pt(i){return i!==null&&typeof i=="object"&&Dt(i)==="[object Arguments]"}function ut(i){return typeof i=="object"&&i!==null}function Pe(){}function we(i){return st(i)}function be(i){var e;if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const s=i[Symbol.toStringTag];return s==null||!((e=Object.getOwnPropertyDescriptor(i,Symbol.toStringTag))!=null&&e.writable)?!1:i.toString()===`[object ${s}]`}let t=i;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(i)===t}function ye(i){if(it(i))return i;if(Array.isArray(i)||st(i)||i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);const t=Object.getPrototypeOf(i),e=t.constructor;if(i instanceof Date||i instanceof Map||i instanceof Set)return new e(i);if(i instanceof RegExp){const s=new e(i);return s.lastIndex=i.lastIndex,s}if(i instanceof DataView)return new e(i.buffer.slice(0));if(i instanceof Error){const s=new e(i.message);return s.stack=i.stack,s.name=i.name,s.cause=i.cause,s}if(typeof File<"u"&&i instanceof File)return new e([i],i.name,{type:i.type,lastModified:i.lastModified});if(typeof i=="object"){const s=Object.create(t);return Object.assign(s,i)}return i}function Ie(i,...t){const e=t.slice(0,-1),s=t[t.length-1];let n=i;for(let a=0;a<e.length;a++){const r=e[a];n=Z(n,r,s,new Map)}return n}function Z(i,t,e,s){if(it(i)&&(i=Object(i)),t==null||typeof t!="object")return i;if(s.has(t))return ye(s.get(t));if(s.set(t,i),Array.isArray(t)){t=t.slice();for(let a=0;a<t.length;a++)t[a]=t[a]??void 0}const n=[...Object.keys(t),...Nt(t)];for(let a=0;a<n.length;a++){const r=n[a];let o=t[r],c=i[r];if(pt(o)&&(o={...o}),pt(c)&&(c={...c}),typeof M<"u"&&M.isBuffer(o)&&(o=ht(o)),Array.isArray(o))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let w=0;w<h.length;w++){const d=h[w];l[d]=c[d]}c=l}else c=[];const u=e(c,o,r,i,t,s);u!=null?i[r]=u:Array.isArray(o)||ut(c)&&ut(o)?i[r]=Z(c,o,e,s):c==null&&be(o)?i[r]=Z({},o,e,s):c==null&&we(o)?i[r]=ht(o):(c===void 0||o!==void 0)&&(i[r]=o)}return i}function Ce(i,...t){return Ie(i,...t,Pe)}var Oe=Object.defineProperty,je=Object.defineProperties,He=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,dt=(i,t,e)=>t in i?Oe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t)=>{for(var e in t||(t={}))$e.call(t,e)&&dt(i,e,t[e]);if(lt)for(var e of lt(t))Ae.call(t,e)&&dt(i,e,t[e]);return i},Ee=(i,t)=>je(i,He(t));function f(i,t,e){var s;const n=B(i);return((s=t.rpcMap)==null?void 0:s[n.reference])||`${St}?chainId=${n.namespace}:${n.reference}&projectId=${e}`}function I(i){return i.includes(":")?i.split(":")[1]:i}function Ut(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Se(i,t){const e=Object.keys(t.namespaces).filter(n=>n.includes(i));if(!e.length)return[];const s=[];return e.forEach(n=>{const a=t.namespaces[n].accounts;s.push(...a)}),s}function ft(i){return Object.fromEntries(Object.entries(i).filter(([t,e])=>{var s,n;return((s=e==null?void 0:e.chains)==null?void 0:s.length)&&((n=e==null?void 0:e.chains)==null?void 0:n.length)>0}))}function k(i={},t={}){const e=ft(mt(i)),s=ft(mt(t));return Ce(e,s)}function mt(i){var t,e,s,n,a;const r={};if(!R(i))return r;for(const[o,c]of Object.entries(i)){const u=$t(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],w=c.rpcMap||{},d=F(o);r[d]=Ee(U(U({},r[d]),c),{chains:z(u,(t=r[d])==null?void 0:t.chains),methods:z(l,(e=r[d])==null?void 0:e.methods),events:z(h,(s=r[d])==null?void 0:s.events)}),(R(w)||R(((n=r[d])==null?void 0:n.rpcMap)||{}))&&(r[d].rpcMap=U(U({},w),(a=r[d])==null?void 0:a.rpcMap))}return r}function vt(i){return i.includes(":")?i.split(":")[2]:i}function gt(i){const t={};for(const[e,s]of Object.entries(i)){const n=s.methods||[],a=s.events||[],r=s.accounts||[],o=$t(e)?[e]:s.chains?s.chains:Ut(s.accounts);t[e]={chains:o,methods:n,events:a,accounts:r}}return t}function G(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}function qe(i){try{const t=JSON.parse(i);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const kt={},p=i=>kt[i],V=(i,t)=>{kt[i]=t};var Ne=Object.defineProperty,Pt=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,wt=(i,t,e)=>t in i?Ne(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bt=(i,t)=>{for(var e in t||(t={}))De.call(t,e)&&wt(i,e,t[e]);if(Pt)for(var e of Pt(t))_e.call(t,e)&&wt(i,e,t[e]);return i};const yt="eip155",Fe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Re=i=>i&&i.startsWith("0x")?BigInt(i).toString(10):i,K=i=>i&&i.startsWith("0x")?i:`0x${BigInt(i).toString(16)}`,It=i=>Object.keys(i).filter(t=>Fe.includes(t)).reduce((t,e)=>(t[e]=xe(i[e]),t),{}),xe=i=>typeof i=="string"&&qe(i)?JSON.parse(i):i,Ue=(i,t,e)=>{const{sessionProperties:s={},scopedProperties:n={}}=i,a={};if(!R(n)&&!R(s))return;const r=It(s);for(const o of e){const c=Re(o);if(!c)continue;a[K(c)]=r;const u=n==null?void 0:n[`${yt}:${c}`];if(u){const l=u==null?void 0:u[`${yt}:${c}:${t}`];a[K(c)]=bt(bt({},a[K(c)]),It(l||u))}}for(const[o,c]of Object.entries(a))Object.keys(c).length===0&&delete a[o];return Object.keys(a).length>0?a:void 0};var ke=Object.defineProperty,Te=(i,t,e)=>t in i?ke(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>Te(i,t+"",e);let W;class rt{constructor(t){Me(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,e){return await this.storage.setItem(t,e)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return W||(W=new rt(t)),W}}var Be=Object.defineProperty,Le=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ot=(i,t,e)=>t in i?Be(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t)=>{for(var e in t||(t={}))ze.call(t,e)&&Ot(i,e,t[e]);if(Ct)for(var e of Ct(t))Ge.call(t,e)&&Ot(i,e,t[e]);return i},Ke=(i,t)=>Le(i,Je(t));async function We(i,t){const e=B(i.result.capabilities.caip345.caip2),s=i.result.capabilities.caip345.transactionHashes,n=await Promise.allSettled(s.map(h=>Ye(e.reference,h,t))),a=n.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);n.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const r=!a.length||a.some(h=>!h),o=a.every(h=>(h==null?void 0:h.status)==="0x1"),c=a.every(h=>(h==null?void 0:h.status)==="0x0"),u=a.some(h=>(h==null?void 0:h.status)==="0x0");let l;return r?l=100:o?l=200:c?l=500:u&&(l=600),{id:i.result.id,version:i.request.version,atomic:i.request.atomicRequired,chainId:i.request.chainId,capabilities:i.result.capabilities,receipts:a,status:l}}async function Ye(i,t,e){return await e(parseInt(i)).request(Et("eth_getTransactionReceipt",[t]))}async function Qe({sendCalls:i,storage:t}){const e=await t.getItem(_);await t.setItem(_,Ke(Ve({},e),{[i.result.id]:{request:i.request,result:i.result,expiry:Lt(Yt)}}))}async function Xe({resultId:i,storage:t}){const e=await t.getItem(_);if(e){delete e[i],await t.setItem(_,e);for(const s in e)At(e[s].expiry)&&delete e[s];await t.setItem(_,e)}}async function Ze({resultId:i,storage:t}){const e=await t.getItem(_),s=e==null?void 0:e[i];if(s&&!At(s.expiry))return s;await Xe({resultId:i,storage:t})}var ti=Object.defineProperty,ei=(i,t,e)=>t in i?ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,C=(i,t,e)=>ei(i,typeof t!="symbol"?t+"":t,e);class ii{constructor(t){C(this,"name","polkadot"),C(this,"client"),C(this,"httpProviders"),C(this,"events"),C(this,"namespace"),C(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var si=Object.defineProperty,ri=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,tt=(i,t,e)=>t in i?si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t)=>{for(var e in t||(t={}))ai.call(t,e)&&tt(i,e,t[e]);if(jt)for(var e of jt(t))oi.call(t,e)&&tt(i,e,t[e]);return i},Q=(i,t)=>ri(i,ni(t)),b=(i,t,e)=>tt(i,typeof t!="symbol"?t+"":t,e);class ci{constructor(t){b(this,"name","eip155"),b(this,"client"),b(this,"chainId"),b(this,"namespace"),b(this,"httpProviders"),b(this,"events"),b(this,"storage"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=rt.getStorage(this.client.core.storage)}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=parseInt(I(e));t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(t){const e=t||this.chainId;return this.httpProviders[e]||(this.httpProviders=Q(Y({},this.httpProviders),{[e]:this.createHttpProvider(e)}),this.httpProviders[e])}async handleSwitchChain(t){var e,s;let n=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,n,a,r;const o=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0],c=((a=(n=t.request)==null?void 0:n.params)==null?void 0:a[1])||[];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((r=u==null?void 0:u.sessionProperties)==null?void 0:r.capabilities)||{},h=`${o}${c.join(",")}`,w=l==null?void 0:l[h];if(w)return w;let d;try{d=Ue(u,o,c)}catch(L){console.warn("Failed to extract capabilities from session",L)}if(d)return d;const at=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Q(Y({},u.sessionProperties||{}),{capabilities:Q(Y({},l||{}),{[h]:at})})})}catch(L){console.warn("Failed to update session with capabilities",L)}return at}async getCallStatus(t){var e,s,n;const a=this.client.session.get(t.topic),r=(e=a.sessionProperties)==null?void 0:e.bundler_name;if(r){const u=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(u,t)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const o=(s=a.sessionProperties)==null?void 0:s.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,o)}const c=await Ze({resultId:(n=t.request.params)==null?void 0:n[0],storage:this.storage});if(c)try{return await We(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;const n=new URL(t),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Et("eth_getUserOperationReceipt",[(s=e.request.params)==null?void 0:s[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(t,e){return`${Wt}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}async sendCalls(t){var e,s,n;const a=await this.client.request(t),r=(e=t.request.params)==null?void 0:e[0],o=a==null?void 0:a.id,c=(a==null?void 0:a.capabilities)||{},u=(s=c==null?void 0:c.caip345)==null?void 0:s.caip2,l=(n=c==null?void 0:c.caip345)==null?void 0:n.transactionHashes;return!o||!u||!(l!=null&&l.length)||await Qe({sendCalls:{request:r,result:a},storage:this.storage}),a}}var hi=Object.defineProperty,pi=(i,t,e)=>t in i?hi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t,e)=>pi(i,typeof t!="symbol"?t+"":t,e);class ui{constructor(t){O(this,"name","solana"),O(this,"client"),O(this,"httpProviders"),O(this,"events"),O(this,"namespace"),O(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var li=Object.defineProperty,di=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,j=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);class fi{constructor(t){j(this,"name","cosmos"),j(this,"client"),j(this,"httpProviders"),j(this,"events"),j(this,"namespace"),j(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var mi=Object.defineProperty,vi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,H=(i,t,e)=>vi(i,typeof t!="symbol"?t+"":t,e);class gi{constructor(t){H(this,"name","algorand"),H(this,"client"),H(this,"httpProviders"),H(this,"events"),H(this,"namespace"),H(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Pi=Object.defineProperty,wi=(i,t,e)=>t in i?Pi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t,e)=>wi(i,typeof t!="symbol"?t+"":t,e);class bi{constructor(t){$(this,"name","cip34"),$(this,"client"),$(this,"httpProviders"),$(this,"events"),$(this,"namespace"),$(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),n=I(e);t[n]=this.createHttpProvider(n,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var yi=Object.defineProperty,Ii=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>Ii(i,typeof t!="symbol"?t+"":t,e);class Ci{constructor(t){A(this,"name","elrond"),A(this,"client"),A(this,"httpProviders"),A(this,"events"),A(this,"namespace"),A(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Oi=Object.defineProperty,ji=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t,e)=>ji(i,typeof t!="symbol"?t+"":t,e);class Hi{constructor(t){E(this,"name","multiversx"),E(this,"client"),E(this,"httpProviders"),E(this,"events"),E(this,"namespace"),E(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var $i=Object.defineProperty,Ai=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>Ai(i,typeof t!="symbol"?t+"":t,e);class Ei{constructor(t){S(this,"name","near"),S(this,"client"),S(this,"httpProviders"),S(this,"events"),S(this,"namespace"),S(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Si=Object.defineProperty,qi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,q=(i,t,e)=>qi(i,typeof t!="symbol"?t+"":t,e);class Ni{constructor(t){q(this,"name","tezos"),q(this,"client"),q(this,"httpProviders"),q(this,"events"),q(this,"namespace"),q(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s))}}var Di=Object.defineProperty,_i=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,N=(i,t,e)=>_i(i,typeof t!="symbol"?t+"":t,e);class Fi{constructor(t){N(this,"name",qt),N(this,"client"),N(this,"httpProviders"),N(this,"events"),N(this,"namespace"),N(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return B(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(n=>{const a=B(n);s[a.reference]=this.createHttpProvider(n)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Ri=Object.defineProperty,xi=Object.defineProperties,Ui=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,et=(i,t,e)=>t in i?Ri(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,T=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&et(i,e,t[e]);if(Ht)for(var e of Ht(t))Ti.call(t,e)&&et(i,e,t[e]);return i},X=(i,t)=>xi(i,Ui(t)),m=(i,t,e)=>et(i,typeof t!="symbol"?t+"":t,e);class nt{constructor(t){m(this,"client"),m(this,"namespaces"),m(this,"optionalNamespaces"),m(this,"sessionProperties"),m(this,"scopedProperties"),m(this,"events",new zt),m(this,"rpcProviders",{}),m(this,"session"),m(this,"providerOpts"),m(this,"logger"),m(this,"uri"),m(this,"disableProviderPing",!1),this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Tt(Mt({level:(t==null?void 0:t.logger)||ct})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new nt(t);return await e.initialize(),e}async request(t,e,s){const[n,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:T({},t),chainId:`${n}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,n){const a=new Date().getTime();this.request(t,s,n).then(r=>e(null,Jt(a,r))).catch(r=>e(r,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ot("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:s,response:n}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));const a=await n();if(this.session=a.session,this.session){const r=gt(this.session.namespaces);this.namespaces=k(this.namespaces,r),await this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){const{uri:e,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});e&&(this.uri=e,this.events.emit("display_uri",e));const n=await s();this.session=n;const a=gt(n.namespaces);return this.namespaces=k(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,n]=this.validateChain(t);this.getProvider(s).setDefaultChain(n,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(!J(e))return;for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}catch(e){this.logger.warn("Failed to cleanup pending pairings",e)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,e;if(this.client=this.providerOpts.client||await Bt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ct,relayUrl:this.providerOpts.relayUrl||Gt,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(s){throw this.logger.error("Failed to get session",s),new Error(`The provided session: ${(e=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:e.topic} doesn't exist in the Sign client`)}else{const s=this.client.session.getAll();this.session=s[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>F(e)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=Se(e,this.session);if((s==null?void 0:s.length)===0)return;const n=Ut(s),a=k(this.namespaces,this.optionalNamespaces),r=X(T({},a[e]),{accounts:s,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new ci({namespace:r});break;case"algorand":this.rpcProviders[e]=new gi({namespace:r});break;case"solana":this.rpcProviders[e]=new ui({namespace:r});break;case"cosmos":this.rpcProviders[e]=new fi({namespace:r});break;case"polkadot":this.rpcProviders[e]=new ii({namespace:r});break;case"cip34":this.rpcProviders[e]=new bi({namespace:r});break;case"elrond":this.rpcProviders[e]=new Ci({namespace:r});break;case"multiversx":this.rpcProviders[e]=new Hi({namespace:r});break;case"near":this.rpcProviders[e]=new Ei({namespace:r});break;case"tezos":this.rpcProviders[e]=new Ni({namespace:r});break;default:this.rpcProviders[e]=new Fi({namespace:r})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var e;const{topic:s}=t;s===((e=this.session)==null?void 0:e.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var e;const{params:s,topic:n}=t;if(n!==((e=this.session)==null?void 0:e.topic))return;const{event:a}=s;if(a.name==="accountsChanged"){const r=a.data;r&&J(r)&&this.events.emit("accountsChanged",r.map(vt))}else if(a.name==="chainChanged"){const r=s.chainId,o=s.event.data,c=F(r),u=G(r)!==G(o)?`${c}:${G(o)}`:r;this.onChainChanged(u)}else this.events.emit(a.name,a.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s,n;if(t!==((s=this.session)==null?void 0:s.topic))return;const{namespaces:a}=e,r=(n=this.client)==null?void 0:n.session.get(t);this.session=X(T({},r),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{var e;t.topic===((e=this.session)==null?void 0:e.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",X(T({},ot("USER_DISCONNECTED")),{data:t.topic})))}),this.on(v.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qt]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e={},optionalNamespaces:s={},sessionProperties:n,scopedProperties:a}=t;this.optionalNamespaces=k(e,s),this.sessionProperties=n,this.scopedProperties=a}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(r=>F(r)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const n=F(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,n]=this.validateChain(t);if(!n)return;this.updateNamespaceChain(s,n);const a=this.getProvider(s).getDefaultChain();e?(this.events.emit("chainChanged",n),this.emitAccountsChangedOnChainChange({namespace:s,previousChainId:a,newChainId:t})):this.getProvider(s).setDefaultChain(n),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:e,newChainId:s}){var n,a;try{if(e===s)return;const r=(a=(n=this.session)==null?void 0:n.namespaces[t])==null?void 0:a.accounts;if(!r)return;const o=r.filter(c=>c.includes(`${s}:`)).map(vt);if(!J(o))return;this.events.emit("accountsChanged",o)}catch(r){this.logger.warn("Failed to emit accountsChanged on chain change",r)}}updateNamespaceChain(t,e){if(!this.namespaces)return;const s=this.namespaces[t]?t:`${t}:${e}`,n={chains:[],methods:[],events:[],defaultChain:e};this.namespaces[s]?this.namespaces[s]&&(this.namespaces[s].defaultChain=e):this.namespaces[s]=n}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,e){var s;const n=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${x}/${t}${n}`,e)}async getFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";return await this.client.core.storage.getItem(`${x}/${t}${s}`)}async deleteFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";await this.client.core.storage.removeItem(`${x}/${t}${s}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const e=await this.client.core.storage.getKeys();for(const s of e)s.startsWith(x)&&await this.client.core.storage.removeItem(s)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}const ws=nt;export{ws as UniversalProvider,nt as default};
|
|
2
|
-
//# sourceMappingURL=index.es-
|
|
1
|
+
import{B as M}from"./dcl-schemas-DslZmh30.js";import{B as Tt,m as Mt,K as ot,o as J,q as Bt,Y as F,P as $t,F as B,V as R,r as z,t as At,u as Lt}from"./wallets-C0y3R1oZ.js";import"./index-Cxyjs4LG.js";import{b as Jt,o as g,c as Et}from"./index-Bn1vI7g7.js";import{f as P}from"./index.es-BEVMBMrG.js";import{N as zt}from"./index-BoY04MqE.js";import"./react-CHXQAvvP.js";import"./signing-CEt9elnK.js";import"./prepare-contract-call-BETrvoaQ.js";import"./utils-CkABEqW6.js";import"./sentry-ClHMnYE5.js";import"./index-S5YYeBud.js";import"./ethers-DeUFwKFN.js";import"./intl-AKLEHPeO.js";import"./to-serializable-transaction-CEJ4iu6L.js";import"./transaction-BO3wjdd5.js";import"./get-bytecode-BQRF3kbv.js";import"./execute-sbSj-emH.js";import"./detectExtension-sB7QDKcb.js";import"./linkAccount-cqqKV9wt.js";import"./index-q7jg-oA_.js";import"./ethereum-BPV2jSj3.js";import"./types-BeDU9GfL.js";import"./store-80QKZ2rN.js";import"./hashTypedData-C77kpNNe.js";import"./send-transaction-CIIBNPf9.js";import"./eth_sendRawTransaction-DYAsy3sS.js";import"./index-OpYIGLSa.js";import"./index-B3-0nuPf.js";import"./index-DWQ8OGZQ.js";import"./browser-ponyfill-Dc2JIprt.js";import"./events-D_yhp3Xa.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new i.Error().stack;t&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[t]="9f6ff620-48e2-499d-ac62-73af743fe454",i._sentryDebugIdIdentifier="sentry-dbid-9f6ff620-48e2-499d-ac62-73af743fe454")}catch{}})();const ct="error",Gt="wss://relay.walletconnect.org",Vt="wc",Kt="universal_provider",x=`${Vt}@2:${Kt}:`,St="https://rpc.walletconnect.org/v1/",qt="generic",Wt=`${St}bundler`,_="call_status",Yt=86400,v={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function it(i){return i==null||typeof i!="object"&&typeof i!="function"}function Nt(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Dt(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Qt="[object RegExp]",_t="[object String]",Ft="[object Number]",Rt="[object Boolean]",xt="[object Arguments]",Xt="[object Symbol]",Zt="[object Date]",te="[object Map]",ee="[object Set]",ie="[object Array]",se="[object ArrayBuffer]",re="[object Object]",ne="[object DataView]",ae="[object Uint8Array]",oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",he="[object Uint32Array]",pe="[object Int8Array]",ue="[object Int16Array]",le="[object Int32Array]",de="[object Float32Array]",fe="[object Float64Array]";function st(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function me(i,t){return D(i,void 0,i,new Map,t)}function D(i,t,e,s=new Map,n=void 0){const a=n==null?void 0:n(i,t,e,s);if(a!=null)return a;if(it(i))return i;if(s.has(i))return s.get(i);if(Array.isArray(i)){const r=new Array(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return Object.hasOwn(i,"index")&&(r.index=i.index),Object.hasOwn(i,"input")&&(r.input=i.input),r}if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){const r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof Map){const r=new Map;s.set(i,r);for(const[o,c]of i)r.set(o,D(c,o,e,s,n));return r}if(i instanceof Set){const r=new Set;s.set(i,r);for(const o of i)r.add(D(o,void 0,e,s,n));return r}if(typeof M<"u"&&M.isBuffer(i))return i.subarray();if(st(i)){const r=new(Object.getPrototypeOf(i)).constructor(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return r}if(i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);if(i instanceof DataView){const r=new DataView(i.buffer.slice(0),i.byteOffset,i.byteLength);return s.set(i,r),y(r,i,e,s,n),r}if(typeof File<"u"&&i instanceof File){const r=new File([i],i.name,{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Blob){const r=new Blob([i],{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Error){const r=new i.constructor;return s.set(i,r),r.message=i.message,r.name=i.name,r.stack=i.stack,r.cause=i.cause,y(r,i,e,s,n),r}if(typeof i=="object"&&ve(i)){const r=Object.create(Object.getPrototypeOf(i));return s.set(i,r),y(r,i,e,s,n),r}return i}function y(i,t,e=i,s,n){const a=[...Object.keys(t),...Nt(t)];for(let r=0;r<a.length;r++){const o=a[r],c=Object.getOwnPropertyDescriptor(i,o);(c==null||c.writable)&&(i[o]=D(t[o],o,e,s,n))}}function ve(i){switch(Dt(i)){case xt:case ie:case se:case ne:case Rt:case Zt:case de:case fe:case pe:case ue:case le:case te:case Ft:case re:case Qt:case ee:case _t:case Xt:case ae:case oe:case ce:case he:return!0;default:return!1}}function ge(i,t){return me(i,(e,s,n,a)=>{if(typeof i=="object")switch(Object.prototype.toString.call(i)){case Ft:case _t:case Rt:{const r=new i.constructor(i==null?void 0:i.valueOf());return y(r,i),r}case xt:{const r={};return y(r,i),r.length=i.length,r[Symbol.iterator]=i[Symbol.iterator],r}default:return}})}function ht(i){return ge(i)}function pt(i){return i!==null&&typeof i=="object"&&Dt(i)==="[object Arguments]"}function ut(i){return typeof i=="object"&&i!==null}function Pe(){}function we(i){return st(i)}function be(i){var e;if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const s=i[Symbol.toStringTag];return s==null||!((e=Object.getOwnPropertyDescriptor(i,Symbol.toStringTag))!=null&&e.writable)?!1:i.toString()===`[object ${s}]`}let t=i;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(i)===t}function ye(i){if(it(i))return i;if(Array.isArray(i)||st(i)||i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);const t=Object.getPrototypeOf(i),e=t.constructor;if(i instanceof Date||i instanceof Map||i instanceof Set)return new e(i);if(i instanceof RegExp){const s=new e(i);return s.lastIndex=i.lastIndex,s}if(i instanceof DataView)return new e(i.buffer.slice(0));if(i instanceof Error){const s=new e(i.message);return s.stack=i.stack,s.name=i.name,s.cause=i.cause,s}if(typeof File<"u"&&i instanceof File)return new e([i],i.name,{type:i.type,lastModified:i.lastModified});if(typeof i=="object"){const s=Object.create(t);return Object.assign(s,i)}return i}function Ie(i,...t){const e=t.slice(0,-1),s=t[t.length-1];let n=i;for(let a=0;a<e.length;a++){const r=e[a];n=Z(n,r,s,new Map)}return n}function Z(i,t,e,s){if(it(i)&&(i=Object(i)),t==null||typeof t!="object")return i;if(s.has(t))return ye(s.get(t));if(s.set(t,i),Array.isArray(t)){t=t.slice();for(let a=0;a<t.length;a++)t[a]=t[a]??void 0}const n=[...Object.keys(t),...Nt(t)];for(let a=0;a<n.length;a++){const r=n[a];let o=t[r],c=i[r];if(pt(o)&&(o={...o}),pt(c)&&(c={...c}),typeof M<"u"&&M.isBuffer(o)&&(o=ht(o)),Array.isArray(o))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let w=0;w<h.length;w++){const d=h[w];l[d]=c[d]}c=l}else c=[];const u=e(c,o,r,i,t,s);u!=null?i[r]=u:Array.isArray(o)||ut(c)&&ut(o)?i[r]=Z(c,o,e,s):c==null&&be(o)?i[r]=Z({},o,e,s):c==null&&we(o)?i[r]=ht(o):(c===void 0||o!==void 0)&&(i[r]=o)}return i}function Ce(i,...t){return Ie(i,...t,Pe)}var Oe=Object.defineProperty,je=Object.defineProperties,He=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,dt=(i,t,e)=>t in i?Oe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t)=>{for(var e in t||(t={}))$e.call(t,e)&&dt(i,e,t[e]);if(lt)for(var e of lt(t))Ae.call(t,e)&&dt(i,e,t[e]);return i},Ee=(i,t)=>je(i,He(t));function f(i,t,e){var s;const n=B(i);return((s=t.rpcMap)==null?void 0:s[n.reference])||`${St}?chainId=${n.namespace}:${n.reference}&projectId=${e}`}function I(i){return i.includes(":")?i.split(":")[1]:i}function Ut(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Se(i,t){const e=Object.keys(t.namespaces).filter(n=>n.includes(i));if(!e.length)return[];const s=[];return e.forEach(n=>{const a=t.namespaces[n].accounts;s.push(...a)}),s}function ft(i){return Object.fromEntries(Object.entries(i).filter(([t,e])=>{var s,n;return((s=e==null?void 0:e.chains)==null?void 0:s.length)&&((n=e==null?void 0:e.chains)==null?void 0:n.length)>0}))}function k(i={},t={}){const e=ft(mt(i)),s=ft(mt(t));return Ce(e,s)}function mt(i){var t,e,s,n,a;const r={};if(!R(i))return r;for(const[o,c]of Object.entries(i)){const u=$t(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],w=c.rpcMap||{},d=F(o);r[d]=Ee(U(U({},r[d]),c),{chains:z(u,(t=r[d])==null?void 0:t.chains),methods:z(l,(e=r[d])==null?void 0:e.methods),events:z(h,(s=r[d])==null?void 0:s.events)}),(R(w)||R(((n=r[d])==null?void 0:n.rpcMap)||{}))&&(r[d].rpcMap=U(U({},w),(a=r[d])==null?void 0:a.rpcMap))}return r}function vt(i){return i.includes(":")?i.split(":")[2]:i}function gt(i){const t={};for(const[e,s]of Object.entries(i)){const n=s.methods||[],a=s.events||[],r=s.accounts||[],o=$t(e)?[e]:s.chains?s.chains:Ut(s.accounts);t[e]={chains:o,methods:n,events:a,accounts:r}}return t}function G(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}function qe(i){try{const t=JSON.parse(i);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const kt={},p=i=>kt[i],V=(i,t)=>{kt[i]=t};var Ne=Object.defineProperty,Pt=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,wt=(i,t,e)=>t in i?Ne(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bt=(i,t)=>{for(var e in t||(t={}))De.call(t,e)&&wt(i,e,t[e]);if(Pt)for(var e of Pt(t))_e.call(t,e)&&wt(i,e,t[e]);return i};const yt="eip155",Fe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Re=i=>i&&i.startsWith("0x")?BigInt(i).toString(10):i,K=i=>i&&i.startsWith("0x")?i:`0x${BigInt(i).toString(16)}`,It=i=>Object.keys(i).filter(t=>Fe.includes(t)).reduce((t,e)=>(t[e]=xe(i[e]),t),{}),xe=i=>typeof i=="string"&&qe(i)?JSON.parse(i):i,Ue=(i,t,e)=>{const{sessionProperties:s={},scopedProperties:n={}}=i,a={};if(!R(n)&&!R(s))return;const r=It(s);for(const o of e){const c=Re(o);if(!c)continue;a[K(c)]=r;const u=n==null?void 0:n[`${yt}:${c}`];if(u){const l=u==null?void 0:u[`${yt}:${c}:${t}`];a[K(c)]=bt(bt({},a[K(c)]),It(l||u))}}for(const[o,c]of Object.entries(a))Object.keys(c).length===0&&delete a[o];return Object.keys(a).length>0?a:void 0};var ke=Object.defineProperty,Te=(i,t,e)=>t in i?ke(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>Te(i,t+"",e);let W;class rt{constructor(t){Me(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,e){return await this.storage.setItem(t,e)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return W||(W=new rt(t)),W}}var Be=Object.defineProperty,Le=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,Ct=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ot=(i,t,e)=>t in i?Be(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t)=>{for(var e in t||(t={}))ze.call(t,e)&&Ot(i,e,t[e]);if(Ct)for(var e of Ct(t))Ge.call(t,e)&&Ot(i,e,t[e]);return i},Ke=(i,t)=>Le(i,Je(t));async function We(i,t){const e=B(i.result.capabilities.caip345.caip2),s=i.result.capabilities.caip345.transactionHashes,n=await Promise.allSettled(s.map(h=>Ye(e.reference,h,t))),a=n.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);n.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const r=!a.length||a.some(h=>!h),o=a.every(h=>(h==null?void 0:h.status)==="0x1"),c=a.every(h=>(h==null?void 0:h.status)==="0x0"),u=a.some(h=>(h==null?void 0:h.status)==="0x0");let l;return r?l=100:o?l=200:c?l=500:u&&(l=600),{id:i.result.id,version:i.request.version,atomic:i.request.atomicRequired,chainId:i.request.chainId,capabilities:i.result.capabilities,receipts:a,status:l}}async function Ye(i,t,e){return await e(parseInt(i)).request(Et("eth_getTransactionReceipt",[t]))}async function Qe({sendCalls:i,storage:t}){const e=await t.getItem(_);await t.setItem(_,Ke(Ve({},e),{[i.result.id]:{request:i.request,result:i.result,expiry:Lt(Yt)}}))}async function Xe({resultId:i,storage:t}){const e=await t.getItem(_);if(e){delete e[i],await t.setItem(_,e);for(const s in e)At(e[s].expiry)&&delete e[s];await t.setItem(_,e)}}async function Ze({resultId:i,storage:t}){const e=await t.getItem(_),s=e==null?void 0:e[i];if(s&&!At(s.expiry))return s;await Xe({resultId:i,storage:t})}var ti=Object.defineProperty,ei=(i,t,e)=>t in i?ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,C=(i,t,e)=>ei(i,typeof t!="symbol"?t+"":t,e);class ii{constructor(t){C(this,"name","polkadot"),C(this,"client"),C(this,"httpProviders"),C(this,"events"),C(this,"namespace"),C(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var si=Object.defineProperty,ri=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,tt=(i,t,e)=>t in i?si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t)=>{for(var e in t||(t={}))ai.call(t,e)&&tt(i,e,t[e]);if(jt)for(var e of jt(t))oi.call(t,e)&&tt(i,e,t[e]);return i},Q=(i,t)=>ri(i,ni(t)),b=(i,t,e)=>tt(i,typeof t!="symbol"?t+"":t,e);class ci{constructor(t){b(this,"name","eip155"),b(this,"client"),b(this,"chainId"),b(this,"namespace"),b(this,"httpProviders"),b(this,"events"),b(this,"storage"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=rt.getStorage(this.client.core.storage)}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=parseInt(I(e));t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(t){const e=t||this.chainId;return this.httpProviders[e]||(this.httpProviders=Q(Y({},this.httpProviders),{[e]:this.createHttpProvider(e)}),this.httpProviders[e])}async handleSwitchChain(t){var e,s;let n=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,n,a,r;const o=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0],c=((a=(n=t.request)==null?void 0:n.params)==null?void 0:a[1])||[];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((r=u==null?void 0:u.sessionProperties)==null?void 0:r.capabilities)||{},h=`${o}${c.join(",")}`,w=l==null?void 0:l[h];if(w)return w;let d;try{d=Ue(u,o,c)}catch(L){console.warn("Failed to extract capabilities from session",L)}if(d)return d;const at=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Q(Y({},u.sessionProperties||{}),{capabilities:Q(Y({},l||{}),{[h]:at})})})}catch(L){console.warn("Failed to update session with capabilities",L)}return at}async getCallStatus(t){var e,s,n;const a=this.client.session.get(t.topic),r=(e=a.sessionProperties)==null?void 0:e.bundler_name;if(r){const u=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(u,t)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const o=(s=a.sessionProperties)==null?void 0:s.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,o)}const c=await Ze({resultId:(n=t.request.params)==null?void 0:n[0],storage:this.storage});if(c)try{return await We(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;const n=new URL(t),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Et("eth_getUserOperationReceipt",[(s=e.request.params)==null?void 0:s[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(t,e){return`${Wt}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}async sendCalls(t){var e,s,n;const a=await this.client.request(t),r=(e=t.request.params)==null?void 0:e[0],o=a==null?void 0:a.id,c=(a==null?void 0:a.capabilities)||{},u=(s=c==null?void 0:c.caip345)==null?void 0:s.caip2,l=(n=c==null?void 0:c.caip345)==null?void 0:n.transactionHashes;return!o||!u||!(l!=null&&l.length)||await Qe({sendCalls:{request:r,result:a},storage:this.storage}),a}}var hi=Object.defineProperty,pi=(i,t,e)=>t in i?hi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t,e)=>pi(i,typeof t!="symbol"?t+"":t,e);class ui{constructor(t){O(this,"name","solana"),O(this,"client"),O(this,"httpProviders"),O(this,"events"),O(this,"namespace"),O(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var li=Object.defineProperty,di=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,j=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);class fi{constructor(t){j(this,"name","cosmos"),j(this,"client"),j(this,"httpProviders"),j(this,"events"),j(this,"namespace"),j(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var mi=Object.defineProperty,vi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,H=(i,t,e)=>vi(i,typeof t!="symbol"?t+"":t,e);class gi{constructor(t){H(this,"name","algorand"),H(this,"client"),H(this,"httpProviders"),H(this,"events"),H(this,"namespace"),H(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Pi=Object.defineProperty,wi=(i,t,e)=>t in i?Pi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t,e)=>wi(i,typeof t!="symbol"?t+"":t,e);class bi{constructor(t){$(this,"name","cip34"),$(this,"client"),$(this,"httpProviders"),$(this,"events"),$(this,"namespace"),$(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),n=I(e);t[n]=this.createHttpProvider(n,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var yi=Object.defineProperty,Ii=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>Ii(i,typeof t!="symbol"?t+"":t,e);class Ci{constructor(t){A(this,"name","elrond"),A(this,"client"),A(this,"httpProviders"),A(this,"events"),A(this,"namespace"),A(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Oi=Object.defineProperty,ji=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t,e)=>ji(i,typeof t!="symbol"?t+"":t,e);class Hi{constructor(t){E(this,"name","multiversx"),E(this,"client"),E(this,"httpProviders"),E(this,"events"),E(this,"namespace"),E(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=I(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var $i=Object.defineProperty,Ai=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>Ai(i,typeof t!="symbol"?t+"":t,e);class Ei{constructor(t){S(this,"name","near"),S(this,"client"),S(this,"httpProviders"),S(this,"events"),S(this,"namespace"),S(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Si=Object.defineProperty,qi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,q=(i,t,e)=>qi(i,typeof t!="symbol"?t+"":t,e);class Ni{constructor(t){q(this,"name","tezos"),q(this,"client"),q(this,"httpProviders"),q(this,"events"),q(this,"namespace"),q(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s))}}var Di=Object.defineProperty,_i=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,N=(i,t,e)=>_i(i,typeof t!="symbol"?t+"":t,e);class Fi{constructor(t){N(this,"name",qt),N(this,"client"),N(this,"httpProviders"),N(this,"events"),N(this,"namespace"),N(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return B(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(n=>{const a=B(n);s[a.reference]=this.createHttpProvider(n)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Ri=Object.defineProperty,xi=Object.defineProperties,Ui=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,et=(i,t,e)=>t in i?Ri(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,T=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&et(i,e,t[e]);if(Ht)for(var e of Ht(t))Ti.call(t,e)&&et(i,e,t[e]);return i},X=(i,t)=>xi(i,Ui(t)),m=(i,t,e)=>et(i,typeof t!="symbol"?t+"":t,e);class nt{constructor(t){m(this,"client"),m(this,"namespaces"),m(this,"optionalNamespaces"),m(this,"sessionProperties"),m(this,"scopedProperties"),m(this,"events",new zt),m(this,"rpcProviders",{}),m(this,"session"),m(this,"providerOpts"),m(this,"logger"),m(this,"uri"),m(this,"disableProviderPing",!1),this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Tt(Mt({level:(t==null?void 0:t.logger)||ct})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new nt(t);return await e.initialize(),e}async request(t,e,s){const[n,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:T({},t),chainId:`${n}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,n){const a=new Date().getTime();this.request(t,s,n).then(r=>e(null,Jt(a,r))).catch(r=>e(r,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ot("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:s,response:n}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));const a=await n();if(this.session=a.session,this.session){const r=gt(this.session.namespaces);this.namespaces=k(this.namespaces,r),await this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){const{uri:e,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});e&&(this.uri=e,this.events.emit("display_uri",e));const n=await s();this.session=n;const a=gt(n.namespaces);return this.namespaces=k(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,n]=this.validateChain(t);this.getProvider(s).setDefaultChain(n,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(!J(e))return;for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}catch(e){this.logger.warn("Failed to cleanup pending pairings",e)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,e;if(this.client=this.providerOpts.client||await Bt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ct,relayUrl:this.providerOpts.relayUrl||Gt,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(s){throw this.logger.error("Failed to get session",s),new Error(`The provided session: ${(e=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:e.topic} doesn't exist in the Sign client`)}else{const s=this.client.session.getAll();this.session=s[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>F(e)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=Se(e,this.session);if((s==null?void 0:s.length)===0)return;const n=Ut(s),a=k(this.namespaces,this.optionalNamespaces),r=X(T({},a[e]),{accounts:s,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new ci({namespace:r});break;case"algorand":this.rpcProviders[e]=new gi({namespace:r});break;case"solana":this.rpcProviders[e]=new ui({namespace:r});break;case"cosmos":this.rpcProviders[e]=new fi({namespace:r});break;case"polkadot":this.rpcProviders[e]=new ii({namespace:r});break;case"cip34":this.rpcProviders[e]=new bi({namespace:r});break;case"elrond":this.rpcProviders[e]=new Ci({namespace:r});break;case"multiversx":this.rpcProviders[e]=new Hi({namespace:r});break;case"near":this.rpcProviders[e]=new Ei({namespace:r});break;case"tezos":this.rpcProviders[e]=new Ni({namespace:r});break;default:this.rpcProviders[e]=new Fi({namespace:r})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var e;const{topic:s}=t;s===((e=this.session)==null?void 0:e.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var e;const{params:s,topic:n}=t;if(n!==((e=this.session)==null?void 0:e.topic))return;const{event:a}=s;if(a.name==="accountsChanged"){const r=a.data;r&&J(r)&&this.events.emit("accountsChanged",r.map(vt))}else if(a.name==="chainChanged"){const r=s.chainId,o=s.event.data,c=F(r),u=G(r)!==G(o)?`${c}:${G(o)}`:r;this.onChainChanged(u)}else this.events.emit(a.name,a.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s,n;if(t!==((s=this.session)==null?void 0:s.topic))return;const{namespaces:a}=e,r=(n=this.client)==null?void 0:n.session.get(t);this.session=X(T({},r),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{var e;t.topic===((e=this.session)==null?void 0:e.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",X(T({},ot("USER_DISCONNECTED")),{data:t.topic})))}),this.on(v.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qt]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e={},optionalNamespaces:s={},sessionProperties:n,scopedProperties:a}=t;this.optionalNamespaces=k(e,s),this.sessionProperties=n,this.scopedProperties=a}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(r=>F(r)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const n=F(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,n]=this.validateChain(t);if(!n)return;this.updateNamespaceChain(s,n);const a=this.getProvider(s).getDefaultChain();e?(this.events.emit("chainChanged",n),this.emitAccountsChangedOnChainChange({namespace:s,previousChainId:a,newChainId:t})):this.getProvider(s).setDefaultChain(n),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:e,newChainId:s}){var n,a;try{if(e===s)return;const r=(a=(n=this.session)==null?void 0:n.namespaces[t])==null?void 0:a.accounts;if(!r)return;const o=r.filter(c=>c.includes(`${s}:`)).map(vt);if(!J(o))return;this.events.emit("accountsChanged",o)}catch(r){this.logger.warn("Failed to emit accountsChanged on chain change",r)}}updateNamespaceChain(t,e){if(!this.namespaces)return;const s=this.namespaces[t]?t:`${t}:${e}`,n={chains:[],methods:[],events:[],defaultChain:e};this.namespaces[s]?this.namespaces[s]&&(this.namespaces[s].defaultChain=e):this.namespaces[s]=n}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,e){var s;const n=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${x}/${t}${n}`,e)}async getFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";return await this.client.core.storage.getItem(`${x}/${t}${s}`)}async deleteFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";await this.client.core.storage.removeItem(`${x}/${t}${s}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const e=await this.client.core.storage.getKeys();for(const s of e)s.startsWith(x)&&await this.client.core.storage.removeItem(s)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}const ws=nt;export{ws as UniversalProvider,nt as default};
|
|
2
|
+
//# sourceMappingURL=index.es-BJ9LWCeM.js.map
|