@dcl/shop 0.10.1-31022274185.commit-4782a6d → 0.10.1-31028852348.commit-7ee46b2

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 (232) hide show
  1. package/_assets/{Activity-BdWXscja.js → Activity-CigX50L3.js} +7 -7
  2. package/_assets/{AnimatedBackground-IWRv7M5f.js → AnimatedBackground-DQ6OLCoU.js} +1 -1
  3. package/_assets/{Assets-jMwS0L0Z.js → Assets-DJRdumAs.js} +15 -15
  4. package/_assets/{Assets.styles-BYK-8Oxq.js → Assets.styles-NJ8NHCYq.js} +1 -1
  5. package/_assets/{Authorizations-vJu-Ee1Y.js → Authorizations-CDxVuPnj.js} +1 -1
  6. package/_assets/{Cart-BcTNvuY7.js → Cart-D3_Ra0ur.js} +2 -2
  7. package/_assets/{CircularProgress-vR-tHD8N.js → CircularProgress-ChZh9f9d.js} +3 -3
  8. package/_assets/{Collection-D6DT1DJs.js → Collection-C0J3XbBO.js} +3 -3
  9. package/_assets/{CollectionCarousel-COl6kYhG.js → CollectionCarousel-D2NxSMbi.js} +12 -12
  10. package/_assets/Confetti-VpUDp1T6.js +17 -0
  11. package/_assets/{ConstantsUtil-BkhvNc68.js → ConstantsUtil-CtukCvy7.js} +1 -1
  12. package/_assets/{ContentClient-CGWTGqN4.js → ContentClient-Cm1xl3FD.js} +1 -1
  13. package/_assets/{Creator-ViSXVv6v.js → Creator-B8J8Ean2.js} +27 -27
  14. package/_assets/{DeploymentBuilder-CFls_09j.js → DeploymentBuilder-CF7zLfx2.js} +1 -1
  15. package/_assets/{ErrorNotice-Cc1oxuPj.js → ErrorNotice-D6XnSgq5.js} +1 -1
  16. package/_assets/{ExchangeController-weKEF6Fo.js → ExchangeController-9gSeZk-R.js} +1 -1
  17. package/_assets/{Faq-XhwmepN6.js → Faq-CqUlJMQp.js} +1 -1
  18. package/_assets/{GetCredits-BSkExYX7.js → GetCredits-TC1jtwLD.js} +57 -52
  19. package/_assets/{Grow-QVzgT-x3.js → Grow-B-8-3S9q.js} +1 -1
  20. package/_assets/{HelpersUtil-B5gLBeY_.js → HelpersUtil-D7LUjgP8.js} +1 -1
  21. package/_assets/{ItemDetail-CX_KaeEs.js → ItemDetail-D9doMNSy.js} +1 -1
  22. package/_assets/LazyEmoteControls-dSxYScIK.js +2 -0
  23. package/_assets/{LoadMore-HeeBSVXn.js → LoadMore-BwyaRmBN.js} +1 -1
  24. package/_assets/{ManaPricingBanner.styles-Bx_fyxrd.js → ManaPricingBanner.styles-24s7fEAg.js} +1 -1
  25. package/_assets/{MyAssets-CBFb0SKZ.js → MyAssets-BtyDd3H7.js} +1 -1
  26. package/_assets/{MyFavorites-I92NNY62.js → MyFavorites-D752r8xS.js} +1 -1
  27. package/_assets/{NetworkUtil-CO-1nCx-.js → NetworkUtil-DXqql1Wz.js} +1 -1
  28. package/_assets/{NotFound-BoyCft0n.js → NotFound-Bp2wRAVw.js} +1 -1
  29. package/_assets/{NotificationsBell-C9UXpBG2.js → NotificationsBell-C0izFIqy.js} +1 -1
  30. package/_assets/{OutfitDetail-CB_q7CSq.js → OutfitDetail-DS1ydlgG.js} +12 -12
  31. package/_assets/{OutfitPreview-CRGZ6ulM.js → OutfitPreview-HYP35Evg.js} +2 -2
  32. package/_assets/{OutfitStudio-C98494xB.js → OutfitStudio-DK4lFyMN.js} +1 -1
  33. package/_assets/{StoreSettings-CCXo5LZ8.js → StoreSettings-CWqyz2N6.js} +1 -1
  34. package/_assets/Success-CbOZDmIg.js +280 -0
  35. package/_assets/{SwapController-CqQfcMUY.js → SwapController-BmvKI3tr.js} +1 -1
  36. package/_assets/{Tooltip-DiQRnF2Q.js → Tooltip-eqp6A3GF.js} +2 -2
  37. package/_assets/{TradeService-YAhr72dC.js → TradeService-1DD8KzmO.js} +1 -1
  38. package/_assets/{W3MFrameProviderSingleton-KqjOf7qE.js → W3MFrameProviderSingleton-PsbedX0Z.js} +3 -3
  39. package/_assets/{WebCryptoP256-D3wkQcJU.js → WebCryptoP256-C7JaegVP.js} +1 -1
  40. package/_assets/{authorizations-Dge9-BPU.js → authorizations-VEZPJ_sN.js} +1 -1
  41. package/_assets/{basic-j-Y5JIO8.js → basic-CzA-7Ag_.js} +1 -1
  42. package/_assets/{biconomy-sywQv7Rk.js → biconomy-BrXwbrpZ.js} +1 -1
  43. package/_assets/{browser-DrmA6_0y.js → browser-DxF-qILS.js} +1 -1
  44. package/_assets/{browser-ponyfill-fSxUcg6c.js → browser-ponyfill-Dj0kiq3a.js} +1 -1
  45. package/_assets/{builder-pl21oKFg.js → builder-D3EuYpNJ.js} +1 -1
  46. package/_assets/{buy-AvolTNyl.js → buy-DiWx4d9p.js} +1 -1
  47. package/_assets/{buy-gasless-CmyKiZii.js → buy-gasless-M8aQxuIP.js} +1 -1
  48. package/_assets/{categories-CsBqvArM.js → categories-CFPQARu6.js} +17 -17
  49. package/_assets/{ccip-t6sFWr80.js → ccip-B12M-vDq.js} +1 -1
  50. package/_assets/{ccip-B1ir1dk0.js → ccip-g9JibD3X.js} +1 -1
  51. package/_assets/{chains-BqVOrxrG.js → chains-Dlj4CXzw.js} +1 -1
  52. package/_assets/collectionPage.styles-DalukIyM.js +48 -0
  53. package/_assets/{common-CkYiP-7J.js → common-B0ixkeRu.js} +1 -1
  54. package/_assets/{controller-DNde5iKW.js → controller-CpSqtfB0.js} +2 -2
  55. package/_assets/{core-BySs3RVN.js → core-DAW092d_.js} +4 -4
  56. package/_assets/{createSvgIcon-gFvd2FCs.js → createSvgIcon-B_5Av69a.js} +2 -2
  57. package/_assets/{custom-C6335g9Q.js → custom-Cj6t1jZs.js} +1 -1
  58. package/_assets/{data-capture-eQ5NsqAI.js → data-capture-_thjzrhO.js} +1 -1
  59. package/_assets/decimals-CMCAWgOh.js +1 -0
  60. package/_assets/{decimals-DyjR4aoq.js → decimals-CqRsKj6U.js} +1 -1
  61. package/_assets/{detectExtension-DWfhzRDC.js → detectExtension-DX7grDLh.js} +1 -1
  62. package/_assets/{disposePreview-flulL6RX.js → disposePreview-C6zVmkpS.js} +1 -1
  63. package/_assets/{email-BfD3HGlL.js → email-DYBIuKzr.js} +1 -1
  64. package/_assets/{embedded-wallet-gF9qNEwy.js → embedded-wallet-D1POZsYW.js} +1 -1
  65. package/_assets/{emotion-styled.browser.esm-nPJqw7mn.js → emotion-styled.browser.esm-DfgRJywI.js} +1 -1
  66. package/_assets/{engine-mV7TUuM7.js → engine-Bt7605K_.js} +1 -1
  67. package/_assets/{errors-i7IRVO4d.js → errors-D6OmNx4B.js} +1 -1
  68. package/_assets/estimate-l1-fee-DqgaZXS_.js +1 -0
  69. package/_assets/eth_estimateGas-BZtzeL48.js +1 -0
  70. package/_assets/{eth_getStorageAt-C4Yqzc5m.js → eth_getStorageAt-E4OzrSEc.js} +1 -1
  71. package/_assets/eth_getTransactionCount-Ck8bEyl_.js +1 -0
  72. package/_assets/{ethereum-DFU7Vz3W.js → ethereum-CBeS7QFR.js} +1 -1
  73. package/_assets/{ethers-lk3HAbPB.js → ethers-BDpbhgX6.js} +1 -1
  74. package/_assets/{execute-D4STlI5E.js → execute-D0JcWnG6.js} +2 -2
  75. package/_assets/{extractIPFS-DzfSqAlh.js → extractIPFS-ChPZSPQw.js} +1 -1
  76. package/_assets/{features-Der6G2-p.js → features-B2JmEbS8.js} +1 -1
  77. package/_assets/{fetchTokenMetadata-DYDuYy-D.js → fetchTokenMetadata-BEymqUwt.js} +2 -2
  78. package/_assets/{field.styles-D_tiVUDr.js → field.styles-DNDY0ykF.js} +1 -1
  79. package/_assets/{fortmatic-9W3d2zrH.js → fortmatic-HaPICQeD.js} +1 -1
  80. package/_assets/{get-bytecode-BsB9WanS.js → get-bytecode-BRKTQsHC.js} +1 -1
  81. package/_assets/get-ecosystem-wallet-info-BhIaKjNl.js +1 -0
  82. package/_assets/{getBalance-DzJJyiOj.js → getBalance-BRa5By1O.js} +2 -2
  83. package/_assets/{getInstalledModules-BE5-ES5I.js → getInstalledModules-DbNUTCf0.js} +1 -1
  84. package/_assets/getNFT-ComxT9hu.js +1 -0
  85. package/_assets/{getNFT-Bgt8Aq0n.js → getNFT-DTEYHChd.js} +2 -2
  86. package/_assets/{grid.styles-GkZpb-YA.js → grid.styles-CzCzWVNk.js} +1 -1
  87. package/_assets/{hashTypedData-Jo4TovAi.js → hashTypedData-ByuohUDu.js} +1 -1
  88. package/_assets/{hashTypedData-BbII8B45.js → hashTypedData-DBpctTYo.js} +1 -1
  89. package/_assets/{in-app-B8kujX2g.js → in-app-BgoUHldk.js} +1 -1
  90. package/_assets/{in-app-wallet-calls-B7txplxO.js → in-app-wallet-calls-HXfb_fUr.js} +1 -1
  91. package/_assets/{index-9fsiI1dP.js → index-7aKGFrXM.js} +339 -339
  92. package/_assets/{index-BH0uyXQR.js → index-B4qED6s6.js} +1 -1
  93. package/_assets/{index-DdFEu3p_.js → index-B7Q8DD_B.js} +1 -1
  94. package/_assets/{index-nkTANarg.js → index-BATE0xL0.js} +1 -1
  95. package/_assets/{index-DjaVGMuG.js → index-BAnQdgwq.js} +1 -1
  96. package/_assets/{index-BIQbox-q.js → index-BEoweKSv.js} +1 -1
  97. package/_assets/{index-BBoR8s_p.js → index-BWvALODD.js} +1 -1
  98. package/_assets/{index-BzcwOGk4.js → index-BX3lLNL7.js} +1 -1
  99. package/_assets/{index-DhsyG2Bx.js → index-BaAaaHEn.js} +1 -1
  100. package/_assets/{index-a--tNk8b.js → index-BaUbrWB6.js} +1 -1
  101. package/_assets/{index-BAii_HrS.js → index-Bc8rwSjv.js} +1 -1
  102. package/_assets/{index-BzCFzqHv.js → index-BikezBJ2.js} +1 -1
  103. package/_assets/{index-CdtBvk_6.js → index-BmYn9NG5.js} +1 -1
  104. package/_assets/{index-CJHWNPsK.js → index-BrL1_rj5.js} +1 -1
  105. package/_assets/{index-Cg3mCf-z.js → index-BsOFE-j9.js} +1 -1
  106. package/_assets/{index-KJ7hHQUO.js → index-BuUQ4paE.js} +1 -1
  107. package/_assets/{index-DV5krbkT.js → index-Byukd2ip.js} +1 -1
  108. package/_assets/{index-CNxC2eH9.js → index-C7QtkdGe.js} +3 -3
  109. package/_assets/{index-CilIP5Db.js → index-C9h0h4Va.js} +1 -1
  110. package/_assets/{index-BgDxkCXj.js → index-C9tRkmFA.js} +3 -3
  111. package/_assets/{index-BGwmGbFC.js → index-C9toGe09.js} +1 -1
  112. package/_assets/{index-BEUF7pWH.js → index-CF_-5pxH.js} +1 -1
  113. package/_assets/{index-BhB231bL.js → index-CN4l5w2c.js} +1 -1
  114. package/_assets/{index-Z2CCU8JP.js → index-COLJBKtL.js} +1 -1
  115. package/_assets/index-CRDob50n.js +2 -0
  116. package/_assets/{index-zdnZ7bAw.js → index-CTVWaU3M.js} +1 -1
  117. package/_assets/{index-Cm_Vh7sp.js → index-CTzs-RFl.js} +1 -1
  118. package/_assets/{index-Zeekf47-.js → index-CXZ6TE-R.js} +2 -2
  119. package/_assets/{index-C6-66TBI.js → index-CYCulN9T.js} +1 -1
  120. package/_assets/{index-CPRvv8dV.js → index-Cb1sLBYD.js} +1 -1
  121. package/_assets/{index-CW9SstXe.js → index-CblGXufl.js} +1 -1
  122. package/_assets/{index-CI756Vop.js → index-CsFnaCM6.js} +1 -1
  123. package/_assets/{index-QWoFtWk4.js → index-CtHR7imI.js} +2 -2
  124. package/_assets/{index-BFc9QBOX.js → index-CvMtNHcX.js} +1 -1
  125. package/_assets/{index-7vaOJntM.js → index-CwklEm59.js} +1 -1
  126. package/_assets/{index-DRT-S6qO.js → index-CxQtr_qc.js} +1 -1
  127. package/_assets/{index-pKUeb2uA.js → index-Cxg0TJh_.js} +1 -1
  128. package/_assets/{index-DisPR-D1.js → index-D45DN5Yt.js} +1 -1
  129. package/_assets/{index-B0Nj1Xpe.js → index-DGZgLX5H.js} +1 -1
  130. package/_assets/{index-BsSKIwHD.js → index-DU4h63RV.js} +1 -1
  131. package/_assets/{index-DN6oK0a_.js → index-DZ6Zf8cL.js} +1 -1
  132. package/_assets/{index-BoMWXzX5.js → index-DZBDBoD6.js} +1 -1
  133. package/_assets/{index-B_SpMQgA.js → index-Da0n9SaW.js} +1 -1
  134. package/_assets/index-DbLpdy-5.js +1 -0
  135. package/_assets/{index-DBMOyGsQ.js → index-Dd7R8qxv.js} +1 -1
  136. package/_assets/{index-CosPU-Pz.js → index-DnF_nTtx.js} +1 -1
  137. package/_assets/{index-BlLd8_kE.js → index-EfmTxpXI.js} +2 -2
  138. package/_assets/{index-CmMwEyKm.js → index-HR2zmIA4.js} +1 -1
  139. package/_assets/{index-BTdh2U-c.js → index-IXh2Q2J2.js} +3 -3
  140. package/_assets/{index-B_4ecENW.js → index-JjyTJp_-.js} +1 -1
  141. package/_assets/{index-DzGUGKu8.js → index-KziiJ1MB.js} +1 -1
  142. package/_assets/{index-an13IKeD.js → index-NkUzrTXh.js} +1 -1
  143. package/_assets/{index-CtbulfdO.js → index-VK2LxTLC.js} +1 -1
  144. package/_assets/{index-BJTaG1cJ.js → index-WyOcp-XQ.js} +1 -1
  145. package/_assets/{index-DhZO_7SD.js → index-XrnrxyLZ.js} +1 -1
  146. package/_assets/{index-Cgd_FunJ.js → index-YXfWp7gV.js} +1 -1
  147. package/_assets/{index-CC3KVZ-C.js → index-_c5LJlQE.js} +1 -1
  148. package/_assets/{index-9a0pGAdR.js → index-cA9Sym3q.js} +2 -2
  149. package/_assets/{index-yRh-9gVq.js → index-mcZn2Bos.js} +1 -1
  150. package/_assets/{index-CydESP8d.js → index-qrMtap-4.js} +1 -1
  151. package/_assets/{index-CJEkcTww.js → index-w01WQ1OT.js} +1 -1
  152. package/_assets/{index-BOhYLjC3.js → index-xME7lh6v.js} +14 -14
  153. package/_assets/{index-DyHpqJDr.js → index-z8fYuNDI.js} +1 -1
  154. package/_assets/{index-BmYxE89b.js → index-zC8tKISW.js} +1 -1
  155. package/_assets/{index.es-CUe7SzmV.js → index.es-B-0r3sbJ.js} +1 -1
  156. package/_assets/{index.es-DrfFlp1M.js → index.es-C4oAOZ2V.js} +1 -1
  157. package/_assets/{index.es-DRJn-GR3.js → index.es-CWvEJSJR.js} +1 -1
  158. package/_assets/{index.es-CieMPR2f.js → index.es-bgwXQ5E4.js} +4 -4
  159. package/_assets/{linkAccount-CNeA4_rd.js → linkAccount-BtAQZlYa.js} +1 -1
  160. package/_assets/{localBatchGatewayRequest-DwqZ_c_f.js → localBatchGatewayRequest-C0Yfw2SP.js} +1 -1
  161. package/_assets/{native-D1Bt7nPF.js → native-CPZ4GKee.js} +1 -1
  162. package/_assets/{networks-BS86h9Lh.js → networks-DaUteCMs.js} +1 -1
  163. package/_assets/{onramp-D7D0OCk9.js → onramp-E_XfxB53.js} +1 -1
  164. package/_assets/{openzeppelin-CxXtbXDY.js → openzeppelin-BSVQsRfY.js} +1 -1
  165. package/_assets/{ownerOf-CSle-7WO.js → ownerOf-DmpjD1-R.js} +1 -1
  166. package/_assets/parseNft-Ctg1LaeO.js +2 -0
  167. package/_assets/{parseSignature-CoGmS7c0.js → parseSignature-2whYRs5e.js} +3 -3
  168. package/_assets/{parseSignature-vRwiK7Zw.js → parseSignature-COvtrwS_.js} +1 -1
  169. package/_assets/{passkeys-BR6U3pW1.js → passkeys-Djkwk7Kp.js} +1 -1
  170. package/_assets/{pay-with-exchange-Dw68xRlY.js → pay-with-exchange-B8CcENx3.js} +1 -1
  171. package/_assets/{prepare-contract-call-Nm9e1q7x.js → prepare-contract-call-DDzIRXLv.js} +1 -1
  172. package/_assets/{qr-overlay-BaYLL_Em.js → qr-overlay-a6_koH6J.js} +3 -3
  173. package/_assets/{react-OEOSdkUk.js → react-BYHuwl8r.js} +1 -1
  174. package/_assets/{receive-sR3ESHJ5.js → receive-Bd2aFb8n.js} +1 -1
  175. package/_assets/{resolveImplementation-BK--s3Ec.js → resolveImplementation-BAXxzJlr.js} +1 -1
  176. package/_assets/{rpc-DTlYxTMv.js → rpc-CbaDwITz.js} +1 -1
  177. package/_assets/{secp256k1-B_4d6vom.js → secp256k1-Bo_Y_fre.js} +1 -1
  178. package/_assets/{secp256k1-D52lJTEk.js → secp256k1-DIKub0IC.js} +1 -1
  179. package/_assets/{secp256k1-CCfiCvs-.js → secp256k1-xVDTw2lf.js} +1 -1
  180. package/_assets/{send-BmvynCVT.js → send-BaAC-uaB.js} +1 -1
  181. package/_assets/{send-batch-transaction-FUeKMYe6.js → send-batch-transaction-c2eHjct6.js} +1 -1
  182. package/_assets/{send-eip712-transaction-gIXTaUO6.js → send-eip712-transaction-ACwIAsfM.js} +2 -2
  183. package/_assets/send-gasless-transaction-CNAYg5BD.js +2 -0
  184. package/_assets/{send-transaction-CV0mqcuj.js → send-transaction-rero7ttO.js} +2 -2
  185. package/_assets/{sendMetaTransaction-D8u324f6.js → sendMetaTransaction-Dr1CV0TY.js} +1 -1
  186. package/_assets/{sendRawTransaction-C7uGJYYZ.js → sendRawTransaction-CrGbjHVr.js} +3 -3
  187. package/_assets/{sentry-B60WY-np.js → sentry-Dx-KuLV3.js} +1 -1
  188. package/_assets/{serializeTransaction-LIoftmSp.js → serializeTransaction-BDn9isZq.js} +1 -1
  189. package/_assets/{session-proposal-FM8LmXKa.js → session-proposal-BZgMJBSE.js} +1 -1
  190. package/_assets/{session-request-DfYm_Li8.js → session-request-MF43I2RX.js} +2 -2
  191. package/_assets/{sha256-B3W1x8Ou.js → sha256-CfLwtdyC.js} +1 -1
  192. package/_assets/{signing-8yhX16bn.js → signing-Dw_OWkLz.js} +3 -3
  193. package/_assets/{socials-BAdFtXtr.js → socials-BNJSBbwT.js} +1 -1
  194. package/_assets/{styled-0dpSKx8k.js → styled-DRo84MDa.js} +2 -2
  195. package/_assets/{swaps-eRH3TFop.js → swaps-B1e15k7n.js} +1 -1
  196. package/_assets/{thirdweb-JnXyMEvM.js → thirdweb-BWIBUIE9.js} +3 -3
  197. package/_assets/{to-serializable-transaction-DEVbteW9.js → to-serializable-transaction-9YJAYPoc.js} +2 -2
  198. package/_assets/{totalSupply-BfIXxtR1.js → totalSupply-DRNaCAzP.js} +1 -1
  199. package/_assets/{transaction-C7nbuBwl.js → transaction-Col-q-Ce.js} +1 -1
  200. package/_assets/{transactionReceipt-DRuVx5eA.js → transactionReceipt-DNsgQMhk.js} +1 -1
  201. package/_assets/{transactions-Cpr-9OpP.js → transactions-D1LUTuMd.js} +1 -1
  202. package/_assets/{useCreditPacks-CKcjDTjk.js → useCreditPacks-BEQPVGPb.js} +1 -1
  203. package/_assets/{useImportable-B8kugnrY.js → useImportable-CWtOqWfJ.js} +1 -1
  204. package/_assets/{useInfiniteGrid-CRukdsdk.js → useInfiniteGrid-BUoYbSMR.js} +1 -1
  205. package/_assets/useTheme-BqrE1B0j.js +1 -0
  206. package/_assets/{useUrlFilters-DABDXRpV.js → useUrlFilters-DH-gxdfV.js} +1 -1
  207. package/_assets/{utils-BkRfOA0C.js → utils-BQF5MiO5.js} +1 -1
  208. package/_assets/{verifyHash-D3N-DpSq.js → verifyHash-CvDYaM_Z.js} +1 -1
  209. package/_assets/{w3m-modal-DrdMVzXu.js → w3m-modal-CvdiFWsy.js} +1 -1
  210. package/_assets/{w3m-modal-DyhVPbkh.js → w3m-modal-DezWGNuN.js} +1 -1
  211. package/_assets/{wait-for-tx-receipt-Ci6vv8Ey.js → wait-for-tx-receipt-DvUvVz11.js} +1 -1
  212. package/_assets/{wallets-CgJo02lh.js → wallets-CFgxN5dS.js} +5 -5
  213. package/_assets/{web-connector-0anvxwVt.js → web-connector-DKzlrEiW.js} +3 -3
  214. package/_assets/{writeContract-BdcOo3Yx.js → writeContract-P3ydNYI2.js} +1 -1
  215. package/_assets/{zora-sepolia-DOetv30E.js → zora-sepolia-5SAdD430.js} +1 -1
  216. package/_assets/{zoraTestnet-DE3HICyd.js → zoraTestnet-BXkuL2ru.js} +1 -1
  217. package/index.html +11 -11
  218. package/package.json +2 -2
  219. package/_assets/LazyEmoteControls-BzEIo4q9.js +0 -2
  220. package/_assets/Success-d2hW8caD.js +0 -296
  221. package/_assets/collectionPage.styles-BdCBFsGv.js +0 -48
  222. package/_assets/decimals-DO67KSdi.js +0 -1
  223. package/_assets/estimate-l1-fee-Dg4-4bu_.js +0 -1
  224. package/_assets/eth_estimateGas-CZdRIIy4.js +0 -1
  225. package/_assets/eth_getTransactionCount-W_BA_-db.js +0 -1
  226. package/_assets/get-ecosystem-wallet-info-C3KGWwDQ.js +0 -1
  227. package/_assets/getNFT-ChgqHLzl.js +0 -1
  228. package/_assets/index-2C6-RuNi.js +0 -2
  229. package/_assets/index-3QPqSkja.js +0 -1
  230. package/_assets/parseNft-95wNCKAi.js +0 -2
  231. package/_assets/send-gasless-transaction-Dffcm2AH.js +0 -2
  232. package/_assets/useTheme-DT4KJhC2.js +0 -1
