@dcl/shop 0.1.0-30381444187.commit-e5b9f13 → 0.1.0-30412251367.commit-a3b4797
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-B63zG8uY.js → Activity-8UjrsG3-.js} +15 -15
- package/assets/{AnimatedBackground-CWPdO0WE.js → AnimatedBackground-BCYG8Tef.js} +20 -3
- package/assets/{Assets-WnaUem5h.js → Assets-CH_R0j7s.js} +84 -84
- package/assets/{Assets.styles-Dmhspue_.js → Assets.styles-CikNDgjl.js} +67 -51
- package/assets/{Authorizations-CAStHHID.js → Authorizations-Bokq2Suf.js} +5 -5
- package/assets/Cart-WsDrlBE7.js +671 -0
- package/assets/{CircularProgress-CpOs7g9a.js → CircularProgress-BMVyWr0x.js} +5 -5
- package/assets/Collection-DJOV1uib.js +119 -0
- package/assets/CollectionCarousel-QT5SE2Qn.js +786 -0
- package/assets/{ConstantsUtil-DTrOBzCe.js → ConstantsUtil-KNWfO3UV.js} +1 -1
- package/assets/{ContentClient-jyMKirlf.js → ContentClient-C6lww4Oh.js} +1 -1
- package/assets/Creator-02vljttt.js +283 -0
- package/assets/{DeploymentBuilder-j08uBP-r.js → DeploymentBuilder-Y6PlTuKa.js} +1 -1
- package/assets/ErrorNotice-D5gYmXmi.js +1 -0
- package/assets/{ExchangeController-CL_gVqSw.js → ExchangeController-C2Dwbbnp.js} +1 -1
- package/assets/{GetCredits-DSK7zyc2.js → GetCredits-wex2fjEr.js} +28 -28
- package/assets/{HelpersUtil-BfapKZKr.js → HelpersUtil-Vd6xvA31.js} +1 -1
- package/assets/ImportListings-Bt5ry6Y2.js +433 -0
- package/assets/{ItemDetail-CkmPrObF.css → ItemDetail-B4Ll03xN.css} +1 -1
- package/assets/ItemDetail-DfXPbN58.js +3262 -0
- package/assets/{LoadMore-DTUpuDyu.js → LoadMore-CQjFLXNq.js} +3 -3
- package/assets/MarketCheckout-CKG6pjiW.js +91 -0
- package/assets/{MenuList-DQbLlN7L.js → MenuList-IJFPnugX.js} +2 -2
- package/assets/{MyAssets-DJ0hwGXR.js → MyAssets-BVW3epBg.js} +6 -6
- package/assets/MyFavorites-CnL6bN9q.js +67 -0
- package/assets/{NetworkUtil-C1aEwuOK.js → NetworkUtil-C48X2eZd.js} +1 -1
- package/assets/NotFound-Bnm7dY5_.js +13 -0
- package/assets/NotificationsBell-DuPpk873.js +34 -0
- package/assets/StoreSettings-jIzJh2hQ.js +253 -0
- package/assets/Success-DyBk-Fyu.js +276 -0
- package/assets/{SwapController-BNkoWTIp.js → SwapController-3FAonz_f.js} +1 -1
- package/assets/{Tooltip-CBuz_rc2.js → Tooltip-BBt5hMnk.js} +7 -7
- package/assets/{TradeService-Dm_ASWCN.js → TradeService-B7rDz3sC.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-CeSRgOaN.js → W3MFrameProviderSingleton-CW-7ZLkS.js} +3 -3
- package/assets/{WebCryptoP256-GalvwmvU.js → WebCryptoP256-Bd8OFfw1.js} +1 -1
- package/assets/{authorizations-Ds7LRLV0.js → authorizations-D9SdrCKu.js} +1 -1
- package/assets/{basic-D_j1sfcj.js → basic-Dvd5bzaA.js} +1 -1
- package/assets/{biconomy-YD94PgiS.js → biconomy-dG6Bg2dg.js} +1 -1
- package/assets/browseLayout.styles-C_Zq7mr0.js +91 -0
- package/assets/{browser-CTzRZpIE.js → browser-BFlLa9WG.js} +1 -1
- package/assets/{browser-ponyfill-CI1-rMvf.js → browser-ponyfill-CjstZ09i.js} +1 -1
- package/assets/browser-ponyfill-D1S2-yVH.js +1 -0
- package/assets/{builder-Cc8g4-4q.js → builder-D8iOQj01.js} +1 -1
- package/assets/{buy-DnSS_Kop.js → buy-D5aQviUN.js} +1 -1
- package/assets/buy-gasless-Dyp24AZP.js +1 -0
- package/assets/cart-checkout-CwE04N9A.js +1 -0
- package/assets/categories-DYeriK5r.js +427 -0
- package/assets/{ccip-bHN-8eS1.js → ccip-CmH6X-VD.js} +1 -1
- package/assets/{ccip-CiESIEiQ.js → ccip-sPJkvjEi.js} +1 -1
- package/assets/{chains-Znt1BTfw.js → chains-C2RietY2.js} +1 -1
- package/assets/clsx-kou7Gw3G.js +9 -0
- package/assets/{common-D9tSChDa.js → common-CsgGwlgE.js} +1 -1
- package/assets/{controller-B2JIau8v.js → controller-xklbTpWc.js} +2 -2
- package/assets/{core-3cHR7yu5.js → core-MZsPOtzz.js} +4 -4
- package/assets/createSvgIcon-IwQBy7pg.js +74 -0
- package/assets/{custom-BFV9Niby.js → custom-BxkhNAWn.js} +1 -1
- package/assets/{data-capture-DTqon_Ye.js → data-capture-BehFEgR3.js} +1 -1
- package/assets/decimals-CiA-5P-9.js +1 -0
- package/assets/{decimals-C4nLn1ac.js → decimals-IP6x1zFM.js} +1 -1
- package/assets/{detectExtension-BgMIFAUw.js → detectExtension-CkPZwVNy.js} +1 -1
- package/assets/{email-CN7CWhKF.js → email-tWQYn7xy.js} +1 -1
- package/assets/{embedded-wallet-Q6nTAiGf.js → embedded-wallet-D30IEXMw.js} +1 -1
- package/assets/emotion-styled.browser.esm-DhhmYbit.js +1 -0
- package/assets/{engine-DoRvgWV1.js → engine-DGnYPLN-.js} +1 -1
- package/assets/{errors-CG6pp58g.js → errors-BnsKc9DV.js} +1 -1
- package/assets/estimate-l1-fee-af1li4fB.js +1 -0
- package/assets/eth_estimateGas-DKDoOLuk.js +1 -0
- package/assets/{eth_getStorageAt--oQrWy0Q.js → eth_getStorageAt-Bk219lKE.js} +1 -1
- package/assets/eth_getTransactionCount-Yz7j7-eF.js +1 -0
- package/assets/{ethereum-3zUUm4Pr.js → ethereum-CFJvhUPP.js} +1 -1
- package/assets/{ethers-CtVvB8eG.js → ethers-BcJP3Jlu.js} +1 -1
- package/assets/{execute-UcJesME5.js → execute-DdoVwcnk.js} +2 -2
- package/assets/{extractIPFS-BmriCqG8.js → extractIPFS-BnnvwCll.js} +1 -1
- package/assets/{features-B53I2xTg.js → features-BHep8ql_.js} +1 -1
- package/assets/{fetchTokenMetadata-CqYkUkwH.js → fetchTokenMetadata-DNF7Ktb5.js} +2 -2
- package/assets/{fortmatic-DM_o40Lo.js → fortmatic-CS3ilTJ-.js} +1 -1
- package/assets/{get-bytecode-C6TlbHJu.js → get-bytecode-7NL5IHp9.js} +1 -1
- package/assets/get-ecosystem-wallet-info-CjX0dGBA.js +1 -0
- package/assets/{getBalance-BMDqICQz.js → getBalance-o3xVy3VD.js} +2 -2
- package/assets/{getInstalledModules-BLQxYEXn.js → getInstalledModules-Bb2RILoZ.js} +1 -1
- package/assets/{getNFT-6TA-E6XX.js → getNFT-BnJhYWTi.js} +2 -2
- package/assets/getNFT-CqhsAlXX.js +1 -0
- package/assets/getThemeProps-D0AJFzVJ.js +1 -0
- package/assets/grid.styles-BuejQ1yn.js +14 -0
- package/assets/{hashTypedData-ug9gj3v5.js → hashTypedData-CoabZkiv.js} +1 -1
- package/assets/{hashTypedData-BGvyK_O1.js → hashTypedData-DuKr_f0f.js} +1 -1
- package/assets/{import-CZZ9-DX_.js → import-WkFMCsEs.js} +1 -1
- package/assets/{in-app-BXpVuL_f.js → in-app-BGJ-xQVR.js} +1 -1
- package/assets/{in-app-wallet-calls-Cw2KNfOh.js → in-app-wallet-calls-DtUfInmk.js} +1 -1
- package/assets/{index-CKSJdo5m.js → index--NzC7DNE.js} +1 -1
- package/assets/{index-C7TVyPoU.js → index-2mQ5xcN9.js} +1 -1
- package/assets/{index-B2DUxMjO.js → index-5kO2yk7p.js} +1 -1
- package/assets/{index-BvrGtJes.js → index-8ojVdZC7.js} +1 -1
- package/assets/{index-BEmTYNSG.js → index-ANt6jUgt.js} +1 -1
- package/assets/{index-DpXleRYB.js → index-AqMtboou.js} +1 -1
- package/assets/{index-D7r-KbUN.js → index-B0LPe9M_.js} +1 -1
- package/assets/{index-b39aIkkP.js → index-B2DXGnIr.js} +1 -1
- package/assets/{index-F_0Er667.js → index-BHw4ODLd.js} +2 -2
- package/assets/{index-B1saYH84.js → index-BQaqHf8o.js} +1 -1
- package/assets/{index-F-n6GV2b.js → index-BXQdsRLU.js} +1 -1
- package/assets/{index-Fe4H2sUE.js → index-Bd3LDqeG.js} +1 -1
- package/assets/{index-B0SdAX-m.js → index-Bh3E5miD.js} +1 -1
- package/assets/{index-BDwWglvl.js → index-Bj6MeO0a.js} +1 -1
- package/assets/{index-CmgoqHgW.js → index-Bk9utcMB.js} +1 -1
- package/assets/{index-CkWJ4sTo.js → index-BohEkpwv.js} +1 -1
- package/assets/{index-Cy8JAEGy.js → index-BojPkeOq.js} +1 -1
- package/assets/index-BtrcjZG0.js +1 -0
- package/assets/{index-BeeMSgi1.js → index-C7RLoETU.js} +1 -1
- package/assets/{index-euFuE7ah.js → index-CBBP7TBs.js} +1 -1
- package/assets/{index-FvnJRnD5.js → index-CBIe-bgQ.js} +3 -3
- package/assets/{index-B7jIFcHs.js → index-CCTlFldw.js} +2 -2
- package/assets/{index-BHPkQDns.js → index-CEer3Dve.js} +1 -1
- package/assets/{index-BG7lZdfP.js → index-CGOjpWDy.js} +1 -1
- package/assets/index-CKj6WCs2.js +2 -0
- package/assets/index-CKryZsyO.js +2637 -0
- package/assets/{index-Bq0YYsbG.js → index-CPx2rJof.js} +1 -1
- package/assets/index-CRHJNQlx.js +1 -0
- package/assets/{index-CDEPMu43.js → index-CSYGb2Fe.js} +3 -3
- package/assets/{index-B5JNl4HC.js → index-CSmBKYZx.js} +1 -1
- package/assets/{index-C0ACz6_-.js → index-CW9GMvzr.js} +1 -1
- package/assets/{index-Y77Y_U0L.js → index-CWMRtcEf.js} +1 -1
- package/assets/{index-DaGhU6Uz.js → index-CX3uS5Lx.js} +1 -1
- package/assets/{index-ogLhf7-S.js → index-CZkRRYw3.js} +1 -1
- package/assets/{index-C68XxPCY.js → index-Cde9ukg9.js} +1 -1
- package/assets/{index-BOMAmQU7.js → index-ChrYH1qu.js} +1 -1
- package/assets/{index-2jouHGho.js → index-ClCrLGWg.js} +1 -1
- package/assets/{index-CSZuXP_O.js → index-CmMivti9.js} +1 -1
- package/assets/{index-_hV86vSn.js → index-CwpsnSE-.js} +1 -1
- package/assets/{index-gxa5wyAJ.js → index-CzKb7vNz.js} +3 -3
- package/assets/{index-Dr9lSl0n.js → index-D5j9PYJF.js} +1 -1
- package/assets/{index-BTV13rXH.js → index-D5r4ujUj.js} +1 -1
- package/assets/{index-D95ZUsPD.js → index-D9y9e0SI.js} +1 -1
- package/assets/index-DCpWUtOQ.css +1 -0
- package/assets/{index-m5R1RgvV.js → index-DGoEKeW3.js} +1 -1
- package/assets/{index-DiGXPxzb.js → index-DIQFiJw5.js} +1 -1
- package/assets/{index-BqPcUFuz.js → index-DKMe_g7M.js} +1 -1
- package/assets/{index-D0fJ7qrq.js → index-DVtofOZW.js} +1 -1
- package/assets/{index-G_lkaThL.js → index-DfCHmMef.js} +1 -1
- package/assets/{index-CYMsLttB.js → index-DfsP9TUM.js} +1 -1
- package/assets/{index-CmgZ4NMC.js → index-DmQpQnV8.js} +1 -1
- package/assets/{index-tFmbSlHL.js → index-Dp4jo2Sw.js} +1 -1
- package/assets/index-DxuZw951.js +4 -0
- package/assets/{index-CeKksx_X.js → index-EdKbWflt.js} +1 -1
- package/assets/{index-DGIUeX6X.js → index-ErYV44Q4.js} +1 -1
- package/assets/{index-CaR23uYb.js → index-Ml84ec8q.js} +1 -1
- package/assets/{index-BZ6S4-Qy.js → index-SFbvmavv.js} +1 -1
- package/assets/index-UPzYWcom.js +1 -0
- package/assets/{index-2RpQo6sW.js → index-gzyTW3Vs.js} +1 -1
- package/assets/{index-BBeW5CPj.js → index-kZnnQ5Ut.js} +1 -1
- package/assets/{index-BQe1IsNb.js → index-npBBtkQ4.js} +2 -2
- package/assets/{index-ExvBrBJ4.js → index-qb84uRHi.js} +2 -2
- package/assets/{index-D9gz4wTG.js → index-xg4lpaz2.js} +1 -1
- package/assets/{index-CjpRvZkq.js → index-yG-FApIh.js} +1 -1
- package/assets/{index.es-CmoiU8SE.js → index.es-B8-dnoim.js} +1 -1
- package/assets/{index.es-DD7iT23u.js → index.es-CVKCWLJM.js} +4 -4
- package/assets/{index.es-DDEozdoq.js → index.es-DJ3kbshj.js} +1 -1
- package/assets/{linkAccount-BR5_llhd.js → linkAccount-CMRw__DD.js} +1 -1
- package/assets/{localBatchGatewayRequest-BGfmM9P7.js → localBatchGatewayRequest-Zo1h78T2.js} +1 -1
- package/assets/mana-rate-5WVYReay.js +1 -0
- package/assets/{native-BSpg_u0K.js → native-CVTOA2Tn.js} +1 -1
- package/assets/{networks-CBAVrHYh.js → networks-lZiCPE_E.js} +1 -1
- package/assets/{onramp-dft5bcN9.js → onramp-CdEvB3NN.js} +1 -1
- package/assets/{openzeppelin-WekOcr_Z.js → openzeppelin-dcSCp8oO.js} +1 -1
- package/assets/{ownerOf-D9UDfElT.js → ownerOf-CsITmz5G.js} +1 -1
- package/assets/{parseNft-DTV6iT7B.js → parseNft-Dyxra80B.js} +2 -2
- package/assets/{parseSignature-C7rL0b_w.js → parseSignature-Bv6LHz0J.js} +3 -3
- package/assets/{parseSignature-DmkHq9fC.js → parseSignature-kR33ICiI.js} +1 -1
- package/assets/{passkeys--Px7LRhh.js → passkeys-CNB2NE7x.js} +1 -1
- package/assets/{pay-with-exchange-CMQeyenn.js → pay-with-exchange-BMLdqedA.js} +1 -1
- package/assets/{prepare-contract-call-CHrp3EL4.js → prepare-contract-call-BaYJFPDg.js} +1 -1
- package/assets/{qr-overlay-Dz377WEQ.js → qr-overlay-CnDI5CiO.js} +3 -3
- package/assets/{react-BW1xvPTF.js → react-BcSuIh9F.js} +1 -1
- package/assets/{receive-CpDxltQB.js → receive-ChA3v35W.js} +1 -1
- package/assets/{resolveImplementation-CFOrDNcu.js → resolveImplementation-CCo5LLf9.js} +1 -1
- package/assets/{rpc-CjfGBkRY.js → rpc-DnrL-lEN.js} +1 -1
- package/assets/{secp256k1-DSadr9B6.js → secp256k1-CMg-D1Yf.js} +1 -1
- package/assets/{secp256k1-C77TwNwR.js → secp256k1-CS2b8XGe.js} +1 -1
- package/assets/{secp256k1-Dgs0hNIB.js → secp256k1-k3rGb0FY.js} +1 -1
- package/assets/{send-BMIoBrdl.js → send-C4CU9amI.js} +1 -1
- package/assets/{send-batch-transaction-CZ5LHGtL.js → send-batch-transaction-CWgV_tKo.js} +1 -1
- package/assets/{send-eip712-transaction-DmvWUFiv.js → send-eip712-transaction-PtOJJ22L.js} +2 -2
- package/assets/send-gasless-transaction-C32fVIA8.js +2 -0
- package/assets/{send-transaction-DVEripxy.js → send-transaction-IaM6NABX.js} +2 -2
- package/assets/{sendMetaTransaction-7YAoB-pL.js → sendMetaTransaction-B3dSruz9.js} +1 -1
- package/assets/{sendRawTransaction-BXyfyJLD.js → sendRawTransaction-DVnoMWRa.js} +3 -3
- package/assets/{sentry-BV_ZSgtd.js → sentry-Cmcd0bRo.js} +1 -1
- package/assets/{serializeTransaction-BkF9WfrN.js → serializeTransaction-xWeCzER5.js} +1 -1
- package/assets/{session-proposal-DoIVwtwv.js → session-proposal-CA_BWpbu.js} +1 -1
- package/assets/{session-request-C3QQi3mV.js → session-request-DrvTdT32.js} +2 -2
- package/assets/{sha256-BImz_UXn.js → sha256-DrqMdEvd.js} +1 -1
- package/assets/{signing-BInyigJZ.js → signing-D7mIsKCi.js} +3 -3
- package/assets/{socials-HN5nwNut.js → socials-DHhQ5hHW.js} +1 -1
- package/assets/{swaps-Dbu6ix4y.js → swaps-GIwSXf8E.js} +1 -1
- package/assets/{thirdweb-DY9iSWOj.js → thirdweb-Cu0RUYVM.js} +3 -3
- package/assets/{to-serializable-transaction-DFrgce7C.js → to-serializable-transaction-CZNMGKgd.js} +2 -2
- package/assets/{totalSupply-D4j1WOYW.js → totalSupply-GlVdMBtF.js} +1 -1
- package/assets/{trade-encoding-CcRCeIpG.js → trade-encoding-Bjf-A7RZ.js} +1 -1
- package/assets/{transaction-BOS1fhp8.js → transaction-BcHeU8fK.js} +1 -1
- package/assets/{transactionReceipt-5vjrQVvz.js → transactionReceipt-BN87RuoF.js} +1 -1
- package/assets/{transactions-DLwOfx7v.js → transactions-Cco6oVpQ.js} +1 -1
- package/assets/useCreditPacks-DTfnYysJ.js +1 -0
- package/assets/{useInfiniteGrid-pff93KiW.js → useInfiniteGrid-DZnjtepZ.js} +1 -1
- package/assets/useManaRate-C4EXijsl.js +1 -0
- package/assets/{useSecondarySales-BRJGIRwF.js → useSecondarySales-DYRKFz6P.js} +1 -1
- package/assets/{useStore-CV_90SkB.js → useStore-_uLtA179.js} +2 -2
- package/assets/useTheme-DzRWFu1V.js +1 -0
- package/assets/{utils-B7rjkjB1.js → utils-DyrKZcP0.js} +1 -1
- package/assets/{verifyHash-BJDJ-yWB.js → verifyHash-DCxQtIBT.js} +1 -1
- package/assets/{w3m-modal-Cs01ZX0b.js → w3m-modal-Da4hI2j8.js} +1 -1
- package/assets/{w3m-modal-C_4vaAKJ.js → w3m-modal-DxYrwlB7.js} +1 -1
- package/assets/{wait-for-tx-receipt-CYy9IgHg.js → wait-for-tx-receipt-C-mmcx5H.js} +1 -1
- package/assets/{wallets-D4ZcCkX2.js → wallets-76x-ub7q.js} +5 -5
- package/assets/{web-connector-p1b6xGQr.js → web-connector-dduTSXH6.js} +3 -3
- package/assets/{writeContract-Cl5bVpey.js → writeContract-DwGysLbg.js} +1 -1
- package/assets/{zora-sepolia-CVS3owSi.js → zora-sepolia-yOsPOmPB.js} +1 -1
- package/assets/{zoraTestnet-Dg220Oc3.js → zoraTestnet-DWoNxnQd.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/AnimatedBackground-CiurwFBv.css +0 -1
- package/assets/Button-BDUHWtxg.js +0 -74
- package/assets/Cart-C_kThny7.css +0 -1
- package/assets/Cart-D-YOXeH9.js +0 -1
- package/assets/Collection-9Fu4_XnC.js +0 -45
- package/assets/Collection-Dpog3TvS.css +0 -1
- package/assets/CollectionCarousel-C8hFnis-.css +0 -1
- package/assets/CollectionCarousel-CzvvuUUw.js +0 -292
- package/assets/Creator-3NXIbePD.js +0 -1
- package/assets/Creator-Cpx_caba.css +0 -1
- package/assets/ErrorNotice-BG40E5Ff.js +0 -1
- package/assets/ImportListings-CgB7Xjb_.css +0 -1
- package/assets/ImportListings-DZs_dFSO.js +0 -5
- package/assets/ItemDetail-D49gDAwf.js +0 -2406
- package/assets/MarketCheckout-CoUO17KO.js +0 -3
- package/assets/MyFavorites-D3n_-d0Z.js +0 -1
- package/assets/NotFound-MMFCqdKn.js +0 -1
- package/assets/NotificationsBell-CNLR9ard.js +0 -34
- package/assets/StoreSettings-CdSK69sU.js +0 -53
- package/assets/StoreSettings-qz4M138c.css +0 -1
- package/assets/Success-KKN_AjMe.js +0 -4
- package/assets/browser-ponyfill-6L1OGOLN.js +0 -1
- package/assets/buy-gasless-9Zn1yAMk.js +0 -1
- package/assets/cart-checkout-BAugwPm6.js +0 -1
- package/assets/categories-BI9AXlDF.js +0 -305
- package/assets/categories-YFBLpDYC.css +0 -1
- package/assets/collection-CrgnzsVL.css +0 -1
- package/assets/collection-DE3QnCpW.js +0 -1
- package/assets/decimals-Bmvg-V50.js +0 -1
- package/assets/emotion-CSxEP8yM.js +0 -1
- package/assets/emotion-styled.browser.esm-DU8E1n2c.js +0 -1
- package/assets/estimate-l1-fee-DIch6QAI.js +0 -1
- package/assets/eth_estimateGas-JYqF9U1i.js +0 -1
- package/assets/eth_getTransactionCount-BEhAgz2O.js +0 -1
- package/assets/get-ecosystem-wallet-info-HoRTPbSm.js +0 -1
- package/assets/getNFT-WdF3UG1j.js +0 -1
- package/assets/getThemeProps-HByDG2pD.js +0 -1
- package/assets/index-8wx1oJ_F.js +0 -4
- package/assets/index-B6MKNzS8.js +0 -1
- package/assets/index-CEcu6qlS.js +0 -2
- package/assets/index-DqLpZ4oP.js +0 -1
- package/assets/index-DwufS2l2.css +0 -1
- package/assets/index-TmxHL85j.js +0 -312
- package/assets/index-Z5LdHVdI.js +0 -1
- package/assets/mana-rate-C8zn6Vfu.js +0 -1
- package/assets/send-gasless-transaction-DxLNFATn.js +0 -2
- package/assets/useCreditPacks-Dft_m4Vq.js +0 -1
- package/assets/useManaRate-C5mRxzeC.js +0 -1
- package/assets/useTheme-cgcgN0ze.js +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import{j as t,L as le,u as ce,r as l}from"./react-BcSuIh9F.js";import{t as b,s as a,d as s,P as de,B as J,J as pe,o as ue,v as ge,I as N,V as F}from"./index-CKryZsyO.js";import{u as xe,d as me,t as he,L as fe,i as M,a as f,s as ve}from"./useStore-_uLtA179.js";import{E as O}from"./ErrorNotice-D5gYmXmi.js";import"./sentry-Cmcd0bRo.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcJP3Jlu.js";import"./intl-CBcMB1D2.js";const be="https://cdn.decentraland.org/@dcl/shop/0.1.0-30412251367.commit-a3b4797/assets/template-cover-1-BETekfHg.jpeg",we="https://cdn.decentraland.org/@dcl/shop/0.1.0-30412251367.commit-a3b4797/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
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 6px;
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
|
|
7
|
+
& input {
|
|
8
|
+
background: ${L.white};
|
|
9
|
+
border: 1px solid ${L.lineStrong};
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
padding: 10px 12px;
|
|
12
|
+
color: ${L.text};
|
|
13
|
+
font: inherit;
|
|
14
|
+
}
|
|
15
|
+
`,Se=de`
|
|
16
|
+
to {
|
|
17
|
+
transform: rotate(360deg);
|
|
18
|
+
}
|
|
19
|
+
`,ke=a.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
gap: 12px;
|
|
24
|
+
color: ${b.colors.muted};
|
|
25
|
+
|
|
26
|
+
&[data-direction='row'] {
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
}
|
|
29
|
+
&[data-direction='column'] {
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
text-align: center;
|
|
32
|
+
}
|
|
33
|
+
`,$e=a.span`
|
|
34
|
+
flex: none;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
border-style: solid;
|
|
37
|
+
border-color: ${b.colors.line};
|
|
38
|
+
border-top-color: ${b.colors.accent};
|
|
39
|
+
animation: ${Se} 0.8s linear infinite;
|
|
40
|
+
|
|
41
|
+
&[data-size='small'] {
|
|
42
|
+
width: 18px;
|
|
43
|
+
height: 18px;
|
|
44
|
+
border-width: 2px;
|
|
45
|
+
}
|
|
46
|
+
&[data-size='medium'] {
|
|
47
|
+
width: 30px;
|
|
48
|
+
height: 30px;
|
|
49
|
+
border-width: 3px;
|
|
50
|
+
}
|
|
51
|
+
&[data-size='large'] {
|
|
52
|
+
width: 48px;
|
|
53
|
+
height: 48px;
|
|
54
|
+
border-width: 4px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-reduced-motion: reduce) {
|
|
58
|
+
animation-duration: 2s;
|
|
59
|
+
}
|
|
60
|
+
`,ye=a.span`
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
`;function _e({label:r,size:u="medium",direction:S="column",className:k}){return t.jsxs(ke,{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($e,{"data-testid":"spinner-box-ring","data-size":u,"aria-hidden":!0}),r?t.jsx(ye,{children:r}):null]})}const{colors:n,radius:Ee,media:K}=b,ze=a(_e)`
|
|
64
|
+
display: grid;
|
|
65
|
+
place-items: center;
|
|
66
|
+
min-height: 60vh;
|
|
67
|
+
`,Ne=a(J)`
|
|
68
|
+
align-self: center;
|
|
69
|
+
min-width: 200px;
|
|
70
|
+
margin-top: 8px;
|
|
71
|
+
`,D=a.section`
|
|
72
|
+
max-width: 640px;
|
|
73
|
+
margin: 0 auto;
|
|
74
|
+
padding: 8px 0 48px;
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: 20px;
|
|
78
|
+
|
|
79
|
+
&[data-signin] {
|
|
80
|
+
min-height: 60vh;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
text-align: center;
|
|
84
|
+
gap: 12px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& .field__label {
|
|
88
|
+
font-weight: 700;
|
|
89
|
+
color: ${n.text};
|
|
90
|
+
}
|
|
91
|
+
& textarea {
|
|
92
|
+
background: ${n.white};
|
|
93
|
+
border: 1px solid ${n.lineStrong};
|
|
94
|
+
border-radius: 8px;
|
|
95
|
+
padding: 10px 12px;
|
|
96
|
+
color: ${n.text};
|
|
97
|
+
font: inherit;
|
|
98
|
+
resize: vertical;
|
|
99
|
+
min-height: 88px;
|
|
100
|
+
}
|
|
101
|
+
`,Le=a.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: baseline;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
gap: 16px;
|
|
106
|
+
flex-wrap: wrap;
|
|
107
|
+
`,Ce=a.div`
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: 10px;
|
|
111
|
+
`,He=a(le)`
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
color: ${n.text};
|
|
116
|
+
transition: color 0.15s linear;
|
|
117
|
+
|
|
118
|
+
&:hover {
|
|
119
|
+
color: ${n.accent};
|
|
120
|
+
}
|
|
121
|
+
& .ico {
|
|
122
|
+
width: 22px;
|
|
123
|
+
height: 22px;
|
|
124
|
+
}
|
|
125
|
+
`,V=a.h1`
|
|
126
|
+
font-size: 24px;
|
|
127
|
+
font-weight: 800;
|
|
128
|
+
`,Ie=a.a`
|
|
129
|
+
display: inline-flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 6px;
|
|
132
|
+
color: ${n.accent};
|
|
133
|
+
font-weight: 700;
|
|
134
|
+
font-size: 14px;
|
|
135
|
+
text-decoration: none;
|
|
136
|
+
|
|
137
|
+
&:hover {
|
|
138
|
+
text-decoration: underline;
|
|
139
|
+
}
|
|
140
|
+
& .ico {
|
|
141
|
+
width: 15px;
|
|
142
|
+
height: 15px;
|
|
143
|
+
}
|
|
144
|
+
`,Te=a.div`
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: stretch;
|
|
147
|
+
border: 1px solid ${n.lineStrong};
|
|
148
|
+
border-radius: 8px;
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
background: ${n.white};
|
|
151
|
+
|
|
152
|
+
& input {
|
|
153
|
+
border: 0 !important;
|
|
154
|
+
border-radius: 0 !important;
|
|
155
|
+
flex: 1;
|
|
156
|
+
min-width: 0;
|
|
157
|
+
}
|
|
158
|
+
`,Pe=a.span`
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
padding: 0 10px;
|
|
162
|
+
background: rgba(0, 0, 0, 0.04);
|
|
163
|
+
color: ${n.muted};
|
|
164
|
+
font-size: 13px;
|
|
165
|
+
white-space: nowrap;
|
|
166
|
+
border-right: 1px solid ${n.lineStrong};
|
|
167
|
+
`,Be=a.div`
|
|
168
|
+
display: grid;
|
|
169
|
+
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
|
170
|
+
gap: 12px;
|
|
171
|
+
|
|
172
|
+
${K.maxWidth("mobile")} {
|
|
173
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
174
|
+
}
|
|
175
|
+
`,C=a.button`
|
|
176
|
+
position: relative;
|
|
177
|
+
padding: 0;
|
|
178
|
+
border: 2px solid ${n.lineStrong};
|
|
179
|
+
border-radius: ${Ee.card};
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
aspect-ratio: 16 / 9;
|
|
182
|
+
background: ${n.media};
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
|
|
185
|
+
& img {
|
|
186
|
+
width: 100%;
|
|
187
|
+
height: 100%;
|
|
188
|
+
object-fit: cover;
|
|
189
|
+
display: block;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&[data-selected='true'] {
|
|
193
|
+
border-color: ${n.accent};
|
|
194
|
+
box-shadow: 0 0 0 2px ${n.accent};
|
|
195
|
+
}
|
|
196
|
+
&[data-selected='true']::after {
|
|
197
|
+
content: '✓';
|
|
198
|
+
position: absolute;
|
|
199
|
+
top: 6px;
|
|
200
|
+
right: 6px;
|
|
201
|
+
width: 22px;
|
|
202
|
+
height: 22px;
|
|
203
|
+
display: grid;
|
|
204
|
+
place-items: center;
|
|
205
|
+
border-radius: 50%;
|
|
206
|
+
background: ${n.accent};
|
|
207
|
+
color: ${n.white};
|
|
208
|
+
font-size: 13px;
|
|
209
|
+
font-weight: 700;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&[data-variant='upload'] {
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
align-items: center;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
gap: 6px;
|
|
218
|
+
border-style: dashed;
|
|
219
|
+
color: ${n.muted};
|
|
220
|
+
font-size: 13px;
|
|
221
|
+
font-weight: 700;
|
|
222
|
+
background: ${n.white};
|
|
223
|
+
}
|
|
224
|
+
&[data-variant='upload'] .ico {
|
|
225
|
+
width: 22px;
|
|
226
|
+
height: 22px;
|
|
227
|
+
background: ${n.muted};
|
|
228
|
+
}
|
|
229
|
+
&[data-variant='upload']:hover {
|
|
230
|
+
border-color: ${n.accent};
|
|
231
|
+
color: ${n.accent};
|
|
232
|
+
}
|
|
233
|
+
&[data-variant='upload']:hover .ico {
|
|
234
|
+
background: ${n.accent};
|
|
235
|
+
}
|
|
236
|
+
`,Re=a.input`
|
|
237
|
+
position: absolute;
|
|
238
|
+
width: 1px;
|
|
239
|
+
height: 1px;
|
|
240
|
+
opacity: 0;
|
|
241
|
+
pointer-events: none;
|
|
242
|
+
`,Ae=a.div`
|
|
243
|
+
display: flex;
|
|
244
|
+
justify-content: flex-end;
|
|
245
|
+
gap: 12px;
|
|
246
|
+
margin-top: 8px;
|
|
247
|
+
`,Fe=a(J)`
|
|
248
|
+
min-width: 180px;
|
|
249
|
+
|
|
250
|
+
${K.maxWidth("mobile")} {
|
|
251
|
+
width: 100%;
|
|
252
|
+
}
|
|
253
|
+
`,W=1e6,Y={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function G(r){return`${(r/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function Ke(){pe({title:s("seo.storeSettings.title"),noindex:!0});const{session:r,signIn:u}=ue(),S=ce(),k=ge(),p=r==null?void 0:r.address,{data:$,isLoading:q}=xe(p),[o,g]=l.useState(Y),[H,I]=l.useState(Y),[y,m]=l.useState(),[h,T]=l.useState(!1),[c,_]=l.useState(null),[w,Q]=l.useState({}),P=l.useRef(null);l.useEffect(()=>{if($){const e=me($);g(e),I(e),m(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 he(i.url)])).then(i=>{e||Q(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=>w[d.name]===o.coverHash):void 0;return i==null?void 0:i.name},[o.coverName,o.coverHash,w]);l.useEffect(()=>{c!=null&&c.hash&&v.some(e=>w[e.name]===c.hash)&&_(null)},[w,c]);const B=y!==void 0&&y>W,U=l.useMemo(()=>fe.filter(e=>!M(e,o.links[e])),[o.links]),X=B||U.length>0,z=l.useMemo(()=>JSON.stringify(o)!==JSON.stringify(H),[o,H]),Z=z&&!X&&!h;if(l.useEffect(()=>{if(!z)return;const e=i=>{i.preventDefault()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[z]),!r)return t.jsxs(D,{"data-signin":!0,"aria-label":s("storeSettings.title"),children:[t.jsx(V,{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 ee(e,i){m(void 0),g(d=>({...d,cover:i,coverName:`cover/${e}`,coverHash:""}))}const te=["image/png","image/jpeg","image/webp"];function ie(e){var R;const i=(R=e.target.files)==null?void 0:R[0];if(!i||!te.includes(i.type))return;m(i.size);const d=`cover/${i.name}`,x=new FileReader;x.onload=()=>{const A=x.result;_({url:A,name:d,hash:""}),g(oe=>({...oe,cover:A,coverName:d,coverHash:""}))},x.readAsDataURL(i)}function se(){c&&(m(void 0),g(e=>({...e,cover:c.url,coverName:c.name,coverHash:c.hash})))}function ne(e,i){const d=i?(f[e]+i).replace(/\s/g,""):"";g(x=>({...x,links:{...x.links,[e]:d}}))}function ae(e){const i=o.links[e];return e==="website"?i:i.replace(f[e],"")}async function re(){if(!(!p||!r)){T(!0);try{await ve(p,o,r.identity),I(o),m(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{T(!1)}}}return t.jsxs(D,{"aria-label":s("storeSettings.title"),children:[t.jsxs(Le,{children:[t.jsxs(Ce,{children:[p?t.jsx(He,{to:`/assets/creator/${p}`,title:s("storeSettings.back"),"aria-label":s("storeSettings.back"),children:t.jsx(N,{name:"arrow-left"})}):null,t.jsx(V,{children:s("storeSettings.title")})]}),p?t.jsxs(Ie,{href:`/assets/creator/${p}`,target:"_blank",rel:"noopener noreferrer",children:[s("storeSettings.seeAsGuest"),t.jsx(N,{name:"external-link"})]}):null]}),q?t.jsx(ze,{size:"large",label:s("storeSettings.loading")}):t.jsxs(t.Fragment,{children:[t.jsxs(j,{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(C,{type:"button","data-testid":"cover-picker-tile","data-selected":i,"aria-pressed":i,onClick:()=>ee(e.name,e.url),children:t.jsx("img",{src:e.url,alt:"",loading:"lazy"})},e.name)}),c?t.jsx(C,{type:"button","data-testid":"cover-picker-tile","data-variant":"custom","data-selected":!E,"aria-pressed":!E,onClick:se,children:t.jsx("img",{src:c.url,alt:""})}):null,t.jsxs(C,{type:"button","data-testid":"cover-picker-tile","data-variant":"upload",onClick:()=>{var e;return(e=P.current)==null?void 0:e.click()},children:[t.jsx(N,{name:"upload"}),t.jsx("span",{children:s("storeSettings.upload")})]}),t.jsx(Re,{ref:P,type:"file",accept:"image/png, image/jpeg, image/webp","data-testid":"cover-picker-input",onChange:ie})]}),B?t.jsx(O,{message:s("storeSettings.sizeError",{max:G(W),current:G(y)})}):null]}),t.jsxs(j,{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(j,{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,"")}}))}),M("website",o.links.website)?null:t.jsx(O,{message:s("storeSettings.linkError",{value:f.website})})]}),["twitter","discord","facebook"].map(e=>t.jsxs(j,{as:"label",children:[t.jsx("span",{className:"field__label",children:s(`storeSettings.${e}`)}),t.jsxs(Te,{children:[t.jsx(Pe,{children:f[e]}),t.jsx("input",{type:"text",value:ae(e),disabled:h,onChange:i=>ne(e,i.target.value)})]})]},e)),t.jsx(Ae,{children:t.jsx(Fe,{variant:"purple","data-testid":"store-settings-save",onClick:()=>void re(),disabled:!Z,children:h?s("storeSettings.saving"):s("storeSettings.save")})})]})]})}export{Ke as StoreSettings,Ke as default};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import{b as L,u as I,j as e,N as T,r as $}from"./react-BcSuIh9F.js";import{t as E,s as t,m as A,W as P,n as W,o as F,J as M,d as n,Q as N,e as O,X as _,c as z,B as q,Y as J}from"./index-CKryZsyO.js";import{w as U,S as X}from"./buy-gasless-Dyp24AZP.js";import"./sentry-Cmcd0bRo.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcJP3Jlu.js";import"./intl-CBcMB1D2.js";import"./authorizations-D9SdrCKu.js";import"./sendMetaTransaction-B3dSruz9.js";import"./trade-encoding-Bjf-A7RZ.js";const{colors:s,radius:u}=E,f="@media (max-width: 600px)",C=t.div`
|
|
2
|
+
max-width: 895px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 32px 12px;
|
|
5
|
+
min-height: 72vh;
|
|
6
|
+
`,D=t.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
text-align: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
min-height: 60vh;
|
|
13
|
+
`,Q=t.span`
|
|
14
|
+
margin: 4px auto 8px;
|
|
15
|
+
width: 40px;
|
|
16
|
+
height: 40px;
|
|
17
|
+
`,y=t.h1`
|
|
18
|
+
font-size: clamp(30px, 4vw, 42px);
|
|
19
|
+
font-weight: 800;
|
|
20
|
+
letter-spacing: -0.02em;
|
|
21
|
+
margin: 20px 0 8px;
|
|
22
|
+
`,b=t.p`
|
|
23
|
+
font-size: 18px;
|
|
24
|
+
color: #4b4b57;
|
|
25
|
+
margin: 0 0 22px;
|
|
26
|
+
`,j=t.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 18px;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
margin: 0 0 20px;
|
|
31
|
+
|
|
32
|
+
&[data-receipt] {
|
|
33
|
+
justify-content: flex-end;
|
|
34
|
+
margin: 0;
|
|
35
|
+
}
|
|
36
|
+
`,Y=t.a`
|
|
37
|
+
display: inline-block;
|
|
38
|
+
margin: 0;
|
|
39
|
+
color: ${s.accent};
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
`,R=t.div`
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: 12px;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
`,K=t.div`
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: 12px;
|
|
52
|
+
width: 100%;
|
|
53
|
+
`,G=t.div`
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
gap: 16px;
|
|
58
|
+
padding: 24px 16px;
|
|
59
|
+
background: #e0f7e7;
|
|
60
|
+
border: 1px solid #34ce77;
|
|
61
|
+
border-radius: 16px;
|
|
62
|
+
`,V=t.span`
|
|
63
|
+
flex-shrink: 0;
|
|
64
|
+
width: 60px;
|
|
65
|
+
height: 60px;
|
|
66
|
+
line-height: 0;
|
|
67
|
+
`,Z=t.p`
|
|
68
|
+
flex: 1;
|
|
69
|
+
margin: 0;
|
|
70
|
+
text-align: center;
|
|
71
|
+
font-size: 20px;
|
|
72
|
+
line-height: 1.334;
|
|
73
|
+
color: ${s.text2};
|
|
74
|
+
|
|
75
|
+
& b {
|
|
76
|
+
font-weight: 700;
|
|
77
|
+
}
|
|
78
|
+
`,H=t.div`
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
padding: 24px;
|
|
82
|
+
background: ${s.white};
|
|
83
|
+
border: 1px solid ${s.gray4};
|
|
84
|
+
border-radius: 16px;
|
|
85
|
+
`,ee=t.div`
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
`,te=t.span`
|
|
89
|
+
display: block;
|
|
90
|
+
height: 1px;
|
|
91
|
+
margin: 12px 0;
|
|
92
|
+
background: ${s.gray4};
|
|
93
|
+
`,ne=t.div`
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
gap: 8px;
|
|
98
|
+
min-height: 109px;
|
|
99
|
+
margin-bottom: 12px;
|
|
100
|
+
padding: 8px 24px;
|
|
101
|
+
border-radius: ${u.btn};
|
|
102
|
+
background: #f4e9ff;
|
|
103
|
+
color: ${s.text};
|
|
104
|
+
`,ie=t(A)`
|
|
105
|
+
width: 30px;
|
|
106
|
+
height: 30px;
|
|
107
|
+
color: ${s.text};
|
|
108
|
+
`,se=t.p`
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: baseline;
|
|
111
|
+
gap: 6px;
|
|
112
|
+
margin: 0;
|
|
113
|
+
`,re=t.span`
|
|
114
|
+
font-size: 24px;
|
|
115
|
+
font-weight: 700;
|
|
116
|
+
text-transform: capitalize;
|
|
117
|
+
`,ce=t.span`
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
font-weight: 400;
|
|
120
|
+
`,oe=t.div`
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
gap: 12px;
|
|
124
|
+
`,ae=t.div`
|
|
125
|
+
position: relative;
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
width: 137px;
|
|
128
|
+
height: 137px;
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
background: ${s.media};
|
|
133
|
+
border: 0.134px solid ${s.muted2};
|
|
134
|
+
border-radius: ${u.btn};
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
|
|
137
|
+
& img {
|
|
138
|
+
width: 83%;
|
|
139
|
+
height: 83%;
|
|
140
|
+
object-fit: contain;
|
|
141
|
+
filter: drop-shadow(0.56px 2.24px 2.8px rgba(0, 0, 0, 0.1));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
${f} {
|
|
145
|
+
width: 96px;
|
|
146
|
+
height: 96px;
|
|
147
|
+
}
|
|
148
|
+
`,de=t.span`
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 8px;
|
|
151
|
+
left: 8px;
|
|
152
|
+
width: 20px;
|
|
153
|
+
height: 20px;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
background: ${s.dclRed};
|
|
158
|
+
border-radius: ${u.chip};
|
|
159
|
+
line-height: 0;
|
|
160
|
+
`,le=t.div`
|
|
161
|
+
flex: 1;
|
|
162
|
+
min-width: 0;
|
|
163
|
+
display: flex;
|
|
164
|
+
flex-direction: column;
|
|
165
|
+
gap: 2px;
|
|
166
|
+
padding: 8px;
|
|
167
|
+
`,xe=t.div`
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
font-size: 20px;
|
|
170
|
+
line-height: 1.57;
|
|
171
|
+
color: ${s.text};
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
text-overflow: ellipsis;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
|
|
176
|
+
${f} {
|
|
177
|
+
font-size: 16px;
|
|
178
|
+
}
|
|
179
|
+
`,pe=t.span`
|
|
180
|
+
margin-left: 8px;
|
|
181
|
+
font-weight: 600;
|
|
182
|
+
font-size: 13px;
|
|
183
|
+
color: ${s.muted};
|
|
184
|
+
`,he=t(P)`
|
|
185
|
+
position: relative;
|
|
186
|
+
z-index: 1;
|
|
187
|
+
color: ${s.muted};
|
|
188
|
+
font-size: 10px;
|
|
189
|
+
|
|
190
|
+
& [data-avatar] {
|
|
191
|
+
display: none;
|
|
192
|
+
}
|
|
193
|
+
`,ue=t.div`
|
|
194
|
+
flex-shrink: 0;
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
gap: 4px;
|
|
198
|
+
padding: 8px;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
font-size: 21px;
|
|
201
|
+
color: ${s.text2};
|
|
202
|
+
white-space: nowrap;
|
|
203
|
+
|
|
204
|
+
${f} {
|
|
205
|
+
font-size: 18px;
|
|
206
|
+
}
|
|
207
|
+
`,fe=t(A)`
|
|
208
|
+
width: 22px;
|
|
209
|
+
height: 22px;
|
|
210
|
+
`,ge=t.div`
|
|
211
|
+
display: flex;
|
|
212
|
+
gap: 12px;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: flex-end;
|
|
215
|
+
|
|
216
|
+
${f} {
|
|
217
|
+
flex-direction: column-reverse;
|
|
218
|
+
}
|
|
219
|
+
`,S=W`
|
|
220
|
+
flex: 1;
|
|
221
|
+
min-width: 0;
|
|
222
|
+
height: 48px;
|
|
223
|
+
display: inline-flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: center;
|
|
226
|
+
gap: 12px;
|
|
227
|
+
padding: 0 24px;
|
|
228
|
+
border-radius: ${u.btn};
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
font-size: 15px;
|
|
231
|
+
letter-spacing: 0.04em;
|
|
232
|
+
text-transform: uppercase;
|
|
233
|
+
text-decoration: none;
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
transition:
|
|
236
|
+
filter 0.15s ease,
|
|
237
|
+
background 0.15s ease;
|
|
238
|
+
|
|
239
|
+
&[data-variant='ghost'] {
|
|
240
|
+
background: transparent;
|
|
241
|
+
border: 2px solid ${s.accent};
|
|
242
|
+
color: ${s.accent};
|
|
243
|
+
}
|
|
244
|
+
&[data-variant='ghost']:hover {
|
|
245
|
+
background: rgba(105, 31, 169, 0.06);
|
|
246
|
+
}
|
|
247
|
+
&[data-variant='ruby'] {
|
|
248
|
+
background: ${s.dclRed};
|
|
249
|
+
border: 0;
|
|
250
|
+
color: ${s.softWhite};
|
|
251
|
+
}
|
|
252
|
+
&[data-variant='ruby']:hover {
|
|
253
|
+
filter: brightness(0.95);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
${f} {
|
|
257
|
+
width: 100%;
|
|
258
|
+
flex: none;
|
|
259
|
+
}
|
|
260
|
+
`,me=t.button`
|
|
261
|
+
${S};
|
|
262
|
+
`,je=t.a`
|
|
263
|
+
${S};
|
|
264
|
+
`,we=t.span`
|
|
265
|
+
display: inline-flex;
|
|
266
|
+
align-items: center;
|
|
267
|
+
justify-content: center;
|
|
268
|
+
width: 32px;
|
|
269
|
+
height: 32px;
|
|
270
|
+
border: 2.5px solid rgba(252, 252, 252, 0.5);
|
|
271
|
+
border-radius: ${u.btn};
|
|
272
|
+
line-height: 0;
|
|
273
|
+
`,v=t(q)`
|
|
274
|
+
min-width: 160px;
|
|
275
|
+
text-align: center;
|
|
276
|
+
`,ye=i=>new Promise(r=>setTimeout(r,i));function be(i,r){const[d,o]=$.useState(i?"pending":"confirmed"),g=r?`${r.owner}-${r.contractAddress}-${r.itemId}`:"";return $.useEffect(()=>{if(!i)return;let a=!1;return(async()=>{let m=!1;for(let c=0;c<20&&!a;c++)try{await U(i,{timeoutMs:15e3}),m=!0;break}catch(x){if(x instanceof X)continue;a||o("failed");return}if(!a){if(!m){o("timed-out");return}if(!r){o("confirmed");return}o("indexing");for(let c=0;c<40&&!a;c++){if(await J(r.owner,r.contractAddress,r.itemId)){a||o("confirmed");return}await ye(3e3)}a||o("timed-out")}})(),()=>{a=!0}},[i,g]),d}const ve=z.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump",ke=z.chainId===80002?"https://amoy.polygonscan.com/tx/":"https://polygonscan.com/tx/";function Pe(){const{state:i}=L(),r=I(),{session:d}=F(),o=i==null?void 0:i.txHash,g=(i==null?void 0:i.items)??[],a=i!=null&&i.creditsAdded&&i.creditsAdded>0?i.creditsAdded:null,l=g[0],m=d!=null&&d.address&&(l!=null&&l.contractAddress)&&(l!=null&&l.itemId)?{owner:d.address,contractAddress:l.contractAddress,itemId:l.itemId}:null,c=be(i!=null&&i.settled?void 0:o,m);M({title:n("seo.success.title"),noindex:!0});const x=g;if(x.length===0)return e.jsx(T,{to:"/assets",replace:!0});const k=x[0],h=!!o&&N(d==null?void 0:d.providerType)?e.jsx(Y,{href:`${ke}${o}`,target:"_blank",rel:"noreferrer",children:n("success.viewTransaction")}):null;return c!=="confirmed"?e.jsx(C,{children:e.jsx(D,{children:c==="pending"||c==="indexing"?e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"spinner","aria-hidden":!0}),e.jsx(y,{children:c==="indexing"?n("success.finalizing"):n("success.processing")}),e.jsx(b,{children:c==="indexing"?e.jsxs(e.Fragment,{children:[n("success.indexingBefore")," ",x.length===1?e.jsx("strong",{children:k.name}):n("success.itemCount",{count:x.length})," ",n("success.indexingAfter")]}):e.jsxs(e.Fragment,{children:[n("success.confirmingBefore")," ",x.length===1?e.jsx("strong",{children:k.name}):n("success.itemCount",{count:x.length})," ",n("success.confirmingAfter")]})}),h?e.jsx(j,{children:h}):null]}):c==="timed-out"?e.jsxs(e.Fragment,{children:[e.jsx(y,{children:n("success.stillProcessingTitle")}),e.jsxs(b,{children:[n("success.timedOutBefore")," ",e.jsx("button",{className:"link",onClick:()=>r("/activity"),children:n("nav.activity")})," ",n("success.timedOutAfter")]}),h?e.jsx(j,{children:h}):null,e.jsxs(R,{children:[e.jsx(v,{variant:"purple",onClick:()=>r("/activity"),children:n("success.viewActivity")}),e.jsx(v,{variant:"ghost",onClick:()=>r("/assets"),children:n("success.keepShopping")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(y,{children:n("success.failedTitle")}),e.jsx(b,{children:n("success.failedBody")}),h?e.jsx(j,{children:h}):null,e.jsx(R,{children:e.jsx(v,{variant:"purple",onClick:()=>r("/assets"),children:n("success.backToShop")})})]})})}):e.jsx(C,{children:e.jsxs(K,{children:[e.jsxs(G,{role:"status",children:[e.jsx(V,{"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(Z,{children:[e.jsx("b",{children:n("success.bannerTitle")})," ",n("success.bannerBody")]})]}),e.jsxs(H,{children:[a?e.jsxs(ne,{"data-testid":"success-credits",children:[e.jsx(ie,{}),e.jsxs(se,{children:[e.jsx(re,{children:n("getCredits.creditsAmount",{credits:a,currency:O.name})})," ",e.jsx(ce,{children:n("getCredits.creditsAdded")})]})]}):null,x.map((p,B)=>{const w=p.quantity??1;return e.jsxs(ee,{children:[B>0?e.jsx(te,{"aria-hidden":!0}):null,e.jsxs(oe,{children:[e.jsxs(ae,{children:[p.thumbnail?e.jsx("img",{src:p.thumbnail,alt:""}):null,e.jsx(de,{"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(le,{children:[e.jsxs(xe,{title:p.name,children:[p.name||n("buyModal.itemFallback"),w>1?e.jsx(pe,{children:n("cartCheckout.qty",{count:w})}):null]}),p.creator?e.jsx(he,{address:p.creator,linkToProfile:!0}):null]}),e.jsxs(ue,{children:[e.jsx(fe,{}),e.jsx("span",{children:_(p.priceCredits*w)})]})]})]},p.id)})]}),h?e.jsx(j,{"data-receipt":!0,children:h}):null,e.jsxs(ge,{children:[e.jsx(me,{"data-variant":"ghost",onClick:()=>r("/my-assets"),children:n("success.myAssets")}),e.jsxs(je,{"data-variant":"ruby",href:ve,target:"_blank",rel:"noreferrer",children:[n("success.tryInWorld"),e.jsx(we,{"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{Pe as Success,Pe 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-CeSRgOaN.js";import{au as C}from"./NetworkUtil-C1aEwuOK.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-CW-7ZLkS.js";import{au as C}from"./NetworkUtil-C48X2eZd.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,8 +1,8 @@
|
|
|
1
|
-
import{r as e,j as
|
|
1
|
+
import{r as e,j as d}from"./react-BcSuIh9F.js";import{s as x,t as o}from"./index-CKryZsyO.js";const u=(...t)=>({shouldForwardProp:s=>!t.includes(s)}),h=x("span",u("block"))`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: ${({block:t})=>t?"flex":"inline-flex"};
|
|
4
4
|
${({block:t})=>t?"width: 100%;":""}
|
|
5
|
-
`,$=
|
|
5
|
+
`,$=x("span",u("placement"))`
|
|
6
6
|
position: absolute;
|
|
7
7
|
left: 50%;
|
|
8
8
|
z-index: 30;
|
|
@@ -12,9 +12,9 @@ import{r as e,j as c}from"./react-BW1xvPTF.js";import{s as d,K as r}from"./index
|
|
|
12
12
|
max-width: 240px;
|
|
13
13
|
padding: 8px 10px;
|
|
14
14
|
border-radius: 8px;
|
|
15
|
-
background: ${
|
|
16
|
-
color:
|
|
17
|
-
font-family: ${
|
|
15
|
+
background: ${o.colors.text};
|
|
16
|
+
color: ${o.colors.white};
|
|
17
|
+
font-family: ${o.font.sans};
|
|
18
18
|
font-size: 12px;
|
|
19
19
|
font-weight: 500;
|
|
20
20
|
line-height: 1.4;
|
|
@@ -39,10 +39,10 @@ import{r as e,j as c}from"./react-BW1xvPTF.js";import{s as d,K as r}from"./index
|
|
|
39
39
|
left: 50%;
|
|
40
40
|
transform: translateX(-50%);
|
|
41
41
|
border: 5px solid transparent;
|
|
42
|
-
${({placement:t})=>t==="top"?`top: 100%; border-top-color: ${
|
|
42
|
+
${({placement:t})=>t==="top"?`top: 100%; border-top-color: ${o.colors.text};`:`bottom: 100%; border-bottom-color: ${o.colors.text};`}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
@media (prefers-reduced-motion: reduce) {
|
|
46
46
|
transition: none;
|
|
47
47
|
}
|
|
48
|
-
`;function
|
|
48
|
+
`;function w({content:t,children:s,placement:f="top",block:m,onShow:r,className:b}){const[n,a]=e.useState(!1),i=e.useId(),l=e.useRef(!1),p=e.useCallback(()=>{a(!0),l.current||(l.current=!0,r==null||r())},[r]),c=e.useCallback(()=>a(!1),[]);return d.jsxs(h,{className:b,block:m,onMouseEnter:p,onMouseLeave:c,onFocus:p,onBlur:c,children:[e.cloneElement(s,{"aria-describedby":n?i:void 0}),d.jsx($,{role:"tooltip",id:i,placement:f,"aria-hidden":!n,...n?{"data-open":""}:{},children:t})]})}export{w as T,u as n};
|