@dcl/shop 0.10.1-31029565525.commit-8eeaa8f → 0.10.1-31032606668.commit-30914a5

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.
Files changed (180) hide show
  1. package/_assets/{Activity-BnUTRccC.js → Activity-CBQ0_5Gp.js} +3 -3
  2. package/_assets/{AnimatedBackground-CFxGJrvr.js → AnimatedBackground-DzU3vjuD.js} +1 -1
  3. package/_assets/{Assets-DKArlsdV.js → Assets-Bm8xT-wK.js} +48 -48
  4. package/_assets/{Assets.styles-Crxo5ZgZ.js → Assets.styles-D_DUFdKV.js} +56 -56
  5. package/_assets/{Authorizations-BVsBhVRE.js → Authorizations-YCl9mcd9.js} +1 -1
  6. package/_assets/{Cart-DGWIQa7u.js → Cart-BRPkkQw3.js} +13 -13
  7. package/_assets/{CircularProgress-C2EMA-WY.js → CircularProgress-BvMoYOvy.js} +1 -1
  8. package/_assets/Collection-D7bUo9dI.js +162 -0
  9. package/_assets/{CollectionCarousel-BfWdU9TS.js → CollectionCarousel-Bs4fBuN6.js} +18 -18
  10. package/_assets/{Confetti-2clep845.js → Confetti-Bf7aP0NE.js} +1 -1
  11. package/_assets/Creator-DctbYEDT.js +306 -0
  12. package/_assets/{ErrorNotice-DuUZx_7m.js → ErrorNotice-BU7FyT1W.js} +1 -1
  13. package/_assets/{ExchangeController-d78CG8uk.js → ExchangeController-D7v6FLdb.js} +1 -1
  14. package/_assets/{Faq-CD5Cn1w0.js → Faq-DBZpkL9P.js} +1 -1
  15. package/_assets/{GetCredits-DByVocxz.js → GetCredits-DEsgS54C.js} +14 -14
  16. package/_assets/{Grow-pVAVq4p8.js → Grow-GSOfEN2l.js} +1 -1
  17. package/_assets/{HelpersUtil-OmexlG_i.js → HelpersUtil-CkBhbL_r.js} +1 -1
  18. package/_assets/{ItemDetail-BB7--DmF.js → ItemDetail-B3yupLtb.js} +209 -209
  19. package/_assets/LazyEmoteControls-DLcKgwgu.js +2 -0
  20. package/_assets/{LoadMore-Bka3px9r.js → LoadMore-i3u3Pyt6.js} +1 -1
  21. package/_assets/{ManaPricingBanner.styles-05aOeHWK.js → ManaPricingBanner.styles-C18BesFl.js} +1 -1
  22. package/_assets/MyAssets-C-lv91w7.js +381 -0
  23. package/_assets/{MyFavorites-CdmRx3i0.js → MyFavorites-U-UxHb-o.js} +2 -2
  24. package/_assets/{NotFound-Cv_WsqDu.js → NotFound-DkcTAlkz.js} +1 -1
  25. package/_assets/{NotificationsBell-B_4w5VLE.js → NotificationsBell-DDCAY3l-.js} +1 -1
  26. package/_assets/{OutfitDetail-BlE4dNxL.js → OutfitDetail-BFmRzzjx.js} +4 -4
  27. package/_assets/{OutfitPreview-BjiO0VsO.js → OutfitPreview-DPS3H3_3.js} +2 -2
  28. package/_assets/{OutfitStudio-D9LQ_WGt.js → OutfitStudio-CrgVuCXP.js} +59 -59
  29. package/_assets/{StoreSettings-DpevQbL3.js → StoreSettings-BLndphwX.js} +43 -43
  30. package/_assets/Success-BY9OhkKm.js +280 -0
  31. package/_assets/{SwapController-BCq8cczu.js → SwapController-DXYjEOyv.js} +1 -1
  32. package/_assets/{Tooltip-BSg8PAuJ.js → Tooltip-BajbwTea.js} +1 -1
  33. package/_assets/{TradeService-DnRblc5X.js → TradeService-Cv02JkEQ.js} +1 -1
  34. package/_assets/{W3MFrameProviderSingleton-BkgMeT5j.js → W3MFrameProviderSingleton-A5mBxhYF.js} +3 -3
  35. package/_assets/{WebCryptoP256-5hLL6y4k.js → WebCryptoP256-CnQALEMv.js} +1 -1
  36. package/_assets/{authorizations-BZabD414.js → authorizations-Xqbnmu9x.js} +1 -1
  37. package/_assets/{basic-CID-Qs3b.js → basic-CvPWviGS.js} +1 -1
  38. package/_assets/{biconomy-BWK8rG_e.js → biconomy-glo4y4ek.js} +1 -1
  39. package/_assets/{builder-C0HXHDnK.js → builder-BqnhdDxo.js} +1 -1
  40. package/_assets/{buy-DMMwBXQK.js → buy-Cq5r6s_d.js} +1 -1
  41. package/_assets/{buy-gasless-DkT1GvmP.js → buy-gasless-CaSmt8Rn.js} +1 -1
  42. package/_assets/{categories-LpPpJwMX.js → categories-Cc9LF1R4.js} +44 -50
  43. package/_assets/{ccip-CmVA7LRy.js → ccip-DtPCxwhK.js} +1 -1
  44. package/_assets/{ccip-CTHaF-0F.js → ccip-HLzoBWhd.js} +1 -1
  45. package/_assets/{collectionPage.styles-C0OU97Vl.js → collectionPage.styles-rLItNGdu.js} +2 -2
  46. package/_assets/{controller-BSCAkC53.js → controller-DLVCl98j.js} +2 -2
  47. package/_assets/{core-BY58gAaC.js → core-BoCM39Dc.js} +4 -4
  48. package/_assets/{createSvgIcon-Co2I3KNE.js → createSvgIcon-CF6VIRxG.js} +1 -1
  49. package/_assets/{custom-BFUJnR6C.js → custom-BQJpm4NP.js} +1 -1
  50. package/_assets/{data-capture-BcT9TYL5.js → data-capture-CPxjWW7W.js} +1 -1
  51. package/_assets/{email-zKJhfKOQ.js → email-DglJsBXd.js} +1 -1
  52. package/_assets/{embedded-wallet-DZzfkRu7.js → embedded-wallet-CRWhciW5.js} +1 -1
  53. package/_assets/{emotion-styled.browser.esm-dvplhB66.js → emotion-styled.browser.esm-BATaYRNB.js} +1 -1
  54. package/_assets/{engine-B3Mf1brx.js → engine-CRPW7FqE.js} +1 -1
  55. package/_assets/{errors-BGVCQOMz.js → errors-D4C9kv7B.js} +1 -1
  56. package/_assets/{estimate-l1-fee-DMFrbofF.js → estimate-l1-fee-aOXZ8ihZ.js} +1 -1
  57. package/_assets/{execute-DCGV6tDo.js → execute-k2RZ2hTw.js} +2 -2
  58. package/_assets/{features-DqHFEBDx.js → features-BmdkdPP-.js} +1 -1
  59. package/_assets/{fetchTokenMetadata-D6K4KP_4.js → fetchTokenMetadata-Bmcczr66.js} +2 -2
  60. package/_assets/{field.styles-DcKQ_iNz.js → field.styles-DQVBZTuq.js} +1 -1
  61. package/_assets/{get-ecosystem-wallet-info-D6HzrmoJ.js → get-ecosystem-wallet-info-BbJRcc1t.js} +1 -1
  62. package/_assets/{getBalance-LGdYuyxa.js → getBalance-DC-t3UhM.js} +1 -1
  63. package/_assets/{getNFT-Cw0O3Ml9.js → getNFT-BlzNSmnK.js} +1 -1
  64. package/_assets/{getNFT-CuZyZceA.js → getNFT-DwruUWap.js} +1 -1
  65. package/_assets/{grid.styles-BoDTH9-L.js → grid.styles-2-Lphh1_.js} +1 -1
  66. package/_assets/{hashTypedData-CM__DDH2.js → hashTypedData-BLMgL5Vz.js} +1 -1
  67. package/_assets/{hashTypedData-qqC1Tbni.js → hashTypedData-D6ew3JpS.js} +1 -1
  68. package/_assets/{in-app-BwohLVFE.js → in-app-BRl8aLUS.js} +1 -1
  69. package/_assets/{in-app-wallet-calls-DkQZMb0p.js → in-app-wallet-calls-Cf8UnG06.js} +1 -1
  70. package/_assets/{index-D8uSGtoz.js → index-B2N5oNn8.js} +1 -1
  71. package/_assets/{index-DplFHsVz.js → index-BBOn5orP.js} +1 -1
  72. package/_assets/{index-CRUz-lFa.js → index-BD25cQD4.js} +1 -1
  73. package/_assets/{index-C4OULSnf.js → index-BDzGigH2.js} +1 -1
  74. package/_assets/{index-txSbIXUX.js → index-BISFLA3c.js} +1 -1
  75. package/_assets/{index-DY-CJBBw.js → index-BJovGEvB.js} +1 -1
  76. package/_assets/{index-CwEAusBk.js → index-BKj0f9wi.js} +1 -1
  77. package/_assets/{index-BeHXNx4l.js → index-BTkQgQDi.js} +1 -1
  78. package/_assets/{index-BHs8Nm1v.js → index-BXzvQW0o.js} +1 -1
  79. package/_assets/{index-jQ98hJsI.js → index-BZL5qpA4.js} +2 -2
  80. package/_assets/{index-BOCGS4MY.js → index-B_PIYV8c.js} +2 -2
  81. package/_assets/{index-BDKp6O92.js → index-BelRIVeb.js} +1 -1
  82. package/_assets/{index-BSioXpnp.js → index-BkspOCIc.js} +1 -1
  83. package/_assets/{index-unjRyi-x.js → index-Bq_9XM9n.js} +1 -1
  84. package/_assets/{index-CVEw6hKC.js → index-C-WOsJGb.js} +1 -1
  85. package/_assets/{index-CvJmHkgv.js → index-C0tIouBf.js} +3 -3
  86. package/_assets/{index-DVP9mmy0.js → index-C6G5Ojpz.js} +1 -1
  87. package/_assets/{index-MhPhsWP8.js → index-C7hGN0lI.js} +1 -1
  88. package/_assets/{index-CFjdvXcL.js → index-CBe4gtAt.js} +2 -2
  89. package/_assets/{index-DOmua37r.js → index-CFypPkBr.js} +1 -1
  90. package/_assets/{index-dguKxdA7.js → index-CHb52k2r.js} +2 -2
  91. package/_assets/{index-DnafkRIs.js → index-CN8WHGrH.js} +1 -1
  92. package/_assets/{index-CDV3IoQm.js → index-COY9dHV9.js} +1 -1
  93. package/_assets/{index-DqogjYMl.js → index-CPTPmsi2.js} +1 -1
  94. package/_assets/{index-CM4gYpZ8.js → index-CPhcLOEq.js} +1 -1
  95. package/_assets/{index-Dg22Nieo.js → index-Ch87wzNg.js} +1 -1
  96. package/_assets/index-CqRUWZDq.js +1 -0
  97. package/_assets/{index-Dij6LJf6.js → index-CuSvjeNM.js} +1 -1
  98. package/_assets/{index-BLKe1fxG.js → index-CwFxxSc1.js} +299 -299
  99. package/_assets/{index-CRd1XuYs.js → index-CwKi0BcO.js} +1 -1
  100. package/_assets/{index-B9zvMdI0.js → index-CxTgEmAp.js} +1 -1
  101. package/_assets/{index-BPqobsB6.js → index-CyQd3Dif.js} +1 -1
  102. package/_assets/{index-BRZA_fuK.js → index-D7TrWXvV.js} +1 -1
  103. package/_assets/{index-BSFFapHO.js → index-DCZ36akI.js} +1 -1
  104. package/_assets/{index-CCenxE7k.js → index-DFNARVN7.js} +1 -1
  105. package/_assets/{index-Bo-edPJM.js → index-DGXzZsJb.js} +1 -1
  106. package/_assets/{index-CSHbp-r-.js → index-DKKo0LoX.js} +11 -11
  107. package/_assets/{index-MuXfi5UE.js → index-DOGInGKk.js} +1 -1
  108. package/_assets/{index-BsgL3ujL.js → index-DQ1Y3Whz.js} +1 -1
  109. package/_assets/{index-BzVWz4Tj.js → index-DRKYu1B3.js} +1 -1
  110. package/_assets/{index-DlhJ9Qox.js → index-DRyHPso7.js} +1 -1
  111. package/_assets/{index-UR9Qpju9.js → index-DSJJjIyM.js} +3 -3
  112. package/_assets/{index-B-2CvxPO.js → index-DSQSVjLs.js} +1 -1
  113. package/_assets/{index-CVIbA-VT.js → index-DdL-MVH6.js} +1 -1
  114. package/_assets/{index-CTenZZ8l.js → index-DgkGEui6.js} +1 -1
  115. package/_assets/{index-LP5Of-SX.js → index-Sn4izkWE.js} +1 -1
  116. package/_assets/index-UdM3HuhV.js +1 -0
  117. package/_assets/{index-CWhL4zBo.js → index-e3mxlGeM.js} +1 -1
  118. package/_assets/{index-Bo5HGYUE.js → index-fRwny2zx.js} +1 -1
  119. package/_assets/{index-0DS7nWrl.js → index-fvtPPVdt.js} +1 -1
  120. package/_assets/{index-ShFdgjrK.js → index-j8jUDLYS.js} +1 -1
  121. package/_assets/{index-BBrm4kwZ.js → index-rj2Zyfmj.js} +3 -3
  122. package/_assets/{index.es-WFmF4El-.js → index.es-C7evsiQb.js} +4 -4
  123. package/_assets/{index.es-CM1g4yN5.js → index.es-DF_rXR3Q.js} +1 -1
  124. package/_assets/{index.es-C61rbBYw.js → index.es-DYP1_xK_.js} +1 -1
  125. package/_assets/{localBatchGatewayRequest-DGjQ1weV.js → localBatchGatewayRequest-BXykDIjc.js} +1 -1
  126. package/_assets/{networks-C1UzX1Sm.js → networks-DKlZyT-L.js} +1 -1
  127. package/_assets/{onramp-Fd2Cj3wL.js → onramp-ByQtA-xO.js} +1 -1
  128. package/_assets/{openzeppelin-BYo8OyKm.js → openzeppelin-CroDtw4s.js} +1 -1
  129. package/_assets/{parseNft-Gein49L0.js → parseNft-BH0wDTt0.js} +2 -2
  130. package/_assets/{parseSignature-k67zYFy4.js → parseSignature-DgaK7Nqy.js} +1 -1
  131. package/_assets/{parseSignature-DaGe9UWu.js → parseSignature-VSsiOnpe.js} +3 -3
  132. package/_assets/{passkeys-D3J4DzgH.js → passkeys-C1oIb99i.js} +1 -1
  133. package/_assets/{pay-with-exchange-CbWF1HDJ.js → pay-with-exchange-CttWQzQs.js} +1 -1
  134. package/_assets/{qr-overlay-nWKGC2_v.js → qr-overlay-DHUyjo36.js} +1 -1
  135. package/_assets/{receive-bg6fMaP3.js → receive-BKxXWv2t.js} +1 -1
  136. package/_assets/{resolveImplementation-3oaoK01c.js → resolveImplementation-X7KhKw3S.js} +1 -1
  137. package/_assets/{rpc-BohETOPd.js → rpc-CLJ9sbD8.js} +1 -1
  138. package/_assets/{secp256k1-DDb2NhqN.js → secp256k1-Cbp19gqh.js} +1 -1
  139. package/_assets/{secp256k1-DTNpVYCz.js → secp256k1-DPi4cvKJ.js} +1 -1
  140. package/_assets/{secp256k1-C-hoA_Tn.js → secp256k1-DxA18vH5.js} +1 -1
  141. package/_assets/{send-CmaFLfs9.js → send-EgTowmAZ.js} +1 -1
  142. package/_assets/{send-batch-transaction-BGvy0zyD.js → send-batch-transaction-wEk0AI7v.js} +1 -1
  143. package/_assets/{send-eip712-transaction-hYvHM7vZ.js → send-eip712-transaction-BBM2idYc.js} +2 -2
  144. package/_assets/{send-gasless-transaction-QyhmnHZB.js → send-gasless-transaction-UdxWKrE2.js} +2 -2
  145. package/_assets/{send-transaction-CtZe85mL.js → send-transaction-DEvt9fmJ.js} +2 -2
  146. package/_assets/{sendMetaTransaction-C5SAvbei.js → sendMetaTransaction-BYbBPih_.js} +1 -1
  147. package/_assets/{sendRawTransaction-B2WHhB1D.js → sendRawTransaction-D5OSt6IO.js} +3 -3
  148. package/_assets/{serializeTransaction-BwuobXgs.js → serializeTransaction-Blc5JuIS.js} +1 -1
  149. package/_assets/{session-proposal-pdBgnfq3.js → session-proposal-BOLRFjK9.js} +1 -1
  150. package/_assets/{session-request-DVhv1Cj8.js → session-request-CRjXklwV.js} +2 -2
  151. package/_assets/{signing-BRSDIb8-.js → signing-B3rrMiJs.js} +3 -3
  152. package/_assets/skeleton.styles-D3iPDKdT.js +7 -0
  153. package/_assets/{socials-D7ScJClR.js → socials-QIa2OQ6D.js} +1 -1
  154. package/_assets/{styled-CrSAMFFb.js → styled-CMJUrQY2.js} +1 -1
  155. package/_assets/{swaps-wmzxaVLP.js → swaps-DIftYDvd.js} +1 -1
  156. package/_assets/{thirdweb-WdIIt1R4.js → thirdweb-C0YKMkrc.js} +3 -3
  157. package/_assets/{to-serializable-transaction-Dcp4UJq5.js → to-serializable-transaction-Cjnw6yJ0.js} +2 -2
  158. package/_assets/{transactionReceipt-CX5pZ3y-.js → transactionReceipt-BCryC1fM.js} +1 -1
  159. package/_assets/{transactions-CP64yjJv.js → transactions-p19NlOdG.js} +1 -1
  160. package/_assets/{useCreditPacks-BtlA3bsY.js → useCreditPacks-DL0joeDc.js} +1 -1
  161. package/_assets/{useImportable-30ssdgwW.js → useImportable-CXGXlKVj.js} +1 -1
  162. package/_assets/{useInfiniteGrid-DwOzTLpA.js → useInfiniteGrid-DCnfT2gg.js} +1 -1
  163. package/_assets/{useTheme-BTDb7mvT.js → useTheme-vYv6two9.js} +1 -1
  164. package/_assets/{verifyHash-C6FN0xpS.js → verifyHash-Dnb3FmXs.js} +1 -1
  165. package/_assets/{w3m-modal-Bq0A97y3.js → w3m-modal-BPKpwX5-.js} +1 -1
  166. package/_assets/{w3m-modal-DoKC93v3.js → w3m-modal-CQfqosvf.js} +1 -1
  167. package/_assets/{wait-for-tx-receipt-25yHA4Ha.js → wait-for-tx-receipt-H6RTv4Cw.js} +1 -1
  168. package/_assets/{wallets-CLLcXEAl.js → wallets-C2vtueR8.js} +5 -5
  169. package/_assets/{web-connector-CXNgxhSL.js → web-connector-Cc4ShgT6.js} +3 -3
  170. package/_assets/{writeContract-78bJpqls.js → writeContract-B_DvmCjk.js} +1 -1
  171. package/_assets/{zoraTestnet-CNk9bURD.js → zoraTestnet-TFaEQBOe.js} +1 -1
  172. package/index.html +11 -11
  173. package/package.json +2 -2
  174. package/_assets/Collection-D6DIMkEd.js +0 -162
  175. package/_assets/Creator-k4PUSiKV.js +0 -306
  176. package/_assets/LazyEmoteControls-CtiNE6Cc.js +0 -2
  177. package/_assets/MyAssets-_v0xxc8e.js +0 -381
  178. package/_assets/Success-rROJaYNs.js +0 -280
  179. package/_assets/index-CLm02-HM.js +0 -1
  180. package/_assets/index-zCa2boac.js +0 -1