@@ -1,4 +1,4 @@
1
- import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as j,t as ie,J as se,K as ae,L as ne,B as w,M as oe,o as R,N as re,v as le,x as de,b as a,O as B,P as N,Q as ce,R as pe,S as he,U as me,V as xe,W as ue,X as ge,Y as fe,Z as be,$ as ve,a0 as ye,a1 as je,a2 as we,a3 as ke,a4 as Ie,a5 as $e,z as E,a6 as Ce,a7 as Ee,a8 as ze,a9 as Le,aa as Oe,ab as Se}from"./index-9fsiI1dP.js";import{E as _}from"./ErrorNotice-Cc1oxuPj.js";import{E as Ae}from"./LazyEmoteControls-BzEIo4q9.js";import{O as Ne}from"./OutfitPreview-CRGZ6ulM.js";import"./sentry-B60WY-np.js";import"./dcl-schemas-CmtP3U6y.js";import"./ethers-lk3HAbPB.js";import"./intl-CBcMB1D2.js";import"./disposePreview-flulL6RX.js";const{colors:o,radius:Fe,media:d}=ie,K=t.div`
1
+ import{L as k,d as te,j as e,r as p}from"./react-BYHuwl8r.js";import{s as t,I as j,t as ie,N as se,O as ae,P as ne,B as w,Q as oe,o as B,R as re,v as le,x as de,b as a,S as M,U as N,V as ce,W as pe,X as he,Y as me,Z as xe,$ as ue,a0 as ge,a1 as fe,a2 as be,a3 as ve,a4 as ye,a5 as je,a6 as we,a7 as ke,a8 as Ie,a9 as $e,z as E,aa as Ce,ab as Ee,ac as ze,ad as Le,ae as Oe,af as Se}from"./index-7aKGFrXM.js";import{E as _}from"./ErrorNotice-D6XnSgq5.js";import{E as Ae}from"./LazyEmoteControls-dSxYScIK.js";import{O as Ne}from"./OutfitPreview-HYP35Evg.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./disposePreview-C6zVmkpS.js";const{colors:o,radius:Fe,media:d}=ie,H=t.div`
2
2
  max-width: 1721px;
