@dcl/shop 0.5.1-30936490891.commit-42e2634 → 0.5.1-30937489674.commit-7b5f7ec
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-CIJJTSUp.js → Activity-CKACY7GY.js} +3 -3
- package/_assets/{AnimatedBackground-Bv2erZC5.js → AnimatedBackground-Bjoz5yE_.js} +1 -1
- package/_assets/{Assets-BoR-QJY6.js → Assets-BxK2PTe5.js} +2 -2
- package/_assets/{Assets.styles-BePHQ_QA.js → Assets.styles-VFZDtV-L.js} +1 -1
- package/_assets/{Authorizations-BCA1IImf.js → Authorizations-Dk24wf9N.js} +1 -1
- package/_assets/{Cart-DTe7zox3.js → Cart-t8K6Hez2.js} +2 -2
- package/_assets/{CircularProgress-DzeFXlov.js → CircularProgress-ocqiOFwz.js} +1 -1
- package/_assets/{Collection-DHHXSeak.js → Collection-CqxTIiTW.js} +1 -1
- package/_assets/{CollectionCarousel-Orp4rJm9.js → CollectionCarousel-DK1GQlTQ.js} +1 -1
- package/_assets/{Creator-AMjYkiKe.js → Creator-MrzjHPNF.js} +1 -1
- package/_assets/{ErrorNotice-I9zAvGEr.js → ErrorNotice-uoSUw6uz.js} +1 -1
- package/_assets/{ExchangeController-B-TJWUiW.js → ExchangeController-xP28M4re.js} +1 -1
- package/_assets/{GetCredits-BNkvpwnR.js → GetCredits-B0xA7J-B.js} +1 -1
- package/_assets/{HelpersUtil-ylN16m8a.js → HelpersUtil-3gFlrCTY.js} +1 -1
- package/_assets/{ItemDetail-k2BANQ0W.js → ItemDetail-AFjL4E8F.js} +3 -3
- package/_assets/{LoadMore-DPVuoR5W.js → LoadMore-C0MsRFAE.js} +1 -1
- package/_assets/{ManaPricingBanner.styles-nRVCJe8Y.js → ManaPricingBanner.styles-DAzIc42S.js} +1 -1
- package/_assets/{MenuList-yS83NC0F.js → MenuList-CbV8jiXv.js} +1 -1
- package/_assets/{MyAssets-Ds0TK1z5.js → MyAssets-CcOi2fL-.js} +1 -1
- package/_assets/{MyFavorites-CDmtpdZP.js → MyFavorites-22WPJMqY.js} +1 -1
- package/_assets/{NotFound-CVe0kC-t.js → NotFound-D9cWw9u4.js} +1 -1
- package/_assets/{NotificationsBell-Fprokx0Q.js → NotificationsBell-DBQ0fDk3.js} +1 -1
- package/_assets/{OutfitDetail-CdEsz8A4.js → OutfitDetail-BJ3owKrx.js} +1 -1
- package/_assets/{OutfitPreview-Y1WhUQaY.js → OutfitPreview-fzgtTYGf.js} +1 -1
- package/_assets/{OutfitStudio-B9G6xI3H.js → OutfitStudio-Alyfoac0.js} +1 -1
- package/_assets/{StoreSettings-RMqF_ccU.js → StoreSettings-VMrIBOxF.js} +1 -1
- package/_assets/{Success-rJNIKLQ6.js → Success-B7QER1pk.js} +1 -1
- package/_assets/{SwapController-CgtlXeu5.js → SwapController-Dljt42lz.js} +1 -1
- package/_assets/{Tooltip-D1Bg11IA.js → Tooltip-CmakEXxx.js} +1 -1
- package/_assets/{TradeService-BhQmC5tm.js → TradeService-Bwt0lbfd.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-D-orryVV.js → W3MFrameProviderSingleton-C8-47Rcd.js} +3 -3
- package/_assets/{WebCryptoP256-Ckj1TqYw.js → WebCryptoP256-DmUARNki.js} +1 -1
- package/_assets/{authorizations-vn6dbOqY.js → authorizations-DiCizdf8.js} +1 -1
- package/_assets/{basic-D2f8I1xA.js → basic-CA1aEmBR.js} +1 -1
- package/_assets/{biconomy-BZAxWDGN.js → biconomy-SwZIbMwk.js} +1 -1
- package/_assets/{browseLayout.styles-BYrLBkl5.js → browseLayout.styles-HpCz3gHu.js} +1 -1
- package/_assets/{builder-DT_IucDZ.js → builder-6kwRAptb.js} +1 -1
- package/_assets/{buy-k-76F4x2.js → buy-CAtkwGsU.js} +1 -1
- package/_assets/{buy-gasless-DP35z8wI.js → buy-gasless-CwGKDSKP.js} +1 -1
- package/_assets/{categories-_gS0pssw.js → categories-CLN28P36.js} +1 -1
- package/_assets/{ccip-skuYIwjJ.js → ccip-C72ffo0Q.js} +1 -1
- package/_assets/{ccip-B4KLf1_A.js → ccip-CprmDCNP.js} +1 -1
- package/_assets/{clsx-BtU7gPvo.js → clsx-DMh9fL43.js} +1 -1
- package/_assets/{controller-BkNCBo5Z.js → controller-DHU-FUxQ.js} +2 -2
- package/_assets/{core-NV0Q-IPg.js → core-FzD1qHVC.js} +4 -4
- package/_assets/{createSvgIcon-ONkmiYB6.js → createSvgIcon-C8hW4bVO.js} +1 -1
- package/_assets/{custom-B2TqKkEi.js → custom-DSLGRsLr.js} +1 -1
- package/_assets/{data-capture-ubD-gh1z.js → data-capture-DZbiDCwX.js} +1 -1
- package/_assets/{email-yk5CxwkK.js → email-B6b7Pihn.js} +1 -1
- package/_assets/{embedded-wallet-Sdgu7IIM.js → embedded-wallet-B0umeTds.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-Bi-gHJrz.js → emotion-styled.browser.esm-mh182qus.js} +1 -1
- package/_assets/{engine-tdlero6P.js → engine-BVwkhnlH.js} +1 -1
- package/_assets/{errors-WsZgWksO.js → errors-DDxkr-df.js} +1 -1
- package/_assets/{estimate-l1-fee-CyMpT0rk.js → estimate-l1-fee-DkXKfMMP.js} +1 -1
- package/_assets/{execute-C4cl9W-o.js → execute-CQY30MRS.js} +2 -2
- package/_assets/{features-CZqcLmC4.js → features-aABiY83f.js} +1 -1
- package/_assets/{fetchTokenMetadata-CS5UBL6x.js → fetchTokenMetadata-B-ittUXv.js} +2 -2
- package/_assets/{field.styles-CJlWBLbF.js → field.styles-AnVl2SkN.js} +1 -1
- package/_assets/{get-ecosystem-wallet-info-07JzLM0i.js → get-ecosystem-wallet-info-DYzdNY3r.js} +1 -1
- package/_assets/{getBalance-DL9ADD0u.js → getBalance-B25lcD9r.js} +1 -1
- package/_assets/{getNFT-D17z9oKn.js → getNFT-3gQ0u_Ad.js} +1 -1
- package/_assets/{getNFT-DoaFm4AC.js → getNFT-BPKHDI15.js} +1 -1
- package/_assets/{getThemeProps-Cl72yIFf.js → getThemeProps-BtZT8-J5.js} +1 -1
- package/_assets/{grid.styles-BZnnDTVu.js → grid.styles-CEjkD1f9.js} +1 -1
- package/_assets/{hashTypedData-wJwJpwvj.js → hashTypedData-B6Ns7uwn.js} +1 -1
- package/_assets/{hashTypedData-CrsUYWGu.js → hashTypedData-C90fm0lo.js} +1 -1
- package/_assets/{in-app-Btz7IDiL.js → in-app-pXzv7C_J.js} +1 -1
- package/_assets/{in-app-wallet-calls-DP3IphiJ.js → in-app-wallet-calls-DCv6deqZ.js} +1 -1
- package/_assets/{index-EECYRahm.js → index-7Hk55boV.js} +1 -1
- package/_assets/{index-Dlg6tqPP.js → index-A4O9UD-C.js} +1 -1
- package/_assets/{index-grgWjFlo.js → index-B5JBd4fr.js} +1 -1
- package/_assets/{index-BYbz0Puw.js → index-B8pZZJz-.js} +1 -1
- package/_assets/{index-8SWxdM-1.js → index-B9tSckDx.js} +1 -1
- package/_assets/{index-IsmxguMZ.js → index-BAnEsc71.js} +1 -1
- package/_assets/{index-C1Z_9GsV.js → index-BClXql-a.js} +1 -1
- package/_assets/{index-CBXYUzDZ.js → index-BFBb0rfQ.js} +2 -2
- package/_assets/{index-O4FksRMn.js → index-BIBwoiYY.js} +1 -1
- package/_assets/{index-Dy5Vw1H0.js → index-BR6IEMrM.js} +258 -258
- package/_assets/{index-BeQhSahz.js → index-BRLHYe51.js} +1 -1
- package/_assets/{index-CZF0PGAb.js → index-BVqb5Xn1.js} +1 -1
- package/_assets/{index-DpOehH6H.js → index-BZs9emRd.js} +3 -3
- package/_assets/{index-BQimjtyT.js → index-BeXckPt5.js} +3 -3
- package/_assets/{index-B59Gh8B7.js → index-BesOjXiK.js} +1 -1
- package/_assets/{index-m00Y2hq4.js → index-BxFAMFrH.js} +1 -1
- package/_assets/{index-BE-fLnWc.js → index-BxLAJ5x3.js} +1 -1
- package/_assets/{index-C7KsfPUz.js → index-ByYcwLlF.js} +1 -1
- package/_assets/{index-7BMeGSgL.js → index-C-PYa491.js} +1 -1
- package/_assets/index-CCZG6i6u.js +472 -0
- package/_assets/{index-C0xJOFUc.js → index-CH298nNs.js} +1 -1
- package/_assets/{index-nNKO8ftl.js → index-CIksKUax.js} +2 -2
- package/_assets/{index-DcebaGnX.js → index-CKjylYSE.js} +1 -1
- package/_assets/{index-CtASwK4E.js → index-CMuJ-UZF.js} +1 -1
- package/_assets/{index-DJ-CxX91.js → index-CNx03geY.js} +1 -1
- package/_assets/{index-BtwYGrhd.js → index-Cap8a-RE.js} +1 -1
- package/_assets/{index-CFksIzM4.js → index-CcgIVLBV.js} +1 -1
- package/_assets/{index-Bi_Apm6j.js → index-Ceayuq0S.js} +1 -1
- package/_assets/{index-CMFliAhY.js → index-Chom5dJx.js} +1 -1
- package/_assets/{index-ClHp2_nl.js → index-Co-gW5Hp.js} +1 -1
- package/_assets/{index-CzghBU6C.js → index-CrM8tpME.js} +1 -1
- package/_assets/{index-CtaCRDRI.js → index-Cy4PNM6A.js} +1 -1
- package/_assets/{index-CrWSaqPI.js → index-D7cHIqYc.js} +1 -1
- package/_assets/{index-Cxty1u3d.js → index-DC4Kv9-V.js} +1 -1
- package/_assets/{index-BVdlPUJG.js → index-DFbrx-dL.js} +1 -1
- package/_assets/{index-DKnXZSeg.js → index-DRc8upCX.js} +1 -1
- package/_assets/{index-D4hVVIWp.js → index-DUGGEaWM.js} +1 -1
- package/_assets/{index-CPdKHNCF.js → index-DUkz3Hx0.js} +1 -1
- package/_assets/{index-C45bHTUp.js → index-DY1F0LWT.js} +1 -1
- package/_assets/{index-CQQrdcNQ.js → index-Dm6iw_dl.js} +1 -1
- package/_assets/{index-CL530K8Y.js → index-DoqNeaqf.js} +1 -1
- package/_assets/{index-Ci8PIdRp.js → index-DosEHc_-.js} +1 -1
- package/_assets/{index-DjltGmXq.js → index-Dq8QHFiA.js} +1 -1
- package/_assets/{index-B5UKanqd.js → index-DykCPSFI.js} +1 -1
- package/_assets/{index-BlQcf37-.js → index-JK8hABNP.js} +1 -1
- package/_assets/{index-BbQMVOsy.js → index-JTqfub3n.js} +3 -3
- package/_assets/{index-CbHNXAwv.js → index-N1xuzaCt.js} +2 -2
- package/_assets/{index-BM3ki5xD.js → index-OAxN4fc3.js} +1 -1
- package/_assets/{index-BxzWlq1h.js → index-VGBz5J8e.js} +1 -1
- package/_assets/{index-DimCwX0M.js → index-YfEt1Rml.js} +1 -1
- package/_assets/{index-639jix5x.js → index-k4tf1CLH.js} +1 -1
- package/_assets/{index-DQM4pVOP.js → index-oHxf4tR1.js} +1 -1
- package/_assets/{index.es-KzvQwqfO.js → index.es-C8eU1wA8.js} +1 -1
- package/_assets/{index.es-BzqwGWTI.js → index.es-CK_ga1Is.js} +4 -4
- package/_assets/{index.es-StMi_Ya4.js → index.es-DZzFd5-b.js} +1 -1
- package/_assets/{localBatchGatewayRequest-DQGGi_PU.js → localBatchGatewayRequest-DTVgXIFF.js} +1 -1
- package/_assets/{mana-convert-D_y2vjtn.js → mana-convert-gocBeMiL.js} +1 -1
- package/_assets/{networks-DDcMYhGU.js → networks-NA0vFG8W.js} +1 -1
- package/_assets/{onramp-CBdambV_.js → onramp-piEEcDx9.js} +1 -1
- package/_assets/{openzeppelin-DSxwqs4i.js → openzeppelin-DqdNqCan.js} +1 -1
- package/_assets/{parseNft-DHPQc0OX.js → parseNft-BUAibBaN.js} +2 -2
- package/_assets/{parseSignature-DJF5siOG.js → parseSignature-BD7TDX9C.js} +3 -3
- package/_assets/{parseSignature-CGumShnk.js → parseSignature-CLxsZU9k.js} +1 -1
- package/_assets/{passkeys-C9h38bzo.js → passkeys-eWclvb1O.js} +1 -1
- package/_assets/{pay-with-exchange-CdWIlkYG.js → pay-with-exchange-C8DalAYE.js} +1 -1
- package/_assets/{qr-overlay-DfYnP7zW.js → qr-overlay-BMuU__O0.js} +1 -1
- package/_assets/{receive-BDPZr_50.js → receive-38k_LlRS.js} +1 -1
- package/_assets/{resolveImplementation-1IibNw8J.js → resolveImplementation-SB0AO_yR.js} +1 -1
- package/_assets/{rpc-Be4cuLO-.js → rpc-DEZlb2Y-.js} +1 -1
- package/_assets/{secp256k1-C2A9iNFQ.js → secp256k1-B-O8Geq4.js} +1 -1
- package/_assets/{secp256k1-CBaRftLy.js → secp256k1-Boxg6ZAq.js} +1 -1
- package/_assets/{secp256k1-CfSstl_L.js → secp256k1-DOOppOlV.js} +1 -1
- package/_assets/{send-DpFdmYN7.js → send-YrDd7FYi.js} +1 -1
- package/_assets/{send-batch-transaction-Bfap8p0Z.js → send-batch-transaction-Dyy9Uesb.js} +1 -1
- package/_assets/{send-eip712-transaction-Ca7s6qzX.js → send-eip712-transaction-3GcoolNv.js} +2 -2
- package/_assets/{send-gasless-transaction-DPOigmTX.js → send-gasless-transaction-QtEZzpC5.js} +2 -2
- package/_assets/{send-transaction-D2BNOa_n.js → send-transaction-DSdOj9eC.js} +2 -2
- package/_assets/{sendMetaTransaction-feJSI2TG.js → sendMetaTransaction-D3FwHHTn.js} +1 -1
- package/_assets/{sendRawTransaction-B-XApuqY.js → sendRawTransaction-CjOHZO88.js} +3 -3
- package/_assets/{serializeTransaction-I8okodGI.js → serializeTransaction-D_Dc_9Gp.js} +1 -1
- package/_assets/{session-proposal-DvL8lvR_.js → session-proposal-Ba1SoCtq.js} +1 -1
- package/_assets/{session-request-BXYdMjrw.js → session-request-CDBg7zst.js} +2 -2
- package/_assets/{signing-DT63E54M.js → signing-BSzxbe16.js} +3 -3
- package/_assets/{socials-ClcK9a8P.js → socials-CCZXYTfQ.js} +1 -1
- package/_assets/{swaps-C0ufdoJC.js → swaps-UHy-bRsG.js} +1 -1
- package/_assets/{thirdweb-B50LsjvD.js → thirdweb-k1S3G2Wc.js} +3 -3
- package/_assets/{to-serializable-transaction-D0wz5egz.js → to-serializable-transaction-BUvEWstJ.js} +2 -2
- package/_assets/{trade-encoding-SVWWPYXU.js → trade-encoding-DhmJ3YE9.js} +1 -1
- package/_assets/{transactionReceipt-BW33bMK1.js → transactionReceipt-DFrpXDGO.js} +1 -1
- package/_assets/{transactions-Dydjvljn.js → transactions-B4l-FEOR.js} +1 -1
- package/_assets/{useCreditPacks-BFQph8eD.js → useCreditPacks-m_96quiO.js} +1 -1
- package/_assets/useImportable-Ck2Tt8Ei.js +1 -0
- package/_assets/{useInfiniteGrid-Dz6b_PHh.js → useInfiniteGrid-XWDqyvpD.js} +1 -1
- package/_assets/useManaRate-sGau1wQV.js +1 -0
- package/_assets/{useStore-ff9cCCX6.js → useStore-DUJBpXit.js} +1 -1
- package/_assets/{useTheme-BzWpoSXD.js → useTheme-ViRtXA8G.js} +1 -1
- package/_assets/{verifyHash-6ZvXkv0_.js → verifyHash-Drn9Way6.js} +1 -1
- package/_assets/{w3m-modal-BI6MOh7J.js → w3m-modal-B0M073Ob.js} +1 -1
- package/_assets/{w3m-modal-B5LvO_YQ.js → w3m-modal-B7mGVnE3.js} +1 -1
- package/_assets/{wait-for-tx-receipt-B6htZpEq.js → wait-for-tx-receipt-BW8Z_n83.js} +1 -1
- package/_assets/{wallets-cwZJIsw-.js → wallets-DZ2SYb3M.js} +5 -5
- package/_assets/{web-connector-BMBh8mIE.js → web-connector-Yp5dVaCI.js} +3 -3
- package/_assets/{writeContract-C3lGbTIC.js → writeContract-BL3rIi0q.js} +1 -1
- package/_assets/{zoraTestnet-Dvb_L0a4.js → zoraTestnet-Cmcli8zw.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/index-EheyvR55.js +0 -472
- package/_assets/useImportable-BP4DqZ-f.js +0 -1
- package/_assets/useManaRate-CfhYfW7C.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{L as j,u as J,j as e,r as m}from"./react-DehiWSvs.js";import{s as t,I as y,t as X,F as Y,G as Z,H as ee,B as v,J as te,n as P,K as ie,u as se,q as ae,b as a,L as A,M as ne,N as re,O as oe,P as le,Q as de,R as ce,S as pe,V as he,W as me,X as xe,Y as ue,Z as ge,$ as fe,a0 as be,w as I,a1 as ye,a2 as ve,a3 as je,a4 as we,a5 as $e,a6 as ke}from"./index-
|
|
1
|
+
import{L as j,u as J,j as e,r as m}from"./react-DehiWSvs.js";import{s as t,I as y,t as X,F as Y,G as Z,H as ee,B as v,J as te,n as P,K as ie,u as se,q as ae,b as a,L as A,M as ne,N as re,O as oe,P as le,Q as de,R as ce,S as pe,V as he,W as me,X as xe,Y as ue,Z as ge,$ as fe,a0 as be,w as I,a1 as ye,a2 as ve,a3 as je,a4 as we,a5 as $e,a6 as ke}from"./index-BR6IEMrM.js";import{E as R}from"./ErrorNotice-uoSUw6uz.js";import{O as Ie}from"./OutfitPreview-fzgtTYGf.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./disposePreview-DIA1G1eQ.js";const{colors:r,radius:Ce,media:l}=X,B=t.div`
|
|
2
2
|
max-width: 1721px;
|
|
3
3
|
margin: 0 auto;
|
|
4
4
|
`,ze=t.nav`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,j as r}from"./react-DehiWSvs.js";import{d as u}from"./dcl-schemas-Dr9BTjb7.js";import{s as j,O as P,c as h,a7 as A,b as R}from"./index-
|
|
1
|
+
import{r as i,j as r}from"./react-DehiWSvs.js";import{d as u}from"./dcl-schemas-Dr9BTjb7.js";import{s as j,O as P,c as h,a7 as A,b as R}from"./index-BR6IEMrM.js";import{u as b,d as O}from"./disposePreview-DIA1G1eQ.js";const F=j.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
inset: 0;
|
|
4
4
|
display: grid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,j as t,L as O,u as Gt,b as qt,d as Wt}from"./react-DehiWSvs.js";import{s as o,t as st,I as M,at as Qt,b as e,w as Y,B as m,ac as vt,n as q,K as Jt,q as Vt,x as wt,u as $t,M as Xt,S as B,au as K,av as Yt,aw as G,Z as Zt,X as te,Y as ee,Q as St,$ as ie,ax as Z,ay as se,az as oe,aA as ae,z as F,aB as kt,aC as Tt,aD as P,j as tt,aE as et,aF as ne,aG as re,aH as de,R as le,aI as ue,aJ as ce,a6 as pe}from"./index-
|
|
1
|
+
import{r as u,j as t,L as O,u as Gt,b as qt,d as Wt}from"./react-DehiWSvs.js";import{s as o,t as st,I as M,at as Qt,b as e,w as Y,B as m,ac as vt,n as q,K as Jt,q as Vt,x as wt,u as $t,M as Xt,S as B,au as K,av as Yt,aw as G,Z as Zt,X as te,Y as ee,Q as St,$ as ie,ax as Z,ay as se,az as oe,aA as ae,z as F,aB as kt,aC as Tt,aD as P,j as tt,aE as et,aF as ne,aG as re,aH as de,R as le,aI as ue,aJ as ce,a6 as pe}from"./index-BR6IEMrM.js";import{E as D}from"./ErrorNotice-uoSUw6uz.js";import{L as fe}from"./LoadMore-C0MsRFAE.js";import{u as he}from"./useInfiniteGrid-XWDqyvpD.js";import{O as me}from"./OutfitPreview-fzgtTYGf.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./disposePreview-DIA1G1eQ.js";const{colors:x,radius:ot,media:xe}=st,ge=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,L as oe,d as le,r as l}from"./react-DehiWSvs.js";import{b as s,t as w,s as a,o as ce,B as q,q as de,n as pe,x as ue,I as N,z as F}from"./index-
|
|
1
|
+
import{j as t,L as oe,d as le,r as l}from"./react-DehiWSvs.js";import{b as s,t as w,s as a,o as ce,B as q,q as de,n as pe,x as ue,I as N,z as F}from"./index-BR6IEMrM.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-DUJBpXit.js";import{E as M}from"./ErrorNotice-uoSUw6uz.js";import{F as j}from"./field.styles-AnVl2SkN.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const ve="https://cdn.decentraland.org/@dcl/shop/0.5.1-30937489674.commit-7b5f7ec/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/0.5.1-30937489674.commit-7b5f7ec/_assets/template-cover-2-Dni9s0i_.jpeg",je=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":ve,"../assets/creator-covers/template-cover-2.jpeg":be}),v=Object.entries(je).sort(([r],[u])=>r.localeCompare(u)).map(([r,u])=>({name:r.split("/").pop(),url:u})),we=ce`
|
|
2
2
|
to {
|
|
3
3
|
transform: rotate(360deg);
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index.es-DQ3AciL_.js","_assets/react-DehiWSvs.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as g,j as e,b as P,d as N,N as M}from"./react-DehiWSvs.js";import{s as t,_ as I,t as F,w as _,aq as O,ac as W,n as D,q,b as n,v as U,C as V,ar as H,c as B,B as J,as as X}from"./index-
|
|
2
|
+
import{r as g,j as e,b as P,d as N,N as M}from"./react-DehiWSvs.js";import{s as t,_ as I,t as F,w as _,aq as O,ac as W,n as D,q,b as n,v as U,C as V,ar as H,c as B,B as J,as as X}from"./index-BR6IEMrM.js";import{w as G,S as K}from"./buy-gasless-CwGKDSKP.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./authorizations-DiCizdf8.js";import"./sendMetaTransaction-D3FwHHTn.js";import"./trade-encoding-DhmJ3YE9.js";const Q=t.div`
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
5
5
|
/**
|
|
@@ -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-D-orryVV.js";import{au as C}from"./NetworkUtil-EoWQDMpU.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-C8-47Rcd.js";import{au as C}from"./NetworkUtil-EoWQDMpU.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,a as T}from"./react-DehiWSvs.js";import{s as P,t as i}from"./index-
|
|
1
|
+
import{r as o,j as C,a as T}from"./react-DehiWSvs.js";import{s as P,t as i}from"./index-BR6IEMrM.js";const B=(...t)=>({shouldForwardProp:p=>!t.includes(p)}),A=P("span",B("block"))`
|
|
2
2
|
display: ${({block:t})=>t?"flex":"inline-flex"};
|
|
3
3
|
${({block:t})=>t?"width: 100%;":""}
|
|
4
4
|
`,I=P("span",B("placement"))`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ve=Object.defineProperty;var xe=(r,t,e)=>t in r?ve(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var p=(r,t,e)=>xe(r,typeof t!="symbol"?t+"":t,e);import{W as ue,a as Q,C as ge,B as Ce,f as X}from"./ethers-CtNGBird.js";import{a as Ee,d as B}from"./dcl-schemas-Dr9BTjb7.js";import{c as ee}from"./react-DehiWSvs.js";import{bV as Re,d as te,g as re}from"./index-
|
|
1
|
+
var ve=Object.defineProperty;var xe=(r,t,e)=>t in r?ve(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var p=(r,t,e)=>xe(r,typeof t!="symbol"?t+"":t,e);import{W as ue,a as Q,C as ge,B as Ce,f as X}from"./ethers-CtNGBird.js";import{a as Ee,d as B}from"./dcl-schemas-Dr9BTjb7.js";import{c as ee}from"./react-DehiWSvs.js";import{bV as Re,d as te,g as re}from"./index-BR6IEMrM.js";import{c as q,e as be}from"./index-N1xuzaCt.js";import{s as Ie}from"./sendMetaTransaction-D3FwHHTn.js";import"./sentry-973sfbO9.js";import"./intl-CBcMB1D2.js";import"./events-DQ172AOg.js";async function Pe(r){const t=await de();if(t){const e=await new ue(t).getSigner().getChainId();if(r===e)return t}return q.createProvider(Ee.ProviderType.NETWORK,r)}async function de(){try{return await q.getProvider()}catch{try{const{provider:r}=await q.tryPreviousConnection();return r}catch{return null}}}function ne(r){return Math.floor(r/1e3)}function ae(r){switch(r.assetType){case B.TradeAssetType.ERC721:return r.tokenId;case B.TradeAssetType.COLLECTION_ITEM:return r.itemId;case B.TradeAssetType.ERC20:return r.amount;default:return console.error("Invalid asset type:",r),""}}function Ae(r){var t;return{checks:{uses:r.checks.uses,expiration:ne(r.checks.expiration),effective:ne(r.checks.effective),salt:Q(r.checks.salt,32),contractSignatureIndex:r.checks.contractSignatureIndex,signerSignatureIndex:r.checks.signerSignatureIndex,allowedRoot:Q(r.checks.allowedRoot,32),externalChecks:(t=r.checks.externalChecks)==null?void 0:t.map(e=>({contractAddress:e.contractAddress,selector:e.selector,value:e.value?e.value:"0x",required:e.required}))},sent:r.sent.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:ae(e),extra:e.extra?e.extra:"0x"})),received:r.received.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:ae(e),extra:e.extra?e.extra:"0x",beneficiary:e.beneficiary}))}}function se(r,t){const e=Ae(r);return{signer:r.signer,signature:r.signature,...e,checks:{...e.checks,allowedProof:[]},sent:e.sent.map(i=>({...i,beneficiary:t}))}}async function Se(r){const t=await r.request({method:"eth_chainId",params:[]});let e;return typeof t=="string"?e=parseInt(t,16):e=t,e}async function Fe(r){const t=await Pe(r);return new ue(t)}const S=new be.EventEmitter;var C;(function(r){r.ERROR="error",r.SUCCESS="success",r.PROMPT="prompt",r.ACCEPT="accept",r.REJECT="reject"})(C||(C={}));let Le="https://transactions-api.decentraland.org/v1";const ke=()=>Le,Ue=()=>new Promise((r,t)=>{const e=()=>{S.removeAllListeners(C.REJECT),r(!0)},i=()=>{S.removeAllListeners(C.ACCEPT),t(new Error("User rejected transaction"))};S.addListener(C.ACCEPT,e),S.addListener(C.REJECT,i)});async function oe(...r){const[t,e,...i]=r;try{const s=await de();if(!s)throw new Error("Provider not connected");const c=await Se(s),l=await Fe(t.chainId),b=new ge(t.address,t.abi,l),T=await(typeof e=="function"?e(b.populateTransaction):b.populateTransaction[e](...i));if(c===t.chainId){const v=l.getSigner();if(s.isMagic||s.isThirdweb){let U=Ce.from(0);try{const _=await v.getGasPrice(),k=await v.estimateGas(T);U=_.mul(k)}catch{}if(!U.isZero()){const _=Ue(),k=await v.getBalance();S.emit(C.PROMPT,{transactionGasPrice:X(U),userBalance:X(k),chainId:t.chainId}),await _}}const P=await v.sendTransaction(T);return S.emit(C.SUCCESS,{txHash:P.hash}),P.hash}else{const v=await Ie(s,l,T.data,t,{serverURL:ke()});return S.emit(C.SUCCESS,{txHash:v}),v}}catch(s){const c={type:C.ERROR,error:s};throw S.emit(C.ERROR,c),s}}var M={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var _e=M.exports,ie;function Oe(){return ie||(ie=1,(function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,c=typeof ee=="object"&ⅇ(c.global===c||c.window===c||c.self===c)&&(e=c);var l,b=2147483647,T=36,v=1,P=26,U=38,_=700,k=72,G=128,J="-",he=/^xn--/,fe=/[^\x20-\x7E]/,pe=/[\x2E\u3002\uFF0E\uFF61]/g,ye={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=T-v,E=Math.floor,O=String.fromCharCode,N;function F(n){throw new RangeError(ye[n])}function V(n,a){for(var o=n.length,u=[];o--;)u[o]=a(n[o]);return u}function $(n,a){var o=n.split("@"),u="";o.length>1&&(u=o[0]+"@",n=o[1]),n=n.replace(pe,".");var d=n.split("."),y=V(d,a).join(".");return u+y}function H(n){for(var a=[],o=0,u=n.length,d,y;o<u;)d=n.charCodeAt(o++),d>=55296&&d<=56319&&o<u?(y=n.charCodeAt(o++),(y&64512)==56320?a.push(((d&1023)<<10)+(y&1023)+65536):(a.push(d),o--)):a.push(d);return a}function W(n){return V(n,function(a){var o="";return a>65535&&(a-=65536,o+=O(a>>>10&1023|55296),a=56320|a&1023),o+=O(a),o}).join("")}function Te(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:T}function Y(n,a){return n+22+75*(n<26)-((a!=0)<<5)}function Z(n,a,o){var u=0;for(n=o?E(n/_):n>>1,n+=E(n/a);n>D*P>>1;u+=T)n=E(n/D);return E(u+(D+1)*n/(n+U))}function K(n){var a=[],o=n.length,u,d=0,y=G,h=k,w,x,R,I,f,m,g,A,L;for(w=n.lastIndexOf(J),w<0&&(w=0),x=0;x<w;++x)n.charCodeAt(x)>=128&&F("not-basic"),a.push(n.charCodeAt(x));for(R=w>0?w+1:0;R<o;){for(I=d,f=1,m=T;R>=o&&F("invalid-input"),g=Te(n.charCodeAt(R++)),(g>=T||g>E((b-d)/f))&&F("overflow"),d+=g*f,A=m<=h?v:m>=h+P?P:m-h,!(g<A);m+=T)L=T-A,f>E(b/L)&&F("overflow"),f*=L;u=a.length+1,h=Z(d-I,u,I==0),E(d/u)>b-y&&F("overflow"),y+=E(d/u),d%=u,a.splice(d++,0,y)}return W(a)}function z(n){var a,o,u,d,y,h,w,x,R,I,f,m=[],g,A,L,j;for(n=H(n),g=n.length,a=G,o=0,y=k,h=0;h<g;++h)f=n[h],f<128&&m.push(O(f));for(u=d=m.length,d&&m.push(J);u<g;){for(w=b,h=0;h<g;++h)f=n[h],f>=a&&f<w&&(w=f);for(A=u+1,w-a>E((b-o)/A)&&F("overflow"),o+=(w-a)*A,a=w,h=0;h<g;++h)if(f=n[h],f<a&&++o>b&&F("overflow"),f==a){for(x=o,R=T;I=R<=y?v:R>=y+P?P:R-y,!(x<I);R+=T)j=x-I,L=T-I,m.push(O(Y(I+j%L,0))),x=E(j/L);m.push(O(Y(x,0))),y=Z(o,A,u==d),o=0,++u}++o,++a}return m.join("")}function we(n){return $(n,function(a){return he.test(a)?K(a.slice(4).toLowerCase()):a})}function me(n){return $(n,function(a){return fe.test(a)?"xn--"+z(a):a})}if(l={version:"1.4.1",ucs2:{decode:H,encode:W},decode:K,encode:z,toASCII:me,toUnicode:we},i&&s)if(r.exports==i)s.exports=l;else for(N in l)l.hasOwnProperty(N)&&(i[N]=l[N]);else e.punycode=l})(_e)})(M,M.exports)),M.exports}Oe();var le=(function(r){function t(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return t();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:t});var e=__magic__;return e})(Object),Me=le.URL;le.URLSearchParams;var Ne={URL:Me};class ce extends Error{constructor(e,i,s){super(e);p(this,"status");p(this,"data");this.status=i,this.data=s}}const De=3,je=1e3,Be=[400,401,403,404,409,422],qe=(globalThis==null?void 0:globalThis.URL)??Ne.URL;class Ge{constructor(t,e){p(this,"baseUrl");p(this,"retries");p(this,"retryDelay");p(this,"nonRetryableStatuses");p(this,"identity");p(this,"sleep",t=>new Promise(e=>{setTimeout(e,t)}));p(this,"getIdentity",()=>this.identity instanceof Function?this.identity():this.identity);p(this,"rawFetch",(t,e)=>{const i=new qe(t,this.baseUrl),s=(e==null?void 0:e.identity)??this.getIdentity();return Re.signedFetchFactory()(i.toString(),{...e,identity:s})});p(this,"fetch",async(t,e)=>{for(let i=0;i<=this.retries;i++)try{let s,c;try{s=await this.rawFetch(t,e);const l=await s.text();l.length===0?c={ok:!0,data:null}:c=JSON.parse(l)}catch(l){throw new ce(l.message,void 0,null)}if(!s.ok||c.ok===!1){const l=c.message??c.error;throw new ce(l??`Request failed with status code ${s.status}`,s.status,c.data)}return c.ok===!0?c.data:c}catch(s){if(console.error(`[API] HTTP request failed: ${s.message||""}`,s),this.retries===i||s.status&&this.nonRetryableStatuses.includes(s.status))throw s;await this.sleep(this.retryDelay)}throw new Error("Unreachable code")});this.baseUrl=t,this.identity=e==null?void 0:e.identity,this.retries=(e==null?void 0:e.retries)??De,this.retryDelay=(e==null?void 0:e.retryDelay)??je,this.nonRetryableStatuses=(e==null?void 0:e.nonRetryableStatuses)??Be}}class Je extends Ge{constructor(e,i,s){super(i,s);p(this,"signer");p(this,"addTrade",async e=>this.fetch("/v1/trades",{method:"POST",body:JSON.stringify(e),metadata:{signer:this.signer,intent:"dcl:create-trade"},headers:{"Content-Type":"application/json"}}));p(this,"fetchTrade",async e=>this.fetch(`/v1/trades/${e}`,{method:"GET"}));this.signer=e}}class et{constructor(t,e,i){p(this,"tradesAPI");this.tradesAPI=new Je(t,e,{identity:i,retries:0})}async addTrade(t){return this.tradesAPI.addTrade(t)}async fetchTrade(t){return this.tradesAPI.fetchTrade(t)}async accept(t,e){const i=te(t.contract),s=re(i,t.chainId),c=se(t,e);return oe(s,"accept",[c])}async cancel(t,e){const i=te(t.contract),s=re(i,t.chainId),c=se(t,e);return oe(s,"cancelSignature",[c])}}export{et as TradeService};
|