@@ -1,8 +1,8 @@
1
- import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t as j,s as n,w as ce,B as G,x as de,o as pe,A as ue,bs as ge,bx as me,by as xe,bz as he,bA as R,I as N,bB as f,bC as fe,E as F}from"./index-BLKe1fxG.js";import{E as M}from"./ErrorNotice-DuUZx_7m.js";import{F as w}from"./field.styles-DcKQ_iNz.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";const ve="https://cdn.decentraland.org/@dcl/shop/0.10.1-31029565525.commit-8eeaa8f/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/0.10.1-31029565525.commit-8eeaa8f/_assets/template-cover-2-Dni9s0i_.jpeg",we=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":ve,"../assets/creator-covers/template-cover-2.jpeg":be}),v=Object.entries(we).sort(([r],[u])=>r.localeCompare(u)).map(([r,u])=>({name:r.split("/").pop(),url:u})),je=ce`
1
+ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t as j,s as a,w as ce,B as G,x as de,o as pe,A as ue,bt as ge,by as me,bz as xe,bA as he,bB as R,I as N,bC as f,bD as fe,E as F}from"./index-CwFxxSc1.js";import{E as D}from"./ErrorNotice-BU7FyT1W.js";import{F as w}from"./field.styles-DQVBZTuq.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";const ve="https://cdn.decentraland.org/@dcl/shop/0.10.1-31032606668.commit-30914a5/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/0.10.1-31032606668.commit-30914a5/_assets/template-cover-2-Dni9s0i_.jpeg",we=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":ve,"../assets/creator-covers/template-cover-2.jpeg":be}),v=Object.entries(we).sort(([r],[u])=>r.localeCompare(u)).map(([r,u])=>({name:r.split("/").pop(),url:u})),je=ce`
2
2
  to {
3
3
  transform: rotate(360deg);
4
4
  }