3
3
  margin: 0 auto;
4
4
  `,Te=t.nav`
@@ -20,7 +20,7 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
20
20
  overflow: hidden;
21
21
  white-space: nowrap;
22
22
  text-overflow: ellipsis;
23
- `,H=t.div`
23
+ `,K=t.div`
24
24
  display: grid;
25
25
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
26
26
  gap: 40px;
@@ -64,7 +64,7 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
64
64
  & [class*='MuiBox'] {
65
65
  pointer-events: auto;
66
66
  }
67
- `,Me=t.img`
67
+ `,Re=t.img`
68
68
  position: absolute;
69
69
  inset: 0;
70
70
  width: 100%;
@@ -75,11 +75,11 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
75
75
  flex-direction: column;
76
76
  gap: 15px;
77
77
  min-height: 0;
78
- `,Re=t.h1`
78
+ `,Be=t.h1`
79
79
  font-size: 28px;
80
80
  font-weight: 600;
81
81
  overflow-wrap: anywhere;
82
- `,Be=t.p`
82
+ `,Me=t.p`
83
83
  font-size: 12px;
84
84
  font-weight: 500;
85
85
  letter-spacing: 0.04em;
@@ -99,14 +99,14 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
99
99
  padding: 0;
100
100
  margin: 0;
101
101
  }
