@dcl/shop 0.1.0 → 0.1.1-30909439604.commit-4721d83
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-BwdIaUnW.js → Activity-CiQm3fPZ.js} +7 -7
- package/_assets/{AnimatedBackground-DP8XKTVN.js → AnimatedBackground-BFRTkuDo.js} +1 -1
- package/_assets/{Assets-Degiynxt.js → Assets--cn5UbRN.js} +50 -50
- package/_assets/{Assets.styles-CmDKBB8r.js → Assets.styles-CkJWzjdk.js} +1 -1
- package/_assets/{Authorizations-CJeq3VNJ.js → Authorizations-Cqqxn9wD.js} +7 -7
- package/_assets/{Cart-DsUb4sI3.js → Cart-ByLo0Q5U.js} +12 -12
- package/_assets/{CircularProgress-CNroeQ3o.js → CircularProgress-Cv24wKWu.js} +5 -5
- package/_assets/Collection-DbZpN_eH.js +119 -0
- package/_assets/{CollectionCarousel-D36c6dts.js → CollectionCarousel-DKVvizGs.js} +7 -7
- package/_assets/{ConstantsUtil-Dfwpy1eP.js → ConstantsUtil-CNJ3pGKv.js} +1 -1
- package/_assets/{ContentClient-D6ofwSpu.js → ContentClient-BJFWm8Bs.js} +1 -1
- package/_assets/Creator-CtdwyJXl.js +306 -0
- package/_assets/{DeploymentBuilder-ku3det23.js → DeploymentBuilder-CXBC22K0.js} +1 -1
- package/_assets/{ErrorNotice-COIh7ro4.js → ErrorNotice-51eOicue.js} +1 -1
- package/_assets/{ExchangeController-DOL-_brz.js → ExchangeController--vn2md5b.js} +1 -1
- package/_assets/{GetCredits-BkjOQ5or.js → GetCredits-CnE9Mkj3.js} +10 -10
- package/_assets/{HelpersUtil-2hZP33Du.js → HelpersUtil-Dg90boC1.js} +1 -1
- package/_assets/ImportListings-BxeqcxAE.js +461 -0
- package/_assets/{ItemDetail-D57x9bXl.js → ItemDetail-CqkeMLxu.js} +251 -281
- package/_assets/LoadMore-BolkAKn7.js +7 -0
- package/_assets/ManaPricingBanner.styles-DKUacHFQ.js +74 -0
- package/_assets/{MenuList-d6ca0DH6.js → MenuList-D4kLbIwO.js} +2 -2
- package/_assets/MyAssets-v3gryjCk.js +381 -0
- package/_assets/{MyFavorites-DxYh88wB.js → MyFavorites-Bg2hc3VG.js} +2 -2
- package/_assets/{NetworkUtil-HlUKXKcF.js → NetworkUtil-Dh3JWXso.js} +1 -1
- package/_assets/{NotFound-DA15lCMu.js → NotFound-R9sTwMQk.js} +1 -1
- package/_assets/{NotificationsBell-C8r1c8mg.js → NotificationsBell-BoefPrvQ.js} +1 -1
- package/_assets/StoreSettings-GYoZCBBR.js +239 -0
- package/_assets/Success-CGQGJeM-.js +296 -0
- package/_assets/{SwapController-CRz8E17o.js → SwapController-BcfprLwB.js} +1 -1
- package/_assets/{Tooltip-D92WFEmr.js → Tooltip-CoMCVLgL.js} +1 -1
- package/_assets/{TradeService-DIWR3GwD.js → TradeService-Be5Jm26-.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-BuQKbZaF.js → W3MFrameProviderSingleton-BLAdE798.js} +3 -3
- package/_assets/{WebCryptoP256-BFDAPngw.js → WebCryptoP256-B2g3GckQ.js} +1 -1
- package/_assets/{authorizations-BNs0emga.js → authorizations-FkFZVBeE.js} +1 -1
- package/_assets/{basic-C6XisVyZ.js → basic-DEelCa7C.js} +1 -1
- package/_assets/{biconomy-09nDKxxN.js → biconomy-BuAmKMqp.js} +1 -1
- package/_assets/{browseLayout.styles-CTl6D_zv.js → browseLayout.styles-6Bx0cPB_.js} +6 -6
- package/_assets/{browser-BGlawS--.js → browser-CMge1DAk.js} +1 -1
- package/_assets/{browser-ponyfill-Dm9rZGtt.js → browser-ponyfill-DdemUjDS.js} +1 -1
- package/_assets/{builder-C8hUH3RB.js → builder-Z4iUHEpn.js} +1 -1
- package/_assets/{buy-Cl7snZzi.js → buy-DiLzTHFT.js} +1 -1
- package/_assets/{buy-gasless-DVLP7U8S.js → buy-gasless-Cn4_YLUa.js} +1 -1
- package/_assets/{categories-BGGjSLd9.js → categories-Byz019bF.js} +8 -8
- package/_assets/{ccip-Dx_KcJBs.js → ccip-CCZIckpG.js} +1 -1
- package/_assets/{ccip-DLDLk2fK.js → ccip-DUqe0wPP.js} +1 -1
- package/_assets/{chains-DjVUcpdx.js → chains-DwiEm2Ny.js} +1 -1
- package/_assets/{clsx-BY1AO2V7.js → clsx-sy6nSRXN.js} +2 -2
- package/_assets/{common-BzdjGk0Y.js → common-ChK99Sbg.js} +1 -1
- package/_assets/confettiAnimation-BpyTLLuX.js +1 -0
- package/_assets/{controller-ZqrzYJ4o.js → controller-D2U901D4.js} +2 -2
- package/_assets/{core-CWR04nJr.js → core-BqndrHwC.js} +4 -4
- package/_assets/{createSvgIcon-BUIodiet.js → createSvgIcon-nAlfqqgf.js} +5 -5
- package/_assets/{custom-DMjRmtpL.js → custom-DJvYgxJy.js} +1 -1
- package/_assets/{data-capture-SoaOqGRY.js → data-capture-CLOU8jih.js} +1 -1
- package/_assets/{decimals-rMqzXjFU.js → decimals-C49MnWnC.js} +1 -1
- package/_assets/decimals-DenLQ0L2.js +1 -0
- package/_assets/{detectExtension-0JcORGBX.js → detectExtension-Bs6N_T7E.js} +1 -1
- package/_assets/{email-i8v6FMCW.js → email-BxF_EMmd.js} +1 -1
- package/_assets/{embedded-wallet-DBT_Ev8g.js → embedded-wallet-6IYwV5B_.js} +1 -1
- package/_assets/emotion-styled.browser.esm-9O-_UQ_M.js +1 -0
- package/_assets/{engine-Bn2HNIpq.js → engine-CDTFOGA6.js} +1 -1
- package/_assets/{errors-Ce5OngHE.js → errors-sJnX14Ki.js} +1 -1
- package/_assets/estimate-l1-fee-B4XbNvFY.js +1 -0
- package/_assets/eth_estimateGas-DaegCW9w.js +1 -0
- package/_assets/{eth_getStorageAt-DIGus6Ic.js → eth_getStorageAt-g-V8ByC9.js} +1 -1
- package/_assets/eth_getTransactionCount-ChnmCar0.js +1 -0
- package/_assets/{ethereum-7duKFA0R.js → ethereum-DdnrEX6r.js} +1 -1
- package/_assets/{ethers-CXBJm_wN.js → ethers-rFeF6PNV.js} +1 -1
- package/_assets/{execute-DO9Rpu0c.js → execute-D8YtDqpj.js} +2 -2
- package/_assets/{extractIPFS-CTs5XnuT.js → extractIPFS-DiQ3ktqZ.js} +1 -1
- package/_assets/{features-5tSUGHg0.js → features-B8MZg8q9.js} +1 -1
- package/_assets/{fetchTokenMetadata-CHnDbBcr.js → fetchTokenMetadata-Cn6UkNbd.js} +2 -2
- package/_assets/field.styles-o0yoMx97.js +70 -0
- package/_assets/{fortmatic-CCMQbesB.js → fortmatic-ZrVXe0if.js} +1 -1
- package/_assets/{get-bytecode-Bg8NviKV.js → get-bytecode-B5xpAv7a.js} +1 -1
- package/_assets/get-ecosystem-wallet-info-DyEERgSx.js +1 -0
- package/_assets/{getBalance-BU5lPIM1.js → getBalance-pdi104jy.js} +2 -2
- package/_assets/{getInstalledModules-KP-LSI0j.js → getInstalledModules-vRyVzBkY.js} +1 -1
- package/_assets/{getNFT-Ctbterca.js → getNFT-ChdTpPL_.js} +2 -2
- package/_assets/getNFT-JwHQ_s5F.js +1 -0
- package/_assets/{getThemeProps-xrG7EYWl.js → getThemeProps-CFDZlxj4.js} +1 -1
- package/_assets/{grid.styles-B1mDfzvi.js → grid.styles-DVBPQuRz.js} +1 -1
- package/_assets/{hashTypedData-DaCcjWXS.js → hashTypedData-2Z2_gEL6.js} +1 -1
- package/_assets/{hashTypedData-BiojmScK.js → hashTypedData-DP9JOjjX.js} +1 -1
- package/_assets/{in-app-Sb-fFEpv.js → in-app-CRH3jQep.js} +1 -1
- package/_assets/{in-app-wallet-calls-BYLiaB1J.js → in-app-wallet-calls-Dp9TxCgN.js} +1 -1
- package/_assets/{index-BbxUYBIl.js → index--coIj_2Q.js} +2 -2
- package/_assets/{index-BV7d8LIf.js → index-5o0_4PJn.js} +1 -1
- package/_assets/{index-CcRW7qMf.js → index-6_pDklk8.js} +1 -1
- package/_assets/{index-BBM5Da88.js → index-72R1sLRe.js} +1 -1
- package/_assets/{index-CcrwUr4B.js → index-B1YUW9FQ.js} +2 -2
- package/_assets/index-B2O7rGJL.js +1 -0
- package/_assets/{index-BCG-_RTT.js → index-B8_IX_3e.js} +1 -1
- package/_assets/{index-Cw22meEP.js → index-BGPVOBHa.js} +1 -1
- package/_assets/{index-DQ2tXB-9.js → index-BHMMC_4O.js} +1 -1
- package/_assets/{index-DmGcqzuR.js → index-BLpG8mks.js} +1 -1
- package/_assets/{index-CD9t0mSF.js → index-BRGDK96N.js} +1 -1
- package/_assets/{index-BzC7P3rh.js → index-BUbZ4ieP.js} +1 -1
- package/_assets/{index-BdWG2PoE.js → index-BWXsvDqD.js} +1 -1
- package/_assets/{index-CKo0vnRV.js → index-BZWNTqaV.js} +1 -1
- package/_assets/{index-DjcstBXY.js → index-BaUli81x.js} +1 -1
- package/_assets/index-Bbgy14tN.js +1 -0
- package/_assets/index-BiIZh9R9.js +2820 -0
- package/_assets/{index-CE-Z89iI.js → index-BkP6Akod.js} +1 -1
- package/_assets/{index-8EYFemjW.js → index-BszwI7-F.js} +1 -1
- package/_assets/{index-CEP90DOS.js → index-BtLL7F-4.js} +1 -1
- package/_assets/{index-DC-Z7MbP.js → index-BtkxBg3h.js} +2 -2
- package/_assets/{index-DWFCwLfs.js → index-Bu5mtkuE.js} +1 -1
- package/_assets/{index-6HemuoHH.js → index-C-E_Jk-6.js} +1 -1
- package/_assets/{index-Bb2mLVTh.js → index-C4AfvPtb.js} +1 -1
- package/_assets/{index-CSqaG5Rs.js → index-CBrp3dUZ.js} +1 -1
- package/_assets/{index-DgMAf2q5.js → index-CCoJpS6M.js} +1 -1
- package/_assets/{index-DMKhInQc.js → index-CDCj0Qak.js} +2 -2
- package/_assets/{index-DvlgcdsJ.js → index-CJ03r2wd.js} +1 -1
- package/_assets/{index-hesFTmUX.js → index-CY1VUN_S.js} +1 -1
- package/_assets/{index-DgKHc2Pp.js → index-CYEynknO.js} +1 -1
- package/_assets/{index-OiKTI-o_.js → index-CZQ-Avg8.js} +1 -1
- package/_assets/{index-BNnLGudB.js → index-ClSZl7Vh.js} +1 -1
- package/_assets/{index-3x98-rKq.js → index-CsEaqK5K.js} +1 -1
- package/_assets/{index-DbkHKS7K.js → index-Csd0nRMS.js} +2 -2
- package/_assets/{index-BpA1I7hL.js → index-CwLvQ9MJ.js} +1 -1
- package/_assets/{index-cSAleFRI.js → index-CyyhNrl2.js} +1 -1
- package/_assets/{index-CSu0sG0T.js → index-D0JhTMR7.js} +1 -1
- package/_assets/{index-CrlwRjah.js → index-D29EUWHC.js} +1 -1
- package/_assets/{index-BsQQxLJN.js → index-D3OKsJLK.js} +1 -1
- package/_assets/{index-DLEx9ISf.js → index-D9Dv7ZRq.js} +1 -1
- package/_assets/{index-PJSp7ijP.js → index-DDqqXhJL.js} +3 -3
- package/_assets/{index-BQG7R5QF.js → index-DGuNIM9a.js} +1 -1
- package/_assets/{index-Cv-5v5Ze.js → index-DHFAjoyI.js} +1 -1
- package/_assets/{index-BgKl-ydS.js → index-DXe1QzPN.js} +1 -1
- package/_assets/{index-CcZyuO92.js → index-DaBMwl5V.js} +1 -1
- package/_assets/{index-C6rpfPMS.js → index-DbyPzhzJ.js} +1 -1
- package/_assets/{index-BIJ2qchS.js → index-Det24uTr.js} +3 -3
- package/_assets/{index-BEtbI0Zv.js → index-Dhe2yejG.js} +1 -1
- package/_assets/{index-B4EKT3oF.js → index-DitauyL5.js} +1 -1
- package/_assets/{index-DFzHpbP5.js → index-DkdxS38k.js} +1 -1
- package/_assets/{index-DyGnajSZ.js → index-DkmumT6q.js} +1 -1
- package/_assets/{index-CviVJpxw.js → index-DquJiMJI.js} +1 -1
- package/_assets/{index-Bor4cMvk.js → index-Duy_bLYT.js} +1 -1
- package/_assets/{index-qVmIz0zn.js → index-Dz7l4WRb.js} +1 -1
- package/_assets/{index-ZoIpzYhg.js → index-PfgUlDb3.js} +1 -1
- package/_assets/{index-RSxxMPji.js → index-Rjrwrr8k.js} +1 -1
- package/_assets/{index-BNEWEGXe.js → index-ThwwXj7K.js} +1 -1
- package/_assets/{index-DNaX9VGC.js → index-UOQDoXBN.js} +1 -1
- package/_assets/index-XMkvXJnG.js +2 -0
- package/_assets/{index-Cso0PIKg.js → index-efx_UGwj.js} +3 -3
- package/_assets/{index-D20v1ehb.js → index-hBIDXrfA.js} +1 -1
- package/_assets/{index-Fyrl3bgj.js → index-jDLQZQqn.js} +1 -1
- package/_assets/{index-DETprG7w.js → index-klYUwFTu.js} +1 -1
- package/_assets/index.es-CWcx_MPC.js +11 -0
- package/_assets/{index.es-4ugP_xPq.js → index.es-DGdQax5Y.js} +1 -1
- package/_assets/{index.es-DWjGiGDB.js → index.es-DWEmsLX5.js} +4 -4
- package/_assets/{index.es-BWoKVfSl.js → index.es-gS9A1DPX.js} +1 -1
- package/_assets/{linkAccount-D303ryxj.js → linkAccount-DktwtO-V.js} +1 -1
- package/_assets/{localBatchGatewayRequest-DxATZPfq.js → localBatchGatewayRequest-DoA6w-sg.js} +1 -1
- package/_assets/{mana-convert-BAmJatVq.js → mana-convert-8bdglmK2.js} +1 -1
- package/_assets/{mana-rate-COZYJ-5D.js → mana-rate-pg062I50.js} +1 -1
- package/_assets/{native-BbO8hggJ.js → native-DUHK6GYV.js} +1 -1
- package/_assets/{networks-BgOd8fAQ.js → networks-CS3wn-YQ.js} +1 -1
- package/_assets/{onramp-C1zk7UMI.js → onramp-_fU1CUPx.js} +1 -1
- package/_assets/{openzeppelin-JqnI3fjU.js → openzeppelin-Byo7VjiL.js} +1 -1
- package/_assets/{ownerOf-B0AowHTZ.js → ownerOf-9FPRCliB.js} +1 -1
- package/_assets/parseNft-f2SijHni.js +2 -0
- package/_assets/{parseSignature-DDl2oW2S.js → parseSignature-7zbxP3S5.js} +3 -3
- package/_assets/{parseSignature-Zp5jbuFC.js → parseSignature-B4bdR_8K.js} +1 -1
- package/_assets/{passkeys-D630VzP0.js → passkeys--fWD2NEw.js} +1 -1
- package/_assets/{pay-with-exchange-DB12e4gP.js → pay-with-exchange-Dk9Xcd3H.js} +1 -1
- package/_assets/{prepare-contract-call-BreQKHF6.js → prepare-contract-call-CUP20AbD.js} +1 -1
- package/_assets/{qr-overlay-BFMFKV4B.js → qr-overlay-DkdnRl_0.js} +3 -3
- package/_assets/{react-vyZjIDcS.js → react-IQWs2nb4.js} +1 -1
- package/_assets/{receive-C0p5nZhH.js → receive-C29mXrSs.js} +1 -1
- package/_assets/{resolveImplementation-Cpqxrq_P.js → resolveImplementation-Brjkq9B3.js} +1 -1
- package/_assets/{rpc-BGoWvIYj.js → rpc-Oikc4qrs.js} +1 -1
- package/_assets/{secp256k1-CxwkeDtE.js → secp256k1-CUWzbXuP.js} +1 -1
- package/_assets/{secp256k1-JugqR1gN.js → secp256k1-WT42JaIN.js} +1 -1
- package/_assets/{secp256k1-DN4fbJll.js → secp256k1-v_OYVKpT.js} +1 -1
- package/_assets/{send-DQo6irxp.js → send-CSdyFqol.js} +1 -1
- package/_assets/{send-batch-transaction-BwQeKmX0.js → send-batch-transaction-BlExRlz8.js} +1 -1
- package/_assets/{send-eip712-transaction-Di3Pi2C5.js → send-eip712-transaction-DyfTHBv1.js} +2 -2
- package/_assets/send-gasless-transaction-Daukbk69.js +2 -0
- package/_assets/{send-transaction-CboskMcL.js → send-transaction-kmfCvyrI.js} +2 -2
- package/_assets/{sendMetaTransaction-DfeiXpP_.js → sendMetaTransaction-BA-2MGdZ.js} +1 -1
- package/_assets/{sendRawTransaction-BgAwN3aK.js → sendRawTransaction-CTjGjbSv.js} +3 -3
- package/_assets/{sentry-B35L1FdR.js → sentry-DvOx8Rfb.js} +1 -1
- package/_assets/{serializeTransaction-Cn_3vzYE.js → serializeTransaction-BmaoI9rx.js} +1 -1
- package/_assets/{session-proposal-B7rpIMJh.js → session-proposal-nGkLb8fO.js} +1 -1
- package/_assets/{session-request--BJtbaZK.js → session-request-QSI6Jos8.js} +2 -2
- package/_assets/{sha256-NdAeiB0X.js → sha256-Dx4Jqb1P.js} +1 -1
- package/_assets/{signing-DiwulEsw.js → signing-VekuwpLK.js} +3 -3
- package/_assets/{socials-054eJtzB.js → socials-BkZgS9yz.js} +1 -1
- package/_assets/{swaps-BPYOHTwx.js → swaps-CAZTnQ-D.js} +1 -1
- package/_assets/{thirdweb-bX_k_ayM.js → thirdweb-Xk7WShny.js} +3 -3
- package/_assets/{to-serializable-transaction-caU-fqUx.js → to-serializable-transaction-C5BoASVF.js} +2 -2
- package/_assets/{totalSupply-BVfGieGk.js → totalSupply-CLQexq9U.js} +1 -1
- package/_assets/{trade-encoding-CXbhpVj8.js → trade-encoding-DgV-A2zO.js} +1 -1
- package/_assets/{transaction-8aHmZ7ni.js → transaction-ToPxlTkC.js} +1 -1
- package/_assets/{transactionReceipt-BzQM-iWX.js → transactionReceipt-BHGI1PBX.js} +1 -1
- package/_assets/{transactions-UfEKiBWb.js → transactions-paKZZL-W.js} +1 -1
- package/_assets/useCreditPacks-CaE-vAPX.js +1 -0
- package/_assets/useInfiniteGrid-CeEt3Zid.js +1 -0
- package/_assets/useManaRate-D4_9UlI5.js +1 -0
- package/_assets/{useSecondarySales-BUPg_0HB.js → useSecondarySales-3tEx5YvY.js} +1 -1
- package/_assets/{useStore-j0moew7P.js → useStore-ByHpJuVH.js} +2 -2
- package/_assets/useTheme-xAwBEFWH.js +1 -0
- package/_assets/{utils-jd03xFBb.js → utils-BgbaLlfC.js} +1 -1
- package/_assets/{verifyHash-BlPjp8uI.js → verifyHash-uE8nq1-h.js} +1 -1
- package/_assets/{w3m-modal-CJSqLQbS.js → w3m-modal-BWkASM7Q.js} +1 -1
- package/_assets/{w3m-modal-B1fkdBpv.js → w3m-modal-CIhzAZkD.js} +1 -1
- package/_assets/{wait-for-tx-receipt-nJ13gHYr.js → wait-for-tx-receipt-Ban9Kz9f.js} +1 -1
- package/_assets/{wallets-BfXeGzQ3.js → wallets-COZ4xX__.js} +5 -5
- package/_assets/{web-connector-D6DeRRYN.js → web-connector-gi_cmfjU.js} +3 -3
- package/_assets/{writeContract-D1XhZg5B.js → writeContract-MVlwq6Xg.js} +1 -1
- package/_assets/{zora-sepolia-Bt1F-uU9.js → zora-sepolia-BOt0KLBF.js} +1 -1
- package/_assets/{zoraTestnet-YWrqaPWn.js → zoraTestnet-BcRH2RHD.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Collection-CP0tfCsZ.js +0 -119
- package/_assets/Creator-CWs_Cx5f.js +0 -306
- package/_assets/ImportListings-DryzCKJV.js +0 -447
- package/_assets/LoadMore-BsvftUzw.js +0 -7
- package/_assets/MyAssets-OTnYju0y.js +0 -258
- package/_assets/StoreSettings-2jXFUoeV.js +0 -253
- package/_assets/Success-2HbLWhw3.js +0 -276
- package/_assets/decimals-CTAJwKFW.js +0 -1
- package/_assets/emotion-styled.browser.esm-C5sYTDtN.js +0 -1
- package/_assets/estimate-l1-fee-BYqkQ2bZ.js +0 -1
- package/_assets/eth_estimateGas-BfIHMLbI.js +0 -1
- package/_assets/eth_getTransactionCount-CmmgCgZ1.js +0 -1
- package/_assets/get-ecosystem-wallet-info-43Mjiw6m.js +0 -1
- package/_assets/getNFT-bNpY4yta.js +0 -1
- package/_assets/import-DbH_aWZX.js +0 -1
- package/_assets/index-9H7pG6F1.js +0 -1
- package/_assets/index-B3FH4SmC.js +0 -1
- package/_assets/index-CVMO2zcQ.js +0 -2
- package/_assets/index-Cn-oc3fB.js +0 -2835
- package/_assets/parseNft-yDYimY68.js +0 -2
- package/_assets/send-gasless-transaction-CCblCzAN.js +0 -2
- package/_assets/useCreditPacks-Ceg0Oam0.js +0 -1
- package/_assets/useInfiniteGrid-YGnKZcnB.js +0 -1
- package/_assets/useManaRate-BhMxx3e3.js +0 -1
- package/_assets/useTheme-cGCeJmwR.js +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import{j as t,L as oe,b as le,r as l}from"./react-IQWs2nb4.js";import{e as s,t as j,s as n,l as ce,B as q,m as de,n as pe,q as ue,I as z,w as F}from"./index-BiIZh9R9.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-ByHpJuVH.js";import{E as M}from"./ErrorNotice-51eOicue.js";import{F as w}from"./field.styles-o0yoMx97.js";import"./sentry-DvOx8Rfb.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-rFeF6PNV.js";import"./intl-CBcMB1D2.js";const ve="https://cdn.decentraland.org/@dcl/shop/0.1.1-30909439604.commit-4721d83/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/0.1.1-30909439604.commit-4721d83/_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(([r],[u])=>r.localeCompare(u)).map(([r,u])=>({name:r.split("/").pop(),url:u})),je=ce`
|
|
2
|
+
to {
|
|
3
|
+
transform: rotate(360deg);
|
|
4
|
+
}
|
|
5
|
+
`,Se=n.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
gap: 12px;
|
|
10
|
+
color: ${j.colors.muted};
|
|
11
|
+
|
|
12
|
+
&[data-direction='row'] {
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
}
|
|
15
|
+
&[data-direction='column'] {
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
text-align: center;
|
|
18
|
+
}
|
|
19
|
+
`,ke=n.span`
|
|
20
|
+
flex: none;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
border-style: solid;
|
|
23
|
+
border-color: ${j.colors.line};
|
|
24
|
+
border-top-color: ${j.colors.accent};
|
|
25
|
+
animation: ${je} 0.8s linear infinite;
|
|
26
|
+
|
|
27
|
+
&[data-size='small'] {
|
|
28
|
+
width: 18px;
|
|
29
|
+
height: 18px;
|
|
30
|
+
border-width: 2px;
|
|
31
|
+
}
|
|
32
|
+
&[data-size='medium'] {
|
|
33
|
+
width: 30px;
|
|
34
|
+
height: 30px;
|
|
35
|
+
border-width: 3px;
|
|
36
|
+
}
|
|
37
|
+
&[data-size='large'] {
|
|
38
|
+
width: 48px;
|
|
39
|
+
height: 48px;
|
|
40
|
+
border-width: 4px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (prefers-reduced-motion: reduce) {
|
|
44
|
+
animation-duration: 2s;
|
|
45
|
+
}
|
|
46
|
+
`,$e=n.span`
|
|
47
|
+
font-size: 14px;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
`;function ye({label:r,size:u="medium",direction:S="column",className:k}){return t.jsxs(Se,{className:k,"data-testid":"spinner-box","data-direction":S,role:"status","aria-live":"polite","aria-label":r?void 0:s("spinner.loading"),children:[t.jsx(ke,{"data-testid":"spinner-box-ring","data-size":u,"aria-hidden":!0}),r?t.jsx($e,{children:r}):null]})}const{colors:a,radius:_e,media:G}=j,Ee=n(ye)`
|
|
50
|
+
display: grid;
|
|
51
|
+
place-items: center;
|
|
52
|
+
min-height: 60vh;
|
|
53
|
+
`,Ne=n(q)`
|
|
54
|
+
align-self: center;
|
|
55
|
+
min-width: 200px;
|
|
56
|
+
margin-top: 8px;
|
|
57
|
+
`,O=n.section`
|
|
58
|
+
max-width: 640px;
|
|
59
|
+
margin: 0 auto;
|
|
60
|
+
padding: 8px 0 48px;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 20px;
|
|
64
|
+
|
|
65
|
+
&[data-signin] {
|
|
66
|
+
min-height: 60vh;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
text-align: center;
|
|
70
|
+
gap: 12px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
& .field__label {
|
|
74
|
+
font-weight: 700;
|
|
75
|
+
color: ${a.text};
|
|
76
|
+
}
|
|
77
|
+
& textarea {
|
|
78
|
+
background: ${a.white};
|
|
79
|
+
border: 1px solid ${a.lineStrong};
|
|
80
|
+
border-radius: 8px;
|
|
81
|
+
padding: 10px 12px;
|
|
82
|
+
color: ${a.text};
|
|
83
|
+
font: inherit;
|
|
84
|
+
resize: vertical;
|
|
85
|
+
min-height: 88px;
|
|
86
|
+
}
|
|
87
|
+
`,ze=n.div`
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: baseline;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
gap: 16px;
|
|
92
|
+
flex-wrap: wrap;
|
|
93
|
+
`,Le=n.div`
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: 10px;
|
|
97
|
+
`,Ce=n(oe)`
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
color: ${a.text};
|
|
102
|
+
transition: color 0.15s linear;
|
|
103
|
+
|
|
104
|
+
&:hover {
|
|
105
|
+
color: ${a.accent};
|
|
106
|
+
}
|
|
107
|
+
& .ico {
|
|
108
|
+
width: 22px;
|
|
109
|
+
height: 22px;
|
|
110
|
+
}
|
|
111
|
+
`,D=n.h1`
|
|
112
|
+
font-size: 24px;
|
|
113
|
+
font-weight: 800;
|
|
114
|
+
`,He=n.a`
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 6px;
|
|
118
|
+
color: ${a.accent};
|
|
119
|
+
font-weight: 700;
|
|
120
|
+
font-size: 14px;
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
|
|
123
|
+
&:hover {
|
|
124
|
+
text-decoration: underline;
|
|
125
|
+
}
|
|
126
|
+
& .ico {
|
|
127
|
+
width: 15px;
|
|
128
|
+
height: 15px;
|
|
129
|
+
}
|
|
130
|
+
`,Ie=n.div`
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: stretch;
|
|
133
|
+
border: 1px solid ${a.lineStrong};
|
|
134
|
+
border-radius: 8px;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
background: ${a.white};
|
|
137
|
+
|
|
138
|
+
& input {
|
|
139
|
+
border: 0 !important;
|
|
140
|
+
border-radius: 0 !important;
|
|
141
|
+
flex: 1;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
}
|
|
144
|
+
`,Te=n.span`
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
padding: 0 10px;
|
|
148
|
+
background: rgba(0, 0, 0, 0.04);
|
|
149
|
+
color: ${a.muted};
|
|
150
|
+
font-size: 13px;
|
|
151
|
+
white-space: nowrap;
|
|
152
|
+
border-right: 1px solid ${a.lineStrong};
|
|
153
|
+
`,Be=n.div`
|
|
154
|
+
display: grid;
|
|
155
|
+
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
|
156
|
+
gap: 12px;
|
|
157
|
+
|
|
158
|
+
${G.maxWidth("mobile")} {
|
|
159
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
160
|
+
}
|
|
161
|
+
`,L=n.button`
|
|
162
|
+
position: relative;
|
|
163
|
+
padding: 0;
|
|
164
|
+
border: 2px solid ${a.lineStrong};
|
|
165
|
+
border-radius: ${_e.card};
|
|
166
|
+
overflow: hidden;
|
|
167
|
+
aspect-ratio: 16 / 9;
|
|
168
|
+
background: ${a.media};
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
|
|
171
|
+
& img {
|
|
172
|
+
width: 100%;
|
|
173
|
+
height: 100%;
|
|
174
|
+
object-fit: cover;
|
|
175
|
+
display: block;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&[data-selected='true'] {
|
|
179
|
+
border-color: ${a.accent};
|
|
180
|
+
box-shadow: 0 0 0 2px ${a.accent};
|
|
181
|
+
}
|
|
182
|
+
&[data-selected='true']::after {
|
|
183
|
+
content: '✓';
|
|
184
|
+
position: absolute;
|
|
185
|
+
top: 6px;
|
|
186
|
+
right: 6px;
|
|
187
|
+
width: 22px;
|
|
188
|
+
height: 22px;
|
|
189
|
+
display: grid;
|
|
190
|
+
place-items: center;
|
|
191
|
+
border-radius: 50%;
|
|
192
|
+
background: ${a.accent};
|
|
193
|
+
color: ${a.white};
|
|
194
|
+
font-size: 13px;
|
|
195
|
+
font-weight: 700;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&[data-variant='upload'] {
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
gap: 6px;
|
|
204
|
+
border-style: dashed;
|
|
205
|
+
color: ${a.muted};
|
|
206
|
+
font-size: 13px;
|
|
207
|
+
font-weight: 700;
|
|
208
|
+
background: ${a.white};
|
|
209
|
+
}
|
|
210
|
+
&[data-variant='upload'] .ico {
|
|
211
|
+
width: 22px;
|
|
212
|
+
height: 22px;
|
|
213
|
+
background: ${a.muted};
|
|
214
|
+
}
|
|
215
|
+
&[data-variant='upload']:hover {
|
|
216
|
+
border-color: ${a.accent};
|
|
217
|
+
color: ${a.accent};
|
|
218
|
+
}
|
|
219
|
+
&[data-variant='upload']:hover .ico {
|
|
220
|
+
background: ${a.accent};
|
|
221
|
+
}
|
|
222
|
+
`,Pe=n.input`
|
|
223
|
+
position: absolute;
|
|
224
|
+
width: 1px;
|
|
225
|
+
height: 1px;
|
|
226
|
+
opacity: 0;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
`,Re=n.div`
|
|
229
|
+
display: flex;
|
|
230
|
+
justify-content: flex-end;
|
|
231
|
+
gap: 12px;
|
|
232
|
+
margin-top: 8px;
|
|
233
|
+
`,Fe=n(q)`
|
|
234
|
+
min-width: 180px;
|
|
235
|
+
|
|
236
|
+
${G.maxWidth("mobile")} {
|
|
237
|
+
width: 100%;
|
|
238
|
+
}
|
|
239
|
+
`,V=1e6,W={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function Y(r){return`${(r/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function Ke(){de({title:s("seo.storeSettings.title"),noindex:!0});const{session:r,signIn:u}=pe(),S=le(),k=ue(),p=r==null?void 0:r.address,{data:$,isLoading:K}=ge(p),[o,g]=l.useState(W),[C,H]=l.useState(W),[y,x]=l.useState(),[h,I]=l.useState(!1),[c,_]=l.useState(null),[b,J]=l.useState({}),T=l.useRef(null);l.useEffect(()=>{if($){const e=me($);g(e),H(e),x(void 0),_(e.cover?{url:e.cover,name:e.coverName,hash:e.coverHash}:null)}},[$]),l.useEffect(()=>{let e=!1;return Promise.all(v.map(async i=>[i.name,await xe(i.url)])).then(i=>{e||J(Object.fromEntries(i))}).catch(()=>{}),()=>{e=!0}},[]);const E=l.useMemo(()=>{const e=v.find(d=>o.coverName===`cover/${d.name}`);if(e)return e.name;const i=o.coverHash?v.find(d=>b[d.name]===o.coverHash):void 0;return i==null?void 0:i.name},[o.coverName,o.coverHash,b]);l.useEffect(()=>{c!=null&&c.hash&&v.some(e=>b[e.name]===c.hash)&&_(null)},[b,c]);const B=y!==void 0&&y>V,Q=l.useMemo(()=>he.filter(e=>!A(e,o.links[e])),[o.links]),U=B||Q.length>0,N=l.useMemo(()=>JSON.stringify(o)!==JSON.stringify(C),[o,C]),X=N&&!U&&!h;if(l.useEffect(()=>{if(!N)return;const e=i=>{i.preventDefault()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[N]),!r)return t.jsxs(O,{"data-signin":!0,"aria-label":s("storeSettings.title"),children:[t.jsx(D,{children:s("storeSettings.title")}),t.jsx("p",{className:"muted",children:s("storeSettings.signInPrompt")}),t.jsx(Ne,{variant:"purple",onClick:u,children:s("storeSettings.signIn")})]});function Z(e,i){x(void 0),g(d=>({...d,cover:i,coverName:`cover/${e}`,coverHash:""}))}const ee=["image/png","image/jpeg","image/webp"];function te(e){var P;const i=(P=e.target.files)==null?void 0:P[0];if(!i||!ee.includes(i.type))return;x(i.size);const d=`cover/${i.name}`,m=new FileReader;m.onload=()=>{const R=m.result;_({url:R,name:d,hash:""}),g(re=>({...re,cover:R,coverName:d,coverHash:""}))},m.readAsDataURL(i)}function ie(){c&&(x(void 0),g(e=>({...e,cover:c.url,coverName:c.name,coverHash:c.hash})))}function se(e,i){const d=i?(f[e]+i).replace(/\s/g,""):"";g(m=>({...m,links:{...m.links,[e]:d}}))}function ae(e){const i=o.links[e];return e==="website"?i:i.replace(f[e],"")}async function ne(){if(!(!p||!r)){I(!0);try{await fe(p,o,r.identity),H(o),x(void 0),await k.invalidateQueries({queryKey:["store",p.toLowerCase()]}),F.success(s("storeSettings.saved")),S(`/assets/creator/${p}`)}catch{F.error(s("storeSettings.saveError"))}finally{I(!1)}}}return t.jsxs(O,{"aria-label":s("storeSettings.title"),children:[t.jsxs(ze,{children:[t.jsxs(Le,{children:[p?t.jsx(Ce,{to:`/assets/creator/${p}`,title:s("storeSettings.back"),"aria-label":s("storeSettings.back"),children:t.jsx(z,{name:"arrow-left"})}):null,t.jsx(D,{children:s("storeSettings.title")})]}),p?t.jsxs(He,{href:`/assets/creator/${p}`,target:"_blank",rel:"noopener noreferrer",children:[s("storeSettings.seeAsGuest"),t.jsx(z,{name:"external-link"})]}):null]}),K?t.jsx(Ee,{size:"large",label:s("storeSettings.loading")}):t.jsxs(t.Fragment,{children:[t.jsxs(w,{children:[t.jsx("span",{className:"field__label",children:s("storeSettings.cover")}),t.jsxs(Be,{role:"group","aria-label":s("storeSettings.cover"),children:[v.map(e=>{const i=E===e.name;return t.jsx(L,{type:"button","data-testid":"cover-picker-tile","data-selected":i,"aria-pressed":i,onClick:()=>Z(e.name,e.url),children:t.jsx("img",{src:e.url,alt:"",loading:"lazy"})},e.name)}),c?t.jsx(L,{type:"button","data-testid":"cover-picker-tile","data-variant":"custom","data-selected":!E,"aria-pressed":!E,onClick:ie,children:t.jsx("img",{src:c.url,alt:""})}):null,t.jsxs(L,{type:"button","data-testid":"cover-picker-tile","data-variant":"upload",onClick:()=>{var e;return(e=T.current)==null?void 0:e.click()},children:[t.jsx(z,{name:"upload"}),t.jsx("span",{children:s("storeSettings.upload")})]}),t.jsx(Pe,{ref:T,type:"file",accept:"image/png, image/jpeg, image/webp","data-testid":"cover-picker-input",onChange:te})]}),B?t.jsx(M,{message:s("storeSettings.sizeError",{max:Y(V),current:Y(y)})}):null]}),t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s("storeSettings.description")}),t.jsx("textarea",{value:o.description,rows:4,disabled:h,onChange:e=>g(i=>({...i,description:e.target.value}))})]}),t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s("storeSettings.website")}),t.jsx("input",{type:"url",value:o.links.website,placeholder:f.website,disabled:h,onChange:e=>g(i=>({...i,links:{...i.links,website:e.target.value.replace(/\s/g,"")}}))}),A("website",o.links.website)?null:t.jsx(M,{message:s("storeSettings.linkError",{value:f.website})})]}),["twitter","discord","facebook"].map(e=>t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s(`storeSettings.${e}`)}),t.jsxs(Ie,{children:[t.jsx(Te,{children:f[e]}),t.jsx("input",{type:"text",value:ae(e),disabled:h,onChange:i=>se(e,i.target.value)})]})]},e)),t.jsx(Re,{children:t.jsx(Fe,{variant:"purple","data-testid":"store-settings-save",onClick:()=>void ne(),disabled:!X,children:h?s("storeSettings.saving"):s("storeSettings.save")})})]})]})}export{Ke as StoreSettings,Ke as default};
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index.es-CWcx_MPC.js","_assets/react-IQWs2nb4.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as g,j as e,u as P,b as N,N as M}from"./react-IQWs2nb4.js";import{s as t,_ as I,t as F,p as _,X as O,G as W,n as D,m as q,e as n,o as U,f as V,Y as X,c as B,B as G,Z as H}from"./index-BiIZh9R9.js";import{w as J,S as Y}from"./buy-gasless-Cn4_YLUa.js";import"./sentry-DvOx8Rfb.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-rFeF6PNV.js";import"./intl-CBcMB1D2.js";import"./authorizations-FkFZVBeE.js";import"./sendMetaTransaction-BA-2MGdZ.js";import"./trade-encoding-DgV-A2zO.js";const K=t.div`
|
|
3
|
+
position: fixed;
|
|
4
|
+
inset: 0;
|
|
5
|
+
/**
|
|
6
|
+
* NEGATIVE, and that is the whole trick.
|
|
7
|
+
*
|
|
8
|
+
* This layer renders INSIDE Success's Root, so it shares that stacking context with the card: a positive or
|
|
9
|
+
* zero z-index paints it above every in-flow sibling no matter what the parent's own z-index is, which is
|
|
10
|
+
* why raising Root did nothing. Only a negative value puts a positioned child behind its parent's content.
|
|
11
|
+
*
|
|
12
|
+
* The parent must then form a stacking context (Root sets position/z-index), or -1 would escape past it and
|
|
13
|
+
* hide behind the page background instead.
|
|
14
|
+
*/
|
|
15
|
+
z-index: -1;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
`,Q=g.lazy(async()=>{const[{default:c},{default:r}]=await Promise.all([I(()=>import("./index.es-CWcx_MPC.js"),__vite__mapDeps([0,1])),I(()=>import("./confettiAnimation-BpyTLLuX.js"),[])]);return{default:()=>e.jsx(c,{animationData:r,loop:1})}});function Z(){const[c]=g.useState(()=>{var r;return!((r=window.matchMedia)!=null&&r.call(window,"(prefers-reduced-motion: reduce)").matches)});return c?e.jsx(K,{"aria-hidden":!0,"data-testid":"confetti",children:e.jsx(g.Suspense,{fallback:null,children:e.jsx(Q,{})})}):null}const{colors:s,radius:m}=F,j="@media (max-width: 600px)",L=t.div`
|
|
18
|
+
/* Its own stacking context, above the confetti layer (z-index 0). Needed because z-index is inert without
|
|
19
|
+
a position, so the content would otherwise sit below the burst regardless of order. */
|
|
20
|
+
position: relative;
|
|
21
|
+
z-index: 1;
|
|
22
|
+
max-width: 895px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
padding: 32px 12px;
|
|
25
|
+
min-height: 72vh;
|
|
26
|
+
`,ee=t.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: center;
|
|
30
|
+
text-align: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
min-height: 60vh;
|
|
33
|
+
`,te=t.span`
|
|
34
|
+
margin: 4px auto 8px;
|
|
35
|
+
width: 40px;
|
|
36
|
+
height: 40px;
|
|
37
|
+
`,C=t.h1`
|
|
38
|
+
font-size: clamp(30px, 4vw, 42px);
|
|
39
|
+
font-weight: 800;
|
|
40
|
+
letter-spacing: -0.02em;
|
|
41
|
+
margin: 20px 0 8px;
|
|
42
|
+
`,z=t.p`
|
|
43
|
+
font-size: 18px;
|
|
44
|
+
color: #4b4b57;
|
|
45
|
+
margin: 0 0 22px;
|
|
46
|
+
`,y=t.div`
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 18px;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
margin: 0 0 20px;
|
|
51
|
+
|
|
52
|
+
&[data-receipt] {
|
|
53
|
+
justify-content: flex-end;
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
`,ne=t.a`
|
|
57
|
+
display: inline-block;
|
|
58
|
+
margin: 0;
|
|
59
|
+
color: ${s.accent};
|
|
60
|
+
font-weight: 600;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
`,T=t.div`
|
|
64
|
+
display: flex;
|
|
65
|
+
gap: 12px;
|
|
66
|
+
flex-wrap: wrap;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
`,ie=t.div`
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: 12px;
|
|
72
|
+
width: 100%;
|
|
73
|
+
`,se=t.div`
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
gap: 16px;
|
|
78
|
+
padding: 24px 16px;
|
|
79
|
+
background: #e0f7e7;
|
|
80
|
+
border: 1px solid #34ce77;
|
|
81
|
+
border-radius: 16px;
|
|
82
|
+
`,re=t.span`
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
width: 60px;
|
|
85
|
+
height: 60px;
|
|
86
|
+
line-height: 0;
|
|
87
|
+
`,oe=t.p`
|
|
88
|
+
flex: 1;
|
|
89
|
+
margin: 0;
|
|
90
|
+
text-align: center;
|
|
91
|
+
font-size: 20px;
|
|
92
|
+
line-height: 1.334;
|
|
93
|
+
color: ${s.text2};
|
|
94
|
+
|
|
95
|
+
& b {
|
|
96
|
+
font-weight: 700;
|
|
97
|
+
}
|
|
98
|
+
`,ce=t.div`
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
padding: 24px;
|
|
102
|
+
background: ${s.white};
|
|
103
|
+
border: 1px solid ${s.gray4};
|
|
104
|
+
border-radius: 16px;
|
|
105
|
+
`,ae=t.div`
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
`,de=t.span`
|
|
109
|
+
display: block;
|
|
110
|
+
height: 1px;
|
|
111
|
+
margin: 12px 0;
|
|
112
|
+
background: ${s.gray4};
|
|
113
|
+
`,le=t.div`
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
gap: 8px;
|
|
118
|
+
min-height: 109px;
|
|
119
|
+
margin-bottom: 12px;
|
|
120
|
+
padding: 8px 24px;
|
|
121
|
+
border-radius: ${m.btn};
|
|
122
|
+
background: #f4e9ff;
|
|
123
|
+
color: ${s.text};
|
|
124
|
+
`,xe=t(_)`
|
|
125
|
+
width: 30px;
|
|
126
|
+
height: 30px;
|
|
127
|
+
color: ${s.text};
|
|
128
|
+
`,pe=t.p`
|
|
129
|
+
display: inline-flex;
|
|
130
|
+
align-items: baseline;
|
|
131
|
+
gap: 6px;
|
|
132
|
+
margin: 0;
|
|
133
|
+
`,he=t.span`
|
|
134
|
+
font-size: 24px;
|
|
135
|
+
font-weight: 700;
|
|
136
|
+
text-transform: capitalize;
|
|
137
|
+
`,ue=t.span`
|
|
138
|
+
font-size: 14px;
|
|
139
|
+
font-weight: 400;
|
|
140
|
+
`,fe=t.div`
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: 12px;
|
|
144
|
+
`,ge=t.div`
|
|
145
|
+
position: relative;
|
|
146
|
+
flex-shrink: 0;
|
|
147
|
+
width: 137px;
|
|
148
|
+
height: 137px;
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
background: ${s.media};
|
|
153
|
+
border: 0.134px solid ${s.muted2};
|
|
154
|
+
border-radius: ${m.btn};
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
|
|
157
|
+
& img {
|
|
158
|
+
width: 83%;
|
|
159
|
+
height: 83%;
|
|
160
|
+
object-fit: contain;
|
|
161
|
+
filter: drop-shadow(0.56px 2.24px 2.8px rgba(0, 0, 0, 0.1));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
${j} {
|
|
165
|
+
width: 96px;
|
|
166
|
+
height: 96px;
|
|
167
|
+
}
|
|
168
|
+
`,me=t.span`
|
|
169
|
+
position: absolute;
|
|
170
|
+
top: 8px;
|
|
171
|
+
left: 8px;
|
|
172
|
+
width: 20px;
|
|
173
|
+
height: 20px;
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
background: ${s.dclRed};
|
|
178
|
+
border-radius: ${m.chip};
|
|
179
|
+
line-height: 0;
|
|
180
|
+
`,je=t.div`
|
|
181
|
+
flex: 1;
|
|
182
|
+
min-width: 0;
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
gap: 2px;
|
|
186
|
+
padding: 8px;
|
|
187
|
+
`,we=t.div`
|
|
188
|
+
font-weight: 600;
|
|
189
|
+
font-size: 20px;
|
|
190
|
+
line-height: 1.57;
|
|
191
|
+
color: ${s.text};
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
text-overflow: ellipsis;
|
|
194
|
+
white-space: nowrap;
|
|
195
|
+
|
|
196
|
+
${j} {
|
|
197
|
+
font-size: 16px;
|
|
198
|
+
}
|
|
199
|
+
`,ye=t.span`
|
|
200
|
+
margin-left: 8px;
|
|
201
|
+
font-weight: 600;
|
|
202
|
+
font-size: 13px;
|
|
203
|
+
color: ${s.muted};
|
|
204
|
+
`,be=t(O)`
|
|
205
|
+
position: relative;
|
|
206
|
+
z-index: 1;
|
|
207
|
+
color: ${s.muted};
|
|
208
|
+
font-size: 10px;
|
|
209
|
+
|
|
210
|
+
& [data-avatar] {
|
|
211
|
+
display: none;
|
|
212
|
+
}
|
|
213
|
+
`,ve=t.div`
|
|
214
|
+
flex-shrink: 0;
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
gap: 4px;
|
|
218
|
+
padding: 8px;
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
font-size: 21px;
|
|
221
|
+
color: ${s.text2};
|
|
222
|
+
white-space: nowrap;
|
|
223
|
+
|
|
224
|
+
${j} {
|
|
225
|
+
font-size: 18px;
|
|
226
|
+
}
|
|
227
|
+
`,ke=t(_)`
|
|
228
|
+
width: 22px;
|
|
229
|
+
height: 22px;
|
|
230
|
+
`,$e=t.div`
|
|
231
|
+
display: flex;
|
|
232
|
+
gap: 12px;
|
|
233
|
+
align-items: center;
|
|
234
|
+
justify-content: flex-end;
|
|
235
|
+
|
|
236
|
+
${j} {
|
|
237
|
+
flex-direction: column-reverse;
|
|
238
|
+
}
|
|
239
|
+
`,E=W`
|
|
240
|
+
flex: 1;
|
|
241
|
+
min-width: 0;
|
|
242
|
+
height: 48px;
|
|
243
|
+
display: inline-flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
justify-content: center;
|
|
246
|
+
gap: 12px;
|
|
247
|
+
padding: 0 24px;
|
|
248
|
+
border-radius: ${m.btn};
|
|
249
|
+
font-weight: 600;
|
|
250
|
+
font-size: 15px;
|
|
251
|
+
letter-spacing: 0.04em;
|
|
252
|
+
text-transform: uppercase;
|
|
253
|
+
text-decoration: none;
|
|
254
|
+
cursor: pointer;
|
|
255
|
+
transition:
|
|
256
|
+
filter 0.15s ease,
|
|
257
|
+
background 0.15s ease;
|
|
258
|
+
|
|
259
|
+
&[data-variant='ghost'] {
|
|
260
|
+
background: transparent;
|
|
261
|
+
border: 2px solid ${s.accent};
|
|
262
|
+
color: ${s.accent};
|
|
263
|
+
}
|
|
264
|
+
&[data-variant='ghost']:hover {
|
|
265
|
+
background: rgba(105, 31, 169, 0.06);
|
|
266
|
+
}
|
|
267
|
+
&[data-variant='ruby'] {
|
|
268
|
+
background: ${s.dclRed};
|
|
269
|
+
border: 0;
|
|
270
|
+
color: ${s.softWhite};
|
|
271
|
+
}
|
|
272
|
+
&[data-variant='ruby']:hover {
|
|
273
|
+
filter: brightness(0.95);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
${j} {
|
|
277
|
+
width: 100%;
|
|
278
|
+
flex: none;
|
|
279
|
+
}
|
|
280
|
+
`,Ce=t.button`
|
|
281
|
+
${E};
|
|
282
|
+
`,ze=t.a`
|
|
283
|
+
${E};
|
|
284
|
+
`,Re=t.span`
|
|
285
|
+
display: inline-flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
justify-content: center;
|
|
288
|
+
width: 32px;
|
|
289
|
+
height: 32px;
|
|
290
|
+
border: 2.5px solid rgba(252, 252, 252, 0.5);
|
|
291
|
+
border-radius: ${m.btn};
|
|
292
|
+
line-height: 0;
|
|
293
|
+
`,R=t(G)`
|
|
294
|
+
min-width: 160px;
|
|
295
|
+
text-align: center;
|
|
296
|
+
`;function Ae(c){return null}const Se=c=>new Promise(r=>setTimeout(r,c));function Ie(c,r){const[i,a]=g.useState(c?"pending":"confirmed"),x=r?`${r.owner}-${r.contractAddress}-${r.itemId}`:"";return g.useEffect(()=>{if(!c)return;let l=!1;return(async()=>{let f=!1;for(let o=0;o<20&&!l;o++)try{await J(c,{timeoutMs:15e3}),f=!0;break}catch(v){if(v instanceof Y)continue;l||a("failed");return}if(!l){if(!f){a("timed-out");return}if(!r){a("confirmed");return}a("indexing");for(let o=0;o<40&&!l;o++){if(await H(r.owner,r.contractAddress,r.itemId)){l||a("confirmed");return}await Se(3e3)}l||a("timed-out")}})(),()=>{l=!0}},[c,x]),i}const Le=B.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump",Te=B.chainId===80002?"https://amoy.polygonscan.com/tx/":"https://polygonscan.com/tx/";function Ue(){var S;const{state:c,search:r}=P(),i=c??Ae(),a=N(),{session:x}=D(),l=i==null?void 0:i.txHash,b=(i==null?void 0:i.items)??[],f=i!=null&&i.creditsAdded&&i.creditsAdded>0?i.creditsAdded:null,o=b[0],v=x!=null&&x.address&&(o!=null&&o.contractAddress)&&(o!=null&&o.itemId)?{owner:x.address,contractAddress:o.contractAddress,itemId:o.itemId}:null,u=Ie(i!=null&&i.settled?void 0:l,v);q({title:n("seo.success.title"),noindex:!0});const h=b;if(h.length===0)return e.jsx(M,{to:"/assets",replace:!0});const A=h[0],w=(S=i==null?void 0:i.txHashes)!=null&&S.length?i.txHashes:l?[l]:[],p=w.length>0&&U(x==null?void 0:x.providerType)?w.map((d,k)=>e.jsx(ne,{href:`${Te}${d}`,target:"_blank",rel:"noreferrer",children:w.length>1?n("success.viewTransactionNumbered",{n:k+1,total:w.length}):n("success.viewTransaction")},d)):null;return u!=="confirmed"?e.jsx(L,{children:e.jsx(ee,{children:u==="pending"||u==="indexing"?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"spinner","aria-hidden":!0}),e.jsx(C,{children:u==="indexing"?n("success.finalizing"):n("success.processing")}),e.jsx(z,{children:u==="indexing"?e.jsxs(e.Fragment,{children:[n("success.indexingBefore")," ",h.length===1?e.jsx("strong",{children:A.name}):n("success.itemCount",{count:h.length})," ",n("success.indexingAfter")]}):e.jsxs(e.Fragment,{children:[n("success.confirmingBefore")," ",h.length===1?e.jsx("strong",{children:A.name}):n("success.itemCount",{count:h.length})," ",n("success.confirmingAfter")]})}),p?e.jsx(y,{children:p}):null]}):u==="timed-out"?e.jsxs(e.Fragment,{children:[e.jsx(C,{children:n("success.stillProcessingTitle")}),e.jsxs(z,{children:[n("success.timedOutBefore")," ",e.jsx("button",{className:"link",onClick:()=>a("/activity"),children:n("nav.activity")})," ",n("success.timedOutAfter")]}),p?e.jsx(y,{children:p}):null,e.jsxs(T,{children:[e.jsx(R,{variant:"purple",onClick:()=>a("/activity"),children:n("success.viewActivity")}),e.jsx(R,{variant:"ghost",onClick:()=>a("/assets"),children:n("success.keepShopping")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{children:n("success.failedTitle")}),e.jsx(z,{children:n("success.failedBody")}),p?e.jsx(y,{children:p}):null,e.jsx(T,{children:e.jsx(R,{variant:"purple",onClick:()=>a("/assets"),children:n("success.backToShop")})})]})})}):e.jsxs(L,{children:[e.jsx(Z,{}),e.jsxs(ie,{children:[e.jsxs(se,{role:"status",children:[e.jsx(re,{"aria-hidden":!0,children:e.jsxs("svg",{viewBox:"0 0 60 60",width:"60",height:"60",children:[e.jsx("circle",{cx:"30",cy:"30",r:"30",fill:"#34ce77"}),e.jsx("path",{d:"M18 31l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"4.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsxs(oe,{children:[e.jsx("b",{children:n("success.bannerTitle")})," ",n("success.bannerBody")]})]}),e.jsxs(ce,{children:[f?e.jsxs(le,{"data-testid":"success-credits",children:[e.jsx(xe,{}),e.jsxs(pe,{children:[e.jsx(he,{children:n("getCredits.creditsAmount",{credits:f,currency:V.name})})," ",e.jsx(ue,{children:n("getCredits.creditsAdded")})]})]}):null,h.map((d,k)=>{const $=d.quantity??1;return e.jsxs(ae,{children:[k>0?e.jsx(de,{"aria-hidden":!0}):null,e.jsxs(fe,{children:[e.jsxs(ge,{children:[d.thumbnail?e.jsx("img",{src:d.thumbnail,alt:""}):null,e.jsx(me,{"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 18 18",width:"12",height:"12",children:e.jsx("path",{d:"M4 9l3.5 3.5L14 5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs(je,{children:[e.jsxs(we,{title:d.name,children:[d.name||n("buyModal.itemFallback"),$>1?e.jsx(ye,{children:n("cartCheckout.qty",{count:$})}):null]}),d.creator?e.jsx(be,{address:d.creator,linkToProfile:!0}):null]}),e.jsxs(ve,{children:[e.jsx(ke,{}),e.jsx("span",{children:X(d.priceCredits*$)})]})]})]},d.id)})]}),p?e.jsx(y,{"data-receipt":!0,children:p}):null,e.jsxs($e,{children:[e.jsx(Ce,{"data-variant":"ghost",onClick:()=>a("/my-assets"),children:n("success.myAssets")}),e.jsxs(ze,{"data-variant":"ruby",href:Le,target:"_blank",rel:"noreferrer",children:[n("success.tryInWorld"),e.jsx(Re,{"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})]})]})}export{Ue as Success,Ue as default};
|
|
@@ -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-BuQKbZaF.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};
|
|
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-BLAdE798.js";import{au as C}from"./NetworkUtil-Dh3JWXso.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,
|
|
1
|
+
import{r as o,j as C,a as T}from"./react-IQWs2nb4.js";import{s as P,t as i}from"./index-BiIZh9R9.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"))`
|