5
- `,Se=n.div`
5
+ `,Se=a.div`
6
6
  display: flex;
7
7
  align-items: center;
8
8
  justify-content: center;
@@ -16,7 +16,7 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
16
16
  flex-direction: column;
17
17
  text-align: center;
18
18
  }
19
- `,ke=n.span`
19
+ `,ke=a.span`
20
20
  flex: none;
21
21
  border-radius: 50%;
22
22
  border-style: solid;
@@ -43,18 +43,18 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
43
43
  @media (prefers-reduced-motion: reduce) {
44
44
  animation-duration: 2s;
45
45
  }
46
- `,$e=n.span`
46
+ `,$e=a.span`
47
47
  font-size: 14px;
48
48
  font-weight: 600;
49
- `;function ye({label:r,size:u="medium",direction:S="column",className:k}){return t.jsxs(Se,{className:k,"data-testid":"spinner-box","data-direction":S,role:"status","aria-live":"polite","aria-label":r?void 0:s("spinner.loading"),children:[t.jsx(ke,{"data-testid":"spinner-box-ring","data-size":u,"aria-hidden":!0}),r?t.jsx($e,{children:r}):null]})}const{colors:a,radius:_e,media:K}=j,Ee=n(ye)`
49
+ `;function ye({label:r,size:u="medium",direction:S="column",className:k}){return t.jsxs(Se,{className:k,"data-testid":"spinner-box","data-direction":S,role:"status","aria-live":"polite","aria-label":r?void 0:s("spinner.loading"),children:[t.jsx(ke,{"data-testid":"spinner-box-ring","data-size":u,"aria-hidden":!0}),r?t.jsx($e,{children:r}):null]})}const{colors:n,radius:_e,media:K}=j,Ee=a(ye)`
50
50
  display: grid;
51
51
  place-items: center;
52
52
  min-height: 60vh;
53
- `,ze=n(G)`
53
+ `,ze=a(G)`
54
54
  align-self: center;
55
55
  min-width: 200px;
56
56
  margin-top: 8px;
57
- `,O=n.section`
57
+ `,M=a.section`
58
58
  max-width: 640px;
59
59
  margin: 0 auto;
60
60
  padding: 8px 0 48px;
@@ -72,50 +72,50 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
72
72
 
73
73
  & .field__label {
74
74
  font-weight: 700;
75
- color: ${a.text};
75
+ color: ${n.text};
76
76
  }
77
77
  & textarea {
78
- background: ${a.white};
79
- border: 1px solid ${a.lineStrong};
78
+ background: ${n.white};
79
+ border: 1px solid ${n.lineStrong};
80
80
  border-radius: 8px;
81
81
  padding: 10px 12px;
82
- color: ${a.text};
82
+ color: ${n.text};
83
83
  font: inherit;
84
84
  resize: vertical;
85
85
  min-height: 88px;
86
86
  }
87
- `,Ne=n.div`
87
+ `,Ne=a.div`
88
88
  display: flex;
89
89
  align-items: baseline;
90
90
  justify-content: space-between;
91
91
  gap: 16px;
92
92
  flex-wrap: wrap;
93
- `,Ce=n.div`
93
+ `,Ce=a.div`
94
94
  display: flex;
95
95
  align-items: center;
96
96
  gap: 10px;
97
- `,Le=n(oe)`
97
+ `,Le=a(oe)`
98
98
  display: flex;
99
99
  align-items: center;
100
100
  justify-content: center;
101
- color: ${a.text};
101
+ color: ${n.text};
102
102
  transition: color 0.15s linear;
103
103
 
104
104
  &:hover {
105
- color: ${a.accent};
105
+ color: ${n.accent};
106
106
  }
107
107
  & .ico {
108
108
  width: 22px;
109
109
  height: 22px;
110
110
  }
111
- `,D=n.h1`
111
+ `,O=a.h1`
112
112
  font-size: 24px;
113
113
  font-weight: 800;
114
- `,He=n.a`
114
+ `,He=a.a`
115
115
  display: inline-flex;
116
116
  align-items: center;
117
117
  gap: 6px;
118
- color: ${a.accent};
118
+ color: ${n.accent};
119
119
  font-weight: 700;
120
120
  font-size: 14px;
121
121
  text-decoration: none;
@@ -127,13 +127,13 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
127
127
  width: 15px;
128
128
  height: 15px;
129
129
  }
130
- `,Ie=n.div`
130
+ `,Ie=a.div`
131
131
  display: flex;
132
132
  align-items: stretch;
133
- border: 1px solid ${a.lineStrong};
133
+ border: 1px solid ${n.lineStrong};
134
134
  border-radius: 8px;
135
135
  overflow: hidden;
136
- background: ${a.white};
136
+ background: ${n.white};
137
137
 
138
138
  & input {
139
139
  border: 0 !important;
@@ -141,16 +141,16 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
141
141
  flex: 1;
142
142
  min-width: 0;
143
143
  }
144
- `,Te=n.span`
144
+ `,Te=a.span`
145
145
  display: flex;
146
146
  align-items: center;
147
147
  padding: 0 10px;
148
148
  background: rgba(0, 0, 0, 0.04);
149
- color: ${a.muted};
149
+ color: ${n.muted};
150
150
  font-size: 13px;
151
151
  white-space: nowrap;
