@dcl/shop 1.13.1-35590455689.commit-b96d6aa → 1.14.0

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 (245) hide show
  1. package/_assets/{Activity-DtmObND1.js → Activity-ClJDhuA1.js} +4 -4
  2. package/_assets/{AnimatedBackground-C7LiOBAR.js → AnimatedBackground-DUa7Ov2v.js} +6 -6
  3. package/_assets/{Assets-BKSeyg2-.js → Assets-BcIc0eUO.js} +5 -5
  4. package/_assets/{Cart-BlPpGnda.js → Cart-D_ERTjKD.js} +2 -2
  5. package/_assets/{Collection-CcSqRcWT.js → Collection-D_kOCbdO.js} +2 -2
  6. package/_assets/{CollectionCarousel-B94cetFe.js → CollectionCarousel-B6lWrJsP.js} +3 -3
  7. package/_assets/{Confetti-BsAs2ze-.js → Confetti-Bew-g_8a.js} +4 -4
  8. package/_assets/{ConstantsUtil-C2D8mddi.js → ConstantsUtil-BEIMadrA.js} +2 -2
  9. package/_assets/{ContentClient-CzFsgWm1.js → ContentClient-y5W_g7Vn.js} +2 -2
  10. package/_assets/{Creator-CJGUaWbh.js → Creator-COzG8j2A.js} +2 -2
  11. package/_assets/{CreditPackPicker-CsfuFEfj.js → CreditPackPicker-B3dHhf6V.js} +2 -2
  12. package/_assets/{DeploymentBuilder-C567uLsW.js → DeploymentBuilder-BqOyy9Nu.js} +2 -2
  13. package/_assets/{EmotePlaybackBar-v4_tU2B8.js → EmotePlaybackBar-CkJMl8Ys.js} +3 -3
  14. package/_assets/{ErrorNotice-Bvb886Qo.js → ErrorNotice-BzCdhpYg.js} +2 -2
  15. package/_assets/{Event-Dw7dIeEd.js → Event-DmwvHWg0.js} +2 -2
  16. package/_assets/{ExchangeController-DosyxWhL.js → ExchangeController-CcJ992u0.js} +2 -2
  17. package/_assets/{Faq-CfWixARb.js → Faq-DyMSOSdu.js} +2 -2
  18. package/_assets/{Filters-YViPs7N9.js → Filters-0mhMwsT4.js} +2 -2
  19. package/_assets/{GetCredits-xHj_8fdJ.js → GetCredits-Zpdkomal.js} +2 -2
  20. package/_assets/{Grow-CTV7DbJ0.js → Grow-BMYVzAB-.js} +2 -2
  21. package/_assets/{HelpersUtil-CH7uwgeQ.js → HelpersUtil-D3GTjIqd.js} +2 -2
  22. package/_assets/{ItemDetail-CGP_a6DC.js → ItemDetail-CJj8jEHw.js} +2 -2
  23. package/_assets/{LoadMore-DtjdrYgG.js → LoadMore-BoawUj5u.js} +2 -2
  24. package/_assets/{ManaPricingBanner.styles-DujCFxcW.js → ManaPricingBanner.styles-ZBF47pKw.js} +2 -2
  25. package/_assets/{MyAssets-B6TkqwwO.js → MyAssets-B716pQR9.js} +2 -2
  26. package/_assets/{MyFavorites-B44xn-9o.js → MyFavorites-C7E4rGlu.js} +2 -2
  27. package/_assets/{MyStore-BQ6gSMq1.js → MyStore-B4ovbK7K.js} +2 -2
  28. package/_assets/{NetworkUtil-gznX6ou4.js → NetworkUtil-Cfolzg8H.js} +2 -2
  29. package/_assets/{NotFound-D7NlwWss.js → NotFound-BeAnWp_j.js} +2 -2
  30. package/_assets/{NotificationsBell-wL661h4k.js → NotificationsBell-BKPZceet.js} +2 -2
  31. package/_assets/{OutfitDetail-CSiCaTR7.js → OutfitDetail-84M6woQd.js} +2 -2
  32. package/_assets/{OutfitPreview-CKul99pm.js → OutfitPreview-B9rXgc6T.js} +2 -2
  33. package/_assets/{OutfitStudio-BFVYiWYq.js → OutfitStudio-Bmcs3UQ2.js} +2 -2
  34. package/_assets/{PaymentMethodStep-gIGuBdJE.js → PaymentMethodStep-BhlDujoG.js} +2 -2
  35. package/_assets/{SaleCountdown-2TjAtNVx.js → SaleCountdown-ZqNNRvGl.js} +2 -2
  36. package/_assets/{Spinner-CRDfDFgI.js → Spinner-q3iTi3ii.js} +2 -2
  37. package/_assets/{StoreSettings-CWiJDJd-.js → StoreSettings-C2RcxecX.js} +2 -2
  38. package/_assets/{Success-BKyyN-pm.js → Success-DC7IQtYH.js} +2 -2
  39. package/_assets/{SwapController-DCQKOdcz.js → SwapController-ZhjMiIuW.js} +2 -2
  40. package/_assets/{Tooltip-DDZC_HFb.js → Tooltip-D93wbqH3.js} +2 -2
  41. package/_assets/{TradeService-DfSf1NpN.js → TradeService-CitNPz55.js} +2 -2
  42. package/_assets/{W3MFrameProviderSingleton-CrWP7H9X.js → W3MFrameProviderSingleton-C45teoHA.js} +4 -4
  43. package/_assets/{WebCryptoP256-CLuRQdD0.js → WebCryptoP256-P1TJpkT3.js} +2 -2
  44. package/_assets/{basic-CnpinvSd.js → basic-DFLU4hvG.js} +2 -2
  45. package/_assets/{biconomy-CQS-_u1K.js → biconomy-Cn58cwLB.js} +2 -2
  46. package/_assets/{browseLayout.styles-DlEgobcb.js → browseLayout.styles-BQX0gV95.js} +2 -2
  47. package/_assets/{browser-jrXp40VI.js → browser-2FaDq09e.js} +2 -2
  48. package/_assets/{browser-JmFfz-b9.js → browser-DUVgJQ9P.js} +2 -2
  49. package/_assets/{browser-ponyfill-vVJjiRiF.js → browser-ponyfill-yjhsbKOy.js} +2 -2
  50. package/_assets/{buy-DNvl7CRU.js → buy-CTkywn1H.js} +2 -2
  51. package/_assets/{buy-gasless-Cd8D2hco.js → buy-gasless-DMB8lxmW.js} +2 -2
  52. package/_assets/{cart-checkout-BvFV5K1b.js → cart-checkout-VtT_e12v.js} +2 -2
  53. package/_assets/{categories-D2I9oC9p.js → categories-D9ztnT0t.js} +2 -2
  54. package/_assets/{ccip-D8g0xR6M.js → ccip-BnqB_0si.js} +2 -2
  55. package/_assets/{ccip-fv1rGl9l.js → ccip-DPDrDIOJ.js} +2 -2
  56. package/_assets/{chains-rk6oFk-J.js → chains-DSedwvSh.js} +2 -2
  57. package/_assets/collectionPage.styles-Ie9Wzs-2.js +41 -0
  58. package/_assets/{common-CMmghlP6.js → common-Csv1Hgun.js} +2 -2
  59. package/_assets/{controller-l-w-81tc.js → controller-BbIvRnu_.js} +3 -3
  60. package/_assets/{core-BphVSVDd.js → core-B1SeNqWd.js} +5 -5
  61. package/_assets/{createSvgIcon-Ci6-mKZX.js → createSvgIcon-DTlsIw_n.js} +2 -2
  62. package/_assets/{crumbs.styles-DhvCPMDb.js → crumbs.styles-BjlZjxKT.js} +2 -2
  63. package/_assets/{custom-COOt78S6.js → custom-CyNnwyrk.js} +2 -2
  64. package/_assets/{data-capture-C7thi-6U.js → data-capture-bl3RuFhy.js} +2 -2
  65. package/_assets/{dcl-schemas-rAoTN5Ga.js → dcl-schemas-DX4k9umP.js} +2 -2
  66. package/_assets/{decimals-Dl7Q2CQ8.js → decimals-BPknTcmM.js} +2 -2
  67. package/_assets/{decimals-DvdfA0Vf.js → decimals-BSb-J95O.js} +2 -2
  68. package/_assets/{detectExtension-CnrRv_RG.js → detectExtension-fRCVx78W.js} +2 -2
  69. package/_assets/{disposePreview-ZbaLYmpw.js → disposePreview-DvIwpsnU.js} +2 -2
  70. package/_assets/{email-eSYyd3Ic.js → email-gkNu-Hlx.js} +2 -2
  71. package/_assets/{embedded-wallet-DDuKB0SG.js → embedded-wallet-Cs5NPUt8.js} +2 -2
  72. package/_assets/{emotion-styled.browser.esm-hf9E1adQ.js → emotion-styled.browser.esm-BJVzjU1c.js} +2 -2
  73. package/_assets/{engine-DD67Y28C.js → engine-CW2Z8pVD.js} +2 -2
  74. package/_assets/{errors-YbnZlxOr.js → errors-4zJ_Wl5M.js} +2 -2
  75. package/_assets/{estimate-l1-fee-Db8Xd1Gz.js → estimate-l1-fee-Badwsb8m.js} +2 -2
  76. package/_assets/{eth_estimateGas-CuREEErh.js → eth_estimateGas-BgFpyTkS.js} +2 -2
  77. package/_assets/{eth_getStorageAt-DZSUCK-B.js → eth_getStorageAt-DKEPQON0.js} +2 -2
  78. package/_assets/{eth_getTransactionCount-BdILqCdx.js → eth_getTransactionCount-gaEnGR6r.js} +2 -2
  79. package/_assets/{ethereum-B-cyXRfV.js → ethereum-S8WcHv6J.js} +2 -2
  80. package/_assets/{ethers-BicPoGF3.js → ethers-zQzQ03Jk.js} +2 -2
  81. package/_assets/{events-CaiMQ2jo.js → events-Dw8qdJzW.js} +2 -2
  82. package/_assets/{execute-DY89Xj7h.js → execute-U5naAh6E.js} +3 -3
  83. package/_assets/{extractIPFS-DPI0xl1R.js → extractIPFS-BNCXnSzg.js} +2 -2
  84. package/_assets/{features-CuKlQS4a.js → features-BBcVsOgK.js} +2 -2
  85. package/_assets/{fetchTokenMetadata-BxkvK3Bm.js → fetchTokenMetadata-By10s6gT.js} +3 -3
  86. package/_assets/{field.styles-DMi6RLqU.js → field.styles-BIZZX6wX.js} +2 -2
  87. package/_assets/{fortmatic-O6xyCC9X.js → fortmatic-B8kFivHm.js} +2 -2
  88. package/_assets/{get-bytecode-Mi4Svfmk.js → get-bytecode-DrE4YuwF.js} +2 -2
  89. package/_assets/{get-ecosystem-wallet-info-UP5lf6cZ.js → get-ecosystem-wallet-info-BNQ_hX9h.js} +2 -2
  90. package/_assets/{getBalance-B6-tJ5BV.js → getBalance-DLClyv9X.js} +3 -3
  91. package/_assets/{getInstalledModules-BtUgUvpg.js → getInstalledModules-IfG8UyYC.js} +2 -2
  92. package/_assets/{getNFT-BkPMs9B5.js → getNFT-DJiUJ9Oi.js} +3 -3
  93. package/_assets/{getNFT-DATmUgAo.js → getNFT-oyj-taig.js} +2 -2
  94. package/_assets/{grid.styles-D0ZoMAGk.js → grid.styles-Z4awgikx.js} +2 -2
  95. package/_assets/{hashTypedData-CefqN4UY.js → hashTypedData-D4-M18T2.js} +2 -2
  96. package/_assets/{hashTypedData-DN22sW92.js → hashTypedData-FU3Vjhpj.js} +2 -2
  97. package/_assets/{import-uY6UfPXb.js → import-CEcKo4mP.js} +2 -2
  98. package/_assets/{in-app-Bny7t-DP.js → in-app-I0cf7WYG.js} +2 -2
  99. package/_assets/{in-app-wallet-calls-DCQO7CRP.js → in-app-wallet-calls-CKuFDFk-.js} +2 -2
  100. package/_assets/{index-CakMQwPl.js → index-1VwXrOEt.js} +2 -2
  101. package/_assets/{index-PCOMQSTj.js → index-42hgym_I.js} +14 -14
  102. package/_assets/{index-BXZWbQLr.js → index-6Xn36K0W.js} +2 -2
  103. package/_assets/{index-MB1YeHVs.js → index-B4wWS0Gy.js} +2 -2
  104. package/_assets/{index-TLvmnU-6.js → index-BAKQxGdL.js} +2 -2
  105. package/_assets/{index-D_GN8H-m.js → index-BLAsxxaO.js} +2 -2
  106. package/_assets/{index-Bwq-s3g2.js → index-BQGv2KeQ.js} +2 -2
  107. package/_assets/{index-BNxapPjc.js → index-BULAWDSX.js} +2 -2
  108. package/_assets/{index-BB2vaXmU.js → index-Be-ctASu.js} +2 -2
  109. package/_assets/{index-ujlY03pm.js → index-BfPQiLLe.js} +2 -2
  110. package/_assets/{index-D1s-_zWj.js → index-Bgiq1vwC.js} +2 -2
  111. package/_assets/{index-D5mE-BZf.js → index-BjBSPCU1.js} +2 -2
  112. package/_assets/{index-BdzxJpnV.js → index-Bo9y28EU.js} +2 -2
  113. package/_assets/{index-CFX2-tLC.js → index-BoPotZC3.js} +2 -2
  114. package/_assets/{index-CM1GTgwu.js → index-Bqh-tCGe.js} +2 -2
  115. package/_assets/{index-B5yRX3sO.js → index-C1hKYMFK.js} +2 -2
  116. package/_assets/{index-0GVDw4uz.js → index-C2mGmByD.js} +2 -2
  117. package/_assets/{index-DBXe-H17.js → index-CA7TO4ls.js} +4 -4
  118. package/_assets/{index-Vx6QrhKv.js → index-CEPyzyCp.js} +2 -2
  119. package/_assets/{index-Dm2tHUTz.js → index-CFthW2p7.js} +2 -2
  120. package/_assets/{index--MHqQDZS.js → index-CV-lFcl7.js} +2 -2
  121. package/_assets/{index-CbayBN70.js → index-C_9coDoA.js} +2 -2
  122. package/_assets/index-Ccn2ZaWp.css +1 -0
  123. package/_assets/{index-BXk1eKu5.js → index-Cf0ax7ss.js} +2 -2
  124. package/_assets/{index-PdWok5k8.js → index-Cf2kLDcU.js} +3 -3
  125. package/_assets/{index-C30kKaUV.js → index-CfVRvVRY.js} +2 -2
  126. package/_assets/{index-B5rvK7P3.js → index-CgIMFF8o.js} +2 -2
  127. package/_assets/{index-Cg51zZ2k.js → index-CkieTCyo.js} +2 -2
  128. package/_assets/{index-_CzitlLr.js → index-Cn2VZ7A5.js} +2 -2
  129. package/_assets/{index-Dk93Si47.js → index-CoM_vldC.js} +2 -2
  130. package/_assets/{index-CW8iztAv.js → index-CsbKyoiZ.js} +2 -2
  131. package/_assets/{index-oZ1tZhJd.js → index-Cwr2mQ1P.js} +3 -3
  132. package/_assets/{index-7-ubf_-8.js → index-CxnrQJZL.js} +2 -2
  133. package/_assets/{index-fKOqL46i.js → index-D36MVtN_.js} +2 -2
  134. package/_assets/{index-Cz_NLjja.js → index-D8S7I2jv.js} +3 -3
  135. package/_assets/{index-DtG0vwAQ.js → index-DBeIvzhn.js} +2 -2
  136. package/_assets/{index-B-pxbYDD.js → index-DC0IP02u.js} +2 -2
  137. package/_assets/{index-DVuOEZvs.js → index-DFGKEHJp.js} +2 -2
  138. package/_assets/{index-BYX4J5QP.js → index-DG7I_o74.js} +2 -2
  139. package/_assets/{index-C1VNSD13.js → index-DLs1oPw4.js} +2 -2
  140. package/_assets/{index-CDzHP3jq.js → index-DOMRwinX.js} +2 -2
  141. package/_assets/{index-CbiZcfm9.js → index-DOnS6h9q.js} +2 -2
  142. package/_assets/{index-DLNZA_z3.js → index-DQ72F3-_.js} +2 -2
  143. package/_assets/{index-BUq9yZ3w.js → index-DQBa_kNC.js} +2 -2
  144. package/_assets/{index-tJJoQndL.js → index-DYg0EuOr.js} +2 -2
  145. package/_assets/{index-B8Miitap.js → index-DZa4T5tN.js} +2 -2
  146. package/_assets/{index-xFEDZfFw.js → index-Dbq2Ch71.js} +2 -2
  147. package/_assets/{index-72AbyZoi.js → index-DcNOFVm1.js} +2 -2
  148. package/_assets/{index-DvmOwVBr.js → index-Dg63gyHq.js} +2 -2
  149. package/_assets/{index-DY5YerbM.js → index-DhOTREMg.js} +3 -3
  150. package/_assets/{index-BvC4isNn.js → index-DjXa64AR.js} +2 -2
  151. package/_assets/{index-DKolBddb.js → index-DjzjJqtG.js} +2 -2
  152. package/_assets/{index-CO1HUlye.js → index-DpxLcDgW.js} +2 -2
  153. package/_assets/{index-Nax2ER2m.js → index-Dtp8rC8A.js} +2 -2
  154. package/_assets/{index-Dmr0-dT1.js → index-DuxgvZzF.js} +2 -2
  155. package/_assets/{index-DXGd7b5m.js → index-FjNEHsud.js} +2 -2
  156. package/_assets/{index-BJ_QYYzi.js → index-GJ64rDmp.js} +2 -2
  157. package/_assets/{index-os35Oj8Y.js → index-QVjmP3xl.js} +2 -2
  158. package/_assets/{index-Crr-s_9f.js → index-SJBE5eFc.js} +2 -2
  159. package/_assets/{index-BxmlkA7q.js → index-W4ibltdC.js} +2 -2
  160. package/_assets/{index-gLJ8elkH.js → index-XHcC2FaE.js} +2 -2
  161. package/_assets/{index-CYNOPRoZ.js → index-Z37GANTN.js} +2 -2
  162. package/_assets/{index-6JqTwz5Z.js → index-fCngzjUk.js} +4 -4
  163. package/_assets/{index-Dck2NPjx.js → index-mTyAR_XJ.js} +2 -2
  164. package/_assets/{index-CP4g0MYO.js → index-srmfnjPo.js} +2 -2
  165. package/_assets/{index-HpMk4su8.js → index-vC3-5xFa.js} +4 -4
  166. package/_assets/{index-B0ZDNOJc.js → index-xHNryJhm.js} +2 -2
  167. package/_assets/{index-DY6MimDO.js → index-xmrxkFq5.js} +2 -2
  168. package/_assets/{index.es-DXZDtwqn.js → index.es-BTnBOO6U.js} +2 -2
  169. package/_assets/{index.es-naJ1lYo9.js → index.es-BjMftfX7.js} +2 -2
  170. package/_assets/{index.es-ug1d0j5_.js → index.es-BoxCyFog.js} +5 -5
  171. package/_assets/{index.es-BA-gf3fx.js → index.es-CkHCyafU.js} +2 -2
  172. package/_assets/items-empty-BgYde4VW.js +2 -0
  173. package/_assets/{jump-CDi48t17.js → jump-DM5AuOdu.js} +2 -2
  174. package/_assets/{linkAccount-D2r-_PNt.js → linkAccount-LJHWy5CK.js} +2 -2
  175. package/_assets/{localBatchGatewayRequest-DCZrRD0b.js → localBatchGatewayRequest-C4Hpu-o0.js} +2 -2
  176. package/_assets/{modal.styles-B9NcZpH1.js → modal.styles-B24MpRUv.js} +2 -2
  177. package/_assets/{native-CsJDQkEo.js → native-DwXB0bjC.js} +2 -2
  178. package/_assets/{networks-H2-ip_xr.js → networks-C5jU04Cx.js} +2 -2
  179. package/_assets/{onramp-jMWRpk_W.js → onramp-vNFpzEJn.js} +2 -2
  180. package/_assets/{openzeppelin-CNtXocND.js → openzeppelin-CZOcMmYj.js} +2 -2
  181. package/_assets/{ownerOf-D2gp3JZq.js → ownerOf-CbZeyYyT.js} +2 -2
  182. package/_assets/{parseNft-Cj0GHmVO.js → parseNft-BbihitES.js} +3 -3
  183. package/_assets/{parseSignature-DqjVaLFW.js → parseSignature-C4U6F_fO.js} +2 -2
  184. package/_assets/{parseSignature-Cr-6xEFY.js → parseSignature-Cfk8FqxM.js} +4 -4
  185. package/_assets/{passkeys-ZTPY9Io2.js → passkeys--CjtD2Ra.js} +2 -2
  186. package/_assets/{pay-with-exchange-DFmrgXeW.js → pay-with-exchange-BI9c0reN.js} +2 -2
  187. package/_assets/{prepare-contract-call-BXj1hstj.js → prepare-contract-call-CoYzlXqQ.js} +2 -2
  188. package/_assets/{qr-overlay-BaiwMdsM.js → qr-overlay-z09rwiht.js} +4 -4
  189. package/_assets/{react-BQkTEhfI.js → react-CZ2YYu9h.js} +2 -2
  190. package/_assets/{receive-C-lo_prs.js → receive-Dd15UTLF.js} +2 -2
  191. package/_assets/{resolveImplementation-CmaftYpU.js → resolveImplementation-DUg5Jhmj.js} +2 -2
  192. package/_assets/{resume-buy-CVhyi-L1.js → resume-buy-B2bK6shi.js} +2 -2
  193. package/_assets/{resume-name-DUz5x9Rs.js → resume-name-HFLT1W-_.js} +2 -2
  194. package/_assets/{rpc-B61gfFSf.js → rpc-D2wD2_af.js} +2 -2
  195. package/_assets/{sales-empty-B211ygk7.js → sales-empty-BSDLd2Ac.js} +2 -2
  196. package/_assets/{search-empty-D4s8B_tZ.js → search-empty-CngZRhKm.js} +2 -2
  197. package/_assets/{secp256k1-Bd-eUAzZ.js → secp256k1-BRknMrYC.js} +2 -2
  198. package/_assets/{secp256k1-iVBXtOip.js → secp256k1-SE5N-Uo1.js} +2 -2
  199. package/_assets/{secp256k1-DV0o92mg.js → secp256k1-jAwCrfgX.js} +2 -2
  200. package/_assets/{send-DxdkG-xE.js → send-BJBHSNCZ.js} +2 -2
  201. package/_assets/{send-batch-transaction-CxU4nO-t.js → send-batch-transaction-BZVCQXYh.js} +2 -2
  202. package/_assets/{send-eip712-transaction-DFcFblDh.js → send-eip712-transaction-BO8U424Q.js} +3 -3
  203. package/_assets/{send-gasless-transaction-8mkyEx1n.js → send-gasless-transaction-CPHMIHcy.js} +3 -3
  204. package/_assets/{send-transaction-5bX-xy_o.js → send-transaction-DwOBumXa.js} +3 -3
  205. package/_assets/{sendMetaTransaction-C0dwdljX.js → sendMetaTransaction-CvXg55Sj.js} +2 -2
  206. package/_assets/{sendRawTransaction-Z6tsEgH4.js → sendRawTransaction-C9G3juFQ.js} +4 -4
  207. package/_assets/{sentry-DEsWWpBW.js → sentry-B1mJ7lMg.js} +3 -3
  208. package/_assets/{serializeTransaction-97Bat4Ro.js → serializeTransaction-BGQTd-eV.js} +2 -2
  209. package/_assets/{session-proposal-BFyOx5ep.js → session-proposal-CmybrBgX.js} +2 -2
  210. package/_assets/{session-request-B-ZDEBIl.js → session-request-B8NAXzJm.js} +3 -3
  211. package/_assets/{sha256-CFlr28b8.js → sha256-BfpwxWFN.js} +2 -2
  212. package/_assets/{sha3-VyXLimeE.js → sha3-BSpI9EWc.js} +2 -2
  213. package/_assets/signin-empty-Ae4I7w1I.js +2 -0
  214. package/_assets/{signing-CaEAGDvd.js → signing-BeQY8i5o.js} +4 -4
  215. package/_assets/{skeleton.styles-CP5AXi51.js → skeleton.styles-BvmK2SPa.js} +2 -2
  216. package/_assets/{socials-BAatCjg9.js → socials-pv-fatlK.js} +2 -2
  217. package/_assets/{styled-Ciz7uJTf.js → styled-BN3FALZ-.js} +2 -2
  218. package/_assets/{swaps-Duk8fCsv.js → swaps-CBLIZcy1.js} +2 -2
  219. package/_assets/{thirdweb-Cvgkcum1.js → thirdweb-B0tAvkOB.js} +4 -4
  220. package/_assets/{to-serializable-transaction-BQmkdzOC.js → to-serializable-transaction-DlVSUELg.js} +3 -3
  221. package/_assets/{totalSupply-DWGbPH_3.js → totalSupply-BUrR0ujT.js} +2 -2
  222. package/_assets/{trade-encoding-7I6Mahyk.js → trade-encoding-BHVebGX4.js} +2 -2
  223. package/_assets/{transaction-C6zqrRsP.js → transaction-DEuQGHWS.js} +2 -2
  224. package/_assets/{transactionReceipt-wHhvs2MM.js → transactionReceipt-BdYwXxz9.js} +2 -2
  225. package/_assets/{transactions-CWlJM2Ik.js → transactions-Dy4aCK3U.js} +2 -2
  226. package/_assets/{useCreatorSales-B_z9WK8w.js → useCreatorSales-C3o5VeDN.js} +2 -2
  227. package/_assets/{useInfiniteGrid-B28HAmqv.js → useInfiniteGrid-Dt_ssV2e.js} +2 -2
  228. package/_assets/{useStore-BH311mqp.js → useStore-DSk5Zm3O.js} +3 -3
  229. package/_assets/{useTheme-CnRNEYQX.js → useTheme-B0ivQtHy.js} +2 -2
  230. package/_assets/{utils-Dpy_P8-Z.js → utils-DhRq6yOi.js} +2 -2
  231. package/_assets/{verifyHash-CNHX3bhf.js → verifyHash-CykSL3oh.js} +2 -2
  232. package/_assets/{w3m-modal-Cd0pP9Y6.js → w3m-modal-MQbLbuVJ.js} +2 -2
  233. package/_assets/{w3m-modal-BfLNfzQm.js → w3m-modal-zpVMRo94.js} +2 -2
  234. package/_assets/{wait-for-tx-receipt-CCoeTvDN.js → wait-for-tx-receipt-COH8KUJZ.js} +2 -2
  235. package/_assets/{wallets-DBEimxdS.js → wallets-D36z-WS9.js} +6 -6
  236. package/_assets/{web-connector-CFETM0Ek.js → web-connector-DfG35fRn.js} +4 -4
  237. package/_assets/{writeContract-xYjTt9Gm.js → writeContract-BZyrswRY.js} +2 -2
  238. package/_assets/{zora-sepolia-CmFkNSlJ.js → zora-sepolia-D5TfknXJ.js} +2 -2
  239. package/_assets/{zoraTestnet-D9iiG-Zu.js → zoraTestnet-YadYknEM.js} +2 -2
  240. package/index.html +11 -11
  241. package/package.json +2 -2
  242. package/_assets/collectionPage.styles-CNsIHztj.js +0 -41
  243. package/_assets/index-DKFaSnR3.css +0 -1
  244. package/_assets/items-empty-DQe16EqO.js +0 -2
  245. package/_assets/signin-empty-3JhXhx04.js +0 -2