102
- `,Ke=t.ul`
102
+ `,He=t.ul`
103
103
  list-style: none;
104
104
  margin: 0;
105
105
  padding: 0;
106
106
  display: flex;
107
107
  flex-direction: column;
108
108
  gap: 10px;
109
- `,He=t.li`
109
+ `,Ke=t.li`
110
110
  position: relative;
111
111
  display: flex;
112
112
  align-items: stretch;
@@ -252,15 +252,15 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
252
252
  text-transform: uppercase;
253
253
  letter-spacing: 0.02em;
254
254
  }
255
- `,Je=t.p`
255
+ `,Xe=t.p`
256
256
  margin-top: 8px;
257
- `,Xe=t.div`
257
+ `,Ye=t.div`
258
258
  display: flex;
259
259
  flex-direction: column;
260
260
  align-items: flex-start;
261
261
  gap: 12px;
262
262
  padding: 8px 0;
263
- `,Ye=t.div`
263
+ `,Ze=t.div`
264
264
  display: flex;
265
265
  flex-direction: column;
266
266
  gap: 12px;
@@ -281,7 +281,7 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
281
281
  background: ${o.softWhite};
282
282
  box-shadow: 0 -4px 16px rgba(22, 21, 24, 0.12);
283
283
  }
284
- `,Ze=t.div`
284
+ `,Je=t.div`
285
285
  display: flex;
286
286
  align-items: center;
287
287
  justify-content: space-between;
