@dcl/shop 1.14.1-35717029846.commit-081e19f → 1.14.1-35719028426.commit-788cbae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_assets/{Activity-B2SI93EE.js → Activity-BpX9dGWm.js} +4 -4
- package/_assets/{AnimatedBackground-CP9Fu2S0.js → AnimatedBackground-DnqDKaQh.js} +2 -2
- package/_assets/Assets-C46WMY9d.js +990 -0
- package/_assets/{Cart-EKwnMXFZ.js → Cart-CmgC7VM5.js} +2 -2
- package/_assets/{Collection-CNuf965Z.js → Collection-DbL5CU22.js} +2 -2
- package/_assets/{CollectionCarousel-SlhH9WTk.js → CollectionCarousel-CctkKEfb.js} +5 -5
- package/_assets/{Confetti-Ck7aETTa.js → Confetti-BOhRu7AS.js} +4 -4
- package/_assets/{ConstantsUtil-D9gWIb6Y.js → ConstantsUtil-DOBR8Vsk.js} +2 -2
- package/_assets/{ContentClient-DTv0EbWI.js → ContentClient-zmznS1eF.js} +2 -2
- package/_assets/{Creator-jAwBuZRn.js → Creator-C8FJNoTI.js} +2 -2
- package/_assets/{CreditPackPicker-Dg5yXKT1.js → CreditPackPicker-Ci5Mlm9_.js} +2 -2
- package/_assets/{DeploymentBuilder-B3WfHq10.js → DeploymentBuilder-CSyKbttK.js} +2 -2
- package/_assets/{EmotePlaybackBar-NAb5My4l.js → EmotePlaybackBar-DAV-3bSn.js} +3 -3
- package/_assets/{ErrorNotice-D7pIVrgz.js → ErrorNotice-D5wtHMoD.js} +2 -2
- package/_assets/{Event-Duu5NjqU.js → Event-DxBFYDFS.js} +2 -2
- package/_assets/{ExchangeController-BFHQVGfP.js → ExchangeController-CXX0sK6W.js} +2 -2
- package/_assets/{Faq-CDtoKNMs.js → Faq-DW6XztFr.js} +2 -2
- package/_assets/{Filters-DlxmTAJg.js → Filters-Bj8msVc8.js} +35 -35
- package/_assets/{GetCredits-Cr0MIsCQ.js → GetCredits-DOIO0fBV.js} +2 -2
- package/_assets/{Grow-CsE3PxpH.js → Grow-BQqVTbgw.js} +2 -2
- package/_assets/{HelpersUtil-DaS3Zwlg.js → HelpersUtil-D-kkzJS4.js} +2 -2
- package/_assets/{ItemDetail-C4NupK37.js → ItemDetail-C-_Y9QEh.js} +2 -2
- package/_assets/{LoadMore-B0ISZU5w.js → LoadMore-BoD1T1M_.js} +2 -2
- package/_assets/{ManaPricingBanner.styles-BreC7I8Y.js → ManaPricingBanner.styles-maEvFsWD.js} +2 -2
- package/_assets/{MyAssets-CBtU_aVL.js → MyAssets-CsQB3BRq.js} +2 -2
- package/_assets/{MyFavorites-lKsdcIdC.js → MyFavorites-bvhILMLM.js} +2 -2
- package/_assets/{MyStore-BS3Sh9pU.js → MyStore-DNyVpX1H.js} +2 -2
- package/_assets/{NetworkUtil-C2wSFZRa.js → NetworkUtil-DppbATSq.js} +2 -2
- package/_assets/{NotFound-BNBxKfHU.js → NotFound-CcvzZxtU.js} +2 -2
- package/_assets/{NotificationsBell-BexOw4QS.js → NotificationsBell-DriXOuFz.js} +2 -2
- package/_assets/{OutfitDetail-Bi3C5NXa.js → OutfitDetail-igLM7qxp.js} +2 -2
- package/_assets/{OutfitPreview-BXwrbtRh.js → OutfitPreview-B8a1U6f7.js} +2 -2
- package/_assets/{OutfitStudio-DYMvORUh.js → OutfitStudio-rrYI9gXU.js} +2 -2
- package/_assets/{PaymentMethodStep-Ci7YjLKm.js → PaymentMethodStep-BNy4uFJN.js} +5 -5
- package/_assets/{SaleCountdown-B4sC2O0e.js → SaleCountdown-De6tyEqD.js} +2 -2
- package/_assets/{Spinner-D8nWRCy3.js → Spinner-D1V4BYKU.js} +2 -2
- package/_assets/{StoreSettings-CQj948x9.js → StoreSettings-o4CGMQ_c.js} +2 -2
- package/_assets/{Success-BcoK_9Jv.js → Success-ha1NaJuw.js} +2 -2
- package/_assets/{SwapController-D6Idkk4b.js → SwapController-CHTlB4ca.js} +2 -2
- package/_assets/{Tooltip-DffNOxV8.js → Tooltip-CK2XVxpk.js} +2 -2
- package/_assets/{TradeService-CwzXKmen.js → TradeService-CYoA-0sX.js} +2 -2
- package/_assets/{W3MFrameProviderSingleton-QzyPSTxu.js → W3MFrameProviderSingleton-DnVf9oP7.js} +4 -4
- package/_assets/{WebCryptoP256-E2y4s0g2.js → WebCryptoP256-DGudfRFV.js} +2 -2
- package/_assets/{basic-BycEvxgy.js → basic-DfmbnRGO.js} +2 -2
- package/_assets/{biconomy-Bkl_cAqJ.js → biconomy-BtQeFx4Z.js} +2 -2
- package/_assets/{browseLayout.styles-B5WVpBNF.js → browseLayout.styles-BADskMsy.js} +2 -2
- package/_assets/{browser-BYHlYSHI.js → browser-BAm0Shd6.js} +2 -2
- package/_assets/{browser-DYSRffPj.js → browser-YUUBuWRC.js} +2 -2
- package/_assets/{browser-ponyfill-DDl4ZwYn.js → browser-ponyfill-BQs2tAcb.js} +2 -2
- package/_assets/{buy-mXjk4WI2.js → buy-CmjBI7r0.js} +2 -2
- package/_assets/{buy-gasless-cbBdaLWy.js → buy-gasless-CeGObjtc.js} +2 -2
- package/_assets/{cart-checkout-tz6LBdP5.js → cart-checkout-BB5EpqsQ.js} +2 -2
- package/_assets/{categories-Iv__3hxj.js → categories-C6DcAku8.js} +2 -2
- package/_assets/{ccip-CiKUY4bL.js → ccip-CwSnLVr-.js} +2 -2
- package/_assets/{ccip-Dl3JR17Z.js → ccip-DShByFbv.js} +2 -2
- package/_assets/{chains-DfRC9hQa.js → chains-BwtDf6HP.js} +2 -2
- package/_assets/collectionPage.styles-B1ljDCRq.js +41 -0
- package/_assets/{common-BTyhI5VP.js → common-CpqUaQ-B.js} +2 -2
- package/_assets/{controller-D4xeSVa8.js → controller-9ErhSX1R.js} +3 -3
- package/_assets/{core-CGHTebrg.js → core-C3KunlFU.js} +5 -5
- package/_assets/{createSvgIcon-muwT4G-f.js → createSvgIcon-DvuLU9-j.js} +2 -2
- package/_assets/{crumbs.styles-D57Tm2je.js → crumbs.styles-q0RtqBNO.js} +2 -2
- package/_assets/{custom-D4S_R1DE.js → custom-AhSzU_hd.js} +2 -2
- package/_assets/{data-capture-DO_y99rr.js → data-capture-DNnqPNOl.js} +2 -2
- package/_assets/{dcl-schemas-B1ZAR9xS.js → dcl-schemas-CD5cNQ8m.js} +2 -2
- package/_assets/{decimals-CqFbvoaJ.js → decimals-BnWYsRCO.js} +2 -2
- package/_assets/{decimals-D2hV7Es5.js → decimals-D0JpPXjS.js} +2 -2
- package/_assets/{detectExtension-DleUr8EP.js → detectExtension-Aw8C19g8.js} +2 -2
- package/_assets/{disposePreview-C0JkUHrP.js → disposePreview-ikbGs1If.js} +2 -2
- package/_assets/{email-7f08ELNb.js → email-CZHK0vXY.js} +2 -2
- package/_assets/{embedded-wallet-Ctd32qRB.js → embedded-wallet-8F_Acxld.js} +2 -2
- package/_assets/{emotion-styled.browser.esm-BZtqiG9F.js → emotion-styled.browser.esm-tajIbHys.js} +2 -2
- package/_assets/{engine-C8FnCdSk.js → engine-R_SrRhuR.js} +2 -2
- package/_assets/{errors-BzF0Lvtf.js → errors-PLCwxC51.js} +2 -2
- package/_assets/{estimate-l1-fee-BEdWPMA9.js → estimate-l1-fee-BBVLQ1rf.js} +2 -2
- package/_assets/{eth_estimateGas-HDX4PZM1.js → eth_estimateGas-D3OwTUpV.js} +2 -2
- package/_assets/{eth_getStorageAt-BT9A1R-c.js → eth_getStorageAt-CVPieOST.js} +2 -2
- package/_assets/{eth_getTransactionCount-DenZRbIC.js → eth_getTransactionCount-BxH1EDlT.js} +2 -2
- package/_assets/{ethereum-B2JEfhqH.js → ethereum-DIBCKB6q.js} +2 -2
- package/_assets/{ethers-CYPe82-i.js → ethers-BDpH2PgN.js} +2 -2
- package/_assets/{events-7axiPuWA.js → events-BuoOWK1v.js} +2 -2
- package/_assets/{execute-BnAV_1Fd.js → execute-B0H8K20m.js} +3 -3
- package/_assets/{extractIPFS-CVCpiFya.js → extractIPFS-CLOKIAiM.js} +2 -2
- package/_assets/{features-CtjsSO2_.js → features-CvXt0H0-.js} +2 -2
- package/_assets/{fetchTokenMetadata-C1q4_ZKP.js → fetchTokenMetadata-PXJxT8ib.js} +3 -3
- package/_assets/{field.styles-wMfYVws6.js → field.styles-Cggq6Wik.js} +2 -2
- package/_assets/{fortmatic-6x45RwZX.js → fortmatic-CO49Qx8z.js} +2 -2
- package/_assets/{get-bytecode-C9gjSWd3.js → get-bytecode-B10dLHqV.js} +2 -2
- package/_assets/{get-ecosystem-wallet-info-C88X1jYy.js → get-ecosystem-wallet-info-DBB-9XsD.js} +2 -2
- package/_assets/{getBalance-BrtqAmxQ.js → getBalance-5TsHxc0-.js} +3 -3
- package/_assets/{getInstalledModules-BJVx5LYq.js → getInstalledModules-QVb_hGAT.js} +2 -2
- package/_assets/{getNFT-BM_GmOuL.js → getNFT-BH8Q3FaG.js} +2 -2
- package/_assets/{getNFT-B1arqOXd.js → getNFT-D2IcC5j3.js} +3 -3
- package/_assets/{grid.styles-BLEMBNDw.js → grid.styles-CkAU0auR.js} +2 -2
- package/_assets/{hashTypedData-B3ogY2Kc.js → hashTypedData-C1NmIJHG.js} +2 -2
- package/_assets/{hashTypedData-DezgQ2Vh.js → hashTypedData-JkaWDc1P.js} +2 -2
- package/_assets/{import-BDlqp2rx.js → import-BDpJaH17.js} +2 -2
- package/_assets/{in-app-BbAtJMuA.js → in-app-DSAJhYoU.js} +2 -2
- package/_assets/{in-app-wallet-calls-C470GpFo.js → in-app-wallet-calls-C1HEVjQe.js} +2 -2
- package/_assets/{index-BVKdLmKw.js → index-03IUSFwe.js} +3 -3
- package/_assets/{index-DEFcrA_x.js → index-B0oer6Qw.js} +2 -2
- package/_assets/{index-DdN8DiqQ.js → index-B68tB4p7.js} +2 -2
- package/_assets/{index-CY5uuWkq.js → index-B9WiLLpE.js} +2 -2
- package/_assets/{index-BoKkNxL7.js → index-BBh2FvPD.js} +2 -2
- package/_assets/{index-DsfqwSo4.js → index-BH5Jo8FC.js} +4 -4
- package/_assets/{index-BxD-5PPV.js → index-BKX2HU5-.js} +2 -2
- package/_assets/{index-53hFVStc.js → index-BN5uV5zg.js} +2 -2
- package/_assets/{index-B5m5DdsO.js → index-BSd24ZVG.js} +3 -3
- package/_assets/{index-BI_gr0SE.js → index-BYx_DXLf.js} +4 -4
- package/_assets/{index-D4NqCXr_.js → index-B_01Grj7.js} +4 -4
- package/_assets/{index-BROlgonb.js → index-BfqF1L4t.js} +2 -2
- package/_assets/{index-DZf2-XdX.js → index-BiH-PTM_.js} +2 -2
- package/_assets/{index-B8wznWjj.js → index-BkAaiwhZ.js} +2 -2
- package/_assets/{index-ClEH0Eg4.js → index-BkirkVZI.js} +2 -2
- package/_assets/{index-SzxcW9Zk.css → index-BkwDN0AW.css} +1 -1
- package/_assets/{index-BeiASkZy.js → index-Bmmjywt5.js} +121 -121
- package/_assets/{index-KM1dHPRB.js → index-Bnb2uJhq.js} +2 -2
- package/_assets/{index-vxkSIQW0.js → index-Bt_66AMF.js} +2 -2
- package/_assets/{index-DrtXqy9I.js → index-BuehnHuA.js} +2 -2
- package/_assets/{index-DlJrzMTL.js → index-BwtaysDn.js} +2 -2
- package/_assets/{index-CH3dqC0b.js → index-By9pFZxy.js} +2 -2
- package/_assets/{index-C_WXMleu.js → index-BzuFMYwR.js} +2 -2
- package/_assets/{index-ChkYwVPF.js → index-C7PFTdsa.js} +2 -2
- package/_assets/{index-DaWsF3KE.js → index-C8SgRhWi.js} +2 -2
- package/_assets/{index-BKnV2Z_o.js → index-C9lbkHYt.js} +2 -2
- package/_assets/{index-BYdES59T.js → index-CBRhRHnT.js} +2 -2
- package/_assets/{index-DgCWcOv0.js → index-CCWpUSDN.js} +2 -2
- package/_assets/{index-DWX8bCf4.js → index-CEBfZzLH.js} +2 -2
- package/_assets/{index-D3vuC0T7.js → index-CEXhnokq.js} +2 -2
- package/_assets/{index-CkPxU5dG.js → index-CEo97Zxi.js} +2 -2
- package/_assets/{index-DD8p2s0N.js → index-CLSQPu3w.js} +2 -2
- package/_assets/{index-FuRS9tVR.js → index-CMSUYLVn.js} +2 -2
- package/_assets/{index-CmqUXsFp.js → index-CP49IXN6.js} +2 -2
- package/_assets/{index-BvpP-fLZ.js → index-CetZxpTs.js} +2 -2
- package/_assets/{index-BmEUzRT3.js → index-Cl_3ax-s.js} +2 -2
- package/_assets/{index-D0GETye4.js → index-CtKtLuEH.js} +2 -2
- package/_assets/{index-D5S-lycM.js → index-CtRRuSWC.js} +2 -2
- package/_assets/{index-CWtnfG_d.js → index-D8VrFbWS.js} +2 -2
- package/_assets/{index-D6e3_BTC.js → index-DBsATBZK.js} +2 -2
- package/_assets/{index-CKCUc2E7.js → index-DBsQAEwj.js} +2 -2
- package/_assets/{index-Bf_coLez.js → index-DCQogtmR.js} +2 -2
- package/_assets/{index-B_HUUfzk.js → index-DHnwkGWV.js} +2 -2
- package/_assets/{index-BfmfQ1WN.js → index-DN8QJ1JD.js} +2 -2
- package/_assets/{index-D2-zplq0.js → index-DORP309u.js} +3 -3
- package/_assets/{index-BX-0jA0k.js → index-DQDnMLb-.js} +2 -2
- package/_assets/{index-BSB4eI22.js → index-DQu6Jq-P.js} +3 -3
- package/_assets/{index-BrE7YGT5.js → index-DS6BtyAN.js} +2 -2
- package/_assets/{index-XEwOM0Sj.js → index-DU6d-mIc.js} +2 -2
- package/_assets/{index-CcjWUhPA.js → index-DfYZqh1F.js} +2 -2
- package/_assets/{index-DF0zgD1N.js → index-Dm8XRkOQ.js} +2 -2
- package/_assets/{index-CG2yRzFW.js → index-DwraOl5Z.js} +2 -2
- package/_assets/{index-C5G2b_tT.js → index-DxfpNcTc.js} +2 -2
- package/_assets/{index-YBAq4pyE.js → index-DzSaphbp.js} +2 -2
- package/_assets/{index-0X6EYQ5_.js → index-LfAh99M4.js} +2 -2
- package/_assets/{index-AVwlO6wd.js → index-O14Pm4Vm.js} +2 -2
- package/_assets/{index-D27ydD10.js → index-TosEWvyg.js} +2 -2
- package/_assets/{index-UQKa4sV0.js → index-ZpHxWAMe.js} +2 -2
- package/_assets/{index-Ccyrmxei.js → index-boseCEFc.js} +2 -2
- package/_assets/{index-DDId6dCv.js → index-eiWzV0in.js} +2 -2
- package/_assets/{index-C8L3d8mc.js → index-gaQwy1co.js} +2 -2
- package/_assets/{index-DxKDgGBk.js → index-mOoRIjAX.js} +2 -2
- package/_assets/{index-CR2Mw3fL.js → index-r7fDYYGF.js} +2 -2
- package/_assets/{index-Cpiw0oxn.js → index-vjDTZ2Fu.js} +2 -2
- package/_assets/{index-BfUmfJrn.js → index-wfHvqm3o.js} +2 -2
- package/_assets/{index-X21Okw5N.js → index-xMPoPnk2.js} +2 -2
- package/_assets/{index-Bp5Ym9TA.js → index-z4wAEgt0.js} +2 -2
- package/_assets/{index-CtjNTKDu.js → index-zabk72U-.js} +2 -2
- package/_assets/{index.es-BW1POn52.js → index.es-C7Dv5zPY.js} +5 -5
- package/_assets/{index.es-BiN1y5Si.js → index.es-CbQC8IaR.js} +2 -2
- package/_assets/{index.es-Dwqr95pF.js → index.es-D0LSJmCv.js} +2 -2
- package/_assets/{index.es-UddKGHGY.js → index.es-D3BvdKWL.js} +2 -2
- package/_assets/{items-empty-CNaLuGS0.js → items-empty-Bey5xaMz.js} +2 -2
- package/_assets/{jump-B3-0_MfX.js → jump-C9-PUsEN.js} +2 -2
- package/_assets/{linkAccount-DtQglTDD.js → linkAccount-BqVzFvhl.js} +2 -2
- package/_assets/{localBatchGatewayRequest-D0bUCkM5.js → localBatchGatewayRequest-GHOUeZNh.js} +2 -2
- package/_assets/{modal.styles-CvBM3Ic6.js → modal.styles-CwCMe226.js} +2 -2
- package/_assets/{native-6ybIHDnf.js → native-letZ2idz.js} +2 -2
- package/_assets/{networks-CsHEBjl9.js → networks-BxPE4g90.js} +2 -2
- package/_assets/{onramp-DAJQqr9t.js → onramp-CAe3tTyc.js} +2 -2
- package/_assets/{openzeppelin-C3YkKRml.js → openzeppelin-9utmmOt4.js} +2 -2
- package/_assets/{ownerOf-cKu10J6S.js → ownerOf-DUhdbuZp.js} +2 -2
- package/_assets/{parseNft-Rw932vgW.js → parseNft-BN_odngq.js} +3 -3
- package/_assets/{parseSignature-hxIXnxi8.js → parseSignature-CCMuAmaf.js} +4 -4
- package/_assets/{parseSignature-Bf1u2rRK.js → parseSignature-DjT_CM7W.js} +2 -2
- package/_assets/{passkeys-Xafxnfve.js → passkeys-5bHsXKj5.js} +2 -2
- package/_assets/{pay-with-exchange-UoATjIjo.js → pay-with-exchange-CLxkNxWU.js} +2 -2
- package/_assets/{prepare-contract-call-Ngikp3Fr.js → prepare-contract-call-DeOGUl_B.js} +2 -2
- package/_assets/{qr-overlay-CHLYrRNL.js → qr-overlay-C9ttaAGX.js} +4 -4
- package/_assets/{react-D7tXswnG.js → react-Up-gi9Mm.js} +2 -2
- package/_assets/{receive-BIvdqF1Z.js → receive-IKTyR-2o.js} +2 -2
- package/_assets/{resolveImplementation-BsNCOpqm.js → resolveImplementation-DmtCLn3R.js} +2 -2
- package/_assets/{resume-buy-MO-Zr8o8.js → resume-buy-DGwc7Ynl.js} +2 -2
- package/_assets/{resume-name-uECxhbwl.js → resume-name-InQ5d1_G.js} +2 -2
- package/_assets/{rpc-C-idz8LW.js → rpc-DY8iUaNU.js} +2 -2
- package/_assets/{sales-empty-Bp9fZDlf.js → sales-empty-CteDkieg.js} +2 -2
- package/_assets/{search-empty--MIAKElx.js → search-empty-03EkKL5Z.js} +2 -2
- package/_assets/{secp256k1-BHQXbvGr.js → secp256k1-6ifHWzIN.js} +2 -2
- package/_assets/{secp256k1-BGO0HoiJ.js → secp256k1-BaCDkGxB.js} +2 -2
- package/_assets/{secp256k1-ClSRMI6Q.js → secp256k1-Bk_6muS3.js} +2 -2
- package/_assets/{send-DULB3GlT.js → send-DYcPprZ8.js} +2 -2
- package/_assets/{send-batch-transaction-D00hngtV.js → send-batch-transaction-DQYUn4Y0.js} +2 -2
- package/_assets/{send-eip712-transaction-DuPL-1c9.js → send-eip712-transaction-CIj6gl7C.js} +3 -3
- package/_assets/{send-gasless-transaction-BKkEeRy8.js → send-gasless-transaction-CS1zz7I2.js} +3 -3
- package/_assets/{send-transaction-CmRhPCIt.js → send-transaction-IudqeD-u.js} +3 -3
- package/_assets/{sendMetaTransaction-B6zKQKN7.js → sendMetaTransaction-CjNKiqIE.js} +2 -2
- package/_assets/{sendRawTransaction-CLs9lD48.js → sendRawTransaction-DasGyf4y.js} +4 -4
- package/_assets/{sentry-CQripdY4.js → sentry-C1mUzhYW.js} +3 -3
- package/_assets/{serializeTransaction-7-2QNm7o.js → serializeTransaction-CCr1XoEZ.js} +2 -2
- package/_assets/{session-proposal-BzvxPABg.js → session-proposal-BCCyKOsh.js} +2 -2
- package/_assets/{session-request-B3kio1DY.js → session-request-DVX0oh8d.js} +3 -3
- package/_assets/{sha256-D4-vNCm0.js → sha256-CgEfCtV4.js} +2 -2
- package/_assets/{sha3-Dqn_ZKT3.js → sha3-1THRNrN3.js} +2 -2
- package/_assets/signin-empty-AIjHyAfB.js +2 -0
- package/_assets/{signing-DQ3IhTKX.js → signing-D3XDPMfA.js} +4 -4
- package/_assets/{skeleton.styles-Df0pDLrt.js → skeleton.styles-F_uy_7R1.js} +2 -2
- package/_assets/{socials-CBGw_of5.js → socials-BLIsj7kN.js} +2 -2
- package/_assets/{styled-DcHF-7QY.js → styled-WyX2RREJ.js} +2 -2
- package/_assets/{swaps-DYhPSnO4.js → swaps-CW4dLS_u.js} +2 -2
- package/_assets/{thirdweb-muof53Z3.js → thirdweb-HCXwbjtb.js} +4 -4
- package/_assets/{to-serializable-transaction--1bEEzuo.js → to-serializable-transaction-kcWJuf8-.js} +3 -3
- package/_assets/{totalSupply-wMdE5ZZN.js → totalSupply-D01jzo_4.js} +2 -2
- package/_assets/{trade-encoding-CF-I5lc1.js → trade-encoding-D6CmZtwy.js} +2 -2
- package/_assets/{transaction-B6KhNG5B.js → transaction-RJOXy1jo.js} +2 -2
- package/_assets/{transactionReceipt-Bga_3Kdz.js → transactionReceipt-D1yX5cKj.js} +2 -2
- package/_assets/{transactions-BudYdZJW.js → transactions-3oLB9l38.js} +2 -2
- package/_assets/{useCreatorSales-BOCng3th.js → useCreatorSales-BOJzW5gZ.js} +2 -2
- package/_assets/{useInfiniteGrid-BEggXlos.js → useInfiniteGrid-D27uCS9o.js} +2 -2
- package/_assets/{useStore-CZHuKN5d.js → useStore-C7yUaPLJ.js} +3 -3
- package/_assets/{useTheme-CBg7wcNp.js → useTheme-DNDchSUH.js} +2 -2
- package/_assets/{utils-CpRS7y5X.js → utils-ByfQ6uMK.js} +2 -2
- package/_assets/{verifyHash-BY0fqswT.js → verifyHash-yAEQreSe.js} +2 -2
- package/_assets/{w3m-modal-CVMHDqoY.js → w3m-modal-BRIZhy9e.js} +2 -2
- package/_assets/{w3m-modal-6tQuNHFa.js → w3m-modal-BvsEMBMX.js} +2 -2
- package/_assets/{wait-for-tx-receipt-CEvEjX95.js → wait-for-tx-receipt-DajCHFAw.js} +2 -2
- package/_assets/{wallets-B_pcUmUT.js → wallets-CvlmQxng.js} +6 -6
- package/_assets/{web-connector-CtoTTCO_.js → web-connector-Dg7ycS4I.js} +4 -4
- package/_assets/{writeContract-CSKQCc5J.js → writeContract-BZCwV6bP.js} +2 -2
- package/_assets/{zora-sepolia-B5Sl-R36.js → zora-sepolia-BNVciHXB.js} +2 -2
- package/_assets/{zoraTestnet-Bd_0Ehh8.js → zoraTestnet-Bg-Y18Mr.js} +2 -2
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Assets-Bo3E1kcH.js +0 -990
- package/_assets/collectionPage.styles-nEe8CNDf.js +0 -41
- package/_assets/signin-empty-D0XzYDid.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-QzyPSTxu.js";import{au as b}from"./NetworkUtil-C2wSFZRa.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-
|
|
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-DnVf9oP7.js";import{au as b}from"./NetworkUtil-DppbATSq.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-CHTlB4ca.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as z,d as W}from"./react-
|
|
1
|
+
import{r as o,j as z,d as W}from"./react-Up-gi9Mm.js";import{s as j,a as c}from"./index-Bmmjywt5.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-D7tXswnG.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-
|
|
46
|
+
//# sourceMappingURL=Tooltip-CK2XVxpk.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-CYPe82-i.js";import{a as Me,d as V}from"./dcl-schemas-B1ZAR9xS.js";import{c as ue}from"./react-D7tXswnG.js";import{c$ as je,L as de,h as le}from"./index-BeiASkZy.js";import{c as z,e as qe}from"./index-BSB4eI22.js";import{s as He}from"./sendMetaTransaction-B6zKQKN7.js";import"./sentry-CQripdY4.js";import"./intl-AKLEHPeO.js";import"./events-7axiPuWA.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-
|
|
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-BDpH2PgN.js";import{a as Me,d as V}from"./dcl-schemas-CD5cNQ8m.js";import{c as ue}from"./react-Up-gi9Mm.js";import{c$ as je,L as de,h as le}from"./index-Bmmjywt5.js";import{c as z,e as qe}from"./index-DQu6Jq-P.js";import{s as He}from"./sendMetaTransaction-CjNKiqIE.js";import"./sentry-C1mUzhYW.js";import"./intl-AKLEHPeO.js";import"./events-BuoOWK1v.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-CYoA-0sX.js.map
|