@@ -1,2 +1,2 @@
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 _,C as m,B as N,b as L,m as E,A as O,n as z,d as W,g as R,o as H,e as V,i as q,p as $}from"./W3MFrameProviderSingleton-CrWP7H9X.js";import{au as b}from"./NetworkUtil-gznX6ou4.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="d5bf39f8-0096-4633-a71d-e79393a73741",n._sentryDebugIdIdentifier="sentry-dbid-d5bf39f8-0096-4633-a71d-e79393a73741")}catch{}})();const C={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=C.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,g={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:W.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=$({...g}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,y,h,A,S,P;const n=m.state.activeChain,o=((i=m.getAccountData(n))==null?void 0:i.caipAddress)??m.state.activeCaipAddress,t=L.getPlainAddress(o),s=R(),c=H.getConnectorId(m.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)||!((y=e.sourceToken)!=null&&y.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(h=e.sourceToken)==null?void 0:h.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===b.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=g.myTokensWithBalance,e.tokensPriceMap=g.tokensPriceMap,e.initialized=g.initialized,e.initializing=g.initializing,e.switchingTokens=g.switchingTokens,e.sourceToken=g.sourceToken,e.sourceTokenAmount=g.sourceTokenAmount,e.sourceTokenPriceInUSD=g.sourceTokenPriceInUSD,e.toToken=g.toToken,e.toTokenAmount=g.toTokenAmount,e.toTokenPriceInUSD=g.toTokenPriceInUSD,e.networkPrice=g.networkPrice,e.networkTokenSymbol=g.networkTokenSymbol,e.networkBalanceInUSD=g.networkBalanceInUSD,e.inputError=g.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=m.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=W.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(W.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:m.state.activeCaipNetwork,address:(s=m.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=m.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=m.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case b.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 b.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=C.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=m.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=L.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 y=L.getPlainAddress(u.tx.to);if(!y)throw new Error("SwapController:createSwapTransaction - address is required");const h={data:u.tx.data,to:y,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=h,h}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:b.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=m.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(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,y,h,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:b.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((y=m.state.activeCaipNetwork)==null?void 0:y.caipNetworkId)||"",swapFromToken:((h=a.state.sourceToken)==null?void 0:h.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.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=m.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(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return C.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=C.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=C.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=C.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
2
- //# sourceMappingURL=SwapController-DCQKOdcz.js.map
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 _,C as m,B as N,b as L,m as E,A as O,n as z,d as W,g as R,o as H,e as V,i as q,p as $}from"./W3MFrameProviderSingleton-C45teoHA.js";import{au as b}from"./NetworkUtil-Cfolzg8H.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="d5bf39f8-0096-4633-a71d-e79393a73741",n._sentryDebugIdIdentifier="sentry-dbid-d5bf39f8-0096-4633-a71d-e79393a73741")}catch{}})();const C={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=C.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,g={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:W.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=$({...g}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,y,h,A,S,P;const n=m.state.activeChain,o=((i=m.getAccountData(n))==null?void 0:i.caipAddress)??m.state.activeCaipAddress,t=L.getPlainAddress(o),s=R(),c=H.getConnectorId(m.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)||!((y=e.sourceToken)!=null&&y.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(h=e.sourceToken)==null?void 0:h.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===b.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=g.myTokensWithBalance,e.tokensPriceMap=g.tokensPriceMap,e.initialized=g.initialized,e.initializing=g.initializing,e.switchingTokens=g.switchingTokens,e.sourceToken=g.sourceToken,e.sourceTokenAmount=g.sourceTokenAmount,e.sourceTokenPriceInUSD=g.sourceTokenPriceInUSD,e.toToken=g.toToken,e.toTokenAmount=g.toTokenAmount,e.toTokenPriceInUSD=g.toTokenPriceInUSD,e.networkPrice=g.networkPrice,e.networkTokenSymbol=g.networkTokenSymbol,e.networkBalanceInUSD=g.networkBalanceInUSD,e.inputError=g.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=m.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=W.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(W.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:m.state.activeCaipNetwork,address:(s=m.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=m.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=m.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case b.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 b.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=C.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=m.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=L.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 y=L.getPlainAddress(u.tx.to);if(!y)throw new Error("SwapController:createSwapTransaction - address is required");const h={data:u.tx.data,to:y,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=h,h}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:b.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=m.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(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,y,h,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:b.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((y=m.state.activeCaipNetwork)==null?void 0:y.caipNetworkId)||"",swapFromToken:((h=a.state.sourceToken)==null?void 0:h.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.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=m.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(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return C.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=C.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=C.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=C.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
2
+ //# sourceMappingURL=SwapController-ZhjMiIuW.js.map
@@ -1,4 +1,4 @@
1
- import{r as o,j as z,d as W}from"./react-BQkTEhfI.js";import{s as j,a as c}from"./index-PCOMQSTj.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="63ca1e8c-66cb-4d82-a30f-d0c39c211a41",t._sentryDebugIdIdentifier="sentry-dbid-63ca1e8c-66cb-4d82-a30f-d0c39c211a41")}catch{}})();const C=(...t)=>({shouldForwardProp:a=>!t.includes(a)}),G=j("span",C("block"))`
1
+ import{r as o,j as z,d as W}from"./react-CZ2YYu9h.js";import{s as j,a as c}from"./index-42hgym_I.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="63ca1e8c-66cb-4d82-a30f-d0c39c211a41",t._sentryDebugIdIdentifier="sentry-dbid-63ca1e8c-66cb-4d82-a30f-d0c39c211a41")}catch{}})();const C=(...t)=>({shouldForwardProp:a=>!t.includes(a)}),G=j("span",C("block"))`
2
2
  display: ${({block:t})=>t?"flex":"inline-flex"};
