@dcl/shop 0.1.0-30461849576.commit-12d07d4 → 0.1.0-30491920077.commit-b636261
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-CSuhDydH.js → Activity-B1PUyPvs.js} +7 -7
- package/assets/{AnimatedBackground-8Z_8Mlol.js → AnimatedBackground-TVJS-gH0.js} +1 -1
- package/assets/{Assets-SN3Y76GI.js → Assets-Dg2UL1q0.js} +7 -7
- package/assets/{Assets.styles-ciQtjliZ.js → Assets.styles-DXfpYzAi.js} +2 -2
- package/assets/{Authorizations-lx92TdPJ.js → Authorizations-D-4hw46l.js} +1 -1
- package/assets/{Cart-B21LiuAo.js → Cart-CxyHlX2J.js} +16 -11
- package/assets/{CircularProgress-Djai3zyH.js → CircularProgress-NzNCIVEM.js} +1 -1
- package/assets/{Collection-CEQxSX4E.js → Collection-pFKxEeja.js} +1 -1
- package/assets/{CollectionCarousel-DfMAEnsm.js → CollectionCarousel-CTx_WmhK.js} +34 -16
- package/assets/{ConstantsUtil-CJLq5-wb.js → ConstantsUtil-Dfwpy1eP.js} +1 -1
- package/assets/{ContentClient-Dt2-TsxC.js → ContentClient-gZyDAKO3.js} +1 -1
- package/assets/Creator-BB3XvV9Z.js +306 -0
- package/assets/{DeploymentBuilder-Cu-VDjOR.js → DeploymentBuilder-DufsvYDr.js} +1 -1
- package/assets/{ErrorNotice-CyxiR_Rh.js → ErrorNotice-AcMffEAY.js} +1 -1
- package/assets/{ExchangeController-Z_fhiIuM.js → ExchangeController-wlmVCi1v.js} +1 -1
- package/assets/{GetCredits-Ctz5CKT1.js → GetCredits-Dz-bnwEB.js} +4 -4
- package/assets/{HelpersUtil-CfY7XYFI.js → HelpersUtil-DcfnZGQ4.js} +1 -1
- package/assets/{ImportListings-DmVwt0Ax.js → ImportListings-CxprZUOI.js} +8 -8
- package/assets/{ItemDetail-CX5br1KM.js → ItemDetail-DhZQXVky.js} +151 -149
- package/assets/{LoadMore-BpBgRt6U.js → LoadMore-CbGw7_AZ.js} +1 -1
- package/assets/{MenuList-D6x9iVBq.js → MenuList-BDM-Jnmn.js} +1 -1
- package/assets/{MyAssets-BexRoK4a.js → MyAssets-BwXozDej.js} +1 -1
- package/assets/{MyFavorites-YMHXyXLK.js → MyFavorites-DBNdZQwR.js} +1 -1
- package/assets/{NetworkUtil-DrZx-6FF.js → NetworkUtil-HlUKXKcF.js} +1 -1
- package/assets/{NotFound-BGBtr9uR.js → NotFound-Dg3tao6l.js} +1 -1
- package/assets/{NotificationsBell-DC-1Irju.js → NotificationsBell-B5rxWs0X.js} +1 -1
- package/assets/{StoreSettings-U-7XtzFv.js → StoreSettings-RchStPPt.js} +1 -1
- package/assets/{Success-DpsXoJt6.js → Success-BXQb9XGi.js} +1 -1
- package/assets/{SwapController-DYEFHcHa.js → SwapController-DpGp1Ynj.js} +1 -1
- package/assets/Tooltip-CaPywNj_.js +45 -0
- package/assets/{TradeService-DctYnk8d.js → TradeService-DK22dfVy.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-E3LZaKPB.js → W3MFrameProviderSingleton-CgZVr29H.js} +3 -3
- package/assets/{WebCryptoP256-CVsQ_o8H.js → WebCryptoP256-DjQsZliH.js} +1 -1
- package/assets/{authorizations-wLlzXVR-.js → authorizations-CBQpjv0Y.js} +1 -1
- package/assets/{basic-CKpMAJq4.js → basic-OCyD-MQ8.js} +1 -1
- package/assets/{biconomy-C-ggcRFD.js → biconomy-CMy-5ybX.js} +1 -1
- package/assets/{browseLayout.styles-4wApiFUk.js → browseLayout.styles-nIInl7-_.js} +1 -1
- package/assets/{browser-CNT004n0.js → browser-BGlawS--.js} +1 -1
- package/assets/browser-ponyfill-B4tSdV4O.js +1 -0
- package/assets/{browser-ponyfill-C5PEoXZC.js → browser-ponyfill-BvriZgAo.js} +1 -1
- package/assets/{builder-DMvOfu4D.js → builder-102Lb9G5.js} +1 -1
- package/assets/{buy-F5h0O1Oz.js → buy-YzKhoSZr.js} +1 -1
- package/assets/{buy-gasless-Bx1g9q5n.js → buy-gasless-DNXWk0IK.js} +1 -1
- package/assets/{categories-DSuB3dEO.js → categories-fg4FNysa.js} +1 -1
- package/assets/{ccip-DFl4XluK.js → ccip-BlzuXBcO.js} +1 -1
- package/assets/{ccip-BO523Iyo.js → ccip-D7pzspy6.js} +1 -1
- package/assets/{chains-B1nqR6QI.js → chains-DjVUcpdx.js} +1 -1
- package/assets/{clsx-CdAehort.js → clsx-DwIdSwcx.js} +2 -2
- package/assets/{common-D06fGQP-.js → common-BzdjGk0Y.js} +1 -1
- package/assets/{controller--bXZwMEA.js → controller-BJZNt1wD.js} +2 -2
- package/assets/{core-BBTEsxmO.js → core-FKpkmBFa.js} +4 -4
- package/assets/{createSvgIcon-CthtS2fU.js → createSvgIcon-DGQlBR6A.js} +2 -2
- package/assets/{custom-CsWArT5d.js → custom-CIyThiRk.js} +1 -1
- package/assets/{data-capture-kKOdMtvw.js → data-capture-CfDNvCcR.js} +1 -1
- package/assets/decimals-CTAJwKFW.js +1 -0
- package/assets/{decimals-DxZ5UHfB.js → decimals-rMqzXjFU.js} +1 -1
- package/assets/{detectExtension-FEABfJC9.js → detectExtension-0JcORGBX.js} +1 -1
- package/assets/{email-vr9UbC4V.js → email-KcRIrjEE.js} +1 -1
- package/assets/{embedded-wallet-DFmANWep.js → embedded-wallet-Ce1sNhFM.js} +1 -1
- package/assets/{emotion-styled.browser.esm-BjmVKpEM.js → emotion-styled.browser.esm-Cz2UYW4L.js} +1 -1
- package/assets/{engine-CIkOAXtz.js → engine-CrjpfCPZ.js} +1 -1
- package/assets/{errors-BHFRAZhi.js → errors-D5A1rAhl.js} +1 -1
- package/assets/estimate-l1-fee-Dl1G4kze.js +1 -0
- package/assets/eth_estimateGas-BfIHMLbI.js +1 -0
- package/assets/{eth_getStorageAt-DTRcHmRI.js → eth_getStorageAt-DIGus6Ic.js} +1 -1
- package/assets/eth_getTransactionCount-CmmgCgZ1.js +1 -0
- package/assets/{ethereum-BtCbkX0F.js → ethereum-7duKFA0R.js} +1 -1
- package/assets/{ethers-C3WgUna9.js → ethers-CpLYx0ea.js} +1 -1
- package/assets/{execute-DXk7xWDJ.js → execute-CiexXudY.js} +2 -2
- package/assets/{extractIPFS-CSmwBy8V.js → extractIPFS-CTs5XnuT.js} +1 -1
- package/assets/{features-CB_msUrB.js → features-DsYpCrnC.js} +1 -1
- package/assets/{fetchTokenMetadata-BonBD4HK.js → fetchTokenMetadata-DWypYxbA.js} +2 -2
- package/assets/{fortmatic-ClwQlaPX.js → fortmatic-CCMQbesB.js} +1 -1
- package/assets/{get-bytecode-DKGahtxz.js → get-bytecode-Bg8NviKV.js} +1 -1
- package/assets/get-ecosystem-wallet-info-DZWKxVA6.js +1 -0
- package/assets/{getBalance-CthDORPr.js → getBalance-Cz6bGYhR.js} +2 -2
- package/assets/{getInstalledModules-Cox2YDyF.js → getInstalledModules-KP-LSI0j.js} +1 -1
- package/assets/{getNFT-Bjg_w6DD.js → getNFT-720NoLwo.js} +2 -2
- package/assets/getNFT-BZS561d1.js +1 -0
- package/assets/{getThemeProps-B7lAOokG.js → getThemeProps-FLQVbLMg.js} +1 -1
- package/assets/{grid.styles-BWHADUFG.js → grid.styles-DtrFzApp.js} +1 -1
- package/assets/{hashTypedData-D3KNbXgE.js → hashTypedData-BILWs9dJ.js} +1 -1
- package/assets/{hashTypedData-BXeSV9EI.js → hashTypedData-DCSgTQmF.js} +1 -1
- package/assets/{import-C0ulsb8r.js → import-BJPDoosw.js} +1 -1
- package/assets/{in-app-8FmH0RQh.js → in-app-NKvMMEfv.js} +1 -1
- package/assets/{in-app-wallet-calls-BFluJbdo.js → in-app-wallet-calls-BajxVBH8.js} +1 -1
- package/assets/{index-M0lk4EtX.js → index-3x98-rKq.js} +1 -1
- package/assets/{index-CuZV-f-I.js → index-8EYFemjW.js} +1 -1
- package/assets/{index-BO_zSTNJ.js → index-8_bleNab.js} +1 -1
- package/assets/index-9H7pG6F1.js +1 -0
- package/assets/{index-C7NK0fVJ.js → index-B-Kqr2Lr.js} +1 -1
- package/assets/{index-D8AjAhj_.js → index-B0bMnciA.js} +1 -1
- package/assets/{index-CnNIEazo.js → index-B1lZILIS.js} +1 -1
- package/assets/{index-CnxZGgAx.js → index-B37cKX5v.js} +1 -1
- package/assets/{index-cZ6tjlq1.js → index-B7EC32ed.js} +1 -1
- package/assets/{index-DH1wbhHD.js → index-B7ResnK5.js} +1 -1
- package/assets/{index-CUCrSrys.js → index-B7orTJ4q.js} +1 -1
- package/assets/{index-C80znnDW.js → index-B8RL4ysF.js} +1 -1
- package/assets/{index-DN4XOFSE.js → index-BJQJ6qaf.js} +1 -1
- package/assets/{index-DX3DHT9n.js → index-BJsueJq0.js} +1 -1
- package/assets/{index-BD3ZPd_8.js → index-BQAp3En-.js} +1 -1
- package/assets/{index-C29PIOfp.js → index-BSDt-TOn.js} +1 -1
- package/assets/{index-CDf3efkp.js → index-BSxUgJbK.js} +2 -2
- package/assets/{index-DuM4noYk.js → index-BgYtilT2.js} +1 -1
- package/assets/{index-B6O6tYQ5.js → index-BqEB64AU.js} +3 -3
- package/assets/{index-VW-lnGw2.js → index-BsH-rkvg.js} +1 -1
- package/assets/{index-Bhux6d7O.js → index-BsS1iZx_.js} +1 -1
- package/assets/{index-DNViA462.js → index-C1GOiHEJ.js} +1 -1
- package/assets/{index-12wxaJ06.js → index-C51fg_o7.js} +1 -1
- package/assets/{index-DMlCumM5.js → index-C6zvyoZv.js} +1 -1
- package/assets/{index-C76nP1O6.js → index-C8fZFdzo.js} +1 -1
- package/assets/{index-rLHhvU40.js → index-CDkwk3uv.js} +2 -2
- package/assets/{index-CgvLEwoy.js → index-CI5h_2tO.js} +1 -1
- package/assets/{index-CyiPWf5n.js → index-CK7WvZif.js} +1 -1
- package/assets/{index-cfvsnH5y.js → index-CKJj9-cA.js} +1 -1
- package/assets/{index-Bycb_NiK.js → index-CMFzXxIX.js} +2 -2
- package/assets/{index-D3kilUkp.js → index-COfMk8pw.js} +1 -1
- package/assets/{index-BUxWfTma.js → index-CcRW7qMf.js} +1 -1
- package/assets/{index-Cq2ACCOS.js → index-Cg9dnh8b.js} +1 -1
- package/assets/{index-B17_4zRY.js → index-ChU8wlCy.js} +1 -1
- package/assets/{index-DkOjkCdA.js → index-CjOntfrV.js} +1 -1
- package/assets/{index-3AqvKhGz.js → index-CkYD3Y0h.js} +1 -1
- package/assets/{index-9-Neoanw.js → index-CrcHD3o5.js} +1 -1
- package/assets/{index-Brd7ji4Z.js → index-Czb_P6bY.js} +602 -480
- package/assets/{index-C4j5Yt0J.js → index-D1allDkb.js} +1 -1
- package/assets/{index-IwNV31qY.js → index-D3ZrYxPz.js} +1 -1
- package/assets/{index-Cjb2XrcZ.js → index-D4PpnM4d.js} +1 -1
- package/assets/{index-Dig_dNhS.js → index-DAgJW1gr.js} +1 -1
- package/assets/{index-DoxTF6om.js → index-DBaksDK_.js} +1 -1
- package/assets/{index-JCA7K3yc.js → index-DCNThdFK.js} +1 -1
- package/assets/{index-CAnUnOx3.js → index-DCYqHavJ.js} +1 -1
- package/assets/{index-pYqFSwbF.js → index-DQXbQePN.js} +2 -2
- package/assets/{index-PPPdjER1.js → index-DVmEcWE3.js} +3 -3
- package/assets/{index-CBA5ujss.js → index-DWqBh31y.js} +1 -1
- package/assets/{index-C2y7hJrh.js → index-DbGOPqdW.js} +1 -1
- package/assets/{index-CMZZ1Nga.js → index-DecjPWBu.js} +1 -1
- package/assets/{index-kLxn63lr.js → index-DgMAf2q5.js} +1 -1
- package/assets/{index-Bsc1WoyD.js → index-DiTVVm7E.js} +1 -1
- package/assets/{index-DdfWi7TC.js → index-DjEA7xwB.js} +1 -1
- package/assets/{index-C1OJ-tO9.js → index-DlkFYSp0.js} +1 -1
- package/assets/{index-BWWTHnLr.js → index-DppjTFXj.js} +1 -1
- package/assets/{index-DV8kBwEP.js → index-Drskl51X.js} +1 -1
- package/assets/{index-DLXZ5p81.js → index-DutOGRmD.js} +1 -1
- package/assets/{index-CFTDHoZh.js → index-DyW_Wdzl.js} +1 -1
- package/assets/{index-DwMtnb8J.js → index-DzIOprpI.js} +1 -1
- package/assets/{index-CyJEkuRi.js → index-Fyrl3bgj.js} +1 -1
- package/assets/{index-ce0Tcydb.js → index-KcjPp4F-.js} +3 -3
- package/assets/index-YUVIXaKh.css +1 -0
- package/assets/{index-BEgz8ixE.js → index-hV1Yn1B5.js} +1 -1
- package/assets/{index-CUa9_lhM.js → index-qU86FliS.js} +1 -1
- package/assets/{index.es-CO16vBVD.js → index.es-BdQmhh-2.js} +1 -1
- package/assets/{index.es-BTrwCm6j.js → index.es-BowEO4n4.js} +1 -1
- package/assets/{index.es-ZvhCWtmg.js → index.es-nVYBSx0q.js} +4 -4
- package/assets/{linkAccount-D6C-iWP9.js → linkAccount-D303ryxj.js} +1 -1
- package/assets/{localBatchGatewayRequest-D0lgdcRM.js → localBatchGatewayRequest-BKtZM-Qe.js} +1 -1
- package/assets/{mana-convert-BSx_Udpc.js → mana-convert-BKXDkQzP.js} +1 -1
- package/assets/{mana-rate-BZhaJjml.js → mana-rate-EViaZGqN.js} +1 -1
- package/assets/{native-DzURTJjQ.js → native-BbO8hggJ.js} +1 -1
- package/assets/{networks-DPBJRt6B.js → networks-CNY8UPfr.js} +1 -1
- package/assets/{onramp-D-V8FIFR.js → onramp-DkE5Rw9T.js} +1 -1
- package/assets/{openzeppelin-B7Q08QJ0.js → openzeppelin-DxhZ29H0.js} +1 -1
- package/assets/{ownerOf-6qjJmcwz.js → ownerOf-B0AowHTZ.js} +1 -1
- package/assets/{parseNft-CZxwd5ZF.js → parseNft-zmNDvjeQ.js} +2 -2
- package/assets/{parseSignature-3qwrNvoW.js → parseSignature-C1Ay4M4x.js} +1 -1
- package/assets/{parseSignature-CtyJ-6L0.js → parseSignature-D0zZ_iJp.js} +3 -3
- package/assets/{passkeys-Cj0tHoDP.js → passkeys-DfCeNvv_.js} +1 -1
- package/assets/{pay-with-exchange-B3f1_w5e.js → pay-with-exchange-CjKH2Vnu.js} +1 -1
- package/assets/{prepare-contract-call-ydWcAfZ2.js → prepare-contract-call-BreQKHF6.js} +1 -1
- package/assets/{qr-overlay-DWPthnKn.js → qr-overlay-DKcOFez0.js} +3 -3
- package/assets/{react-CDiFgvN_.js → react-vyZjIDcS.js} +1 -1
- package/assets/{receive-CsXmvAKt.js → receive-B1DDFUkH.js} +1 -1
- package/assets/{resolveImplementation-BOT-NVc7.js → resolveImplementation-kR8NFXDP.js} +1 -1
- package/assets/{rpc-DSWXzB82.js → rpc-CzGt6OT0.js} +1 -1
- package/assets/{secp256k1-ByXzWbcW.js → secp256k1-B2x_fUXG.js} +1 -1
- package/assets/{secp256k1-uUJiV589.js → secp256k1-DZ44C2PU.js} +1 -1
- package/assets/{secp256k1-BaOo-or_.js → secp256k1-Dar84kjJ.js} +1 -1
- package/assets/{send-C05YEc1T.js → send-Cx4AaCX3.js} +1 -1
- package/assets/{send-batch-transaction-Be0wAoEe.js → send-batch-transaction-Bf0o63Vf.js} +1 -1
- package/assets/{send-eip712-transaction-BJNkYYKf.js → send-eip712-transaction-Bivcwwzr.js} +2 -2
- package/assets/send-gasless-transaction-Dh3lQi9l.js +2 -0
- package/assets/{send-transaction-Bes27L5G.js → send-transaction-D9t290rO.js} +2 -2
- package/assets/{sendMetaTransaction-CDDozl0u.js → sendMetaTransaction-C0YDqCJk.js} +1 -1
- package/assets/{sendRawTransaction-CaQYbFlQ.js → sendRawTransaction-BL7dRGJ_.js} +3 -3
- package/assets/{sentry-DGsLxYkt.js → sentry-B35L1FdR.js} +1 -1
- package/assets/{serializeTransaction-DLXlE_fY.js → serializeTransaction-jsQLtetC.js} +1 -1
- package/assets/{session-proposal-269TY8JU.js → session-proposal-DMe52htu.js} +1 -1
- package/assets/{session-request-DxaePUXl.js → session-request-CvcdX1D8.js} +2 -2
- package/assets/{sha256-BkM0tz1g.js → sha256-NdAeiB0X.js} +1 -1
- package/assets/{signing-ZKf523YR.js → signing-C5rH_Fds.js} +3 -3
- package/assets/{socials-JFjng574.js → socials-DGbsF9Wj.js} +1 -1
- package/assets/{swaps-Cq3Wdoki.js → swaps-BFA3CceQ.js} +1 -1
- package/assets/{thirdweb-BNmNZhah.js → thirdweb-iDY8G1WY.js} +3 -3
- package/assets/{to-serializable-transaction-PJm0PzIG.js → to-serializable-transaction-BG0Kqkd3.js} +2 -2
- package/assets/{totalSupply-C71_H-lN.js → totalSupply-BVfGieGk.js} +1 -1
- package/assets/{trade-encoding-BmLGOyo-.js → trade-encoding-GuhikRmN.js} +1 -1
- package/assets/{transaction-DLOHYmaw.js → transaction-8aHmZ7ni.js} +1 -1
- package/assets/{transactionReceipt-CSJT-pKm.js → transactionReceipt-cJ7HWOtq.js} +1 -1
- package/assets/{transactions-DDewGRUS.js → transactions-C16e5T9v.js} +1 -1
- package/assets/{useCreditPacks-Bqe9pTXx.js → useCreditPacks-DZTzWK5B.js} +1 -1
- package/assets/{useInfiniteGrid-C1qvdQfd.js → useInfiniteGrid-C3613jLi.js} +1 -1
- package/assets/useManaRate-CYlUk99_.js +1 -0
- package/assets/{useSecondarySales-CVaNw0md.js → useSecondarySales-DuNNHIPd.js} +1 -1
- package/assets/{useStore-oZmFLyam.js → useStore-BTXlSV66.js} +2 -2
- package/assets/useTheme-CIMhjSM_.js +1 -0
- package/assets/{utils-a6twR_kC.js → utils-jd03xFBb.js} +1 -1
- package/assets/{verifyHash-BPxoGPRB.js → verifyHash-_9QIIq3n.js} +1 -1
- package/assets/{w3m-modal-BKND42Yg.js → w3m-modal-Cn_rTfFF.js} +1 -1
- package/assets/{w3m-modal-B7e4dFsC.js → w3m-modal-Ozmvjq7b.js} +1 -1
- package/assets/{wait-for-tx-receipt-Dkm_Ycmc.js → wait-for-tx-receipt-BuZtG6lp.js} +1 -1
- package/assets/{wallets-Dcnx0DBg.js → wallets-Du25_N-1.js} +5 -5
- package/assets/{web-connector-B41jHtWN.js → web-connector-CWWf4u_L.js} +3 -3
- package/assets/{writeContract-BBk0XlYd.js → writeContract-DIiudXie.js} +1 -1
- package/assets/{zora-sepolia-o_iB8zm8.js → zora-sepolia-Bt1F-uU9.js} +1 -1
- package/assets/{zoraTestnet-AMJQiMJL.js → zoraTestnet-B26jFGGx.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/Creator-BPKqpaQ0.js +0 -283
- package/assets/Tooltip-azUGAy-5.js +0 -48
- package/assets/browser-ponyfill-U6QFC0pq.js +0 -1
- package/assets/decimals-2E8lbkVo.js +0 -1
- package/assets/estimate-l1-fee-DKfVBk0L.js +0 -1
- package/assets/eth_estimateGas-CYhr9GQg.js +0 -1
- package/assets/eth_getTransactionCount-ZhW4UX5p.js +0 -1
- package/assets/get-ecosystem-wallet-info-B_lrKX-x.js +0 -1
- package/assets/getNFT-BTjqjEEe.js +0 -1
- package/assets/index-867E6STW.js +0 -1
- package/assets/index-DCpWUtOQ.css +0 -1
- package/assets/send-gasless-transaction-ytRd_Rwn.js +0 -2
- package/assets/useManaRate-LgUHZXYp.js +0 -1
- package/assets/useTheme-1sGnebNp.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,L as le,b as ce,r as l}from"./react-
|
|
1
|
+
import{j as t,L as le,b as ce,r as l}from"./react-vyZjIDcS.js";import{t as b,s as a,d as s,w as de,B as K,l as pe,m as ue,D as ge,I as N,E as D}from"./index-Czb_P6bY.js";import{u as xe,d as me,t as he,L as fe,i as F,a as f,s as ve}from"./useStore-BTXlSV66.js";import{E as M}from"./ErrorNotice-AcMffEAY.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CpLYx0ea.js";import"./intl-CBcMB1D2.js";const be="https://cdn.decentraland.org/@dcl/shop/0.1.0-30491920077.commit-b636261/assets/template-cover-1-BETekfHg.jpeg",we="https://cdn.decentraland.org/@dcl/shop/0.1.0-30491920077.commit-b636261/assets/template-cover-2-Dni9s0i_.jpeg",je=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":be,"../assets/creator-covers/template-cover-2.jpeg":we}),v=Object.entries(je).sort(([r],[u])=>r.localeCompare(u)).map(([r,u])=>({name:r.split("/").pop(),url:u})),{colors:L}=b,j=a.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 6px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as L,b as I,j as e,N as T,r as $}from"./react-
|
|
1
|
+
import{a as L,b as I,j as e,N as T,r as $}from"./react-vyZjIDcS.js";import{t as E,s as t,y as A,F,G as P,m as M,l as N,d as n,x as W,e as O,H as _,c as z,B as q,J}from"./index-Czb_P6bY.js";import{w as U,S as D}from"./buy-gasless-DNXWk0IK.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CpLYx0ea.js";import"./intl-CBcMB1D2.js";import"./authorizations-CBQpjv0Y.js";import"./sendMetaTransaction-C0YDqCJk.js";import"./trade-encoding-GuhikRmN.js";const{colors:s,radius:u}=E,f="@media (max-width: 600px)",C=t.div`
|
|
2
2
|
max-width: 895px;
|
|
3
3
|
margin: 0 auto;
|
|
4
4
|
padding: 32px 12px;
|
|
@@ -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-E3LZaKPB.js";import{au as C}from"./NetworkUtil-DrZx-6FF.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-CgZVr29H.js";import{au as C}from"./NetworkUtil-HlUKXKcF.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};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import{r as o,j as C,d as T}from"./react-vyZjIDcS.js";import{s as P,t as i}from"./index-Czb_P6bY.js";const B=(...t)=>({shouldForwardProp:p=>!t.includes(p)}),A=P("span",B("block"))`
|
|
2
|
+
display: ${({block:t})=>t?"flex":"inline-flex"};
|
|
3
|
+
${({block:t})=>t?"width: 100%;":""}
|
|
4
|
+
`,I=P("span",B("placement"))`
|
|
5
|
+
position: fixed;
|
|
6
|
+
z-index: ${i.z.tooltip};
|
|
7
|
+
width: max-content;
|
|
8
|
+
max-width: min(240px, calc(100vw - 32px));
|
|
9
|
+
padding: 8px 10px;
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
background: ${i.colors.text};
|
|
12
|
+
color: ${i.colors.white};
|
|
13
|
+
font-family: ${i.font.sans};
|
|
14
|
+
font-size: 12px;
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
line-height: 1.4;
|
|
17
|
+
text-align: center;
|
|
18
|
+
text-transform: none;
|
|
19
|
+
letter-spacing: 0;
|
|
20
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
|
|
21
|
+
opacity: 0;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
transform: translate(-50%, ${({placement:t})=>t==="top"?"calc(-100% + 4px)":"-4px"});
|
|
24
|
+
transition:
|
|
25
|
+
opacity 0.14s ease,
|
|
26
|
+
transform 0.14s ease;
|
|
27
|
+
|
|
28
|
+
&[data-open] {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
transform: translate(-50%, ${({placement:t})=>t==="top"?"-100%":"0"});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&::after {
|
|
34
|
+
content: '';
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: calc(50% + var(--tooltip-arrow, 0px));
|
|
37
|
+
transform: translateX(-50%);
|
|
38
|
+
border: 5px solid transparent;
|
|
39
|
+
${({placement:t})=>t==="top"?`top: 100%; border-top-color: ${i.colors.text};`:`bottom: 100%; border-bottom-color: ${i.colors.text};`}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (prefers-reduced-motion: reduce) {
|
|
43
|
+
transition: none;
|
|
44
|
+
}
|
|
45
|
+
`,l=8,d=8;function q({content:t,children:p,placement:n="top",block:F,onShow:c,className:H}){const[r,h]=o.useState(!1),[e,W]=o.useState(null),b=o.useId(),w=o.useRef(!1),g=o.useRef(null),E=o.useRef(null),$=o.useCallback(()=>{h(!0),w.current||(w.current=!0,c==null||c())},[c]),v=o.useCallback(()=>h(!1),[]),s=o.useCallback(()=>{const M=g.current,y=E.current;if(!M||!y)return;const a=M.getBoundingClientRect(),{offsetWidth:D,offsetHeight:f}=y,L=D/2,u=L+d,R=a.left+a.width/2,k=Math.min(Math.max(R,u),Math.max(u,window.innerWidth-u)),m={top:a.top-l,bottom:window.innerHeight-a.bottom-l},x=m[n]>=f||m[n]>=m[n==="top"?"bottom":"top"]?n:n==="top"?"bottom":"top",z=x==="top"?a.top-l:a.bottom+l,G=x==="top"?Math.max(z,f+d):Math.min(z,Math.max(d,window.innerHeight-f-d)),j=Math.max(0,L-13);W({left:k,top:G,arrow:Math.min(Math.max(R-k,-j),j),placement:x})},[n]);return o.useLayoutEffect(()=>{r&&s()},[t,r,s]),o.useEffect(()=>{if(r)return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}},[r,s]),C.jsxs(A,{ref:g,className:H,block:F,onMouseEnter:$,onMouseLeave:v,onFocus:$,onBlur:v,children:[o.cloneElement(p,{"aria-describedby":r?b:void 0}),T.createPortal(C.jsx(I,{ref:E,role:"tooltip",id:b,placement:(e==null?void 0:e.placement)??n,"aria-hidden":!r,style:{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,"--tooltip-arrow":`${(e==null?void 0:e.arrow)??0}px`},...r&&e?{"data-open":""}:{},children:t}),document.body)]})}export{q as T,B as n};
|
|
@@ -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,b 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,b as Q,C as ge,B as Ce,f as X}from"./ethers-CpLYx0ea.js";import{p as Ee,d as B}from"./dcl-schemas-BICTSpB5.js";import{c as ee}from"./react-vyZjIDcS.js";import{bd as be,a as te,g as re}from"./index-Czb_P6bY.js";import{c as q,e as Re}from"./index-BSxUgJbK.js";import{s as Ie}from"./sendMetaTransaction-C0YDqCJk.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./events-DQ172AOg.js";async function Pe(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 Pe(r);return new ue(t)}const S=new Re.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),R=new ge(t.address,t.abi,l),T=await(typeof e=="function"?e(R.populateTransaction):R.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 P=await v.sendTransaction(T);return S.emit(C.SUCCESS,{txHash:P.hash}),P.hash}else{const v=await Ie(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,R=2147483647,T=36,v=1,P=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 H(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 W(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 Y(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*P>>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,b,I,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(b=w>0?w+1:0;b<o;){for(I=d,f=1,m=T;b>=o&&F("invalid-input"),g=Te(n.charCodeAt(b++)),(g>=T||g>E((R-d)/f))&&F("overflow"),d+=g*f,A=m<=h?v:m>=h+P?P:m-h,!(g<A);m+=T)L=T-A,f>E(R/L)&&F("overflow"),f*=L;u=a.length+1,h=Z(d-I,u,I==0),E(d/u)>R-y&&F("overflow"),y+=E(d/u),d%=u,a.splice(d++,0,y)}return W(a)}function z(n){var a,o,u,d,y,h,w,x,b,I,f,m=[],g,A,L,j;for(n=H(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=R,h=0;h<g;++h)f=n[h],f>=a&&f<w&&(w=f);for(A=u+1,w-a>E((R-o)/A)&&F("overflow"),o+=(w-a)*A,a=w,h=0;h<g;++h)if(f=n[h],f<a&&++o>R&&F("overflow"),f==a){for(x=o,b=T;I=b<=y?v:b>=y+P?P:b-y,!(x<I);b+=T)j=x-I,L=T-I,m.push(O(Y(I+j%L,0))),x=E(j/L);m.push(O(Y(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:H,encode:W},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 be.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};
|