@@ -331,4 +331,4 @@ import{L as k,a as te,j as e,r as p}from"./react-OEOSdkUk.js";import{s as t,I as
331
331
  opacity: 0.4;
332
332
  `,nt=t.h1`
333
333
  font-size: 24px;
334
- `,M="outfit-detail-preview";function bt(){const{id:i}=te(),n=R(f=>f.session),c=re(),g=c==="creator",{data:r,isError:I,refetch:m}=le({queryKey:["outfit",i,g],enabled:N()&&!!i,staleTime:6e4,queryFn:()=>Se(i,g&&n?n.identity:void 0)}),l=!N()||!i||r===null&&c!=="pending";return de(l?{title:a("seo.outfit.notFoundTitle"),noindex:!0}:r?{title:r.name,image:B(r.thumbnailHash)??void 0}:{}),l?e.jsxs(W,{"data-testid":"outfit-notfound",children:[e.jsx(at,{name:"cart",size:44}),e.jsx(nt,{children:a("outfits.detail.notFoundTitle")}),e.jsx("p",{className:"muted",children:a("outfits.detail.notFoundBody")}),e.jsx(w,{as:k,to:"/items",variant:"purple",children:a("notFound.cta")})]}):I?e.jsxs(W,{"data-testid":"outfit-detail-error",children:[e.jsx(_,{message:a("outfits.errors.generic")}),e.jsx(w,{variant:"purple",onClick:()=>void m(),children:a("outfits.detail.retry")})]}):r?e.jsx(rt,{outfit:r}):e.jsx(K,{"aria-busy":"true","data-testid":"outfit-detail-loading",children:e.jsxs(H,{children:[e.jsx(D,{children:e.jsx("span",{className:"skeleton",style:{position:"absolute",inset:0},"aria-hidden":!0})}),e.jsxs(U,{children:[e.jsx("span",{className:"skeleton",style:{width:"60%",height:32},"aria-hidden":!0}),e.jsx("span",{className:"skeleton",style:{width:"40%",height:16},"aria-hidden":!0}),e.jsx("span",{className:"skeleton",style:{width:"100%",height:48},"aria-hidden":!0})]})]})})}function ot({item:i}){const n=Ce(i),c=Ee(i.gender);return e.jsxs(Qe,{children:[i.rarity?e.jsx(y,{"data-variant":"rarity",style:{background:Oe(i.rarity),color:Le(i.rarity)},title:ze(i.rarity),children:i.rarity}):null,i.isSmart?e.jsxs(y,{"data-variant":"smart",children:[e.jsx(j,{name:"smart",size:13}),a("assetCard.smart")]}):null,n?e.jsx(y,{"data-variant":"icon",children:e.jsx(j,{name:n})}):null,c?e.jsx(y,{"data-variant":"icon",children:e.jsx(j,{name:c})}):null]})}function rt({outfit:i}){const n=ce(i),{split:c,availableCount:g,totalCredits:r,addOutfit:I,isAdding:m}=pe(i,n),l=R(s=>{var u;return(u=s.session)==null?void 0:u.address}),f=he(s=>s.items),L=p.useMemo(()=>new Set(f.map(me)),[f]),O=B(i.thumbnailHash),S=p.useRef(null);p.useEffect(()=>{S.current!==i.id&&(S.current=i.id,xe("Shop Outfit Viewed",{outfit_id:i.id,item_count:i.items.length}))},[i.id,i.items.length]);const $=p.useMemo(()=>i.items.map(s=>{const u=ue(s),C=n.byKey.get(u)??null;return{key:u,item:C,state:C?ge(C,{address:l,cartKeys:L}):"missing"}}),[i,n.byKey,l,L]),{data:V,isFetched:q}=fe(l),G=!l||q,Q=!!l&&!!V,J=i.bodyShape==="female"?be:i.bodyShape==="male"?ve:void 0,x=p.useMemo(()=>$.map(s=>s.item).filter(s=>!!s),[$]),A=p.useMemo(()=>ye(x),[x]),X=p.useMemo(()=>!!je(x),[x]),Y=p.useMemo(()=>x.map(s=>we(s)??"").filter(Boolean),[x]),h=ke({address:l,tryOnUrns:A,tryOnCategories:Y}),Z=i.items.length,ee=!n.isLoading&&!n.isError,b=c.purchasable.length;return e.jsxs(K,{"data-testid":"outfit-detail",children:[e.jsxs(Te,{"aria-label":a("outfits.detail.breadcrumbAria"),children:[e.jsx(F,{to:"/overview",children:a("nav.overview")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(F,{to:"/overview",children:a("outfits.detail.breadcrumbLooks")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Pe,{children:i.name})]}),e.jsxs(H,{children:[e.jsx(D,{"data-testid":"outfit-detail-preview",style:{background:Ie(i)},children:O&&!n.isLoading&&A.length===0?e.jsx(Me,{src:O,alt:i.name}):e.jsx(Ne,{id:M,profile:h.profile,bodyShape:h.bodyShape??(Q?void 0:J),urns:h.urns,skin:h.skin,hair:h.hair,eyes:h.eyes,enabled:G&&!h.isLoading&&!n.isLoading,controls:X?e.jsx(We,{"data-testid":"outfit-emote-controls",children:e.jsx(Ae,{wearablePreviewId:M,hideFrameInput:!0})}):null})}),e.jsxs(U,{children:[e.jsx(Re,{children:i.name}),e.jsx(Be,{"data-testid":"outfit-detail-meta",children:a("outfits.detail.itemsCount",{count:Z})}),n.isError?e.jsxs(Xe,{children:[e.jsx(_,{message:a("outfits.detail.resolveError"),testId:"outfit-detail-resolve-error"}),e.jsx(w,{variant:"outline","data-testid":"outfit-detail-retry",onClick:n.retry,children:a("outfits.detail.retry")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_e,{children:[e.jsx(Ke,{children:$.map(s=>e.jsx(He,{"data-testid":"outfit-detail-item","data-state":s.state,children:s.item?e.jsxs(e.Fragment,{children:[e.jsx(De,{to:`/item/${s.item.contractAddress}/${s.item.itemId}`,state:{item:s.item},"aria-label":s.item.name}),e.jsx(Ue,{src:s.item.thumbnail,alt:"",loading:"lazy"}),e.jsxs(T,{children:[e.jsx(z,{children:s.item.name}),s.item.creator?e.jsx(qe,{to:`/items/creator/${s.item.creator}`,children:e.jsx($e,{address:s.item.creator})}):null,e.jsxs(P,{children:[s.state!=="unavailable"?e.jsxs(Ge,{children:[e.jsx(E,{size:15}),s.item.priceCredits.toLocaleString()]}):null,s.state==="unavailable"?e.jsx(v,{children:a("outfits.card.unavailable")}):s.state==="own_listing"?e.jsx(v,{children:a("outfits.detail.yourListing")}):s.state==="in_cart"?e.jsx(v,{children:a("outfits.detail.inCart")}):null,e.jsx(ot,{item:s.item})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ve,{className:n.isLoading?"skeleton":void 0,"aria-hidden":!0}),e.jsx(T,{children:n.isLoading?e.jsx(z,{children:e.jsx("span",{className:"skeleton",style:{display:"block",width:"70%",height:14}})}):e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"muted",children:a("outfits.card.unavailable")}),e.jsx(P,{children:e.jsx(v,{children:a("outfits.card.unavailable")})})]})})]})},s.key))}),ee&&c.ownListing.length>0?e.jsx(Je,{className:"muted small",children:a("outfits.detail.yourListingHint")}):null]}),e.jsxs(Ye,{"data-testid":"outfit-detail-ctabar",children:[e.jsxs(Ze,{children:[e.jsx(et,{children:a("outfits.detail.totalPrice")}),n.isLoading?e.jsx("span",{className:"skeleton",style:{width:64,height:26},"aria-hidden":!0}):e.jsxs(tt,{children:[e.jsx(E,{size:22}),r.toLocaleString()]})]}),n.isLoading?e.jsx("span",{className:"skeleton",style:{width:"100%",height:52,borderRadius:26},"aria-hidden":!0}):e.jsxs(it,{variant:"purple","data-testid":"outfit-detail-cta",onClick:I,disabled:m||b===0,"aria-busy":m||void 0,children:[m?a("outfits.card.adding"):b>0?a("outfits.detail.addCount",{count:b}):g>0?a("outfits.detail.nothingToAdd"):a("outfits.card.unavailable"),!m&&b>0?e.jsxs(st,{children:[e.jsx(E,{size:16}),r.toLocaleString()]}):null]})]})]})]})]})]})}export{bt as OutfitDetail,bt as default};
334
+ `,R="outfit-detail-preview";function bt(){const{id:i}=te(),n=B(f=>f.session),c=re(),g=c==="creator",{data:r,isError:I,refetch:m}=le({queryKey:["outfit",i,g],enabled:N()&&!!i,staleTime:6e4,queryFn:()=>Se(i,g&&n?n.identity:void 0)}),l=!N()||!i||r===null&&c!=="pending";return de(l?{title:a("seo.outfit.notFoundTitle"),noindex:!0}:r?{title:r.name,image:M(r.thumbnailHash)??void 0}:{}),l?e.jsxs(W,{"data-testid":"outfit-notfound",children:[e.jsx(at,{name:"cart",size:44}),e.jsx(nt,{children:a("outfits.detail.notFoundTitle")}),e.jsx("p",{className:"muted",children:a("outfits.detail.notFoundBody")}),e.jsx(w,{as:k,to:"/items",variant:"purple",children:a("notFound.cta")})]}):I?e.jsxs(W,{"data-testid":"outfit-detail-error",children:[e.jsx(_,{message:a("outfits.errors.generic")}),e.jsx(w,{variant:"purple",onClick:()=>void m(),children:a("outfits.detail.retry")})]}):r?e.jsx(rt,{outfit:r}):e.jsx(H,{"aria-busy":"true","data-testid":"outfit-detail-loading",children:e.jsxs(K,{children:[e.jsx(D,{children:e.jsx("span",{className:"skeleton",style:{position:"absolute",inset:0},"aria-hidden":!0})}),e.jsxs(U,{children:[e.jsx("span",{className:"skeleton",style:{width:"60%",height:32},"aria-hidden":!0}),e.jsx("span",{className:"skeleton",style:{width:"40%",height:16},"aria-hidden":!0}),e.jsx("span",{className:"skeleton",style:{width:"100%",height:48},"aria-hidden":!0})]})]})})}function ot({item:i}){const n=Ce(i),c=Ee(i.gender);return e.jsxs(Qe,{children:[i.rarity?e.jsx(y,{"data-variant":"rarity",style:{background:Oe(i.rarity),color:Le(i.rarity)},title:ze(i.rarity),children:i.rarity}):null,i.isSmart?e.jsxs(y,{"data-variant":"smart",children:[e.jsx(j,{name:"smart",size:13}),a("assetCard.smart")]}):null,n?e.jsx(y,{"data-variant":"icon",children:e.jsx(j,{name:n})}):null,c?e.jsx(y,{"data-variant":"icon",children:e.jsx(j,{name:c})}):null]})}function rt({outfit:i}){const n=ce(i),{split:c,availableCount:g,totalCredits:r,addOutfit:I,isAdding:m}=pe(i,n),l=B(s=>{var u;return(u=s.session)==null?void 0:u.address}),f=he(s=>s.items),L=p.useMemo(()=>new Set(f.map(me)),[f]),O=M(i.thumbnailHash),S=p.useRef(null);p.useEffect(()=>{S.current!==i.id&&(S.current=i.id,xe("Shop Outfit Viewed",{outfit_id:i.id,item_count:i.items.length}))},[i.id,i.items.length]);const $=p.useMemo(()=>i.items.map(s=>{const u=ue(s),C=n.byKey.get(u)??null;return{key:u,item:C,state:C?ge(C,{address:l,cartKeys:L}):"missing"}}),[i,n.byKey,l,L]),{data:V,isFetched:q}=fe(l),G=!l||q,Q=!!l&&!!V,X=i.bodyShape==="female"?be:i.bodyShape==="male"?ve:void 0,x=p.useMemo(()=>$.map(s=>s.item).filter(s=>!!s),[$]),A=p.useMemo(()=>ye(x),[x]),Y=p.useMemo(()=>!!je(x),[x]),Z=p.useMemo(()=>x.map(s=>we(s)??"").filter(Boolean),[x]),h=ke({address:l,tryOnUrns:A,tryOnCategories:Z}),J=i.items.length,ee=!n.isLoading&&!n.isError,b=c.purchasable.length;return e.jsxs(H,{"data-testid":"outfit-detail",children:[e.jsxs(Te,{"aria-label":a("outfits.detail.breadcrumbAria"),children:[e.jsx(F,{to:"/overview",children:a("nav.overview")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(F,{to:"/overview",children:a("outfits.detail.breadcrumbLooks")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Pe,{children:i.name})]}),e.jsxs(K,{children:[e.jsx(D,{"data-testid":"outfit-detail-preview",style:{background:Ie(i)},children:O&&!n.isLoading&&A.length===0?e.jsx(Re,{src:O,alt:i.name}):e.jsx(Ne,{id:R,profile:h.profile,bodyShape:h.bodyShape??(Q?void 0:X),urns:h.urns,skin:h.skin,hair:h.hair,eyes:h.eyes,enabled:G&&!h.isLoading&&!n.isLoading,controls:Y?e.jsx(We,{"data-testid":"outfit-emote-controls",children:e.jsx(Ae,{wearablePreviewId:R,hideFrameInput:!0})}):null})}),e.jsxs(U,{children:[e.jsx(Be,{children:i.name}),e.jsx(Me,{"data-testid":"outfit-detail-meta",children:a("outfits.detail.itemsCount",{count:J})}),n.isError?e.jsxs(Ye,{children:[e.jsx(_,{message:a("outfits.detail.resolveError"),testId:"outfit-detail-resolve-error"}),e.jsx(w,{variant:"outline","data-testid":"outfit-detail-retry",onClick:n.retry,children:a("outfits.detail.retry")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_e,{children:[e.jsx(He,{children:$.map(s=>e.jsx(Ke,{"data-testid":"outfit-detail-item","data-state":s.state,children:s.item?e.jsxs(e.Fragment,{children:[e.jsx(De,{to:`/item/${s.item.contractAddress}/${s.item.itemId}`,state:{item:s.item},"aria-label":s.item.name}),e.jsx(Ue,{src:s.item.thumbnail,alt:"",loading:"lazy"}),e.jsxs(T,{children:[e.jsx(z,{children:s.item.name}),s.item.creator?e.jsx(qe,{to:`/items/creator/${s.item.creator}`,children:e.jsx($e,{address:s.item.creator})}):null,e.jsxs(P,{children:[s.state!=="unavailable"?e.jsxs(Ge,{children:[e.jsx(E,{size:15}),s.item.priceCredits.toLocaleString()]}):null,s.state==="unavailable"?e.jsx(v,{children:a("outfits.card.unavailable")}):s.state==="own_listing"?e.jsx(v,{children:a("outfits.detail.yourListing")}):s.state==="in_cart"?e.jsx(v,{children:a("outfits.detail.inCart")}):null,e.jsx(ot,{item:s.item})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ve,{className:n.isLoading?"skeleton":void 0,"aria-hidden":!0}),e.jsx(T,{children:n.isLoading?e.jsx(z,{children:e.jsx("span",{className:"skeleton",style:{display:"block",width:"70%",height:14}})}):e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"muted",children:a("outfits.card.unavailable")}),e.jsx(P,{children:e.jsx(v,{children:a("outfits.card.unavailable")})})]})})]})},s.key))}),ee&&c.ownListing.length>0?e.jsx(Xe,{className:"muted small",children:a("outfits.detail.yourListingHint")}):null]}),e.jsxs(Ze,{"data-testid":"outfit-detail-ctabar",children:[e.jsxs(Je,{children:[e.jsx(et,{children:a("outfits.detail.totalPrice")}),n.isLoading?e.jsx("span",{className:"skeleton",style:{width:64,height:26},"aria-hidden":!0}):e.jsxs(tt,{children:[e.jsx(E,{size:22}),r.toLocaleString()]})]}),n.isLoading?e.jsx("span",{className:"skeleton",style:{width:"100%",height:52,borderRadius:26},"aria-hidden":!0}):e.jsxs(it,{variant:"purple","data-testid":"outfit-detail-cta",onClick:I,disabled:m||b===0,"aria-busy":m||void 0,children:[m?a("outfits.card.adding"):b>0?a("outfits.detail.addCount",{count:b}):g>0?a("outfits.detail.nothingToAdd"):a("outfits.card.unavailable"),!m&&b>0?e.jsxs(st,{children:[e.jsx(E,{size:16}),r.toLocaleString()]}):null]})]})]})]})]})]})}export{bt as OutfitDetail,bt as default};
@@ -1,6 +1,6 @@
1
- import{r,j as n}from"./react-OEOSdkUk.js";import{d as v}from"./dcl-schemas-CmtP3U6y.js";import{s as P,S as R,c as F,ac as O,b as S}from"./index-9fsiI1dP.js";import{u as B,d as W}from"./disposePreview-flulL6RX.js";const H=P.div`
1
+ import{r,j as n}from"./react-BYHuwl8r.js";import{d as g}from"./dcl-schemas-CmtP3U6y.js";import{s as P,X as R,c as F,ag as O,b as S}from"./index-7aKGFrXM.js";import{u as B,d as W}from"./disposePreview-C6zVmkpS.js";const H=P.div`
2
2
  position: absolute;
3
3
  inset: 0;
4
4
  display: grid;
5
5
  place-items: center;
6
- `;function q({id:a,profile:i,bodyShape:g,urns:s,enabled:c=!0,skin:l,hair:f,eyes:d,controls:w}){const E=R(t=>t.fittingOpen),{ref:x,active:h}=B(),e=c&&s.length>0&&h&&!E,y=s.length>0?s[0].includes(":amoy:"):F.chainId===80002,[j,o]=r.useState(!1),A=s.join(",");r.useEffect(()=>{o(!1)},[A,i,l,f,d]),r.useEffect(()=>{e&&o(!1)},[e]);const[b,m]=r.useState(!1);r.useEffect(()=>{if(!e){m(!1);return}let t=0,I=0;const p=()=>{document.getElementById(a)?m(!0):I++<300&&(t=requestAnimationFrame(p))};return p(),()=>cancelAnimationFrame(t)},[e,a]);const u=r.useRef(null);return r.useEffect(()=>{if(e)return()=>{W(u.current),u.current=null}},[e]),n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:x,"data-preview-viewport":!0,"aria-hidden":!0}),e?n.jsx(O,{id:a,profile:i,bodyShape:g,urns:s,skin:l,hair:f,eyes:d,type:v.PreviewType.AVATAR,emote:v.PreviewEmote.FASHION,disableBackground:!0,disableFadeEffect:!0,dev:y,onLoad:()=>{var t;o(!0),u.current=((t=document.getElementById(a))==null?void 0:t.contentWindow)??null}},i):null,b?w:null,c&&s.length===0?null:!e||!j?n.jsx(H,{"aria-busy":"true","aria-label":S("spinner.loading"),children:n.jsx("span",{className:"spinner","aria-hidden":!0})}):null]})}export{q as O};
6
+ `;function q({id:a,profile:i,bodyShape:v,urns:s,enabled:c=!0,skin:l,hair:f,eyes:d,controls:w}){const E=R(t=>t.fittingOpen),{ref:x,active:h}=B(),e=c&&s.length>0&&h&&!E,y=s.length>0?s[0].includes(":amoy:"):F.chainId===80002,[j,o]=r.useState(!1),A=s.join(",");r.useEffect(()=>{o(!1)},[A,i,l,f,d]),r.useEffect(()=>{e&&o(!1)},[e]);const[b,m]=r.useState(!1);r.useEffect(()=>{if(!e){m(!1);return}let t=0,I=0;const p=()=>{document.getElementById(a)?m(!0):I++<300&&(t=requestAnimationFrame(p))};return p(),()=>cancelAnimationFrame(t)},[e,a]);const u=r.useRef(null);return r.useEffect(()=>{if(e)return()=>{W(u.current),u.current=null}},[e]),n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:x,"data-preview-viewport":!0,"aria-hidden":!0}),e?n.jsx(O,{id:a,profile:i,bodyShape:v,urns:s,skin:l,hair:f,eyes:d,type:g.PreviewType.AVATAR,emote:g.PreviewEmote.FASHION,disableBackground:!0,disableFadeEffect:!0,dev:y,onLoad:()=>{var t;o(!0),u.current=((t=document.getElementById(a))==null?void 0:t.contentWindow)??null}},i):null,b?w:null,c&&s.length===0?null:!e||!j?n.jsx(H,{"aria-busy":"true","aria-label":S("spinner.loading"),children:n.jsx("span",{className:"spinner","aria-hidden":!0})}):null]})}export{q as O};
@@ -1,4 +1,4 @@
1
- import{r as d,j as t,L as F,a as Qt,d as Vt,e as Jt}from"./react-OEOSdkUk.js";import{s as o,t as dt,I as K,aF as Xt,b as e,z as st,B as x,ah as kt,o as J,N as Yt,x as Zt,A as Tt,v as Ct,Q as te,W as N,aG as Q,aH as ee,aI as ie,aJ as V,a0 as se,a1 as oe,Z as ae,$ as ne,O as It,a4 as re,aK as ot,aL as de,aM as le,aN as ue,E as A,aO as Et,aP as Lt,aQ as O,F as at,aR as nt,aS as ce,aT as pe,aU as fe,V as me,aV as he,aW as xe,ab as ge}from"./index-9fsiI1dP.js";import{E as D}from"./ErrorNotice-Cc1oxuPj.js";import{L as be}from"./LoadMore-HeeBSVXn.js";import{u as ye}from"./useInfiniteGrid-CRukdsdk.js";import{O as je}from"./OutfitPreview-CRGZ6ulM.js";import"./sentry-B60WY-np.js";import"./dcl-schemas-CmtP3U6y.js";import"./ethers-lk3HAbPB.js";import"./intl-CBcMB1D2.js";import"./disposePreview-flulL6RX.js";const{colors:h,radius:X,media:ve}=dt,we=o.div`
1
+ import{r as d,j as t,L as F,d as Qt,a as Vt,b as Jt}from"./react-BYHuwl8r.js";import{s as o,t as dt,I as K,aF as Xt,b as e,z as st,B as x,K as kt,o as J,R as Yt,x as Zt,A as Tt,v as Ct,V as te,$ as N,aG as Q,aH as ee,aI as ie,aJ as V,a4 as se,a5 as oe,a2 as ae,a3 as ne,S as It,a8 as re,aK as ot,aL as de,aM as le,aN as ue,E as A,aO as Et,aP as Lt,aQ as O,F as at,aR as nt,aS as ce,aT as pe,aU as fe,Z as me,aV as he,aW as xe,af as ge}from"./index-7aKGFrXM.js";import{E as D}from"./ErrorNotice-D6XnSgq5.js";import{L as be}from"./LoadMore-BwyaRmBN.js";import{u as ye}from"./useInfiniteGrid-BUoYbSMR.js";import{O as je}from"./OutfitPreview-HYP35Evg.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./disposePreview-C6zVmkpS.js";const{colors:h,radius:X,media:ve}=dt,we=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,e as le,r as l}from"./react-OEOSdkUk.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,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-9fsiI1dP.js";import{E as M}from"./ErrorNotice-Cc1oxuPj.js";import{F as w}from"./field.styles-D_tiVUDr.js";import"./sentry-B60WY-np.js";import"./dcl-schemas-CmtP3U6y.js";import"./ethers-lk3HAbPB.js";import"./intl-CBcMB1D2.js";const ve="https://cdn.decentraland.org/@dcl/shop/0.10.1-31022274185.commit-4782a6d/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/0.10.1-31022274185.commit-4782a6d/_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,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-7aKGFrXM.js";import{E as M}from"./ErrorNotice-D6XnSgq5.js";import{F as w}from"./field.styles-DNDY0ykF.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-31028852348.commit-7ee46b2/_assets/template-cover-1-BETekfHg.jpeg",be="https://cdn.decentraland.org/@dcl/shop/0.10.1-31028852348.commit-7ee46b2/_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
  }
@@ -0,0 +1,280 @@
1
+ import{a as N,b as M,j as e,N as P,r as S}from"./react-BYHuwl8r.js";import{t as F,s as t,z as I,J as W,K as O,o as _,x as q,b as n,y as J,C as U,L as D,c as T,B as H,M as K}from"./index-7aKGFrXM.js";import{C as X}from"./Confetti-VpUDp1T6.js";import{w as Q,S as Y}from"./buy-gasless-M8aQxuIP.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./authorizations-VEZPJ_sN.js";import"./sendMetaTransaction-Dr1CV0TY.js";import"./buy-DiWx4d9p.js";const{colors:s,radius:g}=F,m="@media (max-width: 600px)",L=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
+ `,G=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
+ `,V=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
+ `,Z=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
+ `,B=t.div`
48
+ display: flex;
49
+ gap: 12px;
50
+ flex-wrap: wrap;
51
+ justify-content: center;
52
+ `,ee=t.div`
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: 12px;
56
+ width: 100%;
57
+ `,te=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
+ `,ne=t.span`
67
+ flex-shrink: 0;
68
+ width: 60px;
69
+ height: 60px;
70
+ line-height: 0;
71
+ `,ie=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
+ `,se=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
+ `,re=t.div`
90
+ display: flex;
91
+ flex-direction: column;
92
+ `,oe=t.span`
93
+ display: block;
94
+ height: 1px;
95
+ margin: 12px 0;
96
+ background: ${s.gray4};
97
+ `,ce=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: ${g.btn};
106
+ background: #f4e9ff;
107
+ color: ${s.text};
108
+ `,ae=t(I)`
109
+ width: 30px;
110
+ height: 30px;
111
+ color: ${s.text};
112
+ `,de=t.p`
113
+ display: inline-flex;
114
+ align-items: baseline;
115
+ gap: 6px;
116
+ margin: 0;
117
+ `,le=t.span`
118
+ font-size: 24px;
119
+ font-weight: 700;
120
+ text-transform: capitalize;
121
+ `,xe=t.span`
122
+ font-size: 14px;
123
+ font-weight: 400;
124
+ `,pe=t.div`
125
+ display: flex;
126
+ align-items: center;
127
+ gap: 12px;
128
+ `,he=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: ${g.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
+ `,ue=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: ${g.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
+ `,ge=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
+ `,me=t.span`
184
+ margin-left: 8px;
185
+ font-weight: 600;
186
+ font-size: 13px;
187
+ color: ${s.muted};
188
+ `,je=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
+ `,we=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
+ `,be=t(I)`
212
+ width: 22px;
213
+ height: 22px;
214
+ `,ye=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
+ `,E=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: ${g.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
+ `,ve=t.button`
265
+ ${E};
266
+ `,ke=t.a`
267
+ ${E};
268
+ `,$e=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: ${g.btn};
276
+ line-height: 0;
277
+ `,z=t(H)`
278
+ min-width: 160px;
279
+ text-align: center;
280
+ `;function Ce(l){return null}const ze=l=>new Promise(a=>setTimeout(a,l));function Re(l,a){const[i,o]=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 f=!1;for(let r=0;r<20&&!d;r++)try{await Q(l,{timeoutMs:15e3}),f=!0;break}catch(y){if(y instanceof Y)continue;d||o("failed");return}if(!d){if(!f){o("timed-out");return}if(!a){o("confirmed");return}o("indexing");for(let r=0;r<40&&!d;r++){if(await K(a.owner,a.contractAddress,a.itemId)){d||o("confirmed");return}await ze(3e3)}d||o("timed-out")}})(),()=>{d=!0}},[l,x]),i}const Ae=T.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump",Se=T.chainId===80002?"https://amoy.polygonscan.com/tx/":"https://polygonscan.com/tx/";function qe(){var A;const{state:l,search:a}=N(),i=l??Ce(),o=M(),{session:x}=_(),d=i==null?void 0:i.txHash,b=(i==null?void 0:i.items)??[],f=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=Re(i!=null&&i.settled?void 0:d,y);q({title:n("seo.success.title"),noindex:!0});const h=b;if(h.length===0)return e.jsx(P,{to:"/items",replace:!0});const R=h[0],j=(A=i==null?void 0:i.txHashes)!=null&&A.length?i.txHashes:d?[d]:[],p=j.length>0&&J(x==null?void 0:x.providerType)?j.map((c,v)=>e.jsx(Z,{href:`${Se}${c}`,target:"_blank",rel:"noreferrer",children:j.length>1?n("success.viewTransactionNumbered",{n:v+1,total:j.length}):n("success.viewTransaction")},c)):null;return u!=="confirmed"?e.jsx(L,{children:e.jsx(G,{children:u==="pending"||u==="indexing"?e.jsxs(e.Fragment,{children:[e.jsx(V,{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")," ",h.length===1?e.jsx("strong",{children:R.name}):n("success.itemCount",{count:h.length})," ",n("success.indexingAfter")]}):e.jsxs(e.Fragment,{children:[n("success.confirmingBefore")," ",h.length===1?e.jsx("strong",{children:R.name}):n("success.itemCount",{count:h.length})," ",n("success.confirmingAfter")]})}),p?e.jsx(w,{children:p}):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:()=>o("/activity"),children:n("nav.activity")})," ",n("success.timedOutAfter")]}),p?e.jsx(w,{children:p}):null,e.jsxs(B,{children:[e.jsx(z,{variant:"purple",onClick:()=>o("/activity"),children:n("success.viewActivity")}),e.jsx(z,{variant:"ghost",onClick:()=>o("/items"),children:n("success.keepShopping")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{children:n("success.failedTitle")}),e.jsx(C,{children:n("success.failedBody")}),p?e.jsx(w,{children:p}):null,e.jsx(B,{children:e.jsx(z,{variant:"purple",onClick:()=>o("/items"),children:n("success.backToShop")})})]})})}):e.jsxs(L,{children:[e.jsx(X,{}),e.jsxs(ee,{children:[e.jsxs(te,{role:"status",children:[e.jsx(ne,{"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(ie,{children:[e.jsx("b",{children:n("success.bannerTitle")})," ",n("success.bannerBody")]})]}),e.jsxs(se,{children:[f?e.jsxs(ce,{"data-testid":"success-credits",children:[e.jsx(ae,{}),e.jsxs(de,{children:[e.jsx(le,{children:n("getCredits.creditsAmount",{credits:f,currency:U.name})})," ",e.jsx(xe,{children:n("getCredits.creditsAdded")})]})]}):null,h.map((c,v)=>{const k=c.quantity??1;return e.jsxs(re,{children:[v>0?e.jsx(oe,{"aria-hidden":!0}):null,e.jsxs(pe,{children:[e.jsxs(he,{children:[c.thumbnail?e.jsx("img",{src:c.thumbnail,alt:""}):null,e.jsx(ue,{"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(ge,{title:c.name,children:[c.name||n("buyModal.itemFallback"),k>1?e.jsx(me,{children:n("cartCheckout.qty",{count:k})}):null]}),c.creator?e.jsx(je,{address:c.creator,linkToProfile:!0}):null]}),e.jsxs(we,{children:[e.jsx(be,{}),e.jsx("span",{children:D(c.priceCredits*k)})]})]})]},c.id)})]}),p?e.jsx(w,{"data-receipt":!0,children:p}):null,e.jsxs(ye,{children:[e.jsx(ve,{"data-variant":"ghost",onClick:()=>o("/my-items"),children:n("success.myAssets")}),e.jsxs(ke,{"data-variant":"ruby",href:Ae,target:"_blank",rel:"noreferrer",children:[n("success.tryInWorld"),e.jsx($e,{"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{qe as Success,qe 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-KqjOf7qE.js";import{au as C}from"./NetworkUtil-CO-1nCx-.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-PsbedX0Z.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,b as T}from"./react-OEOSdkUk.js";import{s as P,t as i}from"./index-9fsiI1dP.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-7aKGFrXM.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"))`
@@ -42,4 +42,4 @@ import{r as o,j as C,b as T}from"./react-OEOSdkUk.js";import{s as P,t as i}from"
42
42
  @media (prefers-reduced-motion: reduce) {
43
43
  transition: none;
44
44
  }
45
- `,l=8,d=8;function q({content:t,children:p,placement:n="top",block:F,onShow:c,className:H}){const[r,b]=o.useState(!1),[e,W]=o.useState(null),h=o.useId(),w=o.useRef(!1),g=o.useRef(null),E=o.useRef(null),$=o.useCallback(()=>{b(!0),w.current||(w.current=!0,c==null||c())},[c]),v=o.useCallback(()=>b(!1),[]),s=o.useCallback(()=>{const M=g.current,y=E.current;if(!M||!y)return;const a=M.getBoundingClientRect(),{offsetWidth:D,offsetHeight:f}=y,L=D/2,u=L+d,R=a.left+a.width/2,k=Math.min(Math.max(R,u),Math.max(u,window.innerWidth-u)),m={top:a.top-l,bottom:window.innerHeight-a.bottom-l},x=m[n]>=f||m[n]>=m[n==="top"?"bottom":"top"]?n:n==="top"?"bottom":"top",z=x==="top"?a.top-l:a.bottom+l,G=x==="top"?Math.max(z,f+d):Math.min(z,Math.max(d,window.innerHeight-f-d)),j=Math.max(0,L-13);W({left:k,top:G,arrow:Math.min(Math.max(R-k,-j),j),placement:x})},[n]);return o.useLayoutEffect(()=>{r&&s()},[t,r,s]),o.useEffect(()=>{if(r)return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}},[r,s]),C.jsxs(A,{ref:g,className:H,block:F,onMouseEnter:$,onMouseLeave:v,onFocus:$,onBlur:v,children:[o.cloneElement(p,{"aria-describedby":r?h:void 0}),T.createPortal(C.jsx(I,{ref:E,role:"tooltip",id:h,placement:(e==null?void 0:e.placement)??n,"aria-hidden":!r,style:{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,"--tooltip-arrow":`${(e==null?void 0:e.arrow)??0}px`},...r&&e?{"data-open":""}:{},children:t}),document.body)]})}export{q as T,B as n};
45
+ `,l=8,d=8;function q({content:t,children:p,placement:n="top",block:F,onShow:c,className:H}){const[r,h]=o.useState(!1),[e,W]=o.useState(null),b=o.useId(),w=o.useRef(!1),g=o.useRef(null),E=o.useRef(null),$=o.useCallback(()=>{h(!0),w.current||(w.current=!0,c==null||c())},[c]),v=o.useCallback(()=>h(!1),[]),s=o.useCallback(()=>{const M=g.current,y=E.current;if(!M||!y)return;const a=M.getBoundingClientRect(),{offsetWidth:D,offsetHeight:f}=y,L=D/2,u=L+d,R=a.left+a.width/2,k=Math.min(Math.max(R,u),Math.max(u,window.innerWidth-u)),m={top:a.top-l,bottom:window.innerHeight-a.bottom-l},x=m[n]>=f||m[n]>=m[n==="top"?"bottom":"top"]?n:n==="top"?"bottom":"top",z=x==="top"?a.top-l:a.bottom+l,G=x==="top"?Math.max(z,f+d):Math.min(z,Math.max(d,window.innerHeight-f-d)),j=Math.max(0,L-13);W({left:k,top:G,arrow:Math.min(Math.max(R-k,-j),j),placement:x})},[n]);return o.useLayoutEffect(()=>{r&&s()},[t,r,s]),o.useEffect(()=>{if(r)return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}},[r,s]),C.jsxs(A,{ref:g,className:H,block:F,onMouseEnter:$,onMouseLeave:v,onFocus:$,onBlur:v,children:[o.cloneElement(p,{"aria-describedby":r?b:void 0}),T.createPortal(C.jsx(I,{ref:E,role:"tooltip",id:b,placement:(e==null?void 0:e.placement)??n,"aria-hidden":!r,style:{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,"--tooltip-arrow":`${(e==null?void 0:e.arrow)??0}px`},...r&&e?{"data-open":""}:{},children:t}),document.body)]})}export{q as T,B as n};
@@ -1 +1 @@
1
- var ve=Object.defineProperty;var xe=(r,t,e)=>t in r?ve(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var p=(r,t,e)=>xe(r,typeof t!="symbol"?t+"":t,e);import{W as ue,a as Q,C as ge,B as Ce,f as X}from"./ethers-lk3HAbPB.js";import{a as Ee,d as B}from"./dcl-schemas-CmtP3U6y.js";import{c as ee}from"./react-OEOSdkUk.js";import{cl as Re,f as te,g as re}from"./index-9fsiI1dP.js";import{c as q,e as Ie}from"./index-BlLd8_kE.js";import{s as Pe}from"./sendMetaTransaction-D8u324f6.js";import"./sentry-B60WY-np.js";import"./intl-CBcMB1D2.js";import"./events-DQ172AOg.js";async function be(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 be(r);return new ue(t)}const S=new Ie.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),I=new ge(t.address,t.abi,l),T=await(typeof e=="function"?e(I.populateTransaction):I.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 b=await v.sendTransaction(T);return S.emit(C.SUCCESS,{txHash:b.hash}),b.hash}else{const v=await Pe(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"&&ee;(c.global===c||c.window===c||c.self===c)&&(e=c);var l,I=2147483647,T=36,v=1,b=26,U=38,_=700,k=72,G=128,J="-",he=/^xn--/,fe=/[^\x20-\x7E]/,pe=/[\x2E\u3002\uFF0E\uFF61]/g,ye={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=T-v,E=Math.floor,O=String.fromCharCode,N;function F(n){throw new RangeError(ye[n])}function $(n,a){for(var o=n.length,u=[];o--;)u[o]=a(n[o]);return u}function V(n,a){var o=n.split("@"),u="";o.length>1&&(u=o[0]+"@",n=o[1]),n=n.replace(pe,".");var d=n.split("."),y=$(d,a).join(".");return u+y}function H(n){for(var a=[],o=0,u=n.length,d,y;o<u;)d=n.charCodeAt(o++),d>=55296&&d<=56319&&o<u?(y=n.charCodeAt(o++),(y&64512)==56320?a.push(((d&1023)<<10)+(y&1023)+65536):(a.push(d),o--)):a.push(d);return a}function W(n){return $(n,function(a){var o="";return a>65535&&(a-=65536,o+=O(a>>>10&1023|55296),a=56320|a&1023),o+=O(a),o}).join("")}function Te(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:T}function Y(n,a){return n+22+75*(n<26)-((a!=0)<<5)}function Z(n,a,o){var u=0;for(n=o?E(n/_):n>>1,n+=E(n/a);n>D*b>>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,P,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(P=d,f=1,m=T;R>=o&&F("invalid-input"),g=Te(n.charCodeAt(R++)),(g>=T||g>E((I-d)/f))&&F("overflow"),d+=g*f,A=m<=h?v:m>=h+b?b:m-h,!(g<A);m+=T)L=T-A,f>E(I/L)&&F("overflow"),f*=L;u=a.length+1,h=Z(d-P,u,P==0),E(d/u)>I-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,P,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=I,h=0;h<g;++h)f=n[h],f>=a&&f<w&&(w=f);for(A=u+1,w-a>E((I-o)/A)&&F("overflow"),o+=(w-a)*A,a=w,h=0;h<g;++h)if(f=n[h],f<a&&++o>I&&F("overflow"),f==a){for(x=o,R=T;P=R<=y?v:R>=y+b?b:R-y,!(x<P);R+=T)j=x-P,L=T-P,m.push(O(Y(P+j%L,0))),x=E(j/L);m.push(O(Y(x,0))),y=Z(o,A,u==d),o=0,++u}++o,++a}return m.join("")}function we(n){return V(n,function(a){return he.test(a)?K(a.slice(4).toLowerCase()):a})}function me(n){return V(n,function(a){return fe.test(a)?"xn--"+z(a):a})}if(l={version:"1.4.1",ucs2:{decode:H,encode:W},decode:K,encode:z,toASCII:me,toUnicode:we},i&&s)if(r.exports==i)s.exports=l;else for(N in l)l.hasOwnProperty(N)&&(i[N]=l[N]);else e.punycode=l})(_e)})(M,M.exports)),M.exports}Oe();var le=(function(r){function t(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return t();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:t});var e=__magic__;return e})(Object),Me=le.URL;le.URLSearchParams;var Ne={URL:Me};class ce extends Error{constructor(e,i,s){super(e);p(this,"status");p(this,"data");this.status=i,this.data=s}}const De=3,je=1e3,Be=[400,401,403,404,409,422],qe=(globalThis==null?void 0:globalThis.URL)??Ne.URL;class Ge{constructor(t,e){p(this,"baseUrl");p(this,"retries");p(this,"retryDelay");p(this,"nonRetryableStatuses");p(this,"identity");p(this,"sleep",t=>new Promise(e=>{setTimeout(e,t)}));p(this,"getIdentity",()=>this.identity instanceof Function?this.identity():this.identity);p(this,"rawFetch",(t,e)=>{const i=new qe(t,this.baseUrl),s=(e==null?void 0:e.identity)??this.getIdentity();return 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};
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-BDpbhgX6.js";import{a as Ee,d as B}from"./dcl-schemas-CmtP3U6y.js";import{c as ee}from"./react-BYHuwl8r.js";import{cl as Re,f as te,g as re}from"./index-7aKGFrXM.js";import{c as q,e as Ie}from"./index-EfmTxpXI.js";import{s as Pe}from"./sendMetaTransaction-Dr1CV0TY.js";import"./sentry-Dx-KuLV3.js";import"./intl-CBcMB1D2.js";import"./events-DQ172AOg.js";async function be(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 be(r);return new ue(t)}const S=new Ie.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),I=new ge(t.address,t.abi,l),T=await(typeof e=="function"?e(I.populateTransaction):I.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 b=await v.sendTransaction(T);return S.emit(C.SUCCESS,{txHash:b.hash}),b.hash}else{const v=await Pe(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"&&ee;(c.global===c||c.window===c||c.self===c)&&(e=c);var l,I=2147483647,T=36,v=1,b=26,U=38,_=700,k=72,G=128,J="-",he=/^xn--/,fe=/[^\x20-\x7E]/,pe=/[\x2E\u3002\uFF0E\uFF61]/g,ye={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=T-v,E=Math.floor,O=String.fromCharCode,N;function F(n){throw new RangeError(ye[n])}function $(n,a){for(var o=n.length,u=[];o--;)u[o]=a(n[o]);return u}function V(n,a){var o=n.split("@"),u="";o.length>1&&(u=o[0]+"@",n=o[1]),n=n.replace(pe,".");var d=n.split("."),y=$(d,a).join(".");return u+y}function H(n){for(var a=[],o=0,u=n.length,d,y;o<u;)d=n.charCodeAt(o++),d>=55296&&d<=56319&&o<u?(y=n.charCodeAt(o++),(y&64512)==56320?a.push(((d&1023)<<10)+(y&1023)+65536):(a.push(d),o--)):a.push(d);return a}function W(n){return $(n,function(a){var o="";return a>65535&&(a-=65536,o+=O(a>>>10&1023|55296),a=56320|a&1023),o+=O(a),o}).join("")}function Te(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:T}function Y(n,a){return n+22+75*(n<26)-((a!=0)<<5)}function Z(n,a,o){var u=0;for(n=o?E(n/_):n>>1,n+=E(n/a);n>D*b>>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,P,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(P=d,f=1,m=T;R>=o&&F("invalid-input"),g=Te(n.charCodeAt(R++)),(g>=T||g>E((I-d)/f))&&F("overflow"),d+=g*f,A=m<=h?v:m>=h+b?b:m-h,!(g<A);m+=T)L=T-A,f>E(I/L)&&F("overflow"),f*=L;u=a.length+1,h=Z(d-P,u,P==0),E(d/u)>I-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,P,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=I,h=0;h<g;++h)f=n[h],f>=a&&f<w&&(w=f);for(A=u+1,w-a>E((I-o)/A)&&F("overflow"),o+=(w-a)*A,a=w,h=0;h<g;++h)if(f=n[h],f<a&&++o>I&&F("overflow"),f==a){for(x=o,R=T;P=R<=y?v:R>=y+b?b:R-y,!(x<P);R+=T)j=x-P,L=T-P,m.push(O(Y(P+j%L,0))),x=E(j/L);m.push(O(Y(x,0))),y=Z(o,A,u==d),o=0,++u}++o,++a}return m.join("")}function we(n){return V(n,function(a){return he.test(a)?K(a.slice(4).toLowerCase()):a})}function me(n){return V(n,function(a){return fe.test(a)?"xn--"+z(a):a})}if(l={version:"1.4.1",ucs2:{decode:H,encode:W},decode:K,encode:z,toASCII:me,toUnicode:we},i&&s)if(r.exports==i)s.exports=l;else for(N in l)l.hasOwnProperty(N)&&(i[N]=l[N]);else e.punycode=l})(_e)})(M,M.exports)),M.exports}Oe();var le=(function(r){function t(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return t();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:t});var e=__magic__;return e})(Object),Me=le.URL;le.URLSearchParams;var Ne={URL:Me};class ce extends Error{constructor(e,i,s){super(e);p(this,"status");p(this,"data");this.status=i,this.data=s}}const De=3,je=1e3,Be=[400,401,403,404,409,422],qe=(globalThis==null?void 0:globalThis.URL)??Ne.URL;class Ge{constructor(t,e){p(this,"baseUrl");p(this,"retries");p(this,"retryDelay");p(this,"nonRetryableStatuses");p(this,"identity");p(this,"sleep",t=>new Promise(e=>{setTimeout(e,t)}));p(this,"getIdentity",()=>this.identity instanceof Function?this.identity():this.identity);p(this,"rawFetch",(t,e)=>{const i=new qe(t,this.baseUrl),s=(e==null?void 0:e.identity)??this.getIdentity();return 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};