152
- border-right: 1px solid ${a.lineStrong};
153
- `,Be=n.div`
152
+ border-right: 1px solid ${n.lineStrong};
153
+ `,Be=a.div`
154
154
  display: grid;
155
155
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
156
156
  gap: 12px;
@@ -158,14 +158,14 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
158
158
  ${K.maxWidth("mobile")} {
159
159
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
160
160
  }
161
- `,C=n.button`
161
+ `,C=a.button`
162
162
  position: relative;
163
163
  padding: 0;
164
- border: 2px solid ${a.lineStrong};
164
+ border: 2px solid ${n.lineStrong};
165
165
  border-radius: ${_e.card};
166
166
  overflow: hidden;
167
167
  aspect-ratio: 16 / 9;
168
- background: ${a.media};
168
+ background: ${n.media};
169
169
  cursor: pointer;
170
170
 
171
171
  & img {
@@ -176,8 +176,8 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
176
176
  }
177
177
 
178
178
  &[data-selected='true'] {
179
- border-color: ${a.accent};
180
- box-shadow: 0 0 0 2px ${a.accent};
179
+ border-color: ${n.accent};
180
+ box-shadow: 0 0 0 2px ${n.accent};
181
181
  }
182
182
  &[data-selected='true']::after {
183
183
  content: '✓';
@@ -189,8 +189,8 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
189
189
  display: grid;
190
190
  place-items: center;
191
191
  border-radius: 50%;
192
- background: ${a.accent};
193
- color: ${a.white};
192
+ background: ${n.accent};
193
+ color: ${n.white};
194
194
  font-size: 13px;
195
195
  font-weight: 700;
196
196
  }
@@ -202,38 +202,38 @@ import{j as t,L as oe,b as le,r as l}from"./react-BYHuwl8r.js";import{b as s,t a
202
202
  justify-content: center;
203
203
  gap: 6px;
204
204
  border-style: dashed;
205
- color: ${a.muted};
205
+ color: ${n.muted};
206
206
  font-size: 13px;
207
207
  font-weight: 700;
208
- background: ${a.white};
208
+ background: ${n.white};
209
209
  }
210
210
  &[data-variant='upload'] .ico {
211
211
  width: 22px;
212
212
  height: 22px;
213
- background: ${a.muted};
213
+ background: ${n.muted};
214
214
  }
215
215
  &[data-variant='upload']:hover {
216
- border-color: ${a.accent};
217
- color: ${a.accent};
216
+ border-color: ${n.accent};
217
+ color: ${n.accent};
218
218
  }
219
219
  &[data-variant='upload']:hover .ico {
220
- background: ${a.accent};
220
+ background: ${n.accent};
221
221
  }
222
- `,Ae=n.input`
222
+ `,Ae=a.input`
223
223
  position: absolute;
224
224
  width: 1px;
225
225
  height: 1px;
226
226
  opacity: 0;
227
227
  pointer-events: none;
228
- `,Pe=n.div`
228
+ `,Pe=a.div`
229
229
  display: flex;
230
230
  justify-content: flex-end;
231
231
  gap: 12px;
232
232
  margin-top: 8px;
233
- `,Re=n(G)`
233
+ `,Re=a(G)`
234
234
  min-width: 180px;
235
235
 
236
236
  ${K.maxWidth("mobile")} {
237
237
  width: 100%;
238
238
  }