3
3
  ${({block:t})=>t?"width: 100%;":""}
4
4
  `,T=j("span",C("placement"))`
@@ -43,4 +43,4 @@ import{r as o,j as z,d as W}from"./react-BQkTEhfI.js";import{s as j,a as c}from"
43
43
  transition: none;
44
44
  }
45
45
  `,l=8,f=8;function X({content:t,children:a,placement:n="top",block:P,onShow:d,className:_}){const[r,x]=o.useState(!1),[e,B]=o.useState(null),w=o.useId(),h=o.useRef(!1),g=o.useRef(null),y=o.useRef(null),E=o.useCallback(()=>{x(!0),h.current||(h.current=!0,d==null||d())},[d]),v=o.useCallback(()=>x(!1),[]),s=o.useCallback(()=>{const $=g.current,M=y.current;if(!$||!M)return;const i=$.getBoundingClientRect(),{offsetWidth:F,offsetHeight:p}=M,L=F/2,u=L+f,R=i.left+i.width/2,k=Math.min(Math.max(R,u),Math.max(u,window.innerWidth-u)),b={top:i.top-l,bottom:window.innerHeight-i.bottom-l},m=b[n]>=p||b[n]>=b[n==="top"?"bottom":"top"]?n:n==="top"?"bottom":"top",D=m==="top"?i.top-l:i.bottom+l,H=m==="top"?Math.max(D,p+f):Math.min(D,Math.max(f,window.innerHeight-p-f)),I=Math.max(0,L-13);B({left:k,top:H,arrow:Math.min(Math.max(R-k,-I),I),placement:m})},[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]),z.jsxs(G,{ref:g,className:_,block:P,onMouseEnter:E,onMouseLeave:v,onFocus:E,onBlur:v,children:[o.cloneElement(a,{"aria-describedby":r?w:void 0}),W.createPortal(z.jsx(T,{ref:y,role:"tooltip",id:w,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{X as T,C as n};
46
- //# sourceMappingURL=Tooltip-DDZC_HFb.js.map
46
+ //# sourceMappingURL=Tooltip-D93wbqH3.js.map
@@ -1,2 +1,2 @@
1
- var Oe=Object.defineProperty;var Ue=(t,r,e)=>r in t?Oe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e;var m=(t,r,e)=>Ue(t,typeof r!="symbol"?r+"":r,e);import{W as Ie,a as ie,C as De,B as Le,f as ce}from"./ethers-BicPoGF3.js";import{a as Me,d as V}from"./dcl-schemas-rAoTN5Ga.js";import{c as ue}from"./react-BQkTEhfI.js";import{c$ as je,L as de,h as le}from"./index-PCOMQSTj.js";import{c as z,e as qe}from"./index-PdWok5k8.js";import{s as He}from"./sendMetaTransaction-C0dwdljX.js";import"./sentry-DEsWWpBW.js";import"./intl-AKLEHPeO.js";import"./events-CaiMQ2jo.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="5a96ee27-44e6-4c41-a440-e8eae5668511",t._sentryDebugIdIdentifier="sentry-dbid-5a96ee27-44e6-4c41-a440-e8eae5668511")}catch{}})();async function Ne(t){const r=await Re();if(r){const e=await new Ie(r).getSigner().getChainId();if(t===e)return r}return z.createProvider(Me.ProviderType.NETWORK,t)}async function Re(){try{return await z.getProvider()}catch{try{const{provider:t}=await z.tryPreviousConnection();return t}catch{return null}}}function fe(t){return Math.floor(t/1e3)}function he(t){switch(t.assetType){case V.TradeAssetType.ERC721:return t.tokenId;case V.TradeAssetType.COLLECTION_ITEM:return t.itemId;case V.TradeAssetType.ERC20:return t.amount;case V.TradeAssetType.USD_PEGGED_MANA:return t.amount;default:return console.error("Invalid asset type:",t),""}}function ke(t){var r;return{checks:{uses:t.checks.uses,expiration:fe(t.checks.expiration),effective:fe(t.checks.effective),salt:ie(t.checks.salt,32),contractSignatureIndex:t.checks.contractSignatureIndex,signerSignatureIndex:t.checks.signerSignatureIndex,allowedRoot:ie(t.checks.allowedRoot,32),externalChecks:(r=t.checks.externalChecks)==null?void 0:r.map(e=>({contractAddress:e.contractAddress,selector:e.selector,value:e.value?e.value:"0x",required:e.required}))},sent:t.sent.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:he(e),extra:e.extra?e.extra:"0x"})),received:t.received.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:he(e),extra:e.extra?e.extra:"0x",beneficiary:e.beneficiary}))}}function pe(t,r){const e=ke(t);return{signer:t.signer,signature:t.signature,...e,checks:{...e.checks,allowedProof:[]},sent:e.sent.map(o=>({...o,beneficiary:r}))}}async function Ge(t){const r=await t.request({method:"eth_chainId",params:[]});let e;return typeof r=="string"?e=parseInt(r,16):e=r,e}async function Be(t){const r=await Ne(t);return new Ie(r)}const D=new qe.EventEmitter;var P;(function(t){t.ERROR="error",t.SUCCESS="success",t.PROMPT="prompt",t.ACCEPT="accept",t.REJECT="reject"})(P||(P={}));let $e="https://transactions-api.decentraland.org/v1";const Je=()=>$e,Ve=()=>new Promise((t,r)=>{const e=()=>{D.removeAllListeners(P.REJECT),t(!0)},o=()=>{D.removeAllListeners(P.ACCEPT),r(new Error("User rejected transaction"))};D.addListener(P.ACCEPT,e),D.addListener(P.REJECT,o)});async function ye(...t){const[r,e,...o]=t;try{const a=await Re();if(!a)throw new Error("Provider not connected");const i=await Ge(a),f=await Be(r.chainId),l=new De(r.address,r.abi,f),u=await(typeof e=="function"?e(l.populateTransaction):l.populateTransaction[e](...o));if(i===r.chainId){const h=f.getSigner();if(a.isMagic||a.isThirdweb){let p=Le.from(0);try{const I=await h.getGasPrice(),b=await h.estimateGas(u);p=I.mul(b)}catch{}if(!p.isZero()){const I=Ve(),b=await h.getBalance();D.emit(P.PROMPT,{transactionGasPrice:ce(p),userBalance:ce(b),chainId:r.chainId}),await I}}const d=await h.sendTransaction(u);return D.emit(P.SUCCESS,{txHash:d.hash}),d.hash}else{const h=await He(a,f,u.data,r,{serverURL:Je()});return D.emit(P.SUCCESS,{txHash:h}),h}}catch(a){const i={type:P.ERROR,error:a};throw D.emit(P.ERROR,i),a}}var B={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var We=B.exports,ge;function Ye(){return ge||(ge=1,(function(t,r){(function(e){var o=r&&!r.nodeType&&r,a=t&&!t.nodeType&&t,i=typeof ue=="object"&&ue;(i.global===i||i.window===i||i.self===i)&&(e=i);var f,l=2147483647,u=36,h=1,d=26,p=38,I=700,b=72,A=128,L="-",q=/^xn--/,$=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,k={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Z=u-h,C=Math.floor,G=String.fromCharCode,J;function M(n){throw new RangeError(k[n])}function Q(n,s){for(var c=n.length,y=[];c--;)y[c]=s(n[c]);return y}function ee(n,s){var c=n.split("@"),y="";c.length>1&&(y=c[0]+"@",n=c[1]),n=n.replace(H,".");var g=n.split("."),w=Q(g,s).join(".");return y+w}function te(n){for(var s=[],c=0,y=n.length,g,w;c<y;)g=n.charCodeAt(c++),g>=55296&&g<=56319&&c<y?(w=n.charCodeAt(c++),(w&64512)==56320?s.push(((g&1023)<<10)+(w&1023)+65536):(s.push(g),c--)):s.push(g);return s}function re(n){return Q(n,function(s){var c="";return s>65535&&(s-=65536,c+=G(s>>>10&1023|55296),s=56320|s&1023),c+=G(s),c}).join("")}function Fe(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:u}function ne(n,s){return n+22+75*(n<26)-((s!=0)<<5)}function ae(n,s,c){var y=0;for(n=c?C(n/I):n>>1,n+=C(n/s);n>Z*d>>1;y+=u)n=C(n/Z);return C(y+(Z+1)*n/(n+p))}function se(n){var s=[],c=n.length,y,g=0,w=A,v=b,_,R,F,S,T,E,x,U,j;for(_=n.lastIndexOf(L),_<0&&(_=0),R=0;R<_;++R)n.charCodeAt(R)>=128&&M("not-basic"),s.push(n.charCodeAt(R));for(F=_>0?_+1:0;F<c;){for(S=g,T=1,E=u;F>=c&&M("invalid-input"),x=Fe(n.charCodeAt(F++)),(x>=u||x>C((l-g)/T))&&M("overflow"),g+=x*T,U=E<=v?h:E>=v+d?d:E-v,!(x<U);E+=u)j=u-U,T>C(l/j)&&M("overflow"),T*=j;y=s.length+1,v=ae(g-S,y,S==0),C(g/y)>l-w&&M("overflow"),w+=C(g/y),g%=y,s.splice(g++,0,w)}return re(s)}function oe(n){var s,c,y,g,w,v,_,R,F,S,T,E=[],x,U,j,K;for(n=te(n),x=n.length,s=A,c=0,w=b,v=0;v<x;++v)T=n[v],T<128&&E.push(G(T));for(y=g=E.length,g&&E.push(L);y<x;){for(_=l,v=0;v<x;++v)T=n[v],T>=s&&T<_&&(_=T);for(U=y+1,_-s>C((l-c)/U)&&M("overflow"),c+=(_-s)*U,s=_,v=0;v<x;++v)if(T=n[v],T<s&&++c>l&&M("overflow"),T==s){for(R=c,F=u;S=F<=w?h:F>=w+d?d:F-w,!(R<S);F+=u)K=R-S,j=u-S,E.push(G(ne(S+K%j,0))),R=C(K/j);E.push(G(ne(R,0))),w=ae(c,U,y==g),c=0,++y}++c,++s}return E.join("")}function Ae(n){return ee(n,function(s){return q.test(s)?se(s.slice(4).toLowerCase()):s})}function Se(n){return ee(n,function(s){return $.test(s)?"xn--"+oe(s):s})}if(f={version:"1.4.1",ucs2:{decode:te,encode:re},decode:se,encode:oe,toASCII:Se,toUnicode:Ae},o&&a)if(t.exports==o)a.exports=f;else for(J in f)f.hasOwnProperty(J)&&(o[J]=f[J]);else e.punycode=f})(We)})(B,B.exports)),B.exports}Ye();var xe=(function(t){function r(){var o=this||self;return delete t.prototype.__magic__,o}if(typeof globalThis=="object")return globalThis;if(this)return r();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:r});var e=__magic__;return e})(Object),Ze=xe.URL;xe.URLSearchParams;var Ke={URL:Ze},O={},N={},W={},Y={},ve;function Pe(){if(ve)return Y;ve=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.getImplementation=t;function t(r,e){const o=r[e]??globalThis[e];if(!o)throw new ReferenceError(`"${String(e)}" is not defined`);return o}return Y}var Te;function Ce(){if(Te)return W;Te=1,Object.defineProperty(W,"__esModule",{value:!0}),W.default=e;const t=je(),r=Pe();function e(o={}){const a=(0,r.getImplementation)(o,"Headers");return function(f,l,u,h,d){const p=new a(d),I=String(Date.now()),b=JSON.stringify(h),A=[l.toLowerCase(),u.toLowerCase(),I,b].join(":");let L=0;const q=t.Authenticator.signPayload(f,A);for(const $ of q)p.set(t.AUTH_CHAIN_HEADER_PREFIX+L,JSON.stringify($)),L++;return p.set(t.AUTH_TIMESTAMP_HEADER,I),p.set(t.AUTH_METADATA_HEADER,b),p}}return W}var me;function we(){if(me)return N;me=1;var t=N&&N.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(N,"__esModule",{value:!0}),N.default=o;const r=t(Ce()),e=Pe();function o(a={}){const i=(0,r.default)(a),f=(0,e.getImplementation)(a,"URL"),l=(0,e.getImplementation)(a,"Request"),u=(0,e.getImplementation)(a,"fetch");return function(d,p){if(p&&p.identity){const{identity:I,metadata:b,...A}=p;if(typeof d=="string"||d instanceof f||globalThis.URL&&d instanceof globalThis.URL){const H=typeof d=="string"?new f(d):d,k=new l(H.toString(),{...A,headers:i(I,p.method||"GET",H.pathname,b||{},A==null?void 0:A.headers)});return u(k)}const L=new f(d.url),q=new l(d);return i(I,d.method||"GET",L.pathname,b||{}).forEach((H,k)=>{q.headers.set(k,H)}),u(q)}return u(d,p)}}return N}var X={},_e;function Xe(){return _e||(_e=1,Object.defineProperty(X,"__esModule",{value:!0})),X}var be;function ze(){return be||(be=1,(function(t){var r=O&&O.__createBinding||(Object.create?(function(l,u,h,d){d===void 0&&(d=h);var p=Object.getOwnPropertyDescriptor(u,h);(!p||("get"in p?!u.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return u[h]}}),Object.defineProperty(l,d,p)}):(function(l,u,h,d){d===void 0&&(d=h),l[d]=u[h]})),e=O&&O.__exportStar||function(l,u){for(var h in l)h!=="default"&&!Object.prototype.hasOwnProperty.call(u,h)&&r(u,l,h)},o=O&&O.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(t,"__esModule",{value:!0}),t.signedHeaderFactory=t.signedFetchFactory=void 0;const a=o(we());e(Xe(),t);var i=we();Object.defineProperty(t,"signedFetchFactory",{enumerable:!0,get:function(){return o(i).default}});var f=Ce();Object.defineProperty(t,"signedHeaderFactory",{enumerable:!0,get:function(){return o(f).default}}),t.default=(0,a.default)()})(O)),O}var Qe=ze();class Ee extends Error{constructor(e,o,a){super(e);m(this,"status");m(this,"data");this.status=o,this.data=a}}const et=3,tt=1e3,rt=[400,401,403,404,409,422],nt=(globalThis==null?void 0:globalThis.URL)??Ke.URL;class at{constructor(r,e){m(this,"baseUrl");m(this,"retries");m(this,"retryDelay");m(this,"nonRetryableStatuses");m(this,"identity");m(this,"sleep",r=>new Promise(e=>{setTimeout(e,r)}));m(this,"getIdentity",()=>this.identity instanceof Function?this.identity():this.identity);m(this,"rawFetch",(r,e)=>{const o=new nt(r,this.baseUrl),a=(e==null?void 0:e.identity)??this.getIdentity();return Qe.signedFetchFactory()(o.toString(),{...e,identity:a})});m(this,"fetch",async(r,e)=>{for(let o=0;o<=this.retries;o++)try{let a,i;try{a=await this.rawFetch(r,e);const f=await a.text();f.length===0?i={ok:!0,data:null}:i=JSON.parse(f)}catch(f){throw new Ee(f.message,void 0,null)}if(!a.ok||i.ok===!1){const f=i.message??i.error;throw new Ee(f??`Request failed with status code ${a.status}`,a.status,i.data)}return i.ok===!0?i.data:i}catch(a){if(console.error(`[API] HTTP request failed: ${a.message||""}`,a),this.retries===o||a.status&&this.nonRetryableStatuses.includes(a.status))throw a;await this.sleep(this.retryDelay)}throw new Error("Unreachable code")});this.baseUrl=r,this.identity=e==null?void 0:e.identity,this.retries=(e==null?void 0:e.retries)??et,this.retryDelay=(e==null?void 0:e.retryDelay)??tt,this.nonRetryableStatuses=(e==null?void 0:e.nonRetryableStatuses)??rt}}class st extends at{constructor(e,o,a){super(o,a);m(this,"signer");m(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"}}));m(this,"fetchTrade",async e=>this.fetch(`/v1/trades/${e}`,{method:"GET"}));this.signer=e}}class gt{constructor(r,e,o){m(this,"tradesAPI");this.tradesAPI=new st(r,e,{identity:o,retries:0})}async addTrade(r){return this.tradesAPI.addTrade(r)}async fetchTrade(r){return this.tradesAPI.fetchTrade(r)}async accept(r,e){const o=de(r.contract),a=le(o,r.chainId),i=pe(r,e);return ye(a,"accept",[i])}async cancel(r,e){const o=de(r.contract),a=le(o,r.chainId),i=pe(r,e);return ye(a,"cancelSignature",[i])}}export{gt as TradeService};
2
- //# sourceMappingURL=TradeService-DfSf1NpN.js.map
1
+ var Oe=Object.defineProperty;var Ue=(t,r,e)=>r in t?Oe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e;var m=(t,r,e)=>Ue(t,typeof r!="symbol"?r+"":r,e);import{W as Ie,a as ie,C as De,B as Le,f as ce}from"./ethers-zQzQ03Jk.js";import{a as Me,d as V}from"./dcl-schemas-DX4k9umP.js";import{c as ue}from"./react-CZ2YYu9h.js";import{c$ as je,L as de,h as le}from"./index-42hgym_I.js";import{c as z,e as qe}from"./index-Cf2kLDcU.js";import{s as He}from"./sendMetaTransaction-CvXg55Sj.js";import"./sentry-B1mJ7lMg.js";import"./intl-AKLEHPeO.js";import"./events-Dw8qdJzW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="5a96ee27-44e6-4c41-a440-e8eae5668511",t._sentryDebugIdIdentifier="sentry-dbid-5a96ee27-44e6-4c41-a440-e8eae5668511")}catch{}})();async function Ne(t){const r=await Re();if(r){const e=await new Ie(r).getSigner().getChainId();if(t===e)return r}return z.createProvider(Me.ProviderType.NETWORK,t)}async function Re(){try{return await z.getProvider()}catch{try{const{provider:t}=await z.tryPreviousConnection();return t}catch{return null}}}function fe(t){return Math.floor(t/1e3)}function he(t){switch(t.assetType){case V.TradeAssetType.ERC721:return t.tokenId;case V.TradeAssetType.COLLECTION_ITEM:return t.itemId;case V.TradeAssetType.ERC20:return t.amount;case V.TradeAssetType.USD_PEGGED_MANA:return t.amount;default:return console.error("Invalid asset type:",t),""}}function ke(t){var r;return{checks:{uses:t.checks.uses,expiration:fe(t.checks.expiration),effective:fe(t.checks.effective),salt:ie(t.checks.salt,32),contractSignatureIndex:t.checks.contractSignatureIndex,signerSignatureIndex:t.checks.signerSignatureIndex,allowedRoot:ie(t.checks.allowedRoot,32),externalChecks:(r=t.checks.externalChecks)==null?void 0:r.map(e=>({contractAddress:e.contractAddress,selector:e.selector,value:e.value?e.value:"0x",required:e.required}))},sent:t.sent.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:he(e),extra:e.extra?e.extra:"0x"})),received:t.received.map(e=>({assetType:e.assetType,contractAddress:e.contractAddress,value:he(e),extra:e.extra?e.extra:"0x",beneficiary:e.beneficiary}))}}function pe(t,r){const e=ke(t);return{signer:t.signer,signature:t.signature,...e,checks:{...e.checks,allowedProof:[]},sent:e.sent.map(o=>({...o,beneficiary:r}))}}async function Ge(t){const r=await t.request({method:"eth_chainId",params:[]});let e;return typeof r=="string"?e=parseInt(r,16):e=r,e}async function Be(t){const r=await Ne(t);return new Ie(r)}const D=new qe.EventEmitter;var P;(function(t){t.ERROR="error",t.SUCCESS="success",t.PROMPT="prompt",t.ACCEPT="accept",t.REJECT="reject"})(P||(P={}));let $e="https://transactions-api.decentraland.org/v1";const Je=()=>$e,Ve=()=>new Promise((t,r)=>{const e=()=>{D.removeAllListeners(P.REJECT),t(!0)},o=()=>{D.removeAllListeners(P.ACCEPT),r(new Error("User rejected transaction"))};D.addListener(P.ACCEPT,e),D.addListener(P.REJECT,o)});async function ye(...t){const[r,e,...o]=t;try{const a=await Re();if(!a)throw new Error("Provider not connected");const i=await Ge(a),f=await Be(r.chainId),l=new De(r.address,r.abi,f),u=await(typeof e=="function"?e(l.populateTransaction):l.populateTransaction[e](...o));if(i===r.chainId){const h=f.getSigner();if(a.isMagic||a.isThirdweb){let p=Le.from(0);try{const I=await h.getGasPrice(),b=await h.estimateGas(u);p=I.mul(b)}catch{}if(!p.isZero()){const I=Ve(),b=await h.getBalance();D.emit(P.PROMPT,{transactionGasPrice:ce(p),userBalance:ce(b),chainId:r.chainId}),await I}}const d=await h.sendTransaction(u);return D.emit(P.SUCCESS,{txHash:d.hash}),d.hash}else{const h=await He(a,f,u.data,r,{serverURL:Je()});return D.emit(P.SUCCESS,{txHash:h}),h}}catch(a){const i={type:P.ERROR,error:a};throw D.emit(P.ERROR,i),a}}var B={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var We=B.exports,ge;function Ye(){return ge||(ge=1,(function(t,r){(function(e){var o=r&&!r.nodeType&&r,a=t&&!t.nodeType&&t,i=typeof ue=="object"&&ue;(i.global===i||i.window===i||i.self===i)&&(e=i);var f,l=2147483647,u=36,h=1,d=26,p=38,I=700,b=72,A=128,L="-",q=/^xn--/,$=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,k={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Z=u-h,C=Math.floor,G=String.fromCharCode,J;function M(n){throw new RangeError(k[n])}function Q(n,s){for(var c=n.length,y=[];c--;)y[c]=s(n[c]);return y}function ee(n,s){var c=n.split("@"),y="";c.length>1&&(y=c[0]+"@",n=c[1]),n=n.replace(H,".");var g=n.split("."),w=Q(g,s).join(".");return y+w}function te(n){for(var s=[],c=0,y=n.length,g,w;c<y;)g=n.charCodeAt(c++),g>=55296&&g<=56319&&c<y?(w=n.charCodeAt(c++),(w&64512)==56320?s.push(((g&1023)<<10)+(w&1023)+65536):(s.push(g),c--)):s.push(g);return s}function re(n){return Q(n,function(s){var c="";return s>65535&&(s-=65536,c+=G(s>>>10&1023|55296),s=56320|s&1023),c+=G(s),c}).join("")}function Fe(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:u}function ne(n,s){return n+22+75*(n<26)-((s!=0)<<5)}function ae(n,s,c){var y=0;for(n=c?C(n/I):n>>1,n+=C(n/s);n>Z*d>>1;y+=u)n=C(n/Z);return C(y+(Z+1)*n/(n+p))}function se(n){var s=[],c=n.length,y,g=0,w=A,v=b,_,R,F,S,T,E,x,U,j;for(_=n.lastIndexOf(L),_<0&&(_=0),R=0;R<_;++R)n.charCodeAt(R)>=128&&M("not-basic"),s.push(n.charCodeAt(R));for(F=_>0?_+1:0;F<c;){for(S=g,T=1,E=u;F>=c&&M("invalid-input"),x=Fe(n.charCodeAt(F++)),(x>=u||x>C((l-g)/T))&&M("overflow"),g+=x*T,U=E<=v?h:E>=v+d?d:E-v,!(x<U);E+=u)j=u-U,T>C(l/j)&&M("overflow"),T*=j;y=s.length+1,v=ae(g-S,y,S==0),C(g/y)>l-w&&M("overflow"),w+=C(g/y),g%=y,s.splice(g++,0,w)}return re(s)}function oe(n){var s,c,y,g,w,v,_,R,F,S,T,E=[],x,U,j,K;for(n=te(n),x=n.length,s=A,c=0,w=b,v=0;v<x;++v)T=n[v],T<128&&E.push(G(T));for(y=g=E.length,g&&E.push(L);y<x;){for(_=l,v=0;v<x;++v)T=n[v],T>=s&&T<_&&(_=T);for(U=y+1,_-s>C((l-c)/U)&&M("overflow"),c+=(_-s)*U,s=_,v=0;v<x;++v)if(T=n[v],T<s&&++c>l&&M("overflow"),T==s){for(R=c,F=u;S=F<=w?h:F>=w+d?d:F-w,!(R<S);F+=u)K=R-S,j=u-S,E.push(G(ne(S+K%j,0))),R=C(K/j);E.push(G(ne(R,0))),w=ae(c,U,y==g),c=0,++y}++c,++s}return E.join("")}function Ae(n){return ee(n,function(s){return q.test(s)?se(s.slice(4).toLowerCase()):s})}function Se(n){return ee(n,function(s){return $.test(s)?"xn--"+oe(s):s})}if(f={version:"1.4.1",ucs2:{decode:te,encode:re},decode:se,encode:oe,toASCII:Se,toUnicode:Ae},o&&a)if(t.exports==o)a.exports=f;else for(J in f)f.hasOwnProperty(J)&&(o[J]=f[J]);else e.punycode=f})(We)})(B,B.exports)),B.exports}Ye();var xe=(function(t){function r(){var o=this||self;return delete t.prototype.__magic__,o}if(typeof globalThis=="object")return globalThis;if(this)return r();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:r});var e=__magic__;return e})(Object),Ze=xe.URL;xe.URLSearchParams;var Ke={URL:Ze},O={},N={},W={},Y={},ve;function Pe(){if(ve)return Y;ve=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.getImplementation=t;function t(r,e){const o=r[e]??globalThis[e];if(!o)throw new ReferenceError(`"${String(e)}" is not defined`);return o}return Y}var Te;function Ce(){if(Te)return W;Te=1,Object.defineProperty(W,"__esModule",{value:!0}),W.default=e;const t=je(),r=Pe();function e(o={}){const a=(0,r.getImplementation)(o,"Headers");return function(f,l,u,h,d){const p=new a(d),I=String(Date.now()),b=JSON.stringify(h),A=[l.toLowerCase(),u.toLowerCase(),I,b].join(":");let L=0;const q=t.Authenticator.signPayload(f,A);for(const $ of q)p.set(t.AUTH_CHAIN_HEADER_PREFIX+L,JSON.stringify($)),L++;return p.set(t.AUTH_TIMESTAMP_HEADER,I),p.set(t.AUTH_METADATA_HEADER,b),p}}return W}var me;function we(){if(me)return N;me=1;var t=N&&N.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(N,"__esModule",{value:!0}),N.default=o;const r=t(Ce()),e=Pe();function o(a={}){const i=(0,r.default)(a),f=(0,e.getImplementation)(a,"URL"),l=(0,e.getImplementation)(a,"Request"),u=(0,e.getImplementation)(a,"fetch");return function(d,p){if(p&&p.identity){const{identity:I,metadata:b,...A}=p;if(typeof d=="string"||d instanceof f||globalThis.URL&&d instanceof globalThis.URL){const H=typeof d=="string"?new f(d):d,k=new l(H.toString(),{...A,headers:i(I,p.method||"GET",H.pathname,b||{},A==null?void 0:A.headers)});return u(k)}const L=new f(d.url),q=new l(d);return i(I,d.method||"GET",L.pathname,b||{}).forEach((H,k)=>{q.headers.set(k,H)}),u(q)}return u(d,p)}}return N}var X={},_e;function Xe(){return _e||(_e=1,Object.defineProperty(X,"__esModule",{value:!0})),X}var be;function ze(){return be||(be=1,(function(t){var r=O&&O.__createBinding||(Object.create?(function(l,u,h,d){d===void 0&&(d=h);var p=Object.getOwnPropertyDescriptor(u,h);(!p||("get"in p?!u.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return u[h]}}),Object.defineProperty(l,d,p)}):(function(l,u,h,d){d===void 0&&(d=h),l[d]=u[h]})),e=O&&O.__exportStar||function(l,u){for(var h in l)h!=="default"&&!Object.prototype.hasOwnProperty.call(u,h)&&r(u,l,h)},o=O&&O.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(t,"__esModule",{value:!0}),t.signedHeaderFactory=t.signedFetchFactory=void 0;const a=o(we());e(Xe(),t);var i=we();Object.defineProperty(t,"signedFetchFactory",{enumerable:!0,get:function(){return o(i).default}});var f=Ce();Object.defineProperty(t,"signedHeaderFactory",{enumerable:!0,get:function(){return o(f).default}}),t.default=(0,a.default)()})(O)),O}var Qe=ze();class Ee extends Error{constructor(e,o,a){super(e);m(this,"status");m(this,"data");this.status=o,this.data=a}}const et=3,tt=1e3,rt=[400,401,403,404,409,422],nt=(globalThis==null?void 0:globalThis.URL)??Ke.URL;class at{constructor(r,e){m(this,"baseUrl");m(this,"retries");m(this,"retryDelay");m(this,"nonRetryableStatuses");m(this,"identity");m(this,"sleep",r=>new Promise(e=>{setTimeout(e,r)}));m(this,"getIdentity",()=>this.identity instanceof Function?this.identity():this.identity);m(this,"rawFetch",(r,e)=>{const o=new nt(r,this.baseUrl),a=(e==null?void 0:e.identity)??this.getIdentity();return Qe.signedFetchFactory()(o.toString(),{...e,identity:a})});m(this,"fetch",async(r,e)=>{for(let o=0;o<=this.retries;o++)try{let a,i;try{a=await this.rawFetch(r,e);const f=await a.text();f.length===0?i={ok:!0,data:null}:i=JSON.parse(f)}catch(f){throw new Ee(f.message,void 0,null)}if(!a.ok||i.ok===!1){const f=i.message??i.error;throw new Ee(f??`Request failed with status code ${a.status}`,a.status,i.data)}return i.ok===!0?i.data:i}catch(a){if(console.error(`[API] HTTP request failed: ${a.message||""}`,a),this.retries===o||a.status&&this.nonRetryableStatuses.includes(a.status))throw a;await this.sleep(this.retryDelay)}throw new Error("Unreachable code")});this.baseUrl=r,this.identity=e==null?void 0:e.identity,this.retries=(e==null?void 0:e.retries)??et,this.retryDelay=(e==null?void 0:e.retryDelay)??tt,this.nonRetryableStatuses=(e==null?void 0:e.nonRetryableStatuses)??rt}}class st extends at{constructor(e,o,a){super(o,a);m(this,"signer");m(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"}}));m(this,"fetchTrade",async e=>this.fetch(`/v1/trades/${e}`,{method:"GET"}));this.signer=e}}class gt{constructor(r,e,o){m(this,"tradesAPI");this.tradesAPI=new st(r,e,{identity:o,retries:0})}async addTrade(r){return this.tradesAPI.addTrade(r)}async fetchTrade(r){return this.tradesAPI.fetchTrade(r)}async accept(r,e){const o=de(r.contract),a=le(o,r.chainId),i=pe(r,e);return ye(a,"accept",[i])}async cancel(r,e){const o=de(r.contract),a=le(o,r.chainId),i=pe(r,e);return ye(a,"cancelSignature",[i])}}export{gt as TradeService};
2
+ //# sourceMappingURL=TradeService-CitNPz55.js.map