@dodoex/widgets 3.0.2-tac.1 → 3.0.3-neox.3
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/dist/9cc2b17a1958d960.svg +3 -0
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/f7a5110e71722a0c.svg +10 -0
- package/dist/{helper-DxO-wimI.js → helper-AFwQcqmE.js} +1 -1
- package/dist/{helper-D0Wboozr.cjs → helper-C12ODUOJ.cjs} +1 -1
- package/dist/index-1M-rArhg.cjs +32 -0
- package/dist/index-B7LiHjd8.cjs +78 -0
- package/dist/index-BuCwx5gf.js +12 -0
- package/dist/index-CEudvuii.js +32 -0
- package/dist/{index-DLg6E0jt.js → index-DiKxRFk3.js} +4 -4
- package/dist/index-Ha1wzD7Q.cjs +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/types/components/Swap/components/SwapInfoCard.d.ts +9 -0
- package/dist/types/components/Swap/components/TokenCard/BalanceText.d.ts +3 -1
- package/dist/types/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +5 -1
- package/dist/types/components/Swap/components/TokenCard/index.d.ts +5 -5
- package/dist/types/components/Swap/components/TokenPairPriceWithToggle.d.ts +14 -2
- package/dist/types/components/WidgetContainer.d.ts +1 -1
- package/dist/types/constants/api.d.ts +1 -21
- package/dist/types/hooks/Submission/types.d.ts +0 -24
- package/dist/types/hooks/Swap/useFetchRoutePrice.d.ts +1 -1
- package/dist/types/hooks/contract/useFetchETHBalance.d.ts +13 -2
- package/dist/types/hooks/contract/useFetchTokens.d.ts +3 -1
- package/dist/types/hooks/style/useWidgetDevice.d.ts +1 -0
- package/dist/types/utils/address.d.ts +8 -1
- package/dist/types/widgets/PoolWidget/PoolList/components/GoPoolDetailBtn.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/PoolList/hooks/usePoolListFilterTokenAndPool.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/PoolList/hooks/usePoolListTabs.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolList/index.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/AddPoolOperate.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/RemovePoolOperate.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/components/MyLiquidityInfo.d.ts +15 -0
- package/dist/types/widgets/PoolWidget/PoolOperate/components/PairTitle.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/PoolOperate/types.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/hooks/usePoolBalanceInfo.d.ts +4 -3
- package/dist/types/widgets/PoolWidget/hooks/usePoolDetail.d.ts +10 -0
- package/package.json +4 -13
- package/dist/AaveLendingPoolABI-CdLq16uB-CdLq16uB.js +0 -1
- package/dist/AaveLendingPoolABI-CdLq16uB-G3D5zkkz.cjs +0 -1
- package/dist/AaveLendingPoolAddressesProvider-EOSAznLK-DrLP2k1o.cjs +0 -1
- package/dist/AaveLendingPoolAddressesProvider-EOSAznLK-EOSAznLK.js +0 -1
- package/dist/AavePriceOracleABI-C2UEpXR4-C2UEpXR4.js +0 -1
- package/dist/AavePriceOracleABI-C2UEpXR4-C4jkbxlQ.cjs +0 -1
- package/dist/AaveProtocolDataProviderABI-0JclmmLX-0JclmmLX.js +0 -1
- package/dist/AaveProtocolDataProviderABI-0JclmmLX-ChLpWblx.cjs +0 -1
- package/dist/BaseDrops-BrQZPqKk-BrQZPqKk.js +0 -1
- package/dist/BaseDrops-BrQZPqKk-b4x2vqWE.cjs +0 -1
- package/dist/D3MM_READ_ABI-B5536S-z-B5536S-z.js +0 -1
- package/dist/D3MM_READ_ABI-B5536S-z-DPl8m5T6.cjs +0 -1
- package/dist/D3Proxy-CKIzLOhI-CKIzLOhI.js +0 -1
- package/dist/D3Proxy-CKIzLOhI-ChV5DN6z.cjs +0 -1
- package/dist/DODO1155-DDY5Jxhf-BNeD65Or.cjs +0 -1
- package/dist/DODO1155-DDY5Jxhf-DDY5Jxhf.js +0 -1
- package/dist/DODO721-Kl5REiwU-CSXhoGSt.cjs +0 -1
- package/dist/DODO721-Kl5REiwU-Kl5REiwU.js +0 -1
- package/dist/DODOCirculationHelperABI-gu1sCqZ2-BnZp9-jW.cjs +0 -1
- package/dist/DODOCirculationHelperABI-gu1sCqZ2-gu1sCqZ2.js +0 -1
- package/dist/DODORouteProxy-51kl6QgI-51kl6QgI.js +0 -1
- package/dist/DODORouteProxy-51kl6QgI-BZ0Y3GCA.cjs +0 -1
- package/dist/DODOV1PmmHelperABI-DQqthyaE-DD2Zqxnx.cjs +0 -1
- package/dist/DODOV1PmmHelperABI-DQqthyaE-DQqthyaE.js +0 -1
- package/dist/DVM-DjtWbqiJ-BpNPFgPh.cjs +0 -1
- package/dist/DVM-DjtWbqiJ-DjtWbqiJ.js +0 -1
- package/dist/DropsERC721-7Bckjcar-7Bckjcar.js +0 -1
- package/dist/DropsERC721-7Bckjcar-BhKaFHvL.cjs +0 -1
- package/dist/FilterAdmin-jm_-DS1l-cj8kYpNK.cjs +0 -1
- package/dist/FilterAdmin-jm_-DS1l-jm_-DS1l.js +0 -1
- package/dist/FilterERC1155V1-VIUlIHdF-CYRg0d1t.cjs +0 -1
- package/dist/FilterERC1155V1-VIUlIHdF-VIUlIHdF.js +0 -1
- package/dist/FilterERC721V1-CWDEPGmH-Bi0L9sSX.cjs +0 -1
- package/dist/FilterERC721V1-CWDEPGmH-CWDEPGmH.js +0 -1
- package/dist/Fragment-Bd_AXeVx-B-F8I7LL.cjs +0 -1
- package/dist/Fragment-Bd_AXeVx-Bd_AXeVx.js +0 -1
- package/dist/FundingABI-WqQDGVVa-CVCr1rVZ.cjs +0 -1
- package/dist/FundingABI-WqQDGVVa-WqQDGVVa.js +0 -1
- package/dist/IdodoV2-DlW8pwaE-DlW8pwaE.js +0 -1
- package/dist/IdodoV2-DlW8pwaE-RfwR_GpI.cjs +0 -1
- package/dist/LockedTokenVaultABI-CfBj0wEX-CfBj0wEX.js +0 -1
- package/dist/LockedTokenVaultABI-CfBj0wEX-DRbLRj9L.cjs +0 -1
- package/dist/MarginTrading-CQ5odvHB-CQ5odvHB.js +0 -1
- package/dist/MarginTrading-CQ5odvHB-DTxWKyBB.cjs +0 -1
- package/dist/MarginTradingFactory-2RKqvCSO-2RKqvCSO.js +0 -1
- package/dist/MarginTradingFactory-2RKqvCSO-CXV_vwa8.cjs +0 -1
- package/dist/MerkleDistributorABI-Ctn26fnA-C8Qfs-nh.cjs +0 -1
- package/dist/MerkleDistributorABI-Ctn26fnA-Ctn26fnA.js +0 -1
- package/dist/NonfungiblePositionManager-c8Yw_9-Q-C-qYqe32.cjs +0 -1
- package/dist/NonfungiblePositionManager-c8Yw_9-Q-c8Yw_9-Q.js +0 -1
- package/dist/PancakePairABI-Cc9LuXnX-Cc9LuXnX.js +0 -1
- package/dist/PancakePairABI-Cc9LuXnX-DYhV587D.cjs +0 -1
- package/dist/UniswapV3Pool-Da11VKXE-CbMV0NzU.cjs +0 -1
- package/dist/UniswapV3Pool-Da11VKXE-Da11VKXE.js +0 -1
- package/dist/baseFilterV1-BPjWXMKw-BPjWXMKw.js +0 -1
- package/dist/baseFilterV1-BPjWXMKw-BuIlo0KL.cjs +0 -1
- package/dist/bsc-3D5wcqPq-3D5wcqPq.js +0 -1
- package/dist/bsc-3D5wcqPq-DPJpw0CZ.cjs +0 -1
- package/dist/classicalPoolABI-D5LxySAJ-BECDfgEG.cjs +0 -1
- package/dist/classicalPoolABI-D5LxySAJ-D5LxySAJ.js +0 -1
- package/dist/dodoABI-CLkEBJ8P-CLkEBJ8P.js +0 -1
- package/dist/dodoABI-CLkEBJ8P-gkjw8zb6.cjs +0 -1
- package/dist/dodoBuyoutModel-BtQv3C3q-BtQv3C3q.js +0 -1
- package/dist/dodoBuyoutModel-BtQv3C3q-iVgU8FQj.cjs +0 -1
- package/dist/dodoCP-N8KA8JwJ-CLHk9HB9.cjs +0 -1
- package/dist/dodoCP-N8KA8JwJ-N8KA8JwJ.js +0 -1
- package/dist/dodoCPABI-CdAN0KhU-CdAN0KhU.js +0 -1
- package/dist/dodoCPABI-CdAN0KhU-DtzutjJ_.cjs +0 -1
- package/dist/dodoCPABIV2-yzF6FlEg-fyFD9xst.cjs +0 -1
- package/dist/dodoCPABIV2-yzF6FlEg-yzF6FlEg.js +0 -1
- package/dist/dodoCPFactory-CD0SxXT6-CBF19zgJ.cjs +0 -1
- package/dist/dodoCPFactory-CD0SxXT6-CD0SxXT6.js +0 -1
- package/dist/dodoCpProxy-D2AI9-4r-C0DPYWye.cjs +0 -1
- package/dist/dodoCpProxy-D2AI9-4r-D2AI9-4r.js +0 -1
- package/dist/dodoCpProxyV2-CGZRqk2H-CGZRqk2H.js +0 -1
- package/dist/dodoCpProxyV2-CGZRqk2H-DpTvj7-M.cjs +0 -1
- package/dist/dodoCpProxyV202-CoZaEf_6-BLhZ86Hq.cjs +0 -1
- package/dist/dodoCpProxyV202-CoZaEf_6-CoZaEf_6.js +0 -1
- package/dist/dodoCustomMintableERC20-CPpNoX1v-CPpNoX1v.js +0 -1
- package/dist/dodoCustomMintableERC20-CPpNoX1v-_rvvHxmy.cjs +0 -1
- package/dist/dodoDPPAdmin-B-fmpTbV-B-fmpTbV.js +0 -1
- package/dist/dodoDPPAdmin-B-fmpTbV-Dn7blhFO.cjs +0 -1
- package/dist/dodoDPPFactory-DwAkVskt-DZUKGMVx.cjs +0 -1
- package/dist/dodoDPPFactory-DwAkVskt-DwAkVskt.js +0 -1
- package/dist/dodoDSP-B6KYm-Cn-B6KYm-Cn.js +0 -1
- package/dist/dodoDSP-B6KYm-Cn-DiQP3j-f.cjs +0 -1
- package/dist/dodoDSPFactory-j1eg7Ez--Bd74S17p.cjs +0 -1
- package/dist/dodoDSPFactory-j1eg7Ez--j1eg7Ez-.js +0 -1
- package/dist/dodoDVM-DDYx1JAy-DDYx1JAy.js +0 -1
- package/dist/dodoDVM-DDYx1JAy-cigh0zp3.cjs +0 -1
- package/dist/dodoDVMFactory-FpnJdZb2-FpnJdZb2.js +0 -1
- package/dist/dodoDVMFactory-FpnJdZb2-Jw7GN957.cjs +0 -1
- package/dist/dodoDppProxy-A7PPYsqp-A7PPYsqp.js +0 -1
- package/dist/dodoDppProxy-A7PPYsqp-evCBC-32.cjs +0 -1
- package/dist/dodoDropsProxy-vHUWsRNO-aB8sftUR.cjs +0 -1
- package/dist/dodoDropsProxy-vHUWsRNO-vHUWsRNO.js +0 -1
- package/dist/dodoDspProxy-CU7OAvJG-Bp3cG2Me.cjs +0 -1
- package/dist/dodoDspProxy-CU7OAvJG-CU7OAvJG.js +0 -1
- package/dist/dodoERC20V3Factory-Cz4XKDrU-Cz4XKDrU.js +0 -1
- package/dist/dodoERC20V3Factory-Cz4XKDrU-Dp6VtQdx.cjs +0 -1
- package/dist/dodoEthProxyABI-CoX95QJI-COvGooIx.cjs +0 -1
- package/dist/dodoEthProxyABI-CoX95QJI-CoX95QJI.js +0 -1
- package/dist/dodoFeeImpl-zR9Qv4Tq-n8uxW-_A.cjs +0 -1
- package/dist/dodoFeeImpl-zR9Qv4Tq-zR9Qv4Tq.js +0 -1
- package/dist/dodoFragment-4lxmE2XJ-4lxmE2XJ.js +0 -1
- package/dist/dodoFragment-4lxmE2XJ-QQKv5zUw.cjs +0 -1
- package/dist/dodoMineV3Proxy-xOGM7Jnv-DVScIYYs.cjs +0 -1
- package/dist/dodoMineV3Proxy-xOGM7Jnv-xOGM7Jnv.js +0 -1
- package/dist/dodoMineV3ProxyOld-BqsZxJRU-BqsZxJRU.js +0 -1
- package/dist/dodoMineV3ProxyOld-BqsZxJRU-C_F6KVsX.cjs +0 -1
- package/dist/dodoMiningABI-9J5C_6kN-9J5C_6kN.js +0 -1
- package/dist/dodoMiningABI-9J5C_6kN-Bz2I9IA2.cjs +0 -1
- package/dist/dodoMiningReaderABI-DmUXA9Gv-B2wU_50T.cjs +0 -1
- package/dist/dodoMiningReaderABI-DmUXA9Gv-DmUXA9Gv.js +0 -1
- package/dist/dodoNftERC1155-Bw6ID2NE-Bw6ID2NE.js +0 -1
- package/dist/dodoNftERC1155-Bw6ID2NE-DLIuD5w1.cjs +0 -1
- package/dist/dodoNftERC721-CI1l0ip9-CI1l0ip9.js +0 -1
- package/dist/dodoNftERC721-CI1l0ip9-CM9UVOIz.cjs +0 -1
- package/dist/dodoNftPoolProxy-DQkcZHUV-D1h5SkLL.cjs +0 -1
- package/dist/dodoNftPoolProxy-DQkcZHUV-DQkcZHUV.js +0 -1
- package/dist/dodoNftProxy-Di-aoLYM-DM2zeXHX.cjs +0 -1
- package/dist/dodoNftProxy-Di-aoLYM-Di-aoLYM.js +0 -1
- package/dist/dodoNftVault-B4NZaXcd-4I3wB3W5.cjs +0 -1
- package/dist/dodoNftVault-B4NZaXcd-B4NZaXcd.js +0 -1
- package/dist/dodoOracleABI-BxwZofBV-BxwZofBV.js +0 -1
- package/dist/dodoOracleABI-BxwZofBV-CZXzRpKf.cjs +0 -1
- package/dist/dodoPair-VN1aEVFz-DZAKf_5j.cjs +0 -1
- package/dist/dodoPair-VN1aEVFz-VN1aEVFz.js +0 -1
- package/dist/dodoPreminingABI-DU7ocR7L-BO5Cazcq.cjs +0 -1
- package/dist/dodoPreminingABI-DU7ocR7L-DU7ocR7L.js +0 -1
- package/dist/dodoProxyV2-9ED9HqK5-9ED9HqK5.js +0 -1
- package/dist/dodoProxyV2-9ED9HqK5-C4O1SzS4.cjs +0 -1
- package/dist/dodoStarterProxy-B1TdMOvw-B1TdMOvw.js +0 -1
- package/dist/dodoStarterProxy-B1TdMOvw-DgcH9iEq.cjs +0 -1
- package/dist/dodoTokenABI-Dd2DVUbK-6Mpqu75U.cjs +0 -1
- package/dist/dodoTokenABI-Dd2DVUbK-Dd2DVUbK.js +0 -1
- package/dist/dodoUpCPFactoryABI-C1W0Q4Ft-C1W0Q4Ft.js +0 -1
- package/dist/dodoUpCPFactoryABI-C1W0Q4Ft-XGsn8ED4.cjs +0 -1
- package/dist/dodoUpCpFactory-D8ifQyp--D8ifQyp-.js +0 -1
- package/dist/dodoUpCpFactory-D8ifQyp--XGsn8ED4.cjs +0 -1
- package/dist/dodoV1PairProxy-DyRTqyPe-DpEjE8Ne.cjs +0 -1
- package/dist/dodoV1PairProxy-DyRTqyPe-DyRTqyPe.js +0 -1
- package/dist/dodoZooABI-D9Uc4iLK-D44Zl74h.cjs +0 -1
- package/dist/dodoZooABI-D9Uc4iLK-D9Uc4iLK.js +0 -1
- package/dist/dppPoolABI-BvoeLJgK-BdDjNXGV.cjs +0 -1
- package/dist/dppPoolABI-BvoeLJgK-BvoeLJgK.js +0 -1
- package/dist/erc20ABI-v08X4jmE-G8oWOkZ8.cjs +0 -1
- package/dist/erc20ABI-v08X4jmE-v08X4jmE.js +0 -1
- package/dist/erc20Helper-CG659oLz-CG659oLz.js +0 -1
- package/dist/erc20Helper-CG659oLz-DU3PGwta.cjs +0 -1
- package/dist/eth-B9cviUl5-B9cviUl5.js +0 -1
- package/dist/eth-B9cviUl5-BTzl-wbR.cjs +0 -1
- package/dist/feeABI-DnQdJUpQ-DnQdJUpQ.js +0 -1
- package/dist/feeABI-DnQdJUpQ-n8uxW-_A.cjs +0 -1
- package/dist/index-BBk9FsFK.cjs +0 -31
- package/dist/index-BQRzJGQX.js +0 -12
- package/dist/index-CBD2OYiJ.js +0 -31
- package/dist/index-Dl6ozpb-.cjs +0 -78
- package/dist/index-Dtf5I718.cjs +0 -12
- package/dist/multicallABI-D9E1EeQD-D9E1EeQD.js +0 -1
- package/dist/multicallABI-D9E1EeQD-Dhweb42q.cjs +0 -1
- package/dist/nftContract-d4b6ObxG-d4b6ObxG.js +0 -1
- package/dist/nftContract-d4b6ObxG-hvFiWn3Y.cjs +0 -1
- package/dist/nftFilterAdmin-DMr_jrK_-Bq1uLy_8.cjs +0 -1
- package/dist/nftFilterAdmin-DMr_jrK_-DMr_jrK_.js +0 -1
- package/dist/oneBitSettlement-DMzQ-0t_-DMzQ-0t_.js +0 -1
- package/dist/oneBitSettlement-DMzQ-0t_-DiJ0ov7p.cjs +0 -1
- package/dist/setApprovalForAll-BvnCORJI-BvnCORJI.js +0 -1
- package/dist/setApprovalForAll-BvnCORJI-C5PVWdKB.cjs +0 -1
- package/dist/spaceIdABI-BS4XGAT1-B5tTrrz8.cjs +0 -1
- package/dist/spaceIdABI-BS4XGAT1-BS4XGAT1.js +0 -1
- package/dist/spaceIdResolverABI-sYDT8GfP-CrfOXUgo.cjs +0 -1
- package/dist/spaceIdResolverABI-sYDT8GfP-sYDT8GfP.js +0 -1
- package/dist/types/hooks/ConnectWallet/tonConnect/contract.d.ts +0 -11
- package/dist/types/hooks/ConnectWallet/tonConnect/useConnectTon.d.ts +0 -1
- package/dist/types/hooks/ConnectWallet/tonConnect/useTonConnectStore.d.ts +0 -49
- package/dist/v3MiningABI-ZjGBkolS-C-S-QkHw.cjs +0 -1
- package/dist/v3MiningABI-ZjGBkolS-ZjGBkolS.js +0 -1
- package/dist/vdodo-ttc2RVOs-BV3kGDOM.cjs +0 -1
- package/dist/vdodo-ttc2RVOs-ttc2RVOs.js +0 -1
- package/dist/vdodoTokenABI-PldrbOSo-BuOHA0B9.cjs +0 -1
- package/dist/vdodoTokenABI-PldrbOSo-PldrbOSo.js +0 -1
- package/dist/weth-Dz5DGEIF-CGG0Z6re.cjs +0 -1
- package/dist/weth-Dz5DGEIF-Dz5DGEIF.js +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";var e=require("bignumber.js"),t=require("lodash"),i=require("react"),r=require("@emotion/styled"),o=require("@emotion/react"),n=require("react-konva"),s=require("./helper-C12ODUOJ.cjs"),l=require("./index-1M-rArhg.cjs"),a=require("@dodoex/api");require("@lingui/core"),require("@lingui/react"),require("@dodoex/components"),require("@web3-react/core"),require("react-redux"),require("axios"),require("@ethersproject/bignumber"),require("@reduxjs/toolkit"),require("redux"),require("@dodoex/dodo-contract-request"),require("@tanstack/react-query"),require("@web3-react/eip1193"),require("@web3-react/walletconnect-v2"),require("@web3-react/metamask"),require("@web3-react/types"),require("zustand"),require("identicon.js"),require("react-dom"),require("dayjs"),require("react-transition-group"),require("@dodoex/contract-request"),require("recharts"),require("react-window"),require("jsbi"),require("tiny-invariant"),require("@uniswap/sdk-core"),require("@uniswap/v2-sdk"),require("react-infinite-scroller"),require("d3"),require("rmc-date-picker");var u={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},c=i.createContext&&i.createContext(u),d=["attr","size","title"];function p(e,t){if(null==e)return{};var i,r,o=function(e,t){if(null==e)return{};var i,r,o={},n=Object.keys(e);for(r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||(o[i]=e[i]);return o}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)i=n[r],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m.apply(this,arguments)}function g(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function x(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?g(Object(i),!0).forEach((function(t){h(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):g(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function h(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function f(e){return e&&e.map(((e,t)=>i.createElement(e.tag,x({key:t},e.attr),f(e.child))))}function b(e){return t=>i.createElement(M,m({attr:x({},e.attr)},t),f(e.child))}function M(e){var t=t=>{var r,{attr:o,size:n,title:s}=e,l=p(e,d),a=n||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),i.createElement("svg",m({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,o,l,{className:r,style:x(x({color:e.color||t.color},t.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&i.createElement("title",null,s),e.children)};return void 0!==c?i.createElement(c.Consumer,null,(e=>t(e))):t(u)}function v(e){return b({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M13.293 6.293 7.586 12l5.707 5.707 1.414-1.414L10.414 12l4.293-4.293z"},child:[]}]})(e)}function j(e){return b({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10.707 17.707 16.414 12l-5.707-5.707-1.414 1.414L13.586 12l-4.293 4.293z"},child:[]}]})(e)}function y(e){return b({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5 11h14v2H5z"},child:[]}]})(e)}function P(e){return b({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(e)}const L=r.input`
|
|
2
|
+
margin: 4px 10px 4px 6px;
|
|
3
|
+
border-radius: 10px;
|
|
4
|
+
border: 1px solid #373739;
|
|
5
|
+
padding: 4px 9px;
|
|
6
|
+
background-color: #1a1a1b;
|
|
7
|
+
color: #ffffff;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
line-height: 20px;
|
|
11
|
+
outline: none;
|
|
12
|
+
width: 96px;
|
|
13
|
+
&:focus {
|
|
14
|
+
border-color: #fff;
|
|
15
|
+
|
|
16
|
+
${({error:e})=>e&&o.css`
|
|
17
|
+
border-color: red;
|
|
18
|
+
`}
|
|
19
|
+
}
|
|
20
|
+
`;const w="rgba(38, 39, 41, 0.3)";function E({width:r,height:o,midPrice:a,pmmModel:u,params:c,baseTokenSymbol:d,quoteTokenSymbol:p,baseMinAndZoomMultiples:m,colorMap:g,setBaseMinAndZoomMultiples:x}){const h=t.merge({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,w,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,w,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},g),f=r,b=o-18,M=f/7,{buyBaseVert:v,sellBaseVert:j}=s.computeBaseVert({midPrice:a,q:c.q,q0:c.q0,pmmModel:u}),y=v.div(b),P=j.div(b),L=i.useRef(null),E=i.useRef(null),{current:q}=L,z=i.useRef(0),B=i.useRef(),{horizontalGridLines:k,verticalGridLines:T}=function({chartHeight:e,chartWidth:t,horizontalLineCount:r,verticalLineCount:o}){return i.useMemo((()=>{const i=[],n=e/(r+1),s=[],l=t/o;for(let e=0;e<r;e++){const r=n*(e+1);i.push([0,r,t,r])}for(let t=0;t<o;t++){const i=l*t+l/2;s.push([i,0,i,e])}return{horizontalGridLines:i,verticalGridLines:s}}),[e,t,r,o])}({chartHeight:b,chartWidth:f,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:R,horizontalLabelTextPoints:C}=function({chartHeight:e,chartWidth:t,xAxisPoints:r,oneXPx:o,baseMinAndZoomMultiples:n}){return i.useMemo((()=>{const i=s.computeXPortion(t,n.zoomMultiples),a=[],u=[];for(let t=0;t<r;t++){a.push([t*o+o/2,e,t*o+o/2,e+4]);const r=i.multipliedBy(t).multipliedBy(o).plus(i.multipliedBy(o/2)).toNumber(),s=n.baseMin.multipliedBy(10**r),c=t*o,d=e+2+4,p=l.formatShortNumber(s);u.push({x:c,y:d,text:p})}return{horizontalLabelTickPoints:a,horizontalLabelTextPoints:u}}),[n.baseMin,n.zoomMultiples,e,t,o,r])}({chartHeight:b,chartWidth:f,xAxisPoints:7,oneXPx:M,baseMinAndZoomMultiples:m}),{quoteLinePoints:S,quoteLineAreaPoints:N,quoteLineAreaLinearGradientEndPointY:O,baseLinePoints:A,baseLineAreaPoints:X,baseLineAreaLinearGradientEndPointY:Z,midPriceLinePoints:W}=function({chartHeight:t,chartWidth:r,midPrice:o,xPoints:n,pmmModel:l,baseMinAndZoomMultiples:a,buyYPortion:u,sellYPortion:c}){return i.useMemo((()=>{const i=[],d=[],p=[],{baseMin:m,zoomMultiples:g}=a,x=s.computeXPortion(r,g),h=2*g,f=new e(h).div(n);let b=new e(Math.log(o.div(m).toNumber())/Math.log(10));b=e.minimum(h,b),b=e.maximum(0,b);for(let r=new e(0);r.lte(b);){const e=m.multipliedBy(10**r.toNumber()),n=s.evalPoint({val:e,model:l,midPrice:o});if(!n.vert.isNaN()){const e=r.div(x).toNumber(),o=t-n.vert.div(u).toNumber();i.push(e,o)}r=r.plus(f)}for(let e=b;e.lte(h);){const i=m.multipliedBy(10**e.toNumber()),r=s.evalPoint({val:i,model:l,midPrice:o});if(!r.vert.isNaN()){const i=e.div(x).toNumber(),o=t-r.vert.div(c).toNumber();d.push(i,o)}e=e.plus(f)}const M=b.div(x).toNumber(),[,v]=i,j=l.k.eq(0);j&&i.push(M,v||t),i.push(M,t),p.push(M,t,M,0);const y=s.evalPoint({val:m.multipliedBy(10**h),model:l,midPrice:o});let P=t;const L=new e(h).div(x).toNumber();return y.vert.isNaN()||(P=t-y.vert.div(c).toNumber()),j&&d.length>=2&&(d.unshift(M,P),d.unshift(M,t)),d.push(L,P),b.lte(0)&&d.unshift(0,t),{quoteLinePoints:i,quoteLineAreaPoints:[0,t,0,v,...i],quoteLineAreaLinearGradientEndPointY:v,baseLinePoints:d,baseLineAreaPoints:[...d,L,t],baseLineAreaLinearGradientEndPointY:P,midPriceLinePoints:p}}),[a,r,n,o,l,t,u,c])}({chartHeight:b,chartWidth:f,midPrice:a,xPoints:50,pmmModel:u,baseMinAndZoomMultiples:m,buyYPortion:y,sellYPortion:P}),F=e=>{var t;const i=e.target;if(i&&q){const e=null===(t=i.getStage())||void 0===t?void 0:t.getPointerPosition();if(e){const{x:t}=e;if(t>f)return void q.hide();s.updateTooltip({x:t,tooltip:q,buyBaseVert:v,sellBaseVert:j,chartWidth:f,chartHeight:b,midPrice:a,pmmModel:u,baseTokenSymbol:d,quoteTokenSymbol:p,baseMinAndZoomMultiples:m,t:s.chartT,isHover:!0,color:h.tooltipColor,leftColor:h.leftLine,rightColor:h.rightLine})}}},H=i.useMemo((()=>t.throttle((e=>{const{target:t}=e,i=t.getStage();if(i){i.container().style.cursor="grabbing";const e=null==i?void 0:i.getPointerPosition();if(e){const t=e.x-z.current;z.current=e.x,B.current=e.x,x((e=>void 0===e.baseMin?e:{baseMin:s.computeBaseMinByDistance({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:f,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:0}))}}}),100)),[f,x]),D=i.useMemo((()=>t.throttle((e=>{e.cancelBubble=!0,e.evt.preventDefault();const t=e.evt.deltaY<0;x((e=>{const i=s.computeZoomMultiplesWhenZoom({zoomIn:t,prevZoomMultiples:e.zoomMultiples});return{baseMin:s.computeBaseAfterZoom({midPrice:a,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}}))}),100)),[a,x]);return i.useEffect((()=>{m.targetMarginPriceX>0&&null!==q?s.updateTooltip({x:m.targetMarginPriceX,tooltip:q,buyBaseVert:v,sellBaseVert:j,chartWidth:f,chartHeight:b,midPrice:a,pmmModel:u,baseTokenSymbol:d,quoteTokenSymbol:p,baseMinAndZoomMultiples:m,t:s.chartT,color:h.tooltipColor,leftColor:h.leftLine,rightColor:h.rightLine}):void 0!==B.current&&null!==q&&s.updateTooltip({x:B.current,tooltip:q,buyBaseVert:v,sellBaseVert:j,chartWidth:f,chartHeight:b,midPrice:a,pmmModel:u,baseTokenSymbol:d,quoteTokenSymbol:p,baseMinAndZoomMultiples:m,t:s.chartT,isHover:!0,color:h.tooltipColor,leftColor:h.leftLine,rightColor:h.rightLine})}),[m,d,v,b,f,h.leftLine,h.rightLine,h.tooltipColor,a,u,p,j,q]),l.jsxRuntimeExports.jsxs(n.Stage,{ref:E,width:r,offsetY:-s.chartOffsetYBCToolTip,height:o+s.chartOffsetYBCToolTip,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:F,onMouseOver:F,onMouseOut:()=>{q&&q.hide()},onDragStart:function(e){const{target:t}=e,i=t.getStage();if(i){const e=i.getPointerPosition();e&&(z.current=e.x)}},onDragMove:H,onDragEnd:e=>{const{target:t}=e,i=t.getStage();i&&(i.container().style.cursor="pointer")},onWheel:D,children:[l.jsxRuntimeExports.jsxs(n.Layer,{children:[l.jsxRuntimeExports.jsx(n.Rect,{x:0,y:0,width:r,height:b,stroke:h.grid,strokeWidth:1}),k.map(((e,t)=>l.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:h.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),T.map(((e,t)=>l.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:h.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),R.map(((e,t)=>l.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),C.map(((e,t)=>l.jsxRuntimeExports.jsx(n.Text,{x:e.x,y:e.y,text:e.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:M,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t))),l.jsxRuntimeExports.jsx(n.Line,{points:N,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:b},fillLinearGradientEndPoint:{x:0,y:O},fillLinearGradientColorStops:h.leftBg}),l.jsxRuntimeExports.jsx(n.Line,{points:S,stroke:h.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),l.jsxRuntimeExports.jsx(n.Line,{points:X,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:f,y:b},fillLinearGradientEndPoint:{x:f,y:Z},fillLinearGradientColorStops:h.rightBg}),l.jsxRuntimeExports.jsx(n.Line,{points:A,stroke:h.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),l.jsxRuntimeExports.jsx(n.Line,{points:W,stroke:h.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),l.jsxRuntimeExports.jsxs(n.Layer,{ref:L,visible:!1,listening:!1,children:[l.jsxRuntimeExports.jsx(n.Line,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),l.jsxRuntimeExports.jsx(n.Line,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),l.jsxRuntimeExports.jsx(n.Circle,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),l.jsxRuntimeExports.jsxs(n.Label,{x:0,y:0,id:"priceTextLabel",children:[l.jsxRuntimeExports.jsx(n.Tag,{fill:h.tooltipBg,id:"priceTextLabel-tag"}),l.jsxRuntimeExports.jsx(n.Text,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),l.jsxRuntimeExports.jsxs(n.Label,{x:0,y:0,id:"slippageTextLabel",children:[l.jsxRuntimeExports.jsx(n.Tag,{fill:h.tooltipBg,id:"slippageTextLabel-tag"}),l.jsxRuntimeExports.jsx(n.Text,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),l.jsxRuntimeExports.jsxs(n.Label,{x:0,y:0,id:"toolTip",children:[l.jsxRuntimeExports.jsx(n.Tag,{fill:h.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),l.jsxRuntimeExports.jsx(n.Text,{text:"-",fontSize:12,lineHeight:17/12,padding:s.labelPadding,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const q=r.button`
|
|
21
|
+
margin: 0;
|
|
22
|
+
border: none;
|
|
23
|
+
padding: 0;
|
|
24
|
+
background: none;
|
|
25
|
+
|
|
26
|
+
&:focus {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
&:active {
|
|
30
|
+
outline: none;
|
|
31
|
+
}
|
|
32
|
+
`,z=r.div`
|
|
33
|
+
height: 100%;
|
|
34
|
+
`,B=r.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
`,k=r.div`
|
|
38
|
+
border: 1px solid ${({borderColor:e})=>e||"#2a2a2d"};
|
|
39
|
+
flex: 1 0 50%;
|
|
40
|
+
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
line-height: 17px;
|
|
47
|
+
color: #606066;
|
|
48
|
+
|
|
49
|
+
& + & {
|
|
50
|
+
border-left: none;
|
|
51
|
+
}
|
|
52
|
+
`,T=r.span`
|
|
53
|
+
color: #85858d;
|
|
54
|
+
`,R=r.div`
|
|
55
|
+
margin-top: 20px;
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
margin-bottom: 9px;
|
|
59
|
+
`,C=r(q)`
|
|
60
|
+
border-radius: 13px;
|
|
61
|
+
background-color: #373739;
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
font-size: 18px;
|
|
65
|
+
color: #85858d;
|
|
66
|
+
line-height: 0;
|
|
67
|
+
& + & {
|
|
68
|
+
margin-left: 10px;
|
|
69
|
+
}
|
|
70
|
+
&:first-child,
|
|
71
|
+
&:last-child {
|
|
72
|
+
font-size: 20px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:hover {
|
|
76
|
+
color: #fff;
|
|
77
|
+
}
|
|
78
|
+
`;function S({params:t,target:i,isBuy:r=!0}){const o=new e(t.b),n=new e(t.q);let s=new e(t.b0);const l=new e(t.q0),u=new e(t.i),c=new e(t.k),{R:d}=t;1===d&&s.eq(o)&&(s=a.solveQuadraticFunctionForTarget(o,n.minus(l),new e(1).div(u),c));const p=r?o.plus(i):o.minus(i);if(p.lt(s)||o.eq(s)){let t=s.multipliedBy(s).div(p).div(p);return t=new e(1).minus(c).plus(c.multipliedBy(t)),u.multipliedBy(t)}const m=new a.PMMModel;m.RStatus=d,m.B=o,m.B0=s,m.Q=n,m.Q0=l,m.i=u,m.k=c,m.mtFeeRate=new e(0),m.lpFeeRate=new e(0);let g=new e(0);g=r?m.querySellBase(i):m.queryBuyBase(i);const x=r?n.minus(g):n.plus(g);let h=l.multipliedBy(l).div(x).div(x);return h=new e(1).minus(c).plus(c.multipliedBy(h)),u.div(h)}exports.default=({chartId:r,width:o=834,height:n=460,baseTokenSymbol:a,quoteTokenSymbol:u,pmmModel:c,pmmParams:d,midPrice:p=new e(0),colorMap:m,notShowAmountInput:g})=>{(({id:e})=>{i.useEffect((()=>{function t(e){e.preventDefault()}let i=!1;try{const e={get passive(){return i=!0,!1}};window.addEventListener("test",(()=>{}),e),window.removeEventListener("test",(()=>{}))}catch(e){i=!1}const r=document.getElementById(e),o=!!i&&{passive:!1};return null==r||r.addEventListener("wheel",t,o),()=>{null==r||r.removeEventListener("wheel",t)}}),[e])})({id:r});const[x,h]=i.useState(""),[f,b]=i.useState(""),[M,w]=i.useState("-"),[q,N]=i.useState("-"),[O,A]=i.useState({baseMin:new e(0),zoomMultiples:s.baseZoomMultiples,targetMarginPriceX:0});i.useEffect((()=>{void 0!==p&&A((e=>({baseMin:s.computeBaseAfterZoom({midPrice:p,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX})))}),[p]);const X=i.useMemo((()=>t.debounce((({type:t,amount:i})=>{""===i&&p&&(A({baseMin:s.computeBaseAfterZoom({midPrice:p,zoomMultiples:s.baseZoomMultiples}),zoomMultiples:s.baseZoomMultiples,targetMarginPriceX:0}),"buy"===t?w("-"):N("-"));const r=new e(i);if(!r.lte(0)&&!r.isNaN()&&(null==d?void 0:d.b)&&!r.gte(d.b)&&p)if("buy"===t){const e=S({params:d,target:r});A((i=>{const r=s.beforePriceImpactEffect({currentBaseMinAndZoomMultiples:i,targetPrice:e,midPrice:p,width:o});if(r.isSkip)return{baseMin:i.baseMin,zoomMultiples:i.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=s.computeTargetXByTargetPrice({midPrice:p,width:o,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:s.computeBaseAfterZoom({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),w(`${l.formatPercentageNumber({input:e.minus(p).div(p)})}`)}else{const e=function({params:e,target:t}){return S({params:e,target:t,isBuy:!1})}({params:d,target:r});A((i=>{const r=s.beforePriceImpactEffect({currentBaseMinAndZoomMultiples:i,targetPrice:e,midPrice:p,width:o});if(r.isSkip)return{baseMin:i.baseMin,zoomMultiples:i.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=s.computeTargetXByTargetPrice({midPrice:p,width:o,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:s.computeBaseAfterZoom({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),N(`+${l.formatPercentageNumber({input:e.minus(p).div(p)})}`)}}),300)),[d,p,o]);i.useEffect((()=>{void 0!==x&&X({type:"buy",amount:x})}),[X,x]),i.useEffect((()=>{void 0!==f&&X({type:"sell",amount:f})}),[X,f]);const Z=e=>{let t=0;t=e?-.1*o:.1*o,A((e=>void 0===e.baseMin?e:{baseMin:s.computeBaseMinByDistance({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:o,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX}))},W=e=>{A((t=>{const i=s.computeZoomMultiplesWhenZoom({zoomIn:null!=e&&e,prevZoomMultiples:t.zoomMultiples});return{baseMin:s.computeBaseAfterZoom({midPrice:p,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}}))},F=i.useMemo((()=>{if(""===x)return!1;const t=new e(x);return!(!t.lte(0)&&!t.isNaN()&&(null==d?void 0:d.b)&&!t.gte(d.b))}),[x,d]),H=i.useMemo((()=>{if(""===f)return!1;const t=new e(f);return!(!t.lte(0)&&!t.isNaN()&&(null==d?void 0:d.b)&&!t.gte(d.b))}),[f,d]);return l.jsxRuntimeExports.jsxs(z,{id:r,children:[g?"":l.jsxRuntimeExports.jsxs(B,{children:[l.jsxRuntimeExports.jsxs(k,{borderColor:m&&m.grid,children:[s.chartT("pool.chart.buy-amount",{symbol:a}),l.jsxRuntimeExports.jsx(L,{value:x,error:F,onChange:e=>{const t=l.fixedInputStringToFormattedNumber(e.target.value,2);null!==t&&h(t)}}),l.jsxRuntimeExports.jsx(T,{children:s.chartT("pool.chart.price-impact",{amount:M})})]}),l.jsxRuntimeExports.jsxs(k,{borderColor:m&&m.grid,children:[s.chartT("pool.chart.sell-amount",{symbol:a}),l.jsxRuntimeExports.jsx(L,{value:f,error:H,onChange:e=>{const t=l.fixedInputStringToFormattedNumber(e.target.value,2);null!==t&&b(t)}}),l.jsxRuntimeExports.jsx(T,{children:s.chartT("pool.chart.price-impact",{amount:q})})]})]}),void 0!==d&&void 0!==p&&void 0!==c&&void 0!==O.baseMin&&void 0!==p&&l.jsxRuntimeExports.jsx(E,{width:o,height:n,params:d,midPrice:p,pmmModel:c,baseTokenSymbol:a,quoteTokenSymbol:u,baseMinAndZoomMultiples:O,colorMap:m,setBaseMinAndZoomMultiples:A}),l.jsxRuntimeExports.jsxs(R,{className:"operate-btn-wrapper",children:[l.jsxRuntimeExports.jsx(C,{onClick:()=>Z(!0),children:l.jsxRuntimeExports.jsx(v,{})}),l.jsxRuntimeExports.jsx(C,{onClick:()=>W(!1),children:l.jsxRuntimeExports.jsx(y,{})}),l.jsxRuntimeExports.jsx(C,{onClick:()=>W(!0),children:l.jsxRuntimeExports.jsx(P,{})}),l.jsxRuntimeExports.jsx(C,{onClick:()=>Z(!1),children:l.jsxRuntimeExports.jsx(j,{})})]})]})};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import t from"@emotion/styled";import{merge as e}from"lodash";import{useMemo as i,useRef as n}from"react";import{l as r,g as o,m as l}from"./helper-AFwQcqmE.js";import{Line as a,Text as s,Stage as d,Layer as g,Rect as m,Circle as u,Label as p,Tag as c}from"react-konva";import{j as h,f}from"./index-CEudvuii.js";import x from"bignumber.js";import{solveQuadraticFunctionForTarget as L,PMMState as w,PMMHelper as b}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/components";import"@web3-react/core";import"react-redux";import"axios";import"@ethersproject/bignumber";import"@reduxjs/toolkit";import"redux";import"@dodoex/dodo-contract-request";import"@tanstack/react-query";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"zustand";import"identicon.js";import"react-dom";import"dayjs";import"react-transition-group";import"@dodoex/contract-request";import"recharts";import"react-window";import"jsbi";import"tiny-invariant";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";const A=t.div`
|
|
2
|
+
height: 100%;
|
|
3
|
+
position: relative;
|
|
4
|
+
`,y=t.div`
|
|
5
|
+
text-align: center;
|
|
6
|
+
margin-top: 17.1px;
|
|
7
|
+
margin-bottom: 88.41px;
|
|
8
|
+
color: #606066;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
line-height: 17px;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
`,N=36;function P({maxHeight:t,gridAreaHeight:e,value:i}){const n=new x(e).minus(N),r=n.div(t);return n.minus(i.multipliedBy(r)).plus(N).toNumber()}function v({targetPrice:t,areaPoints:e,isLeft:i}){for(let n=0;n<e.length;n++){const r=e[n],o=n<e.length-1?e[n+1]:null;if(!o)return{targetAreaStatPoint:r,targetAreaStatPoints:e};if(i){if(t.lte(r.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}else if(t.gte(r.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function j({x:t,width:e,minXLN10:i,maxXLN10:n}){const r=new x(t).div(e).multipliedBy(n.minus(i)).plus(i);return new x(10**r.toNumber())}function H({width:t,targetLN10:e,minXLN10:i,maxXLN10:n}){return e.minus(i).div(n.minus(i)).multipliedBy(t).toNumber()}function S({target:t}){return new x(Math.log10(t.toNumber()))}const k="rgba(38, 39, 41, 0.3)";function X({width:t,height:A,params:y,baseTokenSymbol:N,quoteTokenSymbol:X,colorMap:B}){const{maxLeftHeight:C,maxRightHeight:F,leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:q}=function({params:t}){return i((()=>{const e=new x(t.b),i=new x(t.q);let n=new x(t.b0);const r=new x(t.q0),o=new x(t.i),l=new x(t.k),{R:a}=t;1===a&&n.eq(e)&&(n=L(e,i.minus(r),new x(1).div(o),l));const s=new w({i:o,K:l,B:e,Q:i,B0:n,Q0:r,R:a,mtFeeRate:new x(0),lpFeeRate:new x(0)}),d=new b,g=new x(s.B),m=[],u=[];let p=new x(0),c=new x(0);const h=d.GetMidPrice(s),f=i.gt(0)?e.div(i):new x(1);for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(h.multipliedBy(f).multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,s);if(i.isNaN()||!i.gt(0))m.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=i.div(e);m.push({giveAmount:e,getAmount:i,price:t})}}for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(h.multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,s);if(i.isNaN()||!i.gt(0))u.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=e.dividedBy(i);u.push({giveAmount:e,getAmount:i,price:t})}}if(m.length<2&&u.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new x(10).multipliedBy(1.2),maxRightHeight:new x(10).multipliedBy(1.2),middlePriceLN10:new x(0),minXLN10:new x(-1),maxXLN10:new x(1)};const A=[];for(let t=1;t<m.length;t++){const e=m[t],{giveAmount:i,getAmount:n,price:r}=e,o=m[t-1];if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),a=n.minus(o.getAmount).abs().multipliedBy(l);1===t&&A.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),A.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),p=x.max(a,p)}}const y=[];for(let t=1;t<u.length;t++){const e=u[t],{giveAmount:i,getAmount:n,price:r}=e,o=u[t-1],l=o.price,a=o.giveAmount,s=o.getAmount;if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(l).abs(),o=i.minus(a).abs(),d=n.minus(s).abs().multipliedBy(o);1===t&&y.push({area:n,price:r,middlePrice:r.minus(e.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:n,price:r,middlePrice:r.minus(e.div(2)),rectangleHeight:d}),c=x.max(d,c)}}const N=m.length>0?m[m.length-1]:u[0],P=u.length>0?u[0]:m[0],v=u.length>0?u[u.length-1]:m[0],j=N.price,H=v.price,S=P.price,k=new x(Math.log10(S.toNumber()));let X=j.gt(0)?new x(Math.log10(j.toNumber())):new x(-Math.log10(H.toNumber())),B=H.gt(0)?new x(Math.log10(H.toNumber())):new x(-Math.log10(j.toNumber()));const C=x.max(k.minus(X).abs(),B.minus(k).abs());return X=k.minus(C),B=k.plus(C),{leftStatAreaPoints:A,rightStatAreaPoints:y,maxLeftHeight:p.multipliedBy(1.2),maxRightHeight:c.multipliedBy(1.2),minXLN10:X,maxXLN10:B,middlePriceLN10:k}}),[t])}({params:y}),J=A-30.13,O=n(null),R=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,k,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,k,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},B),D=e=>{var i;const{current:n}=O,r=e.target;if(r&&n){const e=null===(i=r.getStage())||void 0===i?void 0:i.getPointerPosition();if(e){const{x:i}=e,r=t/2;if(Math.abs(i-r)<=2)return;if(i<=2||t-i<=2)return;const a=j({x:i,width:t,minXLN10:T,maxXLN10:q});let s=null,d=[];const g=i<r;if(g){const t=v({areaPoints:M,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=v({areaPoints:W,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}if(s){const e=S({target:s.middlePrice}),r=H({minXLN10:T,maxXLN10:q,width:t,targetLN10:e}),a=P({maxHeight:g?C:F,gridAreaHeight:J,value:s.rectangleHeight}),m=n.findOne("#tooltip"),u=n.findOne("#toolTipVertLine"),p=n.findOne("#joinCircle"),c=n.findOne("#tooltip-Text"),h=n.findOne("#tooltip-tag"),x=n.findOne("#priceTextLabel"),L=null==x?void 0:x.findOne("#priceTextLabel-text"),w=n.findOne("#area");null==m||m.position({x:r,y:a-5-6}),null==c||c.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),null==c||c.text(g?o("pool.chart.liquidity-chart-buy",{amount:f(s.area),symbol:N,price:f(s.price)}):o("pool.chart.liquidity-chart-sell",{amount:f(s.area),symbol:X,price:f(s.price)})),m&&h&&(m.width()/2>i?(h.pointerDirection("left"),h.pointerHeight(15),h.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+i>t?(h.pointerDirection("right"),h.pointerHeight(15),h.pointerWidth(8),m.offsetX(11),m.offsetY(-11)):(h.pointerDirection("down"),h.pointerHeight(8),h.pointerWidth(15),m.offsetX(0),m.offsetY(0))),null==u||u.points([r,J,r,a]),null==u||u.stroke(g?"#55f6db":"#ff4f73");let b=g?"rgb(86, 246, 218)":"#FF5072",A=g?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(b=g?R.leftLine:R.rightLine,A=g?`rgba(${l(R.leftLine)}, 0.4)`:`rgba(${l(R.rightLine)}, 0.4)`),p&&(p.x(r),p.y(a),p.fill(b),p.stroke(A)),x&&(x.x(r),x.y(J+8.08+1),x.offsetX(x.width()/2),x.x()-x.width()/2<0?x.x(x.width()/2):x.x()+x.width()/2>t?x.x(t-x.width()/2):x.x(i)),L&&(L.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),L.text(f(s.price)));const y=[];for(const e of d){const{middlePrice:i,rectangleHeight:n}=e,r=S({target:i}),o=H({minXLN10:T,maxXLN10:q,width:t,targetLN10:r}),l=P({maxHeight:g?C:F,gridAreaHeight:J,value:n});y.push(o,l+1)}const v=y.slice(),[j,k]=v;g?(v.push(r,a),v.push(r,J),v.push(j,J),v.push(j,k)):(v.unshift(j,J),v.unshift(r,J),v.unshift(r,a)),w&&(w.points(v),w.fill(g?R.leftLine||"#2c5b56":R.rightLine||"#7b3a48")),n.show()}}}},z=function({gridAreaHeight:t,gridAreaWidth:e,horizontalLineCount:n,verticalLineCount:r,color:o="#2A2A2D"}){return i((()=>{const i=[],l=t/(n+1),s=[],d=e/(r+1);for(let t=0;t<n;t++){const n=l*(t+1);i.push([0,n,e,n])}for(let e=0;e<r;e++){const i=d*(e+1);s.push([i,0,i,t])}return h.jsxs(h.Fragment,{children:[i.map(((t,e)=>h.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e))),s.map(((t,e)=>h.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e)))]})}),[t,e,n,r,o])}({gridAreaHeight:J,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:R.grid}),G=function({minXLN10:t,maxXLN10:e,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return i((()=>{const i=o/(n+1),d=[],g=[];for(let l=0;l<n;l++){const n=i/2+i*l;d.push({x:n,y:r+10.08+1,text:f(j({x:i*(l+1),width:o,minXLN10:t,maxXLN10:e}))});const a=i*(l+1);g.push([a,r+1,a,r+4+1])}return h.jsxs(h.Fragment,{children:[d.map(((t,e)=>h.jsx(s,{x:t.x,y:t.y,text:t.text,fontSize:14,fontFamily:"Manrope",fill:l,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},e))),g.map(((t,e)=>h.jsx(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},e)))]})}),[t,e,r,o,n])}({gridAreaHeight:J,gridAreaWidth:t,labelCount:7,minXLN10:T,maxXLN10:q,color:R.textColor}),Q=function({gridAreaHeight:t,gridAreaWidth:e,color:n="#606066"}){return i((()=>{const i=e/2;return h.jsx(a,{points:[i,0,i,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,e,n])}({gridAreaHeight:J,gridAreaWidth:t,color:R.midPriceLine}),{leftLine:E,rightLine:Y}=function({leftStatAreaPoints:t,rightStatAreaPoints:e,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:g}){return{leftLine:i((()=>{if(t.length<1)return h.jsx(h.Fragment,{});const e=[];let i=d;for(const l of t){const{middlePrice:t,rectangleHeight:a}=l,g=S({target:t}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:o,gridAreaHeight:d,value:a});e.push(m,u),u<i&&(i=u)}const l=e.slice(),[m,u]=l,p=l[l.length-1],c=l[l.length-2];return l.push(c,p),l.push(c,d),l.push(m,d),l.push(m,u),h.jsxs(h.Fragment,{children:[h.jsx(a,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.leftBg}),h.jsx(a,{points:e,stroke:g.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,s,n,r,d,o]),rightLine:i((()=>{if(e.length<1)return h.jsx(h.Fragment,{});const t=[];let i=d;for(const o of e){const{middlePrice:e,rectangleHeight:a}=o,g=S({target:e}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,u),u<i&&(i=u)}const o=t.slice(),[m]=o;return o.unshift(m,d),o.unshift(s,d),h.jsxs(h.Fragment,{children:[h.jsx(a,{points:o,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.rightBg}),h.jsx(a,{points:t,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,s,n,r,d,l])}}({leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:q,maxLeftHeight:C,maxRightHeight:F,gridAreaWidth:t,gridAreaHeight:J,colorMap:R});return h.jsxs(d,{width:t,height:A,onMouseMove:D,onMouseOver:D,onMouseEnter:D,onMouseOut:()=>{const{current:t}=O;t&&t.hide()},children:[h.jsxs(g,{children:[h.jsx(m,{x:0,y:0,width:t,height:J,stroke:R.grid,strokeWidth:1}),z,G,E,Y,Q]}),h.jsxs(g,{ref:O,visible:!1,children:[h.jsx(a,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),h.jsx(a,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),h.jsx(u,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),h.jsxs(p,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[h.jsx(c,{fill:R.tooltipBg,id:"priceTextLabel-tag"}),h.jsx(s,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),h.jsxs(p,{listening:!1,id:"tooltip",children:[h.jsx(c,{fill:R.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),h.jsx(s,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}const B=({width:t=834,height:e=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>h.jsxs(A,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&h.jsx(X,{width:t,height:e,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:d}),s?"":h.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});export{B as default};
|