239
- `,V=1e6,W={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function Y(r){return`${(r/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function Ke(){de({title:s("seo.storeSettings.title"),noindex:!0});const{session:r,signIn:u}=pe(),S=le(),k=ue(),p=r==null?void 0:r.address,{data:$,isLoading:q}=ge(p),[o,g]=l.useState(W),[L,H]=l.useState(W),[y,x]=l.useState(),[h,I]=l.useState(!1),[c,_]=l.useState(null),[b,J]=l.useState({}),T=l.useRef(null);l.useEffect(()=>{if($){const e=me($);g(e),H(e),x(void 0),_(e.cover?{url:e.cover,name:e.coverName,hash:e.coverHash}:null)}},[$]),l.useEffect(()=>{let e=!1;return Promise.all(v.map(async i=>[i.name,await xe(i.url)])).then(i=>{e||J(Object.fromEntries(i))}).catch(()=>{}),()=>{e=!0}},[]);const E=l.useMemo(()=>{const e=v.find(d=>o.coverName===`cover/${d.name}`);if(e)return e.name;const i=o.coverHash?v.find(d=>b[d.name]===o.coverHash):void 0;return i==null?void 0:i.name},[o.coverName,o.coverHash,b]);l.useEffect(()=>{c!=null&&c.hash&&v.some(e=>b[e.name]===c.hash)&&_(null)},[b,c]);const B=y!==void 0&&y>V,Q=l.useMemo(()=>he.filter(e=>!R(e,o.links[e])),[o.links]),U=B||Q.length>0,z=l.useMemo(()=>JSON.stringify(o)!==JSON.stringify(L),[o,L]),X=z&&!U&&!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(O,{"data-signin":!0,"aria-label":s("storeSettings.title"),children:[t.jsx(D,{children:s("storeSettings.title")}),t.jsx("p",{className:"muted",children:s("storeSettings.signInPrompt")}),t.jsx(ze,{variant:"purple",onClick:u,children:s("storeSettings.signIn")})]});function Z(e,i){x(void 0),g(d=>({...d,cover:i,coverName:`cover/${e}`,coverHash:""}))}const ee=["image/png","image/jpeg","image/webp"];function te(e){var A;const i=(A=e.target.files)==null?void 0:A[0];if(!i||!ee.includes(i.type))return;x(i.size);const d=`cover/${i.name}`,m=new FileReader;m.onload=()=>{const P=m.result;_({url:P,name:d,hash:""}),g(re=>({...re,cover:P,coverName:d,coverHash:""}))},m.readAsDataURL(i)}function ie(){c&&(x(void 0),g(e=>({...e,cover:c.url,coverName:c.name,coverHash:c.hash})))}function se(e,i){const d=i?(f[e]+i).replace(/\s/g,""):"";g(m=>({...m,links:{...m.links,[e]:d}}))}function ae(e){const i=o.links[e];return e==="website"?i:i.replace(f[e],"")}async function ne(){if(!(!p||!r)){I(!0);try{await fe(p,o,r.identity),H(o),x(void 0),await k.invalidateQueries({queryKey:["store",p.toLowerCase()]}),F.success(s("storeSettings.saved")),S(`/items/creator/${p}`)}catch{F.error(s("storeSettings.saveError"))}finally{I(!1)}}}return t.jsxs(O,{"aria-label":s("storeSettings.title"),children:[t.jsxs(Ne,{children:[t.jsxs(Ce,{children:[p?t.jsx(Le,{to:`/items/creator/${p}`,title:s("storeSettings.back"),"aria-label":s("storeSettings.back"),children:t.jsx(N,{name:"arrow-left"})}):null,t.jsx(D,{children:s("storeSettings.title")})]}),p?t.jsxs(He,{href:`/items/creator/${p}`,target:"_blank",rel:"noopener noreferrer",children:[s("storeSettings.seeAsGuest"),t.jsx(N,{name:"external-link"})]}):null]}),q?t.jsx(Ee,{size:"large",label:s("storeSettings.loading")}):t.jsxs(t.Fragment,{children:[t.jsxs(w,{children:[t.jsx("span",{className:"field__label",children:s("storeSettings.cover")}),t.jsxs(Be,{role:"group","aria-label":s("storeSettings.cover"),children:[v.map(e=>{const i=E===e.name;return t.jsx(C,{type:"button","data-testid":"cover-picker-tile","data-selected":i,"aria-pressed":i,onClick:()=>Z(e.name,e.url),children:t.jsx("img",{src:e.url,alt:"",loading:"lazy"})},e.name)}),c?t.jsx(C,{type:"button","data-testid":"cover-picker-tile","data-variant":"custom","data-selected":!E,"aria-pressed":!E,onClick:ie,children:t.jsx("img",{src:c.url,alt:""})}):null,t.jsxs(C,{type:"button","data-testid":"cover-picker-tile","data-variant":"upload",onClick:()=>{var e;return(e=T.current)==null?void 0:e.click()},children:[t.jsx(N,{name:"upload"}),t.jsx("span",{children:s("storeSettings.upload")})]}),t.jsx(Ae,{ref:T,type:"file",accept:"image/png, image/jpeg, image/webp","data-testid":"cover-picker-input",onChange:te})]}),B?t.jsx(M,{message:s("storeSettings.sizeError",{max:Y(V),current:Y(y)})}):null]}),t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s("storeSettings.description")}),t.jsx("textarea",{value:o.description,rows:4,disabled:h,onChange:e=>g(i=>({...i,description:e.target.value}))})]}),t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s("storeSettings.website")}),t.jsx("input",{type:"url",value:o.links.website,placeholder:f.website,disabled:h,onChange:e=>g(i=>({...i,links:{...i.links,website:e.target.value.replace(/\s/g,"")}}))}),R("website",o.links.website)?null:t.jsx(M,{message:s("storeSettings.linkError",{value:f.website})})]}),["twitter","discord","facebook"].map(e=>t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s(`storeSettings.${e}`)}),t.jsxs(Ie,{children:[t.jsx(Te,{children:f[e]}),t.jsx("input",{type:"text",value:ae(e),disabled:h,onChange:i=>se(e,i.target.value)})]})]},e)),t.jsx(Pe,{children:t.jsx(Re,{variant:"purple","data-testid":"store-settings-save",onClick:()=>void ne(),disabled:!X,children:h?s("storeSettings.saving"):s("storeSettings.save")})})]})]})}export{Ke as StoreSettings,Ke as default};
239
+ `,V=1e6,W={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function Y(r){return`${(r/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function Ke(){de({title:s("seo.storeSettings.title"),noindex:!0});const{session:r,signIn:u}=pe(),S=le(),k=ue(),p=r==null?void 0:r.address,{data:$,isLoading:q}=ge(p),[o,g]=l.useState(W),[L,H]=l.useState(W),[y,x]=l.useState(),[h,I]=l.useState(!1),[c,_]=l.useState(null),[b,J]=l.useState({}),T=l.useRef(null);l.useEffect(()=>{if($){const e=me($);g(e),H(e),x(void 0),_(e.cover?{url:e.cover,name:e.coverName,hash:e.coverHash}:null)}},[$]),l.useEffect(()=>{let e=!1;return Promise.all(v.map(async i=>[i.name,await xe(i.url)])).then(i=>{e||J(Object.fromEntries(i))}).catch(()=>{}),()=>{e=!0}},[]);const E=l.useMemo(()=>{const e=v.find(d=>o.coverName===`cover/${d.name}`);if(e)return e.name;const i=o.coverHash?v.find(d=>b[d.name]===o.coverHash):void 0;return i==null?void 0:i.name},[o.coverName,o.coverHash,b]);l.useEffect(()=>{c!=null&&c.hash&&v.some(e=>b[e.name]===c.hash)&&_(null)},[b,c]);const B=y!==void 0&&y>V,Q=l.useMemo(()=>he.filter(e=>!R(e,o.links[e])),[o.links]),U=B||Q.length>0,z=l.useMemo(()=>JSON.stringify(o)!==JSON.stringify(L),[o,L]),X=z&&!U&&!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(M,{"data-signin":!0,"aria-label":s("storeSettings.title"),children:[t.jsx(O,{children:s("storeSettings.title")}),t.jsx("p",{className:"muted",children:s("storeSettings.signInPrompt")}),t.jsx(ze,{variant:"purple",onClick:u,children:s("storeSettings.signIn")})]});function Z(e,i){x(void 0),g(d=>({...d,cover:i,coverName:`cover/${e}`,coverHash:""}))}const ee=["image/png","image/jpeg","image/webp"];function te(e){var A;const i=(A=e.target.files)==null?void 0:A[0];if(!i||!ee.includes(i.type))return;x(i.size);const d=`cover/${i.name}`,m=new FileReader;m.onload=()=>{const P=m.result;_({url:P,name:d,hash:""}),g(re=>({...re,cover:P,coverName:d,coverHash:""}))},m.readAsDataURL(i)}function ie(){c&&(x(void 0),g(e=>({...e,cover:c.url,coverName:c.name,coverHash:c.hash})))}function se(e,i){const d=i?(f[e]+i).replace(/\s/g,""):"";g(m=>({...m,links:{...m.links,[e]:d}}))}function ne(e){const i=o.links[e];return e==="website"?i:i.replace(f[e],"")}async function ae(){if(!(!p||!r)){I(!0);try{await fe(p,o,r.identity),H(o),x(void 0),await k.invalidateQueries({queryKey:["store",p.toLowerCase()]}),F.success(s("storeSettings.saved")),S(`/items/creator/${p}`)}catch{F.error(s("storeSettings.saveError"))}finally{I(!1)}}}return t.jsxs(M,{"aria-label":s("storeSettings.title"),children:[t.jsxs(Ne,{children:[t.jsxs(Ce,{children:[p?t.jsx(Le,{to:`/items/creator/${p}`,title:s("storeSettings.back"),"aria-label":s("storeSettings.back"),children:t.jsx(N,{name:"arrow-left"})}):null,t.jsx(O,{children:s("storeSettings.title")})]}),p?t.jsxs(He,{href:`/items/creator/${p}`,target:"_blank",rel:"noopener noreferrer",children:[s("storeSettings.seeAsGuest"),t.jsx(N,{name:"external-link"})]}):null]}),q?t.jsx(Ee,{size:"large",label:s("storeSettings.loading")}):t.jsxs(t.Fragment,{children:[t.jsxs(w,{children:[t.jsx("span",{className:"field__label",children:s("storeSettings.cover")}),t.jsxs(Be,{role:"group","aria-label":s("storeSettings.cover"),children:[v.map(e=>{const i=E===e.name;return t.jsx(C,{type:"button","data-testid":"cover-picker-tile","data-selected":i,"aria-pressed":i,onClick:()=>Z(e.name,e.url),children:t.jsx("img",{src:e.url,alt:"",loading:"lazy"})},e.name)}),c?t.jsx(C,{type:"button","data-testid":"cover-picker-tile","data-variant":"custom","data-selected":!E,"aria-pressed":!E,onClick:ie,children:t.jsx("img",{src:c.url,alt:""})}):null,t.jsxs(C,{type:"button","data-testid":"cover-picker-tile","data-variant":"upload",onClick:()=>{var e;return(e=T.current)==null?void 0:e.click()},children:[t.jsx(N,{name:"upload"}),t.jsx("span",{children:s("storeSettings.upload")})]}),t.jsx(Ae,{ref:T,type:"file",accept:"image/png, image/jpeg, image/webp","data-testid":"cover-picker-input",onChange:te})]}),B?t.jsx(D,{message:s("storeSettings.sizeError",{max:Y(V),current:Y(y)})}):null]}),t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s("storeSettings.description")}),t.jsx("textarea",{value:o.description,rows:4,disabled:h,onChange:e=>g(i=>({...i,description:e.target.value}))})]}),t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s("storeSettings.website")}),t.jsx("input",{type:"url",value:o.links.website,placeholder:f.website,disabled:h,onChange:e=>g(i=>({...i,links:{...i.links,website:e.target.value.replace(/\s/g,"")}}))}),R("website",o.links.website)?null:t.jsx(D,{message:s("storeSettings.linkError",{value:f.website})})]}),["twitter","discord","facebook"].map(e=>t.jsxs(w,{as:"label",children:[t.jsx("span",{className:"field__label",children:s(`storeSettings.${e}`)}),t.jsxs(Ie,{children:[t.jsx(Te,{children:f[e]}),t.jsx("input",{type:"text",value:ne(e),disabled:h,onChange:i=>se(e,i.target.value)})]})]},e)),t.jsx(Pe,{children:t.jsx(Re,{variant:"purple","data-testid":"store-settings-save",onClick:()=>void ae(),disabled:!X,children:h?s("storeSettings.saving"):s("storeSettings.save")})})]})]})}export{Ke as StoreSettings,Ke as default};
@@ -0,0 +1,280 @@
1
+ import{a as E,b as F,j as e,N as M,r as S}from"./react-BYHuwl8r.js";import{t as P,s as t,z as B,J as W,K as O,o as _,x as q,b as n,y as J,C as U,L as D,M as H,c as T,B as K,N as X}from"./index-CwFxxSc1.js";import{C as Q}from"./Confetti-Bf7aP0NE.js";import{w as Y,S as G}from"./buy-gasless-CaSmt8Rn.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./authorizations-Xqbnmu9x.js";import"./sendMetaTransaction-BYbBPih_.js";import"./buy-Cq5r6s_d.js";const{colors:s,radius:f}=P,m="@media (max-width: 600px)",I=t.div`
2
+ /* Its own stacking context, above the confetti layer (z-index 0). Needed because z-index is inert without
3
+ a position, so the content would otherwise sit below the burst regardless of order. */
4
+ position: relative;
5
+ z-index: 1;
6
+ max-width: 895px;
7
+ margin: 0 auto;
8
+ padding: 32px 12px;
9
+ min-height: 72vh;
10
+ `,V=t.div`
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: center;
14
+ text-align: center;
15
+ justify-content: center;
16
+ min-height: 60vh;
17
+ `,Z=t.span`
18
+ margin: 4px auto 8px;
19
+ width: 40px;
20
+ height: 40px;
21
+ `,$=t.h1`
22
+ font-size: clamp(30px, 4vw, 42px);
23
+ font-weight: 800;
24
+ letter-spacing: -0.02em;
25
+ margin: 20px 0 8px;
26
+ `,C=t.p`
27
+ font-size: 18px;
28
+ color: #4b4b57;
29
+ margin: 0 0 22px;
30
+ `,w=t.div`
31
+ display: flex;
32
+ gap: 18px;
33
+ justify-content: center;
34
+ margin: 0 0 20px;
35
+
36
+ &[data-receipt] {
37
+ justify-content: flex-end;
38
+ margin: 0;
39
+ }
40
+ `,ee=t.a`
41
+ display: inline-block;
42
+ margin: 0;
43
+ color: ${s.accent};
44
+ font-weight: 600;
45
+ font-size: 14px;
46
+ text-decoration: none;
47
+ `,L=t.div`
48
+ display: flex;
49
+ gap: 12px;
50
+ flex-wrap: wrap;
51
+ justify-content: center;
52
+ `,te=t.div`
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: 12px;
56
+ width: 100%;
57
+ `,ne=t.div`
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ gap: 16px;
62
+ padding: 24px 16px;
63
+ background: #e0f7e7;
64
+ border: 1px solid #34ce77;
65
+ border-radius: 16px;
66
+ `,ie=t.span`
67
+ flex-shrink: 0;
68
+ width: 60px;
69
+ height: 60px;
70
+ line-height: 0;
71
+ `,se=t.p`
72
+ flex: 1;
73
+ margin: 0;
74
+ text-align: center;
75
+ font-size: 20px;
76
+ line-height: 1.334;
77
+ color: ${s.text2};
78
+
79
+ & b {
80
+ font-weight: 700;
81
+ }
82
+ `,re=t.div`
83
+ display: flex;
84
+ flex-direction: column;
85
+ padding: 24px;
86
+ background: ${s.white};
87
+ border: 1px solid ${s.gray4};
88
+ border-radius: 16px;
89
+ `,oe=t.div`
90
+ display: flex;
91
+ flex-direction: column;
92
+ `,ce=t.span`
93
+ display: block;
94
+ height: 1px;
95
+ margin: 12px 0;
96
+ background: ${s.gray4};
97
+ `,ae=t.div`
98
+ display: flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ gap: 8px;
102
+ min-height: 109px;
103
+ margin-bottom: 12px;
104
+ padding: 8px 24px;
105
+ border-radius: ${f.btn};
106
+ background: #f4e9ff;
107
+ color: ${s.text};
108
+ `,de=t(B)`
109
+ width: 30px;
110
+ height: 30px;
111
+ color: ${s.text};
112
+ `,le=t.p`
113
+ display: inline-flex;
114
+ align-items: baseline;
115
+ gap: 6px;
116
+ margin: 0;
117
+ `,xe=t.span`
118
+ font-size: 24px;
119
+ font-weight: 700;
120
+ text-transform: capitalize;
121
+ `,pe=t.span`
122
+ font-size: 14px;
123
+ font-weight: 400;
124
+ `,he=t.div`
125
+ display: flex;
126
+ align-items: center;
127
+ gap: 12px;
128
+ `,ue=t.div`
129
+ position: relative;
130
+ flex-shrink: 0;
131
+ width: 137px;
132
+ height: 137px;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ background: ${s.media};
137
+ border: 0.134px solid ${s.muted2};
138
+ border-radius: ${f.btn};
139
+ overflow: hidden;
140
+
141
+ & img {
142
+ width: 83%;
143
+ height: 83%;
144
+ object-fit: contain;
145
+ filter: drop-shadow(0.56px 2.24px 2.8px rgba(0, 0, 0, 0.1));
146
+ }
147
+
148
+ ${m} {
149
+ width: 96px;
150
+ height: 96px;
151
+ }
152
+ `,ge=t.span`
153
+ position: absolute;
154
+ top: 8px;
155
+ left: 8px;
156
+ width: 20px;
157
+ height: 20px;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ background: ${s.dclRed};
162
+ border-radius: ${f.chip};
163
+ line-height: 0;
164
+ `,fe=t.div`
165
+ flex: 1;
166
+ min-width: 0;
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 2px;
170
+ padding: 8px;
171
+ `,me=t.div`
172
+ font-weight: 600;
173
+ font-size: 20px;
174
+ line-height: 1.57;
175
+ color: ${s.text};
176
+ overflow: hidden;
177
+ text-overflow: ellipsis;
178
+ white-space: nowrap;
179
+
180
+ ${m} {
181
+ font-size: 16px;
182
+ }
183
+ `,je=t.span`
184
+ margin-left: 8px;
185
+ font-weight: 600;
186
+ font-size: 13px;
187
+ color: ${s.muted};
188
+ `,we=t(W)`
189
+ position: relative;
190
+ z-index: 1;
191
+ color: ${s.muted};
192
+ font-size: 10px;
193
+
194
+ & [data-avatar] {
195
+ display: none;
196
+ }
197
+ `,be=t.div`
198
+ flex-shrink: 0;
199
+ display: flex;
200
+ align-items: center;
201
+ gap: 4px;
202
+ padding: 8px;
203
+ font-weight: 600;
204
+ font-size: 21px;
205
+ color: ${s.text2};
206
+ white-space: nowrap;
207
+
208
+ ${m} {
209
+ font-size: 18px;
210
+ }
211
+ `,ye=t(B)`
212
+ width: 22px;
213
+ height: 22px;
214
+ `,ve=t.div`
215
+ display: flex;
216
+ gap: 12px;
217
+ align-items: center;
218
+ justify-content: flex-end;
219
+
220
+ ${m} {
221
+ flex-direction: column-reverse;
222
+ }
223
+ `,N=O`
224
+ flex: 1;
225
+ min-width: 0;
226
+ height: 48px;
227
+ display: inline-flex;
228
+ align-items: center;
229
+ justify-content: center;
230
+ gap: 12px;
231
+ padding: 0 24px;
232
+ border-radius: ${f.btn};
233
+ font-weight: 600;
234
+ font-size: 15px;
235
+ letter-spacing: 0.04em;
236
+ text-transform: uppercase;
237
+ text-decoration: none;
238
+ cursor: pointer;
239
+ transition:
240
+ filter 0.15s ease,
241
+ background 0.15s ease;
242
+
243
+ &[data-variant='ghost'] {
244
+ background: transparent;
245
+ border: 2px solid ${s.accent};
246
+ color: ${s.accent};
247
+ }
248
+ &[data-variant='ghost']:hover {
249
+ background: rgba(105, 31, 169, 0.06);
250
+ }
251
+ &[data-variant='ruby'] {
252
+ background: ${s.dclRed};
253
+ border: 0;
254
+ color: ${s.softWhite};
255
+ }
256
+ &[data-variant='ruby']:hover {
257
+ filter: brightness(0.95);
258
+ }
259
+
260
+ ${m} {
261
+ width: 100%;
262
+ flex: none;
263
+ }
264
+ `,ke=t.button`
265
+ ${N};
266
+ `,$e=t.a`
267
+ ${N};
268
+ `,Ce=t.span`
269
+ display: inline-flex;
270
+ align-items: center;
271
+ justify-content: center;
272
+ width: 32px;
273
+ height: 32px;
274
+ border: 2.5px solid rgba(252, 252, 252, 0.5);
275
+ border-radius: ${f.btn};
276
+ line-height: 0;
277
+ `,z=t(K)`
278
+ min-width: 160px;
279
+ text-align: center;
280
+ `;function ze(l){return null}const Re=l=>new Promise(a=>setTimeout(a,l));function Ae(l,a){const[i,c]=S.useState(l?"pending":"confirmed"),x=a?`${a.owner}-${a.contractAddress}-${a.itemId}`:"";return S.useEffect(()=>{if(!l)return;let d=!1;return(async()=>{let g=!1;for(let r=0;r<20&&!d;r++)try{await Y(l,{timeoutMs:15e3}),g=!0;break}catch(y){if(y instanceof G)continue;d||c("failed");return}if(!d){if(!g){c("timed-out");return}if(!a){c("confirmed");return}c("indexing");for(let r=0;r<40&&!d;r++){if(await X(a.owner,a.contractAddress,a.itemId)){d||c("confirmed");return}await Re(3e3)}d||c("timed-out")}})(),()=>{d=!0}},[l,x]),i}const Se=T.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump",Ie=T.chainId===80002?"https://amoy.polygonscan.com/tx/":"https://polygonscan.com/tx/";function Je(){var A;const{state:l,search:a}=E(),i=l??ze(),c=F(),{session:x}=_(),d=i==null?void 0:i.txHash,b=(i==null?void 0:i.items)??[],g=i!=null&&i.creditsAdded&&i.creditsAdded>0?i.creditsAdded:null,r=b[0],y=x!=null&&x.address&&(r!=null&&r.contractAddress)&&(r!=null&&r.itemId)?{owner:x.address,contractAddress:r.contractAddress,itemId:r.itemId}:null,u=Ae(i!=null&&i.settled?void 0:d,y);q({title:n("seo.success.title"),noindex:!0});const p=b;if(p.length===0)return e.jsx(M,{to:"/items",replace:!0});const R=p[0],j=(A=i==null?void 0:i.txHashes)!=null&&A.length?i.txHashes:d?[d]:[],h=j.length>0&&J(x==null?void 0:x.providerType)?j.map((o,v)=>e.jsx(ee,{href:`${Ie}${o}`,target:"_blank",rel:"noreferrer",children:j.length>1?n("success.viewTransactionNumbered",{n:v+1,total:j.length}):n("success.viewTransaction")},o)):null;return u!=="confirmed"?e.jsx(I,{children:e.jsx(V,{children:u==="pending"||u==="indexing"?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"spinner","aria-hidden":!0}),e.jsx($,{children:u==="indexing"?n("success.finalizing"):n("success.processing")}),e.jsx(C,{children:u==="indexing"?e.jsxs(e.Fragment,{children:[n("success.indexingBefore")," ",p.length===1?e.jsx("strong",{children:R.name}):n("success.itemCount",{count:p.length})," ",n("success.indexingAfter")]}):e.jsxs(e.Fragment,{children:[n("success.confirmingBefore")," ",p.length===1?e.jsx("strong",{children:R.name}):n("success.itemCount",{count:p.length})," ",n("success.confirmingAfter")]})}),h?e.jsx(w,{children:h}):null]}):u==="timed-out"?e.jsxs(e.Fragment,{children:[e.jsx($,{children:n("success.stillProcessingTitle")}),e.jsxs(C,{children:[n("success.timedOutBefore")," ",e.jsx("button",{className:"link",onClick:()=>c("/activity"),children:n("nav.activity")})," ",n("success.timedOutAfter")]}),h?e.jsx(w,{children:h}):null,e.jsxs(L,{children:[e.jsx(z,{variant:"purple",onClick:()=>c("/activity"),children:n("success.viewActivity")}),e.jsx(z,{variant:"ghost",onClick:()=>c("/items"),children:n("success.keepShopping")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{children:n("success.failedTitle")}),e.jsx(C,{children:n("success.failedBody")}),h?e.jsx(w,{children:h}):null,e.jsx(L,{children:e.jsx(z,{variant:"purple",onClick:()=>c("/items"),children:n("success.backToShop")})})]})})}):e.jsxs(I,{children:[e.jsx(Q,{}),e.jsxs(te,{children:[e.jsxs(ne,{role:"status",children:[e.jsx(ie,{"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(se,{children:[e.jsx("b",{children:n("success.bannerTitle")})," ",n("success.bannerBody")]})]}),e.jsxs(re,{children:[g?e.jsxs(ae,{"data-testid":"success-credits",children:[e.jsx(de,{}),e.jsxs(le,{children:[e.jsx(xe,{children:n("getCredits.creditsAmount",{credits:g,currency:U.name})})," ",e.jsx(pe,{children:n("getCredits.creditsAdded")})]})]}):null,p.map((o,v)=>{const k=o.quantity??1;return e.jsxs(oe,{children:[v>0?e.jsx(ce,{"aria-hidden":!0}):null,e.jsxs(he,{children:[e.jsxs(ue,{children:[o.thumbnail?e.jsx("img",{src:o.thumbnail,alt:""}):null,e.jsx(ge,{"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(fe,{children:[e.jsxs(me,{title:o.name,children:[o.name||n("buyModal.itemFallback"),k>1?e.jsx(je,{children:n("cartCheckout.qty",{count:k})}):null]}),o.creator?e.jsx(we,{address:o.creator,linkToProfile:!0}):null]}),e.jsxs(be,{children:[e.jsx(ye,{}),e.jsx("span",{children:D(o.priceCredits*k)})]})]})]},o.id)})]}),h?e.jsx(w,{"data-receipt":!0,children:h}):null,e.jsxs(ve,{children:[e.jsx(ke,{"data-variant":"ghost",onClick:()=>c(H(p.map(o=>o.category))),children:n("success.myAssets")}),e.jsxs($e,{"data-variant":"ruby",href:Se,target:"_blank",rel:"noreferrer",children:[n("success.tryInWorld"),e.jsx(Ce,{"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{Je as Success,Je 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-BkgMeT5j.js";import{au as C}from"./NetworkUtil-DXqql1Wz.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-A5mBxhYF.js";import{au as C}from"./NetworkUtil-DXqql1Wz.js";const b={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=b.getGasPriceInEther(o,t);return T.bigNumber(n).times(s).toNumber()},getPriceImpact({sourceTokenAmount:n,sourceTokenPriceInUSD:o,toTokenPriceInUSD:t,toTokenAmount:s}){const c=T.bigNumber(n).times(o),r=T.bigNumber(s).times(t);return c.minus(r).div(c).times(100).toNumber()},getMaxSlippage(n,o){const t=T.bigNumber(n).div(100);return T.multiply(o,t).toNumber()},getProviderFee(n,o=.0085){return T.bigNumber(n).times(o).toString()},isInsufficientNetworkTokenForGas(n,o){const t=o||"0";return T.bigNumber(n).eq(0)?!0:T.bigNumber(T.bigNumber(t)).gt(n)},isInsufficientSourceTokenForSwap(n,o,t){var r,d;const s=(d=(r=t==null?void 0:t.find(l=>l.address===o))==null?void 0:r.quantity)==null?void 0:d.numeric;return T.bigNumber(s||"0").lt(n)}},x=15e4,Q=6,m={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:_.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},e=$({...m}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,h,y,A,S,P;const n=g.state.activeChain,o=((i=g.getAccountData(n))==null?void 0:i.caipAddress)??g.state.activeCaipAddress,t=W.getPlainAddress(o),s=R(),c=H.getConnectorId(g.state.activeChain);if(!t)throw new Error("No address found to swap the tokens from.");const r=!((u=e.toToken)!=null&&u.address)||!((p=e.toToken)!=null&&p.decimals),d=!((w=e.sourceToken)!=null&&w.address)||!((h=e.sourceToken)!=null&&h.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(y=e.sourceToken)==null?void 0:y.address,toTokenAddress:(A=e.toToken)==null?void 0:A.address,toTokenAmount:e.toTokenAmount,toTokenDecimals:(S=e.toToken)==null?void 0:S.decimals,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:(P=e.sourceToken)==null?void 0:P.decimals,invalidToToken:r,invalidSourceToken:d,invalidSourceTokenAmount:l,availableToSwap:o&&!r&&!d&&!l,isAuthConnector:c===C.CONNECTOR_ID.AUTH}},async setSourceToken(n){if(!n){e.sourceToken=n,e.sourceTokenAmount="",e.sourceTokenPriceInUSD=0;return}e.sourceToken=n,await a.setTokenPrice(n.address,"sourceToken")},setSourceTokenAmount(n){e.sourceTokenAmount=n},async setToToken(n){if(!n){e.toToken=n,e.toTokenAmount="",e.toTokenPriceInUSD=0;return}e.toToken=n,await a.setTokenPrice(n.address,"toToken")},setToTokenAmount(n){e.toTokenAmount=n?T.toFixed(n,Q):""},async setTokenPrice(n,o){let t=e.tokensPriceMap[n]||0;t||(e.loadingPrices=!0,t=await a.getAddressPrice(n)),o==="sourceToken"?e.sourceTokenPriceInUSD=t:o==="toToken"&&(e.toTokenPriceInUSD=t),e.loadingPrices&&(e.loadingPrices=!1),a.getParams().availableToSwap&&!e.switchingTokens&&a.swapTokens()},async switchTokens(){if(!(e.initializing||!e.initialized||e.switchingTokens)){e.switchingTokens=!0;try{const n=e.toToken?{...e.toToken}:void 0,o=e.sourceToken?{...e.sourceToken}:void 0,t=n&&e.toTokenAmount===""?"1":e.toTokenAmount;a.setSourceTokenAmount(t),a.setToTokenAmount(""),await a.setSourceToken(n),await a.setToToken(o),e.switchingTokens=!1,a.swapTokens()}catch(n){throw e.switchingTokens=!1,n}}},resetState(){e.myTokensWithBalance=m.myTokensWithBalance,e.tokensPriceMap=m.tokensPriceMap,e.initialized=m.initialized,e.initializing=m.initializing,e.switchingTokens=m.switchingTokens,e.sourceToken=m.sourceToken,e.sourceTokenAmount=m.sourceTokenAmount,e.sourceTokenPriceInUSD=m.sourceTokenPriceInUSD,e.toToken=m.toToken,e.toTokenAmount=m.toTokenAmount,e.toTokenPriceInUSD=m.toTokenPriceInUSD,e.networkPrice=m.networkPrice,e.networkTokenSymbol=m.networkTokenSymbol,e.networkBalanceInUSD=m.networkBalanceInUSD,e.inputError=m.inputError},resetValues(){var t;const{networkAddress:n}=a.getParams(),o=(t=e.tokens)==null?void 0:t.find(s=>s.address===n);a.setSourceToken(o),a.setToToken(void 0)},getApprovalLoadingState(){return e.loadingApprovalTransaction},clearError(){e.transactionError=void 0},async initializeState(){if(!e.initializing){if(e.initializing=!0,!e.initialized)try{await a.fetchTokens(),e.initialized=!0}catch{e.initialized=!1,f.showError("Failed to initialize swap"),I.goBack()}e.initializing=!1}},async fetchTokens(){var t;const{networkAddress:n}=a.getParams();await a.getNetworkTokenPrice(),await a.getMyTokensWithBalance();const o=(t=e.myTokensWithBalance)==null?void 0:t.find(s=>s.address===n);o&&(e.networkTokenSymbol=o.symbol,a.setSourceToken(o),a.setSourceTokenAmount("0"))},async getTokenList(){var o,t;const n=(o=g.state.activeCaipNetwork)==null?void 0:o.caipNetworkId;if(!(e.caipNetworkId===n&&e.tokens))try{e.tokensLoading=!0;const s=await E.getTokenList(n);e.tokens=s,e.caipNetworkId=n,e.popularTokens=s.sort((i,u)=>i.symbol<u.symbol?-1:i.symbol>u.symbol?1:0);const r=(n&&((t=_.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(_.SWAP_SUGGESTED_TOKENS||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i).filter(i=>!r.some(u=>u.address===i.address));e.suggestedTokens=[...r,...l]}catch{e.tokens=[],e.popularTokens=[],e.suggestedTokens=[]}finally{e.tokensLoading=!1}},async getAddressPrice(n){var i,u;const o=e.tokensPriceMap[n];if(o)return o;const t=await N.fetchTokenPrice({addresses:[n]}),s=(t==null?void 0:t.fungibles)||[],c=[...e.tokens||[],...e.myTokensWithBalance||[]],r=(i=c==null?void 0:c.find(p=>p.address===n))==null?void 0:i.symbol,d=((u=s.find(p=>p.symbol.toLowerCase()===(r==null?void 0:r.toLowerCase())))==null?void 0:u.price)||0,l=parseFloat(d.toString());return e.tokensPriceMap[n]=l,l},async getNetworkTokenPrice(){var c;const{networkAddress:n}=a.getParams(),t=(c=(await N.fetchTokenPrice({addresses:[n]}).catch(()=>(f.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:c[0],s=(t==null?void 0:t.price.toString())||"0";e.tokensPriceMap[n]=parseFloat(s),e.networkTokenSymbol=(t==null?void 0:t.symbol)||"",e.networkPrice=s},async getMyTokensWithBalance(n){var s;const o=await z.getMyTokensWithBalance({forceUpdate:n,caipNetwork:g.state.activeCaipNetwork,address:(s=g.getAccountData())==null?void 0:s.address}),t=E.mapBalancesToSwapTokens(o);t&&(await a.getInitialGasPrice(),a.setBalances(t))},setBalances(n){const{networkAddress:o}=a.getParams(),t=g.state.activeCaipNetwork;if(!t)return;const s=n.find(c=>c.address===o);n.forEach(c=>{e.tokensPriceMap[c.address]=c.price||0}),e.myTokensWithBalance=n.filter(c=>c.address.startsWith(t.caipNetworkId)),e.networkBalanceInUSD=s?T.multiply(s.quantity.numeric,s.price).toString():"0"},async getInitialGasPrice(){var o,t;const n=await E.fetchGasPrice();if(!n)return{gasPrice:null,gasPriceInUSD:null};switch((t=(o=g.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case C.CHAIN.SOLANA:return e.gasFee=n.standard??"0",e.gasPriceInUSD=T.multiply(n.standard,e.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(e.gasFee),gasPriceInUSD:Number(e.gasPriceInUSD)};case C.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=b.getGasPriceInUSD(e.networkPrice,r,c);return e.gasFee=s,e.gasPriceInUSD=d,{gasPrice:c,gasPriceInUSD:d}}},async swapTokens(){var r,d,l;const n=(r=g.getAccountData())==null?void 0:r.address,o=e.sourceToken,t=e.toToken,s=T.bigNumber(e.sourceTokenAmount).gt(0);if(s||a.setToTokenAmount(""),!t||!o||e.loadingPrices||!s||!n)return;e.loadingQuote=!0;const c=T.bigNumber(e.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const i=await N.fetchSwapQuote({userAddress:n,from:o.address,to:t.address,gasPrice:e.gasFee,amount:c.toString()});e.loadingQuote=!1;const u=(l=(d=i==null?void 0:i.quotes)==null?void 0:d[0])==null?void 0:l.toAmount;if(!u){O.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const p=T.bigNumber(u).div(10**t.decimals).toString();a.setToTokenAmount(p),a.hasInsufficientToken(e.sourceTokenAmount,o.address)?e.inputError="Insufficient balance":(e.inputError=void 0,a.setTransactionDetails())}catch(i){const u=await E.handleSwapError(i);e.loadingQuote=!1,e.inputError=u||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:n,availableToSwap:o}=a.getParams(),t=e.sourceToken,s=e.toToken;if(!(!n||!o||!t||!s||e.loadingQuote))try{e.loadingBuildTransaction=!0;const c=await E.fetchSwapAllowance({userAddress:n,tokenAddress:t.address,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:t.decimals});let r;return c?r=await a.createSwapTransaction():r=await a.createAllowanceTransaction(),e.loadingBuildTransaction=!1,e.fetchError=!1,r}catch{I.goBack(),f.showError("Failed to check allowance"),e.loadingBuildTransaction=!1,e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:n,sourceTokenAddress:o,toTokenAddress:t}=a.getParams();if(!(!n||!t)){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const s=await N.generateApproveCalldata({from:o,to:t,userAddress:n}),c=W.getPlainAddress(s.tx.from);if(!c)throw new Error("SwapController:createAllowanceTransaction - address is required");const r={data:s.tx.data,to:c,gasPrice:BigInt(s.tx.eip155.gasPrice),value:BigInt(s.tx.value),toAmount:e.toTokenAmount};return e.swapTransaction=void 0,e.approvalTransaction={data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount},{data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount}}catch{I.goBack(),f.showError("Failed to create approval transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}}},async createSwapTransaction(){var d,l;const{networkAddress:n,fromCaipAddress:o,sourceTokenAmount:t}=a.getParams(),s=e.sourceToken,c=e.toToken;if(!o||!t||!s||!c)return;let r=(d=B.parseUnits(t,s.decimals))==null?void 0:d.toString();try{const i=s.address===n;let u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:r,disableEstimate:!0}),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice);if(i&&r){const A=(l=e.myTokensWithBalance)==null?void 0:l.find(S=>S.address===n);if(A){const S=parseInt(A.quantity.decimals,10),P=B.parseUnits(A.quantity.numeric,S)??0n,v=p*w;if(BigInt(r)+v>P){const k=P>v?P-v:0n;k>0n&&(u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:k.toString(),disableEstimate:!0}),r=k.toString(),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice))}}}const h=W.getPlainAddress(u.tx.to);if(!h)throw new Error("SwapController:createSwapTransaction - address is required");const y={data:u.tx.data,to:h,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=b.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=y,y}catch{I.goBack(),f.showError("Failed to create transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){f.showLoading("Approve limit increase in your wallet"),I.replace("SwapPreview")},async sendTransactionForApproval(n){var c,r,d;const{fromAddress:o,isAuthConnector:t}=a.getParams();e.loadingApprovalTransaction=!0,t?I.pushTransactionStack({onSuccess:a.onEmbeddedWalletApprovalSuccess}):f.showLoading("Approve limit increase in your wallet");try{await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:C.CHAIN.EVM}),await a.swapTokens(),await a.getTransaction(),e.approvalTransaction=void 0,e.loadingApprovalTransaction=!1}catch(l){const i=l;e.transactionError=i==null?void 0:i.displayMessage,e.loadingApprovalTransaction=!1,f.showError((i==null?void 0:i.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(i==null?void 0:i.displayMessage)||(i==null?void 0:i.message)||"Unknown",network:((c=g.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",swapFromToken:((r=a.state.sourceToken)==null?void 0:r.symbol)||"",swapToToken:((d=a.state.toToken)==null?void 0:d.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,h,y,A,S,P,v;if(!n)return;const{fromAddress:o,toTokenAmount:t,isAuthConnector:s}=a.getParams();e.loadingTransaction=!0;const c=`Swapping ${(d=e.sourceToken)==null?void 0:d.symbol} to ${T.formatNumberToLocalString(t,3)} ${(l=e.toToken)==null?void 0:l.symbol}`,r=`Swapped ${(i=e.sourceToken)==null?void 0:i.symbol} to ${T.formatNumberToLocalString(t,3)} ${(u=e.toToken)==null?void 0:u.symbol}`;s?I.pushTransactionStack({onSuccess(){I.replace("Account"),f.showLoading(c),D.resetState()}}):f.showLoading("Confirm transaction in your wallet");try{const U=[(p=e.sourceToken)==null?void 0:p.address,(w=e.toToken)==null?void 0:w.address].join(","),k=await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:C.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((h=g.state.activeCaipNetwork)==null?void 0:h.caipNetworkId)||"",swapFromToken:((y=a.state.sourceToken)==null?void 0:y.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}}),D.resetState(),s||I.replace("Account"),D.getMyTokensWithBalance(U),k}catch(U){const k=U;e.transactionError=k==null?void 0:k.displayMessage,e.loadingTransaction=!1,f.showError((k==null?void 0:k.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(k==null?void 0:k.displayMessage)||(k==null?void 0:k.message)||"Unknown",network:((S=g.state.activeCaipNetwork)==null?void 0:S.caipNetworkId)||"",swapFromToken:((P=a.state.sourceToken)==null?void 0:P.symbol)||"",swapToToken:((v=a.state.toToken)==null?void 0:v.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(C.CHAIN.EVM)===L.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return b.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=b.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=b.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=b.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=b.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
@@ -1,4 +1,4 @@
1
- import{r as o,j as C,e as T}from"./react-BYHuwl8r.js";import{s as P,t as i}from"./index-BLKe1fxG.js";const B=(...t)=>({shouldForwardProp:p=>!t.includes(p)}),A=P("span",B("block"))`
1
+ import{r as o,j as C,e as T}from"./react-BYHuwl8r.js";import{s as P,t as i}from"./index-CwFxxSc1.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"))`