@dcl/shop 1.4.2-31312432830.commit-294f554 → 1.4.2-31318756114.commit-f38062f
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-NHOQ_W_-.js → Activity-CH13MWoB.js} +3 -3
- package/_assets/{AnimatedBackground-BuJlRsTt.js → AnimatedBackground-BtahI2yr.js} +1 -1
- package/_assets/{Assets-DsnrEwvE.js → Assets-B0RTY_4B.js} +2 -2
- package/_assets/{Assets.styles-CuWT78zl.js → Assets.styles-Cf5P2KoZ.js} +1 -1
- package/_assets/{Authorizations-B4PIyNsB.js → Authorizations-C_kJKK0F.js} +1 -1
- package/_assets/Cart-DAFR_U42.js +696 -0
- package/_assets/{CircularProgress-DUq9NPI6.js → CircularProgress-F5pVOzox.js} +1 -1
- package/_assets/{Collection-BGucqUBi.js → Collection-BFgBwwbW.js} +1 -1
- package/_assets/{CollectionCarousel-Cps0wYBU.js → CollectionCarousel-CTXfQk3n.js} +110 -110
- package/_assets/{Confetti-CBj-mVZI.js → Confetti-xJuLJyZt.js} +1 -1
- package/_assets/{ConstantsUtil-Ck3fDr3h.js → ConstantsUtil-CDQZixBe.js} +1 -1
- package/_assets/{ContentClient-Cx6YR2x_.js → ContentClient-mI39sHYs.js} +1 -1
- package/_assets/{Creator-CXw3Kadz.js → Creator-CtfIixjn.js} +1 -1
- package/_assets/{DeploymentBuilder-8vMsUZ5r.js → DeploymentBuilder-BZ6GZi6C.js} +1 -1
- package/_assets/{ErrorNotice-C_RVGUzO.js → ErrorNotice-Bbr5IZyl.js} +1 -1
- package/_assets/{ExchangeController-BlbdUNWF.js → ExchangeController-_JFGiO87.js} +1 -1
- package/_assets/{Faq-D0xuEVP5.js → Faq-Ok7Xf6Az.js} +1 -1
- package/_assets/{GetCredits-DrHn8Lnz.js → GetCredits-B_Bu8SA3.js} +2 -2
- package/_assets/{Grow-CU75s2bu.js → Grow-Cg_pp1bL.js} +1 -1
- package/_assets/{HelpersUtil-D6HuwesN.js → HelpersUtil-8laLxS6i.js} +1 -1
- package/_assets/ItemDetail-DDVvGiAK.js +3577 -0
- package/_assets/LazyEmoteControls-BiDyYsAZ.js +2 -0
- package/_assets/{LoadMore-P_MKAf1K.js → LoadMore-BElYLyIk.js} +1 -1
- package/_assets/{ManaPricingBanner.styles-CWoDMKMl.js → ManaPricingBanner.styles-W1xFuPQc.js} +1 -1
- package/_assets/{MyAssets-CUEMlx_o.js → MyAssets-DpRrVTC0.js} +2 -2
- package/_assets/{MyFavorites-BPb8OEVx.js → MyFavorites-CSAgjHyS.js} +1 -1
- package/_assets/{NetworkUtil-tcDS1IIB.js → NetworkUtil-rxhycXNt.js} +1 -1
- package/_assets/{NotFound-tne0tBOa.js → NotFound-BMSaGsh7.js} +1 -1
- package/_assets/{NotificationsBell-CmFSFwZP.js → NotificationsBell-BdF1-lqB.js} +1 -1
- package/_assets/{OutfitDetail-BT9obLRM.js → OutfitDetail-CTNY93aj.js} +1 -1
- package/_assets/{OutfitPreview-CYXMUVw2.js → OutfitPreview-C88DTtOy.js} +1 -1
- package/_assets/{OutfitStudio-YBvL5VGl.js → OutfitStudio-iXMGFuFY.js} +1 -1
- package/_assets/{StoreSettings-CZz1NxHF.js → StoreSettings-DVLJIj5-.js} +1 -1
- package/_assets/{Success-CQKYcWpX.js → Success-f4IsZ-t8.js} +1 -1
- package/_assets/{SwapController-BEVqtoCD.js → SwapController-CuIGfv30.js} +1 -1
- package/_assets/{Tooltip-sT07OWHO.js → Tooltip-BggcwAzU.js} +1 -1
- package/_assets/{TradeService-CI3giiHH.js → TradeService-C8ffaOhF.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-CF6uvH5s.js → W3MFrameProviderSingleton-YT2v-UAO.js} +3 -3
- package/_assets/{WebCryptoP256-BORYCvjs.js → WebCryptoP256-C_HNQel2.js} +1 -1
- package/_assets/authorizations-B2lXGBml.js +1 -0
- package/_assets/{basic-C4mQYhuA.js → basic-XjYpshyi.js} +1 -1
- package/_assets/{biconomy-CuJVLNp7.js → biconomy-tjuOVhE0.js} +1 -1
- package/_assets/{builder-CkniOHea.js → builder-w2ONbPIy.js} +1 -1
- package/_assets/{buy-P1ELLgiE.js → buy-CWZqT4z9.js} +1 -1
- package/_assets/{buy-gasless-BHi46MwF.js → buy-gasless-CPOiesVv.js} +1 -1
- package/_assets/{categories-C3d1csvn.js → categories-C2_r6452.js} +1 -1
- package/_assets/{ccip-BuuvnkRx.js → ccip-DQx2BHRK.js} +1 -1
- package/_assets/{ccip-C2VEvCbm.js → ccip-DwB2U-aT.js} +1 -1
- package/_assets/{chains-BIWEr0ij.js → chains-CeaUuyFk.js} +1 -1
- package/_assets/{collectionPage.styles-CeGOp9uA.js → collectionPage.styles-RfmLM7o-.js} +1 -1
- package/_assets/{common-DC11HrTT.js → common-CuD9cq2y.js} +1 -1
- package/_assets/{controller-BFSczMkH.js → controller-Ggie9io6.js} +2 -2
- package/_assets/{core-BW1P_HvM.js → core-6hPESr7t.js} +4 -4
- package/_assets/{createSvgIcon-Cv96eCpQ.js → createSvgIcon-DeL6nQf4.js} +1 -1
- package/_assets/{custom-DTSkEq9y.js → custom-DeqKJYGU.js} +1 -1
- package/_assets/{data-capture-CqPKue4D.js → data-capture-Blelq03f.js} +1 -1
- package/_assets/decimals-CTd11MEC.js +1 -0
- package/_assets/{decimals-Cq50aW31.js → decimals-D_zJ1SGP.js} +1 -1
- package/_assets/{detectExtension-DECAB97m.js → detectExtension-fXngWuJO.js} +1 -1
- package/_assets/{email-Y6VS8X-I.js → email-Jtvek7bj.js} +1 -1
- package/_assets/{embedded-wallet-DhCY0HS9.js → embedded-wallet-Bq0TA7ov.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-DS9PERKq.js → emotion-styled.browser.esm--4ZBXTCj.js} +1 -1
- package/_assets/{engine-C0KKoxYU.js → engine-DvcQogdJ.js} +1 -1
- package/_assets/{errors-CJ2pCYot.js → errors-B9awri0w.js} +1 -1
- package/_assets/{estimate-l1-fee-CdSpN9-3.js → estimate-l1-fee-wvYMkwDp.js} +1 -1
- package/_assets/{eth_estimateGas-cxuHKZ6E.js → eth_estimateGas-DpK9Ktrh.js} +1 -1
- package/_assets/{eth_getStorageAt-CtArmjiC.js → eth_getStorageAt-ClWWqBA4.js} +1 -1
- package/_assets/{eth_getTransactionCount-BfjxI2ac.js → eth_getTransactionCount-C_i4wN3-.js} +1 -1
- package/_assets/{ethereum-DDjO_s3T.js → ethereum-B5wbQK7D.js} +1 -1
- package/_assets/{ethers-DfPQ1iPJ.js → ethers-KA0WcT1W.js} +1 -1
- package/_assets/{execute-D_9LMioQ.js → execute-aC9iqBZr.js} +2 -2
- package/_assets/{extractIPFS-BzqQpbV3.js → extractIPFS-H0uQRNED.js} +1 -1
- package/_assets/{features-D0XU01_q.js → features-Boe0CxL-.js} +1 -1
- package/_assets/{fetchTokenMetadata-3bs5L4Ed.js → fetchTokenMetadata-BoHjxKKz.js} +2 -2
- package/_assets/{field.styles-DJeExo1o.js → field.styles-Bh0QuWM6.js} +1 -1
- package/_assets/{get-bytecode-CBzbILdG.js → get-bytecode-BMQIr7AZ.js} +1 -1
- package/_assets/get-ecosystem-wallet-info-CEmkl3oD.js +1 -0
- package/_assets/{getBalance-CfTr0idF.js → getBalance-nz_Qfvtt.js} +2 -2
- package/_assets/{getInstalledModules-CMaA3R_c.js → getInstalledModules-D3z1V1WH.js} +1 -1
- package/_assets/getNFT-D13p0fnl.js +1 -0
- package/_assets/{getNFT-CpdvnGlo.js → getNFT-odvi-29q.js} +2 -2
- package/_assets/{grid.styles-pd8Kimjr.js → grid.styles-BJJTujqb.js} +1 -1
- package/_assets/{hashTypedData-DyjRVyiF.js → hashTypedData-CLiDq9rD.js} +1 -1
- package/_assets/{hashTypedData-BznBKEJ4.js → hashTypedData-FbzHIrFn.js} +1 -1
- package/_assets/{in-app-CYmfrim9.js → in-app-Dc5R2ez_.js} +1 -1
- package/_assets/{in-app-wallet-calls-CqmNnUJE.js → in-app-wallet-calls-CC8PxAps.js} +1 -1
- package/_assets/{index-sMZT0osM.js → index--7OC6PCI.js} +1 -1
- package/_assets/{index-ChdPVYi_.js → index-4Es0FX7_.js} +2 -2
- package/_assets/{index-DMsfjzv3.js → index-4edBJ43Q.js} +1 -1
- package/_assets/{index-B9uk5-Wa.js → index-B0Vq5ejV.js} +1 -1
- package/_assets/{index-CWAxO3pP.js → index-B132S8vh.js} +1 -1
- package/_assets/{index-zsZ0nIv4.js → index-B1jABDUh.js} +1 -1
- package/_assets/{index-D-X0uab8.js → index-B2257SH-.js} +1 -1
- package/_assets/{index-BFG6-uk-.js → index-B5yfAnPU.js} +1 -1
- package/_assets/{index-B2jn-mld.js → index-BHPo3ekW.js} +1 -1
- package/_assets/{index-CiRq1n15.js → index-BLV9z85v.js} +2 -2
- package/_assets/{index-D4Dobs6V.js → index-BOqYML9Z.js} +1 -1
- package/_assets/{index-BNzvL79U.js → index-BTR_LXd2.js} +1 -1
- package/_assets/{index-2pZiTD3a.js → index-BWIedksf.js} +1 -1
- package/_assets/{index-HlCcqGG0.js → index-BagqxFca.js} +1 -1
- package/_assets/{index-DO1MDP-3.js → index-BdxoCMJE.js} +1 -1
- package/_assets/{index-SkahHxGM.js → index-BeEyqq5A.js} +1 -1
- package/_assets/{index-D4I_r7iA.js → index-BfN8JyCc.js} +1 -1
- package/_assets/{index-Bt3T1cvz.js → index-BgQVMC1A.js} +1 -1
- package/_assets/{index-DIZ6Fpja.js → index-Bl2zhAS_.js} +1 -1
- package/_assets/{index-CXgpMw_a.js → index-Bm0qdptx.js} +1 -1
- package/_assets/{index-1ioVeg7x.js → index-Bs3LqO7Q.js} +1 -1
- package/_assets/{index-BoVFCbnW.js → index-Bv6DmmCw.js} +1 -1
- package/_assets/{index--7bmhnCr.js → index-ByqdPx-g.js} +1 -1
- package/_assets/{index-CcCLyIxX.js → index-C8IS1XP2.js} +3 -3
- package/_assets/{index-BspLYzJo.js → index-CMUsZlxr.js} +1 -1
- package/_assets/{index-B6lhjXm3.js → index-CO1boh5B.js} +1 -1
- package/_assets/{index-BkA4dzPp.js → index-CR4kmTnE.js} +1 -1
- package/_assets/{index-CVVzw90M.js → index-CXQ7hfZf.js} +1 -1
- package/_assets/{index-Cd27zE1I.js → index-CZBzbQ0F.js} +1 -1
- package/_assets/{index-D_Xy7OI9.js → index-CbDYHEhS.js} +1 -1
- package/_assets/{index-CU34Q9VB.js → index-CgEFqINh.js} +1 -1
- package/_assets/{index-5g575ePx.js → index-CheVn-Gb.js} +1 -1
- package/_assets/{index-CB7o8WQW.js → index-Chx3QVFR.js} +1 -1
- package/_assets/{index-DG04DWBB.js → index-Co0PSPLX.js} +1 -1
- package/_assets/{index-koAbgvGY.js → index-CrCNYDrn.js} +1 -1
- package/_assets/{index-C_bUhgEP.js → index-CuzwAHOg.js} +1 -1
- package/_assets/{index-h9B4YXUq.js → index-CwLrALgf.js} +1 -1
- package/_assets/{index-HMAhnswt.js → index-D00Vge6w.js} +1 -1
- package/_assets/{index-Cq8I2bCh.js → index-D4WtCbvP.js} +67 -67
- package/_assets/{index-Cn9uLg18.js → index-D5-D9dKC.js} +1 -1
- package/_assets/{index-CoNQ2sAc.js → index-DBHaPShO.js} +1 -1
- package/_assets/{index-CGQb2ZQU.js → index-DCC4AH_W.js} +1 -1
- package/_assets/{index-BZuG0Sc3.js → index-DIF4isXI.js} +1 -1
- package/_assets/{index-B40CqL6J.js → index-DJTY02Lm.js} +1 -1
- package/_assets/{index-DqbRg5LC.js → index-DOMF5Qpu.js} +2 -2
- package/_assets/{index-DNCRJDU6.js → index-DQ_VLK_b.js} +1 -1
- package/_assets/{index-dFumStoV.js → index-DV_oamj_.js} +1 -1
- package/_assets/{index-CiPrjG5a.js → index-DWdQDIa2.js} +1 -1
- package/_assets/{index-CX_8l6aH.js → index-D_Fy7dRk.js} +1 -1
- package/_assets/{index-Domysh9-.js → index-D_seoFht.js} +1 -1
- package/_assets/{index-BeYcw5Co.js → index-Deh1RDqU.js} +1 -1
- package/_assets/{index-DwnMvkbN.js → index-Df6A1qsv.js} +1 -1
- package/_assets/{index-Dbs-O_xu.js → index-Dmadp6QB.js} +2 -2
- package/_assets/{index-YTZYM_mv.js → index-Du2tzQIs.js} +1 -1
- package/_assets/{index-BAEUZZ6m.js → index-Dz7CytEG.js} +1 -1
- package/_assets/{index-BOFr5q8K.js → index-G_eDeNVf.js} +1 -1
- package/_assets/{index-C9qn3MDW.js → index-Niu6qsRx.js} +1 -1
- package/_assets/{index-1UqZYo-x.js → index-VzCVOadZ.js} +1 -1
- package/_assets/{index-BdcjNzsb.js → index-avyoZsuC.js} +1 -1
- package/_assets/{index-C0FhBugy.js → index-hhwq3d4P.js} +3 -3
- package/_assets/{index-oyav6SwC.js → index-tXaUa8Cs.js} +1 -1
- package/_assets/{index-Bpjughes.js → index-vjg1njrW.js} +3 -3
- package/_assets/{index.es-C5ucclti.js → index.es-CL05QnJW.js} +1 -1
- package/_assets/{index.es-B088SWVm.js → index.es-CLntoI58.js} +1 -1
- package/_assets/{index.es-BgY67W9o.js → index.es-Dc6t3ivq.js} +4 -4
- package/_assets/{linkAccount-B2LX6Ayb.js → linkAccount-PtSN0QcL.js} +1 -1
- package/_assets/{localBatchGatewayRequest-CrEvGINX.js → localBatchGatewayRequest-BFytMsdf.js} +1 -1
- package/_assets/{native-BYuJILVU.js → native-dHHbZdbJ.js} +1 -1
- package/_assets/{networks-BgzjLjJ2.js → networks-yQg4rbqq.js} +1 -1
- package/_assets/{onramp-Svn_UmTw.js → onramp-D_yYR0s5.js} +1 -1
- package/_assets/{openzeppelin-BPRRVTr1.js → openzeppelin-BLjFbX3r.js} +1 -1
- package/_assets/{ownerOf-BswBoTM4.js → ownerOf-B0wWnGAM.js} +1 -1
- package/_assets/{parseNft-CfYOiCXQ.js → parseNft-CUXYgxsd.js} +2 -2
- package/_assets/{parseSignature-gNg7kA4M.js → parseSignature-B4E7CQmy.js} +3 -3
- package/_assets/{parseSignature-NfMUgfN4.js → parseSignature-auGHp-jm.js} +1 -1
- package/_assets/{passkeys-Bf7HGrQE.js → passkeys-BZSRAVgt.js} +1 -1
- package/_assets/{pay-with-exchange-NpC_jsVL.js → pay-with-exchange-uqccuNZX.js} +1 -1
- package/_assets/{prepare-contract-call-DrM5fnvt.js → prepare-contract-call-D2QFN7zR.js} +1 -1
- package/_assets/{qr-overlay-CX-B0YKk.js → qr-overlay-BNMX_WIE.js} +1 -1
- package/_assets/{receive-DU_jmquO.js → receive-BT1UePgl.js} +1 -1
- package/_assets/{resolveImplementation-0bOm_A8l.js → resolveImplementation-CYaOQ5sv.js} +1 -1
- package/_assets/{rpc-DwUMO0mH.js → rpc-BIVRXDns.js} +1 -1
- package/_assets/{secp256k1-NtZ6kHJZ.js → secp256k1-DE1S7xuz.js} +1 -1
- package/_assets/{secp256k1-BJWN557q.js → secp256k1-Sh8sTQXG.js} +1 -1
- package/_assets/{secp256k1-CRg-T_AS.js → secp256k1-_bm2fnpV.js} +1 -1
- package/_assets/{send-B6q0W9lI.js → send-Dm0GvghF.js} +1 -1
- package/_assets/{send-batch-transaction-Cg-JwW7k.js → send-batch-transaction-BW7JqYr-.js} +1 -1
- package/_assets/{send-eip712-transaction-GrhIPA6L.js → send-eip712-transaction-D8UYfBzy.js} +2 -2
- package/_assets/send-gasless-transaction-C10kFc-4.js +2 -0
- package/_assets/{send-transaction-Aq0ndQmo.js → send-transaction-BS4mKukV.js} +2 -2
- package/_assets/{sendMetaTransaction-BuEwIAyh.js → sendMetaTransaction-BOQmFcY9.js} +1 -1
- package/_assets/{sendRawTransaction-JGobH71Z.js → sendRawTransaction-2OEfpgbg.js} +3 -3
- package/_assets/{sentry-2i8Tr7WR.js → sentry-1EfTvlEd.js} +1 -1
- package/_assets/{serializeTransaction-B-NbRyZz.js → serializeTransaction-CuDu3vwz.js} +1 -1
- package/_assets/{session-proposal-b3xSScTf.js → session-proposal-D_H9xlHz.js} +1 -1
- package/_assets/{session-request-BhfPcY4l.js → session-request-DjHYCh5G.js} +2 -2
- package/_assets/{sha256-BKfXR492.js → sha256-CxKrCdyI.js} +1 -1
- package/_assets/{signing-CzYSJwB8.js → signing-Dq3sLeI8.js} +3 -3
- package/_assets/{skeleton.styles-BwXvfynq.js → skeleton.styles-y_b4J2xL.js} +1 -1
- package/_assets/{socials-ClkHxAE_.js → socials-BMK4uEMR.js} +1 -1
- package/_assets/{styled-jiv5F83t.js → styled-C7i5Orxw.js} +1 -1
- package/_assets/{swaps-BwEAGSoG.js → swaps-fhdUUEjy.js} +1 -1
- package/_assets/{thirdweb-BCcw3IiV.js → thirdweb-Co67--fA.js} +3 -3
- package/_assets/{to-serializable-transaction-CI-QnODl.js → to-serializable-transaction-DMM_ICCl.js} +2 -2
- package/_assets/{totalSupply-gVMBAoD-.js → totalSupply-B_0Pn62r.js} +1 -1
- package/_assets/{transaction-7HLCNEOz.js → transaction-D83MU1Bp.js} +1 -1
- package/_assets/{transactionReceipt-a17hpBtt.js → transactionReceipt-Cz-1bZ1D.js} +1 -1
- package/_assets/{transactions-up6hcXnh.js → transactions-Ce2E_vT5.js} +1 -1
- package/_assets/useCreditPacks-DYIEt5ni.js +1 -0
- package/_assets/{useImportable-BpgbDKEn.js → useImportable-CgYCyKZ9.js} +1 -1
- package/_assets/{useInfiniteGrid-CyR838AE.js → useInfiniteGrid-CKUzdlpU.js} +1 -1
- package/_assets/{useStore-kijFHyHV.js → useStore-D6WwYrDv.js} +2 -2
- package/_assets/{useTheme-DIejI6C_.js → useTheme-BZ-lMk44.js} +1 -1
- package/_assets/{utils-BPBPOxKw.js → utils-CfFH9jvF.js} +1 -1
- package/_assets/{verifyHash-BqY8uOSx.js → verifyHash-D7K4ylcs.js} +1 -1
- package/_assets/{w3m-modal-D0vRJJdP.js → w3m-modal-CfudP4Ab.js} +1 -1
- package/_assets/{w3m-modal-DWLBXt0Y.js → w3m-modal-Cs4OGOy-.js} +1 -1
- package/_assets/{wait-for-tx-receipt-1xUKRb2m.js → wait-for-tx-receipt-CxEEJm9u.js} +1 -1
- package/_assets/{wallets-B25NNhvI.js → wallets-2d1wGxwj.js} +5 -5
- package/_assets/{web-connector-N42CiDrd.js → web-connector-By0422b-.js} +3 -3
- package/_assets/{writeContract-CuegwesU.js → writeContract-D_cXCGKD.js} +1 -1
- package/_assets/{zora-sepolia-ChK9Wob7.js → zora-sepolia-BdgZOQdg.js} +1 -1
- package/_assets/{zoraTestnet-k3Q5cVnd.js → zoraTestnet-DzYJOdjJ.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Cart-CWjD9l0B.js +0 -696
- package/_assets/ItemDetail-7FWHJW_E.js +0 -3577
- package/_assets/LazyEmoteControls-D_Cuiw7-.js +0 -2
- package/_assets/authorizations-CAFiSVFA.js +0 -1
- package/_assets/decimals-DUdu01dG.js +0 -1
- package/_assets/get-ecosystem-wallet-info-ASLw891I.js +0 -1
- package/_assets/getNFT-BLfp3o9w.js +0 -1
- package/_assets/send-gasless-transaction-Dnd0BR62.js +0 -2
- package/_assets/useCreditPacks-CDD4tXAF.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{L as k,d as ie,j as e,r as h}from"./react-BYHuwl8r.js";import{t as ae,s as t,I as w,O as se,P as ne,B as $,Q as oe,v as M,R as re,l as le,y as de,b as s,S as _,U as F,V as ce,W as he,X as pe,Y as me,Z as ue,$ as xe,a0 as ge,a1 as fe,a2 as be,a3 as ye,a4 as ve,a5 as je,a6 as we,a7 as $e,a8 as ke,a9 as Ce,A as z,aa as Ie,ab as Ee,ac as ze,ad as Le,ae as We,af as Oe}from"./index-
|
|
1
|
+
import{L as k,d as ie,j as e,r as h}from"./react-BYHuwl8r.js";import{t as ae,s as t,I as w,O as se,P as ne,B as $,Q as oe,v as M,R as re,l as le,y as de,b as s,S as _,U as F,V as ce,W as he,X as pe,Y as me,Z as ue,$ as xe,a0 as ge,a1 as fe,a2 as be,a3 as ye,a4 as ve,a5 as je,a6 as we,a7 as $e,a8 as ke,a9 as Ce,A as z,aa as Ie,ab as Ee,ac as ze,ad as Le,ae as We,af as Oe}from"./index-D4WtCbvP.js";import{E as H}from"./ErrorNotice-Bbr5IZyl.js";import{E as Se}from"./LazyEmoteControls-BiDyYsAZ.js";import{O as Ae}from"./OutfitPreview-C88DTtOy.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-1EfTvlEd.js";import"./ethers-KA0WcT1W.js";import"./intl-CBcMB1D2.js";import"./disposePreview-5vjiqVZ0.js";const{colors:n,radius:f,media:r,gradients:Fe}=ae,K=t.div`
|
|
2
2
|
max-width: 1721px;
|
|
3
3
|
margin: 0 auto;
|
|
4
4
|
/* The page's bottom padding is 56px, but the phone CTA bar is sticky and has its own bottom padding for the safe area.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r,j as n}from"./react-BYHuwl8r.js";import{d as g}from"./dcl-schemas-CmtP3U6y.js";import{s as P,X as R,ag as F,c as O,ah as S,b as B}from"./index-
|
|
1
|
+
import{r,j as n}from"./react-BYHuwl8r.js";import{d as g}from"./dcl-schemas-CmtP3U6y.js";import{s as P,X as R,ag as F,c as O,ah as S,b as B}from"./index-D4WtCbvP.js";import{d as W}from"./disposePreview-5vjiqVZ0.js";const H=P.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
inset: 0;
|
|
4
4
|
display: grid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d,j as t,L as F,d as Jt,a as Xt,b as Yt}from"./react-BYHuwl8r.js";import{s,t as lt,I as K,aZ as Zt,b as e,A as ot,B as x,K as Ct,v as X,R as te,y as ee,D as It,l as Et,V as ie,$ as z,a_ as V,a$ as se,b0 as oe,b1 as J,a4 as re,a5 as ae,a2 as ne,a3 as de,S as Lt,a8 as le,b2 as rt,b3 as ue,b4 as ce,b5 as pe,F as N,b6 as Rt,b7 as zt,b8 as A,k as at,b9 as nt,ba as he,bb as fe,bc as xe,Z as me,bd as ge,be,af as ye}from"./index-
|
|
1
|
+
import{r as d,j as t,L as F,d as Jt,a as Xt,b as Yt}from"./react-BYHuwl8r.js";import{s,t as lt,I as K,aZ as Zt,b as e,A as ot,B as x,K as Ct,v as X,R as te,y as ee,D as It,l as Et,V as ie,$ as z,a_ as V,a$ as se,b0 as oe,b1 as J,a4 as re,a5 as ae,a2 as ne,a3 as de,S as Lt,a8 as le,b2 as rt,b3 as ue,b4 as ce,b5 as pe,F as N,b6 as Rt,b7 as zt,b8 as A,k as at,b9 as nt,ba as he,bb as fe,bc as xe,Z as me,bd as ge,be,af as ye}from"./index-D4WtCbvP.js";import{E as U}from"./ErrorNotice-Bbr5IZyl.js";import{L as je}from"./LoadMore-BElYLyIk.js";import{u as ve}from"./useInfiniteGrid-CKUzdlpU.js";import{O as we}from"./OutfitPreview-C88DTtOy.js";import{T as $e}from"./skeleton.styles-y_b4J2xL.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-1EfTvlEd.js";import"./ethers-KA0WcT1W.js";import"./intl-CBcMB1D2.js";import"./disposePreview-5vjiqVZ0.js";const{colors:m,radius:Y,media:ke}=lt,Se=s.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as r,t as j,s as a,x as ce,B as G,y as de,v as pe,D as ue,I as L,F as R}from"./index-
|
|
1
|
+
import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as r,t as j,s as a,x as ce,B as G,y as de,v as pe,D as ue,I as L,F as R}from"./index-D4WtCbvP.js";import{u as ge,d as me,t as xe,L as he,i as A,a as f,s as fe}from"./useStore-D6WwYrDv.js";import{E as D}from"./ErrorNotice-Bbr5IZyl.js";import{F as w}from"./field.styles-Bh0QuWM6.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-1EfTvlEd.js";import"./ethers-KA0WcT1W.js";import"./intl-CBcMB1D2.js";const ve="https://cdn.decentraland.org/@dcl/shop/1.4.2-31318756114.commit-f38062f/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/1.4.2-31318756114.commit-f38062f/_assets/template-cover-2-Dni9s0i_.jpeg",we=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":ve,"../assets/creator-covers/template-cover-2.jpeg":be}),v=Object.entries(we).sort(([n],[u])=>n.localeCompare(u)).map(([n,u])=>({name:n.split("/").pop(),url:u})),je=ce`
|
|
2
2
|
to {
|
|
3
3
|
transform: rotate(360deg);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as P,b as M,j as e,N as W,r as I}from"./react-BYHuwl8r.js";import{t as J,s as t,A as N,J as O,K as _,v as q,y as H,b as n,z as U,C as X,L as D,M as G,c as E,B as K,N as Q}from"./index-
|
|
1
|
+
import{a as P,b as M,j as e,N as W,r as I}from"./react-BYHuwl8r.js";import{t as J,s as t,A as N,J as O,K as _,v as q,y as H,b as n,z as U,C as X,L as D,M as G,c as E,B as K,N as Q}from"./index-D4WtCbvP.js";import{C as Y}from"./Confetti-xJuLJyZt.js";import{J as V}from"./JumpInIcon-CfzbSVBF.js";import{w as Z,S as ee}from"./buy-gasless-CPOiesVv.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-1EfTvlEd.js";import"./ethers-KA0WcT1W.js";import"./intl-CBcMB1D2.js";import"./authorizations-B2lXGBml.js";import"./sendMetaTransaction-BOQmFcY9.js";import"./buy-CWZqT4z9.js";const{colors:i,radius:b}=J,c="@media (max-width: 600px)",S=t.div`
|
|
2
2
|
/* Its own stacking context, above the confetti layer (z-index 0). Needed because z-index is inert without
|
|
3
3
|
a position, so the content would otherwise sit below the burst regardless of order. */
|
|
4
4
|
position: relative;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as T,j as G,R as I,S as f,k as B,E as M,l as F,W as L,C as g,B as N,b as W,m as E,A as O,n as z,d as _,g as R,o as H,e as V,i as q,p as $}from"./W3MFrameProviderSingleton-CF6uvH5s.js";import{au as C}from"./NetworkUtil-tcDS1IIB.js";const b={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=b.getGasPriceInEther(o,t);return T.bigNumber(n).times(s).toNumber()},getPriceImpact({sourceTokenAmount:n,sourceTokenPriceInUSD:o,toTokenPriceInUSD:t,toTokenAmount:s}){const c=T.bigNumber(n).times(o),r=T.bigNumber(s).times(t);return c.minus(r).div(c).times(100).toNumber()},getMaxSlippage(n,o){const t=T.bigNumber(n).div(100);return T.multiply(o,t).toNumber()},getProviderFee(n,o=.0085){return T.bigNumber(n).times(o).toString()},isInsufficientNetworkTokenForGas(n,o){const t=o||"0";return T.bigNumber(n).eq(0)?!0:T.bigNumber(T.bigNumber(t)).gt(n)},isInsufficientSourceTokenForSwap(n,o,t){var r,d;const s=(d=(r=t==null?void 0:t.find(l=>l.address===o))==null?void 0:r.quantity)==null?void 0:d.numeric;return T.bigNumber(s||"0").lt(n)}},x=15e4,Q=6,m={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:_.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},e=$({...m}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,h,y,A,S,P;const n=g.state.activeChain,o=((i=g.getAccountData(n))==null?void 0:i.caipAddress)??g.state.activeCaipAddress,t=W.getPlainAddress(o),s=R(),c=H.getConnectorId(g.state.activeChain);if(!t)throw new Error("No address found to swap the tokens from.");const r=!((u=e.toToken)!=null&&u.address)||!((p=e.toToken)!=null&&p.decimals),d=!((w=e.sourceToken)!=null&&w.address)||!((h=e.sourceToken)!=null&&h.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(y=e.sourceToken)==null?void 0:y.address,toTokenAddress:(A=e.toToken)==null?void 0:A.address,toTokenAmount:e.toTokenAmount,toTokenDecimals:(S=e.toToken)==null?void 0:S.decimals,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:(P=e.sourceToken)==null?void 0:P.decimals,invalidToToken:r,invalidSourceToken:d,invalidSourceTokenAmount:l,availableToSwap:o&&!r&&!d&&!l,isAuthConnector:c===C.CONNECTOR_ID.AUTH}},async setSourceToken(n){if(!n){e.sourceToken=n,e.sourceTokenAmount="",e.sourceTokenPriceInUSD=0;return}e.sourceToken=n,await a.setTokenPrice(n.address,"sourceToken")},setSourceTokenAmount(n){e.sourceTokenAmount=n},async setToToken(n){if(!n){e.toToken=n,e.toTokenAmount="",e.toTokenPriceInUSD=0;return}e.toToken=n,await a.setTokenPrice(n.address,"toToken")},setToTokenAmount(n){e.toTokenAmount=n?T.toFixed(n,Q):""},async setTokenPrice(n,o){let t=e.tokensPriceMap[n]||0;t||(e.loadingPrices=!0,t=await a.getAddressPrice(n)),o==="sourceToken"?e.sourceTokenPriceInUSD=t:o==="toToken"&&(e.toTokenPriceInUSD=t),e.loadingPrices&&(e.loadingPrices=!1),a.getParams().availableToSwap&&!e.switchingTokens&&a.swapTokens()},async switchTokens(){if(!(e.initializing||!e.initialized||e.switchingTokens)){e.switchingTokens=!0;try{const n=e.toToken?{...e.toToken}:void 0,o=e.sourceToken?{...e.sourceToken}:void 0,t=n&&e.toTokenAmount===""?"1":e.toTokenAmount;a.setSourceTokenAmount(t),a.setToTokenAmount(""),await a.setSourceToken(n),await a.setToToken(o),e.switchingTokens=!1,a.swapTokens()}catch(n){throw e.switchingTokens=!1,n}}},resetState(){e.myTokensWithBalance=m.myTokensWithBalance,e.tokensPriceMap=m.tokensPriceMap,e.initialized=m.initialized,e.initializing=m.initializing,e.switchingTokens=m.switchingTokens,e.sourceToken=m.sourceToken,e.sourceTokenAmount=m.sourceTokenAmount,e.sourceTokenPriceInUSD=m.sourceTokenPriceInUSD,e.toToken=m.toToken,e.toTokenAmount=m.toTokenAmount,e.toTokenPriceInUSD=m.toTokenPriceInUSD,e.networkPrice=m.networkPrice,e.networkTokenSymbol=m.networkTokenSymbol,e.networkBalanceInUSD=m.networkBalanceInUSD,e.inputError=m.inputError},resetValues(){var t;const{networkAddress:n}=a.getParams(),o=(t=e.tokens)==null?void 0:t.find(s=>s.address===n);a.setSourceToken(o),a.setToToken(void 0)},getApprovalLoadingState(){return e.loadingApprovalTransaction},clearError(){e.transactionError=void 0},async initializeState(){if(!e.initializing){if(e.initializing=!0,!e.initialized)try{await a.fetchTokens(),e.initialized=!0}catch{e.initialized=!1,f.showError("Failed to initialize swap"),I.goBack()}e.initializing=!1}},async fetchTokens(){var t;const{networkAddress:n}=a.getParams();await a.getNetworkTokenPrice(),await a.getMyTokensWithBalance();const o=(t=e.myTokensWithBalance)==null?void 0:t.find(s=>s.address===n);o&&(e.networkTokenSymbol=o.symbol,a.setSourceToken(o),a.setSourceTokenAmount("0"))},async getTokenList(){var o,t;const n=(o=g.state.activeCaipNetwork)==null?void 0:o.caipNetworkId;if(!(e.caipNetworkId===n&&e.tokens))try{e.tokensLoading=!0;const s=await E.getTokenList(n);e.tokens=s,e.caipNetworkId=n,e.popularTokens=s.sort((i,u)=>i.symbol<u.symbol?-1:i.symbol>u.symbol?1:0);const r=(n&&((t=_.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(_.SWAP_SUGGESTED_TOKENS||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i).filter(i=>!r.some(u=>u.address===i.address));e.suggestedTokens=[...r,...l]}catch{e.tokens=[],e.popularTokens=[],e.suggestedTokens=[]}finally{e.tokensLoading=!1}},async getAddressPrice(n){var i,u;const o=e.tokensPriceMap[n];if(o)return o;const t=await N.fetchTokenPrice({addresses:[n]}),s=(t==null?void 0:t.fungibles)||[],c=[...e.tokens||[],...e.myTokensWithBalance||[]],r=(i=c==null?void 0:c.find(p=>p.address===n))==null?void 0:i.symbol,d=((u=s.find(p=>p.symbol.toLowerCase()===(r==null?void 0:r.toLowerCase())))==null?void 0:u.price)||0,l=parseFloat(d.toString());return e.tokensPriceMap[n]=l,l},async getNetworkTokenPrice(){var c;const{networkAddress:n}=a.getParams(),t=(c=(await N.fetchTokenPrice({addresses:[n]}).catch(()=>(f.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:c[0],s=(t==null?void 0:t.price.toString())||"0";e.tokensPriceMap[n]=parseFloat(s),e.networkTokenSymbol=(t==null?void 0:t.symbol)||"",e.networkPrice=s},async getMyTokensWithBalance(n){var s;const o=await z.getMyTokensWithBalance({forceUpdate:n,caipNetwork:g.state.activeCaipNetwork,address:(s=g.getAccountData())==null?void 0:s.address}),t=E.mapBalancesToSwapTokens(o);t&&(await a.getInitialGasPrice(),a.setBalances(t))},setBalances(n){const{networkAddress:o}=a.getParams(),t=g.state.activeCaipNetwork;if(!t)return;const s=n.find(c=>c.address===o);n.forEach(c=>{e.tokensPriceMap[c.address]=c.price||0}),e.myTokensWithBalance=n.filter(c=>c.address.startsWith(t.caipNetworkId)),e.networkBalanceInUSD=s?T.multiply(s.quantity.numeric,s.price).toString():"0"},async getInitialGasPrice(){var o,t;const n=await E.fetchGasPrice();if(!n)return{gasPrice:null,gasPriceInUSD:null};switch((t=(o=g.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case C.CHAIN.SOLANA:return e.gasFee=n.standard??"0",e.gasPriceInUSD=T.multiply(n.standard,e.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(e.gasFee),gasPriceInUSD:Number(e.gasPriceInUSD)};case C.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=b.getGasPriceInUSD(e.networkPrice,r,c);return e.gasFee=s,e.gasPriceInUSD=d,{gasPrice:c,gasPriceInUSD:d}}},async swapTokens(){var r,d,l;const n=(r=g.getAccountData())==null?void 0:r.address,o=e.sourceToken,t=e.toToken,s=T.bigNumber(e.sourceTokenAmount).gt(0);if(s||a.setToTokenAmount(""),!t||!o||e.loadingPrices||!s||!n)return;e.loadingQuote=!0;const c=T.bigNumber(e.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const i=await N.fetchSwapQuote({userAddress:n,from:o.address,to:t.address,gasPrice:e.gasFee,amount:c.toString()});e.loadingQuote=!1;const u=(l=(d=i==null?void 0:i.quotes)==null?void 0:d[0])==null?void 0:l.toAmount;if(!u){O.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const p=T.bigNumber(u).div(10**t.decimals).toString();a.setToTokenAmount(p),a.hasInsufficientToken(e.sourceTokenAmount,o.address)?e.inputError="Insufficient balance":(e.inputError=void 0,a.setTransactionDetails())}catch(i){const u=await E.handleSwapError(i);e.loadingQuote=!1,e.inputError=u||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:n,availableToSwap:o}=a.getParams(),t=e.sourceToken,s=e.toToken;if(!(!n||!o||!t||!s||e.loadingQuote))try{e.loadingBuildTransaction=!0;const c=await E.fetchSwapAllowance({userAddress:n,tokenAddress:t.address,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:t.decimals});let r;return c?r=await a.createSwapTransaction():r=await a.createAllowanceTransaction(),e.loadingBuildTransaction=!1,e.fetchError=!1,r}catch{I.goBack(),f.showError("Failed to check allowance"),e.loadingBuildTransaction=!1,e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:n,sourceTokenAddress:o,toTokenAddress:t}=a.getParams();if(!(!n||!t)){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const s=await N.generateApproveCalldata({from:o,to:t,userAddress:n}),c=W.getPlainAddress(s.tx.from);if(!c)throw new Error("SwapController:createAllowanceTransaction - address is required");const r={data:s.tx.data,to:c,gasPrice:BigInt(s.tx.eip155.gasPrice),value:BigInt(s.tx.value),toAmount:e.toTokenAmount};return e.swapTransaction=void 0,e.approvalTransaction={data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount},{data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount}}catch{I.goBack(),f.showError("Failed to create approval transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}}},async createSwapTransaction(){var d,l;const{networkAddress:n,fromCaipAddress:o,sourceTokenAmount:t}=a.getParams(),s=e.sourceToken,c=e.toToken;if(!o||!t||!s||!c)return;let r=(d=B.parseUnits(t,s.decimals))==null?void 0:d.toString();try{const i=s.address===n;let u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:r,disableEstimate:!0}),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice);if(i&&r){const A=(l=e.myTokensWithBalance)==null?void 0:l.find(S=>S.address===n);if(A){const S=parseInt(A.quantity.decimals,10),P=B.parseUnits(A.quantity.numeric,S)??0n,v=p*w;if(BigInt(r)+v>P){const k=P>v?P-v:0n;k>0n&&(u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:k.toString(),disableEstimate:!0}),r=k.toString(),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice))}}}const h=W.getPlainAddress(u.tx.to);if(!h)throw new Error("SwapController:createSwapTransaction - address is required");const y={data:u.tx.data,to:h,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=b.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=y,y}catch{I.goBack(),f.showError("Failed to create transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){f.showLoading("Approve limit increase in your wallet"),I.replace("SwapPreview")},async sendTransactionForApproval(n){var c,r,d;const{fromAddress:o,isAuthConnector:t}=a.getParams();e.loadingApprovalTransaction=!0,t?I.pushTransactionStack({onSuccess:a.onEmbeddedWalletApprovalSuccess}):f.showLoading("Approve limit increase in your wallet");try{await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:C.CHAIN.EVM}),await a.swapTokens(),await a.getTransaction(),e.approvalTransaction=void 0,e.loadingApprovalTransaction=!1}catch(l){const i=l;e.transactionError=i==null?void 0:i.displayMessage,e.loadingApprovalTransaction=!1,f.showError((i==null?void 0:i.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(i==null?void 0:i.displayMessage)||(i==null?void 0:i.message)||"Unknown",network:((c=g.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",swapFromToken:((r=a.state.sourceToken)==null?void 0:r.symbol)||"",swapToToken:((d=a.state.toToken)==null?void 0:d.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,h,y,A,S,P,v;if(!n)return;const{fromAddress:o,toTokenAmount:t,isAuthConnector:s}=a.getParams();e.loadingTransaction=!0;const c=`Swapping ${(d=e.sourceToken)==null?void 0:d.symbol} to ${T.formatNumberToLocalString(t,3)} ${(l=e.toToken)==null?void 0:l.symbol}`,r=`Swapped ${(i=e.sourceToken)==null?void 0:i.symbol} to ${T.formatNumberToLocalString(t,3)} ${(u=e.toToken)==null?void 0:u.symbol}`;s?I.pushTransactionStack({onSuccess(){I.replace("Account"),f.showLoading(c),D.resetState()}}):f.showLoading("Confirm transaction in your wallet");try{const U=[(p=e.sourceToken)==null?void 0:p.address,(w=e.toToken)==null?void 0:w.address].join(","),k=await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:C.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((h=g.state.activeCaipNetwork)==null?void 0:h.caipNetworkId)||"",swapFromToken:((y=a.state.sourceToken)==null?void 0:y.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}}),D.resetState(),s||I.replace("Account"),D.getMyTokensWithBalance(U),k}catch(U){const k=U;e.transactionError=k==null?void 0:k.displayMessage,e.loadingTransaction=!1,f.showError((k==null?void 0:k.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(k==null?void 0:k.displayMessage)||(k==null?void 0:k.message)||"Unknown",network:((S=g.state.activeCaipNetwork)==null?void 0:S.caipNetworkId)||"",swapFromToken:((P=a.state.sourceToken)==null?void 0:P.symbol)||"",swapToToken:((v=a.state.toToken)==null?void 0:v.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return b.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=b.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=b.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=b.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=b.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
|
|
1
|
+
import{N as T,j as G,R as I,S as f,k as B,E as M,l as F,W as L,C as g,B as N,b as W,m as E,A as O,n as z,d as _,g as R,o as H,e as V,i as q,p as $}from"./W3MFrameProviderSingleton-YT2v-UAO.js";import{au as C}from"./NetworkUtil-rxhycXNt.js";const b={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=b.getGasPriceInEther(o,t);return T.bigNumber(n).times(s).toNumber()},getPriceImpact({sourceTokenAmount:n,sourceTokenPriceInUSD:o,toTokenPriceInUSD:t,toTokenAmount:s}){const c=T.bigNumber(n).times(o),r=T.bigNumber(s).times(t);return c.minus(r).div(c).times(100).toNumber()},getMaxSlippage(n,o){const t=T.bigNumber(n).div(100);return T.multiply(o,t).toNumber()},getProviderFee(n,o=.0085){return T.bigNumber(n).times(o).toString()},isInsufficientNetworkTokenForGas(n,o){const t=o||"0";return T.bigNumber(n).eq(0)?!0:T.bigNumber(T.bigNumber(t)).gt(n)},isInsufficientSourceTokenForSwap(n,o,t){var r,d;const s=(d=(r=t==null?void 0:t.find(l=>l.address===o))==null?void 0:r.quantity)==null?void 0:d.numeric;return T.bigNumber(s||"0").lt(n)}},x=15e4,Q=6,m={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:_.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},e=$({...m}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,h,y,A,S,P;const n=g.state.activeChain,o=((i=g.getAccountData(n))==null?void 0:i.caipAddress)??g.state.activeCaipAddress,t=W.getPlainAddress(o),s=R(),c=H.getConnectorId(g.state.activeChain);if(!t)throw new Error("No address found to swap the tokens from.");const r=!((u=e.toToken)!=null&&u.address)||!((p=e.toToken)!=null&&p.decimals),d=!((w=e.sourceToken)!=null&&w.address)||!((h=e.sourceToken)!=null&&h.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(y=e.sourceToken)==null?void 0:y.address,toTokenAddress:(A=e.toToken)==null?void 0:A.address,toTokenAmount:e.toTokenAmount,toTokenDecimals:(S=e.toToken)==null?void 0:S.decimals,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:(P=e.sourceToken)==null?void 0:P.decimals,invalidToToken:r,invalidSourceToken:d,invalidSourceTokenAmount:l,availableToSwap:o&&!r&&!d&&!l,isAuthConnector:c===C.CONNECTOR_ID.AUTH}},async setSourceToken(n){if(!n){e.sourceToken=n,e.sourceTokenAmount="",e.sourceTokenPriceInUSD=0;return}e.sourceToken=n,await a.setTokenPrice(n.address,"sourceToken")},setSourceTokenAmount(n){e.sourceTokenAmount=n},async setToToken(n){if(!n){e.toToken=n,e.toTokenAmount="",e.toTokenPriceInUSD=0;return}e.toToken=n,await a.setTokenPrice(n.address,"toToken")},setToTokenAmount(n){e.toTokenAmount=n?T.toFixed(n,Q):""},async setTokenPrice(n,o){let t=e.tokensPriceMap[n]||0;t||(e.loadingPrices=!0,t=await a.getAddressPrice(n)),o==="sourceToken"?e.sourceTokenPriceInUSD=t:o==="toToken"&&(e.toTokenPriceInUSD=t),e.loadingPrices&&(e.loadingPrices=!1),a.getParams().availableToSwap&&!e.switchingTokens&&a.swapTokens()},async switchTokens(){if(!(e.initializing||!e.initialized||e.switchingTokens)){e.switchingTokens=!0;try{const n=e.toToken?{...e.toToken}:void 0,o=e.sourceToken?{...e.sourceToken}:void 0,t=n&&e.toTokenAmount===""?"1":e.toTokenAmount;a.setSourceTokenAmount(t),a.setToTokenAmount(""),await a.setSourceToken(n),await a.setToToken(o),e.switchingTokens=!1,a.swapTokens()}catch(n){throw e.switchingTokens=!1,n}}},resetState(){e.myTokensWithBalance=m.myTokensWithBalance,e.tokensPriceMap=m.tokensPriceMap,e.initialized=m.initialized,e.initializing=m.initializing,e.switchingTokens=m.switchingTokens,e.sourceToken=m.sourceToken,e.sourceTokenAmount=m.sourceTokenAmount,e.sourceTokenPriceInUSD=m.sourceTokenPriceInUSD,e.toToken=m.toToken,e.toTokenAmount=m.toTokenAmount,e.toTokenPriceInUSD=m.toTokenPriceInUSD,e.networkPrice=m.networkPrice,e.networkTokenSymbol=m.networkTokenSymbol,e.networkBalanceInUSD=m.networkBalanceInUSD,e.inputError=m.inputError},resetValues(){var t;const{networkAddress:n}=a.getParams(),o=(t=e.tokens)==null?void 0:t.find(s=>s.address===n);a.setSourceToken(o),a.setToToken(void 0)},getApprovalLoadingState(){return e.loadingApprovalTransaction},clearError(){e.transactionError=void 0},async initializeState(){if(!e.initializing){if(e.initializing=!0,!e.initialized)try{await a.fetchTokens(),e.initialized=!0}catch{e.initialized=!1,f.showError("Failed to initialize swap"),I.goBack()}e.initializing=!1}},async fetchTokens(){var t;const{networkAddress:n}=a.getParams();await a.getNetworkTokenPrice(),await a.getMyTokensWithBalance();const o=(t=e.myTokensWithBalance)==null?void 0:t.find(s=>s.address===n);o&&(e.networkTokenSymbol=o.symbol,a.setSourceToken(o),a.setSourceTokenAmount("0"))},async getTokenList(){var o,t;const n=(o=g.state.activeCaipNetwork)==null?void 0:o.caipNetworkId;if(!(e.caipNetworkId===n&&e.tokens))try{e.tokensLoading=!0;const s=await E.getTokenList(n);e.tokens=s,e.caipNetworkId=n,e.popularTokens=s.sort((i,u)=>i.symbol<u.symbol?-1:i.symbol>u.symbol?1:0);const r=(n&&((t=_.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(_.SWAP_SUGGESTED_TOKENS||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i).filter(i=>!r.some(u=>u.address===i.address));e.suggestedTokens=[...r,...l]}catch{e.tokens=[],e.popularTokens=[],e.suggestedTokens=[]}finally{e.tokensLoading=!1}},async getAddressPrice(n){var i,u;const o=e.tokensPriceMap[n];if(o)return o;const t=await N.fetchTokenPrice({addresses:[n]}),s=(t==null?void 0:t.fungibles)||[],c=[...e.tokens||[],...e.myTokensWithBalance||[]],r=(i=c==null?void 0:c.find(p=>p.address===n))==null?void 0:i.symbol,d=((u=s.find(p=>p.symbol.toLowerCase()===(r==null?void 0:r.toLowerCase())))==null?void 0:u.price)||0,l=parseFloat(d.toString());return e.tokensPriceMap[n]=l,l},async getNetworkTokenPrice(){var c;const{networkAddress:n}=a.getParams(),t=(c=(await N.fetchTokenPrice({addresses:[n]}).catch(()=>(f.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:c[0],s=(t==null?void 0:t.price.toString())||"0";e.tokensPriceMap[n]=parseFloat(s),e.networkTokenSymbol=(t==null?void 0:t.symbol)||"",e.networkPrice=s},async getMyTokensWithBalance(n){var s;const o=await z.getMyTokensWithBalance({forceUpdate:n,caipNetwork:g.state.activeCaipNetwork,address:(s=g.getAccountData())==null?void 0:s.address}),t=E.mapBalancesToSwapTokens(o);t&&(await a.getInitialGasPrice(),a.setBalances(t))},setBalances(n){const{networkAddress:o}=a.getParams(),t=g.state.activeCaipNetwork;if(!t)return;const s=n.find(c=>c.address===o);n.forEach(c=>{e.tokensPriceMap[c.address]=c.price||0}),e.myTokensWithBalance=n.filter(c=>c.address.startsWith(t.caipNetworkId)),e.networkBalanceInUSD=s?T.multiply(s.quantity.numeric,s.price).toString():"0"},async getInitialGasPrice(){var o,t;const n=await E.fetchGasPrice();if(!n)return{gasPrice:null,gasPriceInUSD:null};switch((t=(o=g.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case C.CHAIN.SOLANA:return e.gasFee=n.standard??"0",e.gasPriceInUSD=T.multiply(n.standard,e.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(e.gasFee),gasPriceInUSD:Number(e.gasPriceInUSD)};case C.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=b.getGasPriceInUSD(e.networkPrice,r,c);return e.gasFee=s,e.gasPriceInUSD=d,{gasPrice:c,gasPriceInUSD:d}}},async swapTokens(){var r,d,l;const n=(r=g.getAccountData())==null?void 0:r.address,o=e.sourceToken,t=e.toToken,s=T.bigNumber(e.sourceTokenAmount).gt(0);if(s||a.setToTokenAmount(""),!t||!o||e.loadingPrices||!s||!n)return;e.loadingQuote=!0;const c=T.bigNumber(e.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const i=await N.fetchSwapQuote({userAddress:n,from:o.address,to:t.address,gasPrice:e.gasFee,amount:c.toString()});e.loadingQuote=!1;const u=(l=(d=i==null?void 0:i.quotes)==null?void 0:d[0])==null?void 0:l.toAmount;if(!u){O.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const p=T.bigNumber(u).div(10**t.decimals).toString();a.setToTokenAmount(p),a.hasInsufficientToken(e.sourceTokenAmount,o.address)?e.inputError="Insufficient balance":(e.inputError=void 0,a.setTransactionDetails())}catch(i){const u=await E.handleSwapError(i);e.loadingQuote=!1,e.inputError=u||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:n,availableToSwap:o}=a.getParams(),t=e.sourceToken,s=e.toToken;if(!(!n||!o||!t||!s||e.loadingQuote))try{e.loadingBuildTransaction=!0;const c=await E.fetchSwapAllowance({userAddress:n,tokenAddress:t.address,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:t.decimals});let r;return c?r=await a.createSwapTransaction():r=await a.createAllowanceTransaction(),e.loadingBuildTransaction=!1,e.fetchError=!1,r}catch{I.goBack(),f.showError("Failed to check allowance"),e.loadingBuildTransaction=!1,e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:n,sourceTokenAddress:o,toTokenAddress:t}=a.getParams();if(!(!n||!t)){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const s=await N.generateApproveCalldata({from:o,to:t,userAddress:n}),c=W.getPlainAddress(s.tx.from);if(!c)throw new Error("SwapController:createAllowanceTransaction - address is required");const r={data:s.tx.data,to:c,gasPrice:BigInt(s.tx.eip155.gasPrice),value:BigInt(s.tx.value),toAmount:e.toTokenAmount};return e.swapTransaction=void 0,e.approvalTransaction={data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount},{data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount}}catch{I.goBack(),f.showError("Failed to create approval transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}}},async createSwapTransaction(){var d,l;const{networkAddress:n,fromCaipAddress:o,sourceTokenAmount:t}=a.getParams(),s=e.sourceToken,c=e.toToken;if(!o||!t||!s||!c)return;let r=(d=B.parseUnits(t,s.decimals))==null?void 0:d.toString();try{const i=s.address===n;let u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:r,disableEstimate:!0}),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice);if(i&&r){const A=(l=e.myTokensWithBalance)==null?void 0:l.find(S=>S.address===n);if(A){const S=parseInt(A.quantity.decimals,10),P=B.parseUnits(A.quantity.numeric,S)??0n,v=p*w;if(BigInt(r)+v>P){const k=P>v?P-v:0n;k>0n&&(u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:k.toString(),disableEstimate:!0}),r=k.toString(),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice))}}}const h=W.getPlainAddress(u.tx.to);if(!h)throw new Error("SwapController:createSwapTransaction - address is required");const y={data:u.tx.data,to:h,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=b.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=y,y}catch{I.goBack(),f.showError("Failed to create transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){f.showLoading("Approve limit increase in your wallet"),I.replace("SwapPreview")},async sendTransactionForApproval(n){var c,r,d;const{fromAddress:o,isAuthConnector:t}=a.getParams();e.loadingApprovalTransaction=!0,t?I.pushTransactionStack({onSuccess:a.onEmbeddedWalletApprovalSuccess}):f.showLoading("Approve limit increase in your wallet");try{await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:C.CHAIN.EVM}),await a.swapTokens(),await a.getTransaction(),e.approvalTransaction=void 0,e.loadingApprovalTransaction=!1}catch(l){const i=l;e.transactionError=i==null?void 0:i.displayMessage,e.loadingApprovalTransaction=!1,f.showError((i==null?void 0:i.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(i==null?void 0:i.displayMessage)||(i==null?void 0:i.message)||"Unknown",network:((c=g.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",swapFromToken:((r=a.state.sourceToken)==null?void 0:r.symbol)||"",swapToToken:((d=a.state.toToken)==null?void 0:d.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,h,y,A,S,P,v;if(!n)return;const{fromAddress:o,toTokenAmount:t,isAuthConnector:s}=a.getParams();e.loadingTransaction=!0;const c=`Swapping ${(d=e.sourceToken)==null?void 0:d.symbol} to ${T.formatNumberToLocalString(t,3)} ${(l=e.toToken)==null?void 0:l.symbol}`,r=`Swapped ${(i=e.sourceToken)==null?void 0:i.symbol} to ${T.formatNumberToLocalString(t,3)} ${(u=e.toToken)==null?void 0:u.symbol}`;s?I.pushTransactionStack({onSuccess(){I.replace("Account"),f.showLoading(c),D.resetState()}}):f.showLoading("Confirm transaction in your wallet");try{const U=[(p=e.sourceToken)==null?void 0:p.address,(w=e.toToken)==null?void 0:w.address].join(","),k=await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:C.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((h=g.state.activeCaipNetwork)==null?void 0:h.caipNetworkId)||"",swapFromToken:((y=a.state.sourceToken)==null?void 0:y.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}}),D.resetState(),s||I.replace("Account"),D.getMyTokensWithBalance(U),k}catch(U){const k=U;e.transactionError=k==null?void 0:k.displayMessage,e.loadingTransaction=!1,f.showError((k==null?void 0:k.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(k==null?void 0:k.displayMessage)||(k==null?void 0:k.message)||"Unknown",network:((S=g.state.activeCaipNetwork)==null?void 0:S.caipNetworkId)||"",swapFromToken:((P=a.state.sourceToken)==null?void 0:P.symbol)||"",swapToToken:((v=a.state.toToken)==null?void 0:v.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return b.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=b.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=b.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=b.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=b.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as C,e as T}from"./react-BYHuwl8r.js";import{s as P,t as i}from"./index-
|
|
1
|
+
import{r as o,j as C,e as T}from"./react-BYHuwl8r.js";import{s as P,t as i}from"./index-D4WtCbvP.js";const B=(...t)=>({shouldForwardProp:p=>!t.includes(p)}),A=P("span",B("block"))`
|
|
2
2
|
display: ${({block:t})=>t?"flex":"inline-flex"};
|
|
3
3
|
${({block:t})=>t?"width: 100%;":""}
|
|
4
4
|
`,I=P("span",B("placement"))`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ve=Object.defineProperty;var xe=(r,t,e)=>t in r?ve(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var p=(r,t,e)=>xe(r,typeof t!="symbol"?t+"":t,e);import{W as ue,a as Q,C as ge,B as Ce,f as X}from"./ethers-
|
|
1
|
+
var ve=Object.defineProperty;var xe=(r,t,e)=>t in r?ve(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var p=(r,t,e)=>xe(r,typeof t!="symbol"?t+"":t,e);import{W as ue,a as Q,C as ge,B as Ce,f as X}from"./ethers-KA0WcT1W.js";import{a as Ee,d as B}from"./dcl-schemas-CmtP3U6y.js";import{c as ee}from"./react-BYHuwl8r.js";import{cl as Re,aY as te,g as re}from"./index-D4WtCbvP.js";import{c as q,e as Ie}from"./index-BLV9z85v.js";import{s as Pe}from"./sendMetaTransaction-BOQmFcY9.js";import"./sentry-1EfTvlEd.js";import"./intl-CBcMB1D2.js";import"./events-DQ172AOg.js";async function be(r){const t=await de();if(t){const e=await new ue(t).getSigner().getChainId();if(r===e)return t}return q.createProvider(Ee.ProviderType.NETWORK,r)}async function de(){try{return await q.getProvider()}catch{try{const{provider:r}=await q.tryPreviousConnection();return r}catch{return null}}}function ne(r){return Math.floor(r/1e3)}function ae(r){switch(r.assetType){case B.TradeAssetType.ERC721:return r.tokenId;case B.TradeAssetType.COLLECTION_ITEM:return r.itemId;case B.TradeAssetType.ERC20:return r.amount;default:return console.error("Invalid asset type:",r),""}}function Ae(r){var t;return{checks:{uses:r.checks.uses,expiration:ne(r.checks.expiration),effective:ne(r.checks.effective),salt:Q(r.checks.salt,32),contractSignatureIndex:r.checks.contractSignatureIndex,signerSignatureIndex:r.checks.signerSignatureIndex,allowedRoot:Q(r.checks.allowedRoot,32),externalChecks:(t=r.checks.externalChecks)==null?void 0:t.map(e=>({contractAddress:e.contractAddress,selector:e.selector,value:e.value?e.value:"0x",required:e.required}))},sent:r.sent.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:ae(e),extra:e.extra?e.extra:"0x"})),received:r.received.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:ae(e),extra:e.extra?e.extra:"0x",beneficiary:e.beneficiary}))}}function se(r,t){const e=Ae(r);return{signer:r.signer,signature:r.signature,...e,checks:{...e.checks,allowedProof:[]},sent:e.sent.map(i=>({...i,beneficiary:t}))}}async function Se(r){const t=await r.request({method:"eth_chainId",params:[]});let e;return typeof t=="string"?e=parseInt(t,16):e=t,e}async function Fe(r){const t=await be(r);return new ue(t)}const S=new Ie.EventEmitter;var C;(function(r){r.ERROR="error",r.SUCCESS="success",r.PROMPT="prompt",r.ACCEPT="accept",r.REJECT="reject"})(C||(C={}));let Le="https://transactions-api.decentraland.org/v1";const ke=()=>Le,Ue=()=>new Promise((r,t)=>{const e=()=>{S.removeAllListeners(C.REJECT),r(!0)},i=()=>{S.removeAllListeners(C.ACCEPT),t(new Error("User rejected transaction"))};S.addListener(C.ACCEPT,e),S.addListener(C.REJECT,i)});async function oe(...r){const[t,e,...i]=r;try{const s=await de();if(!s)throw new Error("Provider not connected");const c=await Se(s),l=await Fe(t.chainId),I=new ge(t.address,t.abi,l),T=await(typeof e=="function"?e(I.populateTransaction):I.populateTransaction[e](...i));if(c===t.chainId){const v=l.getSigner();if(s.isMagic||s.isThirdweb){let U=Ce.from(0);try{const _=await v.getGasPrice(),k=await v.estimateGas(T);U=_.mul(k)}catch{}if(!U.isZero()){const _=Ue(),k=await v.getBalance();S.emit(C.PROMPT,{transactionGasPrice:X(U),userBalance:X(k),chainId:t.chainId}),await _}}const b=await v.sendTransaction(T);return S.emit(C.SUCCESS,{txHash:b.hash}),b.hash}else{const v=await Pe(s,l,T.data,t,{serverURL:ke()});return S.emit(C.SUCCESS,{txHash:v}),v}}catch(s){const c={type:C.ERROR,error:s};throw S.emit(C.ERROR,c),s}}var M={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var _e=M.exports,ie;function Oe(){return ie||(ie=1,(function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,c=typeof ee=="object"&ⅇ(c.global===c||c.window===c||c.self===c)&&(e=c);var l,I=2147483647,T=36,v=1,b=26,U=38,_=700,k=72,G=128,J="-",he=/^xn--/,fe=/[^\x20-\x7E]/,pe=/[\x2E\u3002\uFF0E\uFF61]/g,ye={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=T-v,E=Math.floor,O=String.fromCharCode,N;function F(n){throw new RangeError(ye[n])}function $(n,a){for(var o=n.length,u=[];o--;)u[o]=a(n[o]);return u}function V(n,a){var o=n.split("@"),u="";o.length>1&&(u=o[0]+"@",n=o[1]),n=n.replace(pe,".");var d=n.split("."),y=$(d,a).join(".");return u+y}function Y(n){for(var a=[],o=0,u=n.length,d,y;o<u;)d=n.charCodeAt(o++),d>=55296&&d<=56319&&o<u?(y=n.charCodeAt(o++),(y&64512)==56320?a.push(((d&1023)<<10)+(y&1023)+65536):(a.push(d),o--)):a.push(d);return a}function H(n){return $(n,function(a){var o="";return a>65535&&(a-=65536,o+=O(a>>>10&1023|55296),a=56320|a&1023),o+=O(a),o}).join("")}function Te(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:T}function W(n,a){return n+22+75*(n<26)-((a!=0)<<5)}function Z(n,a,o){var u=0;for(n=o?E(n/_):n>>1,n+=E(n/a);n>D*b>>1;u+=T)n=E(n/D);return E(u+(D+1)*n/(n+U))}function K(n){var a=[],o=n.length,u,d=0,y=G,h=k,w,x,R,P,f,m,g,A,L;for(w=n.lastIndexOf(J),w<0&&(w=0),x=0;x<w;++x)n.charCodeAt(x)>=128&&F("not-basic"),a.push(n.charCodeAt(x));for(R=w>0?w+1:0;R<o;){for(P=d,f=1,m=T;R>=o&&F("invalid-input"),g=Te(n.charCodeAt(R++)),(g>=T||g>E((I-d)/f))&&F("overflow"),d+=g*f,A=m<=h?v:m>=h+b?b:m-h,!(g<A);m+=T)L=T-A,f>E(I/L)&&F("overflow"),f*=L;u=a.length+1,h=Z(d-P,u,P==0),E(d/u)>I-y&&F("overflow"),y+=E(d/u),d%=u,a.splice(d++,0,y)}return H(a)}function z(n){var a,o,u,d,y,h,w,x,R,P,f,m=[],g,A,L,j;for(n=Y(n),g=n.length,a=G,o=0,y=k,h=0;h<g;++h)f=n[h],f<128&&m.push(O(f));for(u=d=m.length,d&&m.push(J);u<g;){for(w=I,h=0;h<g;++h)f=n[h],f>=a&&f<w&&(w=f);for(A=u+1,w-a>E((I-o)/A)&&F("overflow"),o+=(w-a)*A,a=w,h=0;h<g;++h)if(f=n[h],f<a&&++o>I&&F("overflow"),f==a){for(x=o,R=T;P=R<=y?v:R>=y+b?b:R-y,!(x<P);R+=T)j=x-P,L=T-P,m.push(O(W(P+j%L,0))),x=E(j/L);m.push(O(W(x,0))),y=Z(o,A,u==d),o=0,++u}++o,++a}return m.join("")}function we(n){return V(n,function(a){return he.test(a)?K(a.slice(4).toLowerCase()):a})}function me(n){return V(n,function(a){return fe.test(a)?"xn--"+z(a):a})}if(l={version:"1.4.1",ucs2:{decode:Y,encode:H},decode:K,encode:z,toASCII:me,toUnicode:we},i&&s)if(r.exports==i)s.exports=l;else for(N in l)l.hasOwnProperty(N)&&(i[N]=l[N]);else e.punycode=l})(_e)})(M,M.exports)),M.exports}Oe();var le=(function(r){function t(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return t();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:t});var e=__magic__;return e})(Object),Me=le.URL;le.URLSearchParams;var Ne={URL:Me};class ce extends Error{constructor(e,i,s){super(e);p(this,"status");p(this,"data");this.status=i,this.data=s}}const De=3,je=1e3,Be=[400,401,403,404,409,422],qe=(globalThis==null?void 0:globalThis.URL)??Ne.URL;class Ge{constructor(t,e){p(this,"baseUrl");p(this,"retries");p(this,"retryDelay");p(this,"nonRetryableStatuses");p(this,"identity");p(this,"sleep",t=>new Promise(e=>{setTimeout(e,t)}));p(this,"getIdentity",()=>this.identity instanceof Function?this.identity():this.identity);p(this,"rawFetch",(t,e)=>{const i=new qe(t,this.baseUrl),s=(e==null?void 0:e.identity)??this.getIdentity();return Re.signedFetchFactory()(i.toString(),{...e,identity:s})});p(this,"fetch",async(t,e)=>{for(let i=0;i<=this.retries;i++)try{let s,c;try{s=await this.rawFetch(t,e);const l=await s.text();l.length===0?c={ok:!0,data:null}:c=JSON.parse(l)}catch(l){throw new ce(l.message,void 0,null)}if(!s.ok||c.ok===!1){const l=c.message??c.error;throw new ce(l??`Request failed with status code ${s.status}`,s.status,c.data)}return c.ok===!0?c.data:c}catch(s){if(console.error(`[API] HTTP request failed: ${s.message||""}`,s),this.retries===i||s.status&&this.nonRetryableStatuses.includes(s.status))throw s;await this.sleep(this.retryDelay)}throw new Error("Unreachable code")});this.baseUrl=t,this.identity=e==null?void 0:e.identity,this.retries=(e==null?void 0:e.retries)??De,this.retryDelay=(e==null?void 0:e.retryDelay)??je,this.nonRetryableStatuses=(e==null?void 0:e.nonRetryableStatuses)??Be}}class Je extends Ge{constructor(e,i,s){super(i,s);p(this,"signer");p(this,"addTrade",async e=>this.fetch("/v1/trades",{method:"POST",body:JSON.stringify(e),metadata:{signer:this.signer,intent:"dcl:create-trade"},headers:{"Content-Type":"application/json"}}));p(this,"fetchTrade",async e=>this.fetch(`/v1/trades/${e}`,{method:"GET"}));this.signer=e}}class et{constructor(t,e,i){p(this,"tradesAPI");this.tradesAPI=new Je(t,e,{identity:i,retries:0})}async addTrade(t){return this.tradesAPI.addTrade(t)}async fetchTrade(t){return this.tradesAPI.fetchTrade(t)}async accept(t,e){const i=te(t.contract),s=re(i,t.chainId),c=se(t,e);return oe(s,"accept",[c])}async cancel(t,e){const i=te(t.contract),s=re(i,t.chainId),c=se(t,e);return oe(s,"cancelSignature",[c])}}export{et as TradeService};
|