@dodoex/widgets 3.14.1-react.9 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/README.md +70 -70
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/helper-Dry2KYfh.js +1 -0
- package/dist/helper-iRd-4sp4.cjs +1 -0
- package/dist/index-BRTABuMK.cjs +12 -0
- package/dist/index-Ca_h9Yxg.js +34 -0
- package/dist/index-DDwPtr_I.js +12 -0
- package/dist/index-DHfQEIuw.cjs +78 -0
- package/dist/index-DsQIchnJ.js +78 -0
- package/dist/index-vyWzevj_.cjs +34 -0
- package/dist/index.cjs +1 -2
- 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/Bridge/BridgeRouteShortCard.d.ts +2 -4
- package/dist/types/components/Bridge/BridgeSummaryDialog/index.d.ts +2 -2
- package/dist/types/components/Bridge/CompareRoute.d.ts +4 -0
- package/dist/types/components/Bridge/RouteVision.d.ts +7 -0
- package/dist/types/components/Bridge/RouteVisionModal.d.ts +5 -0
- package/dist/types/components/CardWidgets.d.ts +11 -2
- package/dist/types/components/ConnectWallet/NeedConnectButton.d.ts +1 -1
- package/dist/types/components/ErrorMessageDialog.d.ts +2 -1
- package/dist/types/components/HowItWorks.d.ts +5 -5
- package/dist/types/components/Message/index.d.ts +1 -1
- package/dist/types/components/SelectChain.d.ts +1 -2
- package/dist/types/components/SquaredGoBack.d.ts +5 -0
- package/dist/types/components/Swap/SwapOrderHistory/CrossChainOrderList.d.ts +4 -0
- package/dist/types/components/Swap/SwapOrderHistory/CrossOrderCard.d.ts +8 -0
- package/dist/types/components/Swap/SwapOrderHistory/RefundModal.d.ts +9 -0
- package/dist/types/components/Swap/SwapOrderHistory/SameChainOrderList.d.ts +3 -0
- package/dist/types/components/Swap/SwapOrderHistory/index.d.ts +6 -5
- package/dist/types/components/Swap/components/Dialog.d.ts +1 -1
- package/dist/types/components/Swap/components/FiatEntryAndGasRefuel.d.ts +1 -0
- package/dist/types/components/Swap/components/ReceiveAddressInputModal.d.ts +10 -0
- package/dist/types/components/Swap/components/ReviewDialog.d.ts +2 -1
- package/dist/types/components/Swap/components/RouteVisionModal.d.ts +7 -0
- package/dist/types/components/Swap/components/SettingsDialog/index.d.ts +2 -1
- package/dist/types/components/Swap/components/SwapSettingsDialog/SlippageSetting.d.ts +1 -2
- package/dist/types/components/Swap/components/SwapSettingsDialog/SlippageWarning.d.ts +1 -3
- package/dist/types/components/Swap/components/SwapSettingsDialog/SupplierSelect.d.ts +5 -0
- package/dist/types/components/Swap/components/SwapSettingsDialog/index.d.ts +3 -2
- package/dist/types/components/Swap/components/TokenCard/TokenCardSwap.d.ts +48 -0
- package/dist/types/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +2 -0
- package/dist/types/components/Swap/components/TokenCard/WalletConnectBtn.d.ts +11 -0
- package/dist/types/components/Swap/components/TokenPairPriceWithToggle.d.ts +3 -2
- package/dist/types/components/Swap/index.d.ts +2 -4
- package/dist/types/components/TokenPicker/TokenItem.d.ts +3 -4
- package/dist/types/components/TokenPicker/index.d.ts +3 -3
- package/dist/types/components/Widget/index.d.ts +13 -15
- package/dist/types/components/WithExecutionDialog/index.d.ts +1 -2
- package/dist/types/constants/address.d.ts +6 -0
- package/dist/types/constants/api.d.ts +96 -4
- package/dist/types/constants/chainList.d.ts +10 -0
- package/dist/types/constants/chains.d.ts +17 -1
- package/dist/types/constants/sessionStorage.d.ts +1 -0
- package/dist/types/constants/swap.d.ts +1 -0
- package/dist/types/constants/tokenList.d.ts +8 -9
- package/dist/types/hooks/Bridge/createBridgeOrder.d.ts +4 -24
- package/dist/types/hooks/Bridge/useExecuteBridgeRoute.d.ts +1 -2
- package/dist/types/hooks/Bridge/useFeeList.d.ts +9 -0
- package/dist/types/hooks/Bridge/useFetchRoutePriceBridge.d.ts +138 -48
- package/dist/types/hooks/Bridge/useSendRoute.d.ts +1 -2
- package/dist/types/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +4 -1
- package/dist/types/hooks/Bridge/utils.d.ts +6 -0
- package/dist/types/hooks/ConnectWallet/index.d.ts +0 -2
- package/dist/types/hooks/ConnectWallet/useBTCWalletStore.d.ts +1 -0
- package/dist/types/hooks/ConnectWallet/useSwitchChain.d.ts +1 -12
- package/dist/types/hooks/Submission/types.d.ts +29 -1
- package/dist/types/hooks/Submission/useExecution.d.ts +1 -1
- package/dist/types/hooks/Swap/useBridgeSlippage.d.ts +3 -0
- package/dist/types/hooks/Swap/useCrossSwapOrderList.d.ts +215 -0
- package/dist/types/hooks/Swap/useExecuteSwap.d.ts +2 -1
- package/dist/types/hooks/Swap/useFetchRoutePrice.d.ts +2 -4
- package/dist/types/hooks/Swap/useForecastSlippageList.d.ts +0 -6
- package/dist/types/hooks/Swap/usePrivacySwapStatus.d.ts +10 -0
- package/dist/types/hooks/Swap/useSlippageLimit.d.ts +2 -2
- package/dist/types/hooks/Swap/useSwapSettingStore.d.ts +3 -5
- package/dist/types/hooks/Swap/useSwapSlippage.d.ts +0 -6
- package/dist/types/hooks/Swap/useSwitchToSupplierChain.d.ts +13 -0
- package/dist/types/hooks/Swap/useTradeSwapOrderList.d.ts +34 -133
- package/dist/types/hooks/Token/type.d.ts +3 -2
- package/dist/types/hooks/Token/useInitTokenList.d.ts +2 -2
- package/dist/types/hooks/Token/useSelectChainList.d.ts +5 -5
- package/dist/types/hooks/Token/useTokenList.d.ts +4 -8
- package/dist/types/hooks/Token/useTokenListDefaultToken.d.ts +2 -2
- package/dist/types/hooks/Token/useTokenListFetchBalance.d.ts +1 -4
- package/dist/types/hooks/Token/useTokenStatus.d.ts +28 -2
- package/dist/types/hooks/contract/useFetchETHBalance.d.ts +2 -1
- package/dist/types/hooks/contract/useFetchMultiTokensForSingleChain.d.ts +20 -0
- package/dist/types/hooks/contract/useFetchTokens.d.ts +9 -4
- package/dist/types/hooks/useAddressValidation.d.ts +2 -0
- package/dist/types/hooks/useGlobalState.d.ts +2 -0
- package/dist/types/hooks/useGraphQLRequests.d.ts +0 -1
- package/dist/types/hooks/useMessageState.d.ts +2 -1
- package/dist/types/hooks/useRouteVisionData.d.ts +17 -1
- package/dist/types/hooks/useTokenState.d.ts +3 -18
- package/dist/types/index.d.ts +27 -35
- package/dist/types/router/types.d.ts +5 -0
- package/dist/types/utils/CaipNetworksUtil.d.ts +5 -0
- package/dist/types/utils/address.d.ts +1 -1
- package/dist/types/utils/btc.d.ts +42 -0
- package/dist/types/utils/constants.d.ts +2 -0
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/reown-types.d.ts +28 -0
- package/dist/types/utils/solana.d.ts +7 -0
- package/dist/types/utils/token.d.ts +1 -1
- package/dist/types/utils/ton.d.ts +3 -0
- package/dist/types/utils/wallet.d.ts +2 -0
- package/dist/types/utils/zetachain_btc_test.d.ts +5 -0
- package/dist/types/widgets/MiningWidget/MiningCreate/hooks/useCreateMining.d.ts +1 -1
- package/dist/types/widgets/MiningWidget/hooks/usePrevious.d.ts +1 -1
- package/dist/types/widgets/MiningWidget/hooks/useRewardListAmount.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/AMMV2Create/Ratio.d.ts +1 -4
- package/dist/types/widgets/PoolWidget/AMMV2Create/Setting.d.ts +16 -0
- package/dist/types/widgets/PoolWidget/AMMV3/AddLiquidityV3.d.ts +2 -1
- package/dist/types/widgets/PoolWidget/AMMV3/components/LiquidityChartRangeInput/hooks.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/AMMV3/components/LiquidityChartRangeInput/index.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/AMMV3/components/LiquidityChartRangeInput/usePrevious.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/AMMV3/components/RangeSetList.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/AMMV3/components/TokenPairSelect.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/AMMV3/hooks/usePoolTickData.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/AMMV3/hooks/useV3DerivedMintInfo.d.ts +4 -1
- package/dist/types/widgets/PoolWidget/AMMV3/reducer.d.ts +4 -1
- package/dist/types/widgets/PoolWidget/PoolCreate/components/BaseInfoCardList.d.ts +1 -3
- package/dist/types/widgets/PoolWidget/PoolCreate/components/FeeRateCard.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/components/LqRatioSet.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/components/LqSettingsShow.d.ts +1 -3
- package/dist/types/widgets/PoolWidget/PoolCreate/components/PriceModeCard.d.ts +1 -3
- package/dist/types/widgets/PoolWidget/PoolCreate/components/VersionChartExample.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/components/widgets.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/hooks/useDefaultTokens.d.ts +2 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/hooks/usePriceInit.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/hooks/useVersionList.d.ts +4 -4
- package/dist/types/widgets/PoolWidget/PoolCreate/index.d.ts +1 -3
- package/dist/types/widgets/PoolWidget/PoolCreate/operate-widgets/InitPriceSetting.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/operate-widgets/PriceModeSetting.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/operate-widgets/VersionSelect.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolCreate/utils.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolDetail/components/MoreDetail/ParametersTable.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolDetail/components/MoreDetail/index.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolDetail/components/Overview.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolDetail/hooks/useLiquidityProviders.d.ts +0 -6
- package/dist/types/widgets/PoolWidget/PoolDetail/hooks/usePoolDashboard.d.ts +0 -6
- package/dist/types/widgets/PoolWidget/PoolDetail/hooks/usePoolDayData.d.ts +0 -6
- package/dist/types/widgets/PoolWidget/PoolDetail/hooks/usePoolSwapList.d.ts +0 -6
- package/dist/types/widgets/PoolWidget/PoolDetail/index.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolList/AddLiquidity.d.ts +7 -5
- package/dist/types/widgets/PoolWidget/PoolList/MyCreated.d.ts +2 -7
- package/dist/types/widgets/PoolWidget/PoolList/MyLiquidity.d.ts +7 -5
- package/dist/types/widgets/PoolWidget/PoolList/components/FilterGroup.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/PoolList/components/GoPoolDetailBtn.d.ts +3 -1
- package/dist/types/widgets/PoolWidget/PoolList/components/SortButtonGroup.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/PoolList/components/TableSortButton.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/PoolList/components/tags.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/PoolList/hooks/usePoolListTabs.d.ts +14 -6
- package/dist/types/widgets/PoolWidget/PoolList/index.d.ts +8 -7
- package/dist/types/widgets/PoolWidget/PoolModify/index.d.ts +1 -2
- package/dist/types/widgets/PoolWidget/PoolOperate/AddPoolOperate.d.ts +2 -6
- package/dist/types/widgets/PoolWidget/PoolOperate/PoolOperateInner.d.ts +2 -4
- package/dist/types/widgets/PoolWidget/PoolOperate/RemovePoolOperate.d.ts +2 -4
- package/dist/types/widgets/PoolWidget/PoolOperate/components/OperateBtn.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/components/Ratio.d.ts +1 -5
- package/dist/types/widgets/PoolWidget/PoolOperate/components/SlippageSetting.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/hooks/useRemoveLiquidityTokenStatus.d.ts +49 -2
- package/dist/types/widgets/PoolWidget/PoolOperate/index.d.ts +2 -6
- package/dist/types/widgets/PoolWidget/PoolOperate/types.d.ts +0 -12
- package/dist/types/widgets/PoolWidget/curve/Add.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/AddOrRemove.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/curve/AllPools.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/curve/CurvePoolDetail.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/OperateDialog.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/curve/Remove.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/components/ApyTooltip.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/curve/components/CoinReservePieChart.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/curve/components/CoinsLogoList.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/curve/components/FilterAddressTags.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/curve/components/LiquidityProvidersTable.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/curve/components/OperateButtonContainer.d.ts +3 -0
- package/dist/types/widgets/PoolWidget/curve/components/ParametersTable.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/components/PoolTitle.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/components/PoolTotalStats.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/components/SlippageBonus.d.ts +3 -0
- package/dist/types/widgets/PoolWidget/curve/components/SwapsTable.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/curve/components/TokenListPoolItem.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/curve/hooks/useLiquidityProviders.d.ts +166 -0
- package/dist/types/widgets/PoolWidget/curve/hooks/useLpTokenBalances.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/curve/hooks/usePoolDetail.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/curve/hooks/usePoolListFilterTokenAndPool.d.ts +9 -0
- package/dist/types/widgets/PoolWidget/curve/hooks/usePoolSwapList.d.ts +166 -0
- package/dist/types/widgets/PoolWidget/curve/types.d.ts +44 -0
- package/dist/types/widgets/PoolWidget/curve/utils.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/hooks/contract/useModifyDppPool.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/hooks/useAMMV2AddLiquidity.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/hooks/useAMMV2RemoveLiquidity.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/hooks/usePoolDetail.d.ts +0 -6
- package/dist/types/widgets/PoolWidget/hooks/useUniV2Pairs.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/utils.d.ts +4 -0
- package/package.json +161 -161
- package/dist/28442382d977858a.svg +0 -9
- package/dist/8de9a184d4ef0a11.svg +0 -6
- package/dist/assets/bundle-BBymdwHN.css +0 -65
- package/dist/b3f16b2626f03378.svg +0 -10
- package/dist/ed726d76d93d4899.svg +0 -10
- package/dist/helper-Ds_8_78g.cjs +0 -2
- package/dist/helper-Ds_8_78g.cjs.map +0 -1
- package/dist/helper-l9rrGqkT.js +0 -1
- package/dist/index-B6OsCe_1.cjs +0 -13
- package/dist/index-B6OsCe_1.cjs.map +0 -1
- package/dist/index-Bcqk1fMQ.cjs +0 -15
- package/dist/index-Bcqk1fMQ.cjs.map +0 -1
- package/dist/index-Bp_1xqpK.js +0 -14
- package/dist/index-BrLsqpSG.js +0 -12
- package/dist/index-DyKuKZOu.cjs +0 -79
- package/dist/index-DyKuKZOu.cjs.map +0 -1
- package/dist/index-bVmd7uFj.js +0 -78
- package/dist/index.cjs.map +0 -1
- package/dist/types/components/ConnectWallet/ConnectWalletDialog.d.ts +0 -4
- package/dist/types/components/ConnectWallet/OpenConnectWalletInfo.d.ts +0 -2
- package/dist/types/components/SubmittedDialog.d.ts +0 -7
- package/dist/types/components/Swap/components/ConnectWallet/index.d.ts +0 -5
- package/dist/types/components/Swap/components/SwapPreviewInfoCard.d.ts +0 -7
- package/dist/types/components/SwitchChainDialog/index.d.ts +0 -6
- package/dist/types/components/TokenPicker/ImportToken.d.ts +0 -6
- package/dist/types/components/TokenPicker/TokenDetailInfo.d.ts +0 -6
- package/dist/types/hooks/ConnectWallet/Connectors/JsonRpcConnector.d.ts +0 -9
- package/dist/types/hooks/ConnectWallet/useWalletInfo.d.ts +0 -8
- package/dist/types/hooks/ConnectWallet/useWeb3Connectors.d.ts +0 -17
- package/dist/types/hooks/ConnectWallet/web3.d.ts +0 -10
- package/dist/types/hooks/Token/useFindTokenByAddress.test.d.ts +0 -1
- package/dist/types/hooks/Token/useSelectChainList.test.d.ts +0 -1
- package/dist/types/hooks/Token/useTokenList.test.d.ts +0 -1
- package/dist/types/hooks/Token/useTokenStatus.test.d.ts +0 -1
- package/dist/types/widgets/PoolWidget/PoolList/components/OnlyV3Toggle.d.ts +0 -7
- package/dist/types/widgets/PoolWidget/hooks/usePoolListMyLiquidity.d.ts +0 -15
- /package/dist/types/hooks/{Bridge/useFetchRoutePriceBridge.test.d.ts → useAddressValidation.test.d.ts} +0 -0
- /package/dist/types/{widgets/MiningWidget/hooks → hooks}/useRefetch.d.ts +0 -0
- /package/dist/types/{hooks/Chain/useChainList.test.d.ts → tests/1-get-account-state.d.ts} +0 -0
- /package/dist/types/{hooks/Swap/useFetchFiatPrice.test.d.ts → tests/1-send-ton.d.ts} +0 -0
- /package/dist/types/{hooks/Swap/useFetchRoutePrice.test.d.ts → utils/sui_test.d.ts} +0 -0
- /package/dist/types/{hooks/Swap/useMarginAmount.test.d.ts → utils/ton_test.d.ts} +0 -0
package/dist/index-BrLsqpSG.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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,h as o,m as l}from"./helper-l9rrGqkT.js";import{Line as a,Text as s,Stage as d,Layer as m,Rect as p,Circle as g,Label as u,Tag as c}from"react-konva";import{f as h}from"./index-Bp_1xqpK.js";import f from"bignumber.js";import{jsxs as x,Fragment as L,jsx as b}from"react/jsx-runtime";import{solveQuadraticFunctionForTarget as w,PMMState as A,PMMHelper as y}from"@dodoex/api";import"@lingui/core";import"@dodoex/components";import"@dodoex/dodo-contract-request";import"@babel/runtime/helpers/interopRequireDefault";import"@babel/runtime/helpers/defineProperty";import"@lingui/react";import"identicon.js";import"zustand";import"zustand/middleware";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@tanstack/react-query";import"@ethersproject/bignumber";import"react-dom";import"react-window";import"dayjs";import"dayjs/plugin/utc";import"dayjs/plugin/duration";import"dayjs/plugin/localizedFormat";import"react-transition-group";import"react-is";import"@dodoex/contract-request";import"axios";import"recharts";import"react-dom/client";import"jsbi";import"tiny-invariant";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";import"rmc-date-picker/assets/index.css";import"react-datetime/css/react-datetime.css";const P=t.div`
|
|
2
|
-
height: 100%;
|
|
3
|
-
position: relative;
|
|
4
|
-
`,N=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
|
-
`;function v({maxHeight:t,gridAreaHeight:e,value:i}){const n=new f(e).minus(36),r=n.div(t);return n.minus(i.multipliedBy(r)).plus(36).toNumber()}function H({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 S({x:t,width:e,minXLN10:i,maxXLN10:n}){const r=new f(t).div(e).multipliedBy(n.minus(i)).plus(i);return new f(10**r.toNumber())}function k({width:t,targetLN10:e,minXLN10:i,maxXLN10:n}){return e.minus(i).div(n.minus(i)).multipliedBy(t).toNumber()}function X({target:t}){return new f(Math.log10(t.toNumber()))}const B="rgba(38, 39, 41, 0.3)";function C({width:t,height:P,params:N,baseTokenSymbol:C,quoteTokenSymbol:M,colorMap:W}){const{maxLeftHeight:F,maxRightHeight:T,leftStatAreaPoints:j,rightStatAreaPoints:q,minXLN10:J,maxXLN10:R}=function({params:t}){return i(()=>{const e=new f(t.b),i=new f(t.q);let n=new f(t.b0);const r=new f(t.q0),o=new f(t.i),l=new f(t.k),{R:a}=t;1===a&&n.eq(e)&&(n=w(e,i.minus(r),new f(1).div(o),l));const s=new A({i:o,K:l,B:e,Q:i,B0:n,Q0:r,R:a,mtFeeRate:new f(0),lpFeeRate:new f(0)}),d=new y,m=new f(s.B),p=[],g=[];let u=new f(0),c=new f(0);const h=d.GetMidPrice(s),x=i.gt(0)?e.div(i):new f(1);for(let t=0;t<=250;t++){let e=m.multipliedBy(t/100).multipliedBy(h.multipliedBy(x).multipliedBy(4));0===t&&(e=m.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,s);if(!i.isNaN()&&i.gt(0)){const t=i.div(e);p.push({giveAmount:e,getAmount:i,price:t});continue}p.push({giveAmount:e,getAmount:new f(0),price:new f(0)})}for(let t=0;t<=250;t++){let e=m.multipliedBy(t/100).multipliedBy(h.multipliedBy(4));0===t&&(e=m.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,s);if(!i.isNaN()&&i.gt(0)){const t=e.dividedBy(i);g.push({giveAmount:e,getAmount:i,price:t});continue}g.push({giveAmount:e,getAmount:new f(0),price:new f(0)})}if(p.length<2&&g.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new f(10).multipliedBy(1.2),maxRightHeight:new f(10).multipliedBy(1.2),middlePriceLN10:new f(0),minXLN10:new f(-1),maxXLN10:new f(1)};const L=[];for(let t=1;t<p.length;t++){const e=p[t],{giveAmount:i,getAmount:n,price:r}=e,o=p[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&&L.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),L.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),u=f.max(a,u)}}const b=[];for(let t=1;t<g.length;t++){const e=g[t],{giveAmount:i,getAmount:n,price:r}=e,o=g[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&&b.push({area:n,price:r,middlePrice:r.minus(e.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),b.push({area:n,price:r,middlePrice:r.minus(e.div(2)),rectangleHeight:d}),c=f.max(d,c)}}const P=p.length>0?p[p.length-1]:g[0],N=g.length>0?g[0]:p[0],v=g.length>0?g[g.length-1]:p[0],H=P.price,S=v.price,k=N.price,X=new f(Math.log10(k.toNumber()));let B=H.gt(0)?new f(Math.log10(H.toNumber())):new f(-Math.log10(S.toNumber())),C=S.gt(0)?new f(Math.log10(S.toNumber())):new f(-Math.log10(H.toNumber()));const M=f.max(X.minus(B).abs(),C.minus(X).abs());return B=X.minus(M),C=X.plus(M),{leftStatAreaPoints:L,rightStatAreaPoints:b,maxLeftHeight:u.multipliedBy(1.2),maxRightHeight:c.multipliedBy(1.2),minXLN10:B,maxXLN10:C,middlePriceLN10:X}},[t])}({params:N}),O=P-30.13,z=n(null),D=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,B,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,B,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},W),G=e=>{var i;const{current:n}=z,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=S({x:i,width:t,minXLN10:J,maxXLN10:R});let s=null,d=[];const m=i<r;if(m){const t=H({areaPoints:j,targetPrice:a,isLeft:m});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=H({areaPoints:q,targetPrice:a,isLeft:m});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}if(s){const e=X({target:s.middlePrice}),r=k({minXLN10:J,maxXLN10:R,width:t,targetLN10:e}),a=v({maxHeight:m?F:T,gridAreaHeight:O,value:s.rectangleHeight}),p=n.findOne("#tooltip"),g=n.findOne("#toolTipVertLine"),u=n.findOne("#joinCircle"),c=n.findOne("#tooltip-Text"),f=n.findOne("#tooltip-tag"),x=n.findOne("#priceTextLabel"),L=null==x?void 0:x.findOne("#priceTextLabel-text"),b=n.findOne("#area");null==p||p.position({x:r,y:a-5-6}),null==c||c.fill(D.tooltipColor||(m?"#00FAD9":"#FF5072")),null==c||c.text(m?o("pool.chart.liquidity-chart-buy",{amount:h(s.area),symbol:C,price:h(s.price)}):o("pool.chart.liquidity-chart-sell",{amount:h(s.area),symbol:M,price:h(s.price)})),p&&f&&(p.width()/2>i?(f.pointerDirection("left"),f.pointerHeight(15),f.pointerWidth(8),p.offsetX(-11),p.offsetY(-11)):p.width()/2+i>t?(f.pointerDirection("right"),f.pointerHeight(15),f.pointerWidth(8),p.offsetX(11),p.offsetY(-11)):(f.pointerDirection("down"),f.pointerHeight(8),f.pointerWidth(15),p.offsetX(0),p.offsetY(0))),null==g||g.points([r,O,r,a]),null==g||g.stroke(m?"#55f6db":"#ff4f73");let w=m?"rgb(86, 246, 218)":"#FF5072",A=m?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";D.leftLine&&D.rightLine&&(w=m?D.leftLine:D.rightLine,A=m?`rgba(${l(D.leftLine)}, 0.4)`:`rgba(${l(D.rightLine)}, 0.4)`),u&&(u.x(r),u.y(a),u.fill(w),u.stroke(A)),x&&(x.x(r),x.y(O+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(D.tooltipColor||(m?"#00FAD9":"#FF5072")),L.text(h(s.price)));const y=[];for(const e of d){const{middlePrice:i,rectangleHeight:n}=e,r=X({target:i}),o=k({minXLN10:J,maxXLN10:R,width:t,targetLN10:r}),l=v({maxHeight:m?F:T,gridAreaHeight:O,value:n});y.push(o,l+1)}const P=y.slice(),[N,H]=P;m?(P.push(r,a),P.push(r,O),P.push(N,O),P.push(N,H)):(P.unshift(N,O),P.unshift(r,O),P.unshift(r,a)),b&&(b.points(P),b.fill(m?D.leftLine||"#2c5b56":D.rightLine||"#7b3a48")),n.show()}}}},Q=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 x(L,{children:[i.map((t,e)=>b(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e)),s.map((t,e)=>b(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e))]})},[t,e,n,r,o])}({gridAreaHeight:O,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:D.grid}),E=function({minXLN10:t,maxXLN10:e,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return i(()=>{const i=o/(n+1),d=[],m=[];for(let l=0;l<n;l++){const n=i/2+i*l;d.push({x:n,y:r+10.08+1,text:h(S({x:i*(l+1),width:o,minXLN10:t,maxXLN10:e}))});const a=i*(l+1);m.push([a,r+1,a,r+4+1])}return x(L,{children:[d.map((t,e)=>b(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)),m.map((t,e)=>b(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},e))]})},[t,e,r,o,n])}({gridAreaHeight:O,gridAreaWidth:t,labelCount:7,minXLN10:J,maxXLN10:R,color:D.textColor}),Y=function({gridAreaHeight:t,gridAreaWidth:e,color:n="#606066"}){return i(()=>{const i=e/2;return b(a,{points:[i,0,i,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})},[t,e,n])}({gridAreaHeight:O,gridAreaWidth:t,color:D.midPriceLine}),{leftLine:V,rightLine:$}=function({leftStatAreaPoints:t,rightStatAreaPoints:e,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:m}){return{leftLine:i(()=>{if(t.length<1)return b(L,{});const e=[];let i=d;for(const l of t){const{middlePrice:t,rectangleHeight:a}=l,m=X({target:t}),p=k({minXLN10:n,maxXLN10:r,width:s,targetLN10:m}),g=v({maxHeight:o,gridAreaHeight:d,value:a});e.push(p,g),g<i&&(i=g)}const l=e.slice(),[p,g]=l,u=l[l.length-1],c=l[l.length-2];return l.push(c,u),l.push(c,d),l.push(p,d),l.push(p,g),x(L,{children:[b(a,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:m.leftBg}),b(a,{points:e,stroke:m.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})},[t,s,n,r,d,o]),rightLine:i(()=>{if(e.length<1)return b(L,{});const t=[];let i=d;for(const o of e){const{middlePrice:e,rectangleHeight:a}=o,m=X({target:e}),p=k({minXLN10:n,maxXLN10:r,width:s,targetLN10:m}),g=v({maxHeight:l,gridAreaHeight:d,value:a});t.push(p,g),g<i&&(i=g)}const o=t.slice(),[p]=o;return o.unshift(p,d),o.unshift(s,d),x(L,{children:[b(a,{points:o,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:m.rightBg}),b(a,{points:t,stroke:m.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})},[e,s,n,r,d,l])}}({leftStatAreaPoints:j,rightStatAreaPoints:q,minXLN10:J,maxXLN10:R,maxLeftHeight:F,maxRightHeight:T,gridAreaWidth:t,gridAreaHeight:O,colorMap:D});return x(d,{width:t,height:P,onMouseMove:G,onMouseOver:G,onMouseEnter:G,onMouseOut:()=>{const{current:t}=z;t&&t.hide()},children:[x(m,{children:[b(p,{x:0,y:0,width:t,height:O,stroke:D.grid,strokeWidth:1}),Q,E,V,$,Y]}),x(m,{ref:z,visible:!1,children:[b(a,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),b(a,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),b(g,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),x(u,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[b(c,{fill:D.tooltipBg,id:"priceTextLabel-tag"}),b(s,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),x(u,{listening:!1,id:"tooltip",children:[b(c,{fill:D.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),b(s,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}const M=({width:t=834,height:e=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>x(P,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&b(C,{width:t,height:e,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:d}),s?"":x(N,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});export{M as default};
|
package/dist/index-DyKuKZOu.cjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("bignumber.js"),t=require("lodash"),i=require("react"),o=require("react-icons/bi"),r=require("@emotion/styled"),n=require("@emotion/react"),l=require("react-konva"),s=require("./helper-Ds_8_78g.cjs"),a=require("./index-Bcqk1fMQ.cjs"),u=require("react/jsx-runtime"),d=require("@dodoex/api");require("@lingui/core"),require("@dodoex/components"),require("@dodoex/dodo-contract-request"),require("@babel/runtime/helpers/interopRequireDefault"),require("@babel/runtime/helpers/defineProperty"),require("@lingui/react"),require("identicon.js"),require("zustand"),require("zustand/middleware"),require("@web3-react/core"),require("@web3-react/eip1193"),require("@web3-react/walletconnect-v2"),require("@web3-react/metamask"),require("@web3-react/types"),require("@tanstack/react-query"),require("@ethersproject/bignumber"),require("react-dom"),require("react-window"),require("dayjs"),require("dayjs/plugin/utc"),require("dayjs/plugin/duration"),require("dayjs/plugin/localizedFormat"),require("react-transition-group"),require("react-is"),require("@dodoex/contract-request"),require("axios"),require("recharts"),require("react-dom/client"),require("jsbi"),require("tiny-invariant"),require("@uniswap/sdk-core"),require("@uniswap/v2-sdk"),require("react-infinite-scroller"),require("d3"),require("rmc-date-picker"),require("rmc-date-picker/assets/index.css"),require("react-datetime/css/react-datetime.css");const c=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&&n.css`
|
|
17
|
-
border-color: red;
|
|
18
|
-
`}
|
|
19
|
-
}
|
|
20
|
-
`;const p="rgba(38, 39, 41, 0.3)";function m({width:o,height:r,midPrice:n,pmmModel:d,params:c,baseTokenSymbol:m,quoteTokenSymbol:g,baseMinAndZoomMultiples:h,colorMap:b,setBaseMinAndZoomMultiples:M}){const f=t.merge({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,p,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,p,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},b),x=o,P=r-18,v=x/7,{buyBaseVert:y,sellBaseVert:L}=s.computeBaseVert({midPrice:n,q:c.q,q0:c.q0,pmmModel:d}),q=y.div(P),B=L.div(P),z=i.useRef(null),j=i.useRef(null),{current:w}=z,T=i.useRef(0),k=i.useRef(),{horizontalGridLines:C,verticalGridLines:S}=function({chartHeight:e,chartWidth:t,horizontalLineCount:o,verticalLineCount:r}){return i.useMemo(()=>{const i=[],n=e/(o+1),l=[],s=t/r;for(let e=0;e<o;e++){const o=n*(e+1);i.push([0,o,t,o])}for(let t=0;t<r;t++){const i=s*t+s/2;l.push([i,0,i,e])}return{horizontalGridLines:i,verticalGridLines:l}},[e,t,o,r])}({chartHeight:P,chartWidth:x,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:A,horizontalLabelTextPoints:X}=function({chartHeight:e,chartWidth:t,xAxisPoints:o,oneXPx:r,baseMinAndZoomMultiples:n}){return i.useMemo(()=>{const i=s.computeXPortion(t,n.zoomMultiples),l=[],u=[];for(let t=0;t<o;t++){l.push([t*r+r/2,e,t*r+r/2,e+4]);const o=i.multipliedBy(t).multipliedBy(r).plus(i.multipliedBy(r/2)).toNumber(),s=n.baseMin.multipliedBy(10**o),d=t*r,c=e+2+4,p=a.formatShortNumber(s);u.push({x:d,y:c,text:p})}return{horizontalLabelTickPoints:l,horizontalLabelTextPoints:u}},[n.baseMin,n.zoomMultiples,e,t,r,o])}({chartHeight:P,chartWidth:x,xAxisPoints:7,oneXPx:v,baseMinAndZoomMultiples:h}),{quoteLinePoints:N,quoteLineAreaPoints:Z,quoteLineAreaLinearGradientEndPointY:W,baseLinePoints:F,baseLineAreaPoints:E,baseLineAreaLinearGradientEndPointY:G,midPriceLinePoints:H}=function({chartHeight:t,chartWidth:o,midPrice:r,xPoints:n,pmmModel:l,baseMinAndZoomMultiples:a,buyYPortion:u,sellYPortion:d}){return i.useMemo(()=>{const i=[],c=[],p=[],{baseMin:m,zoomMultiples:g}=a,h=s.computeXPortion(o,g),b=2*g,M=new e(b).div(n);let f=new e(Math.log(r.div(m).toNumber())/Math.log(10));f=e.minimum(b,f),f=e.maximum(0,f);for(let o=new e(0);o.lte(f);){const e=m.multipliedBy(10**o.toNumber()),r=s.evalPoint({val:e,model:l});if(!r.vert.isNaN()){const e=o.div(h).toNumber(),n=t-r.vert.div(u).toNumber();i.push(e,n)}o=o.plus(M)}for(let e=f;e.lte(b);){const i=m.multipliedBy(10**e.toNumber()),o=s.evalPoint({val:i,model:l});if(!o.vert.isNaN()){const i=e.div(h).toNumber(),r=t-o.vert.div(d).toNumber();c.push(i,r)}e=e.plus(M)}const x=f.div(h).toNumber(),[,P]=i,v=l.k.eq(0);v&&i.push(x,P||t),i.push(x,t),p.push(x,t,x,0);const y=s.evalPoint({val:m.multipliedBy(10**b),model:l});let L=t;const q=new e(b).div(h).toNumber();return y.vert.isNaN()||(L=t-y.vert.div(d).toNumber()),v&&c.length>=2&&(c.unshift(x,L),c.unshift(x,t)),c.push(q,L),f.lte(0)&&c.unshift(0,t),{quoteLinePoints:i,quoteLineAreaPoints:[0,t,0,P,...i],quoteLineAreaLinearGradientEndPointY:P,baseLinePoints:c,baseLineAreaPoints:[...c,q,t],baseLineAreaLinearGradientEndPointY:L,midPriceLinePoints:p}},[a,o,n,r,l,t,u,d])}({chartHeight:P,chartWidth:x,midPrice:n,xPoints:50,pmmModel:d,baseMinAndZoomMultiples:h,buyYPortion:q,sellYPortion:B}),D=e=>{var t;const i=e.target;if(i&&w){const e=null===(t=i.getStage())||void 0===t?void 0:t.getPointerPosition();if(e){const{x:t}=e;if(t>x)return void w.hide();s.updateTooltip({x:t,tooltip:w,buyBaseVert:y,sellBaseVert:L,chartWidth:x,chartHeight:P,midPrice:n,pmmModel:d,baseTokenSymbol:m,quoteTokenSymbol:g,baseMinAndZoomMultiples:h,t:s.chartT,isHover:!0,color:f.tooltipColor,leftColor:f.leftLine,rightColor:f.rightLine})}}},R=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-T.current;T.current=e.x,k.current=e.x,M(e=>void 0===e.baseMin?e:{baseMin:s.computeBaseMinByDistance({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:x,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:0})}}},100),[x,M]),Y=i.useMemo(()=>t.throttle(e=>{e.cancelBubble=!0,e.evt.preventDefault();const t=e.evt.deltaY<0;M(e=>{const i=s.computeZoomMultiplesWhenZoom({zoomIn:t,prevZoomMultiples:e.zoomMultiples});return{baseMin:s.computeBaseAfterZoom({midPrice:n,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}})},100),[n,M]);return i.useEffect(()=>{h.targetMarginPriceX>0&&null!==w?s.updateTooltip({x:h.targetMarginPriceX,tooltip:w,buyBaseVert:y,sellBaseVert:L,chartWidth:x,chartHeight:P,midPrice:n,pmmModel:d,baseTokenSymbol:m,quoteTokenSymbol:g,baseMinAndZoomMultiples:h,t:s.chartT,color:f.tooltipColor,leftColor:f.leftLine,rightColor:f.rightLine}):void 0!==k.current&&null!==w&&s.updateTooltip({x:k.current,tooltip:w,buyBaseVert:y,sellBaseVert:L,chartWidth:x,chartHeight:P,midPrice:n,pmmModel:d,baseTokenSymbol:m,quoteTokenSymbol:g,baseMinAndZoomMultiples:h,t:s.chartT,isHover:!0,color:f.tooltipColor,leftColor:f.leftLine,rightColor:f.rightLine})},[h,m,y,P,x,f.leftLine,f.rightLine,f.tooltipColor,n,d,g,L,w]),u.jsxs(l.Stage,{ref:j,width:o,offsetY:-s.chartOffsetYBCToolTip,height:r+s.chartOffsetYBCToolTip,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:D,onMouseOver:D,onMouseOut:()=>{w&&w.hide()},onDragStart:function(e){const{target:t}=e,i=t.getStage();if(i){const e=i.getPointerPosition();e&&(T.current=e.x)}},onDragMove:R,onDragEnd:e=>{const{target:t}=e,i=t.getStage();i&&(i.container().style.cursor="pointer")},onWheel:Y,children:[u.jsxs(l.Layer,{children:[u.jsx(l.Rect,{x:0,y:0,width:o,height:P,stroke:f.grid,strokeWidth:1}),C.map((e,t)=>u.jsx(l.Line,{points:e,stroke:f.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t)),S.map((e,t)=>u.jsx(l.Line,{points:e,stroke:f.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t)),A.map((e,t)=>u.jsx(l.Line,{points:e,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t)),X.map((e,t)=>u.jsx(l.Text,{x:e.x,y:e.y,text:e.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:v,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t)),u.jsx(l.Line,{points:Z,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:P},fillLinearGradientEndPoint:{x:0,y:W},fillLinearGradientColorStops:f.leftBg}),u.jsx(l.Line,{points:N,stroke:f.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),u.jsx(l.Line,{points:E,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:x,y:P},fillLinearGradientEndPoint:{x:x,y:G},fillLinearGradientColorStops:f.rightBg}),u.jsx(l.Line,{points:F,stroke:f.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),u.jsx(l.Line,{points:H,stroke:f.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),u.jsxs(l.Layer,{ref:z,visible:!1,listening:!1,children:[u.jsx(l.Line,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),u.jsx(l.Line,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),u.jsx(l.Circle,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),u.jsxs(l.Label,{x:0,y:0,id:"priceTextLabel",children:[u.jsx(l.Tag,{fill:f.tooltipBg,id:"priceTextLabel-tag"}),u.jsx(l.Text,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),u.jsxs(l.Label,{x:0,y:0,id:"slippageTextLabel",children:[u.jsx(l.Tag,{fill:f.tooltipBg,id:"slippageTextLabel-tag"}),u.jsx(l.Text,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),u.jsxs(l.Label,{x:0,y:0,id:"toolTip",children:[u.jsx(l.Tag,{fill:f.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),u.jsx(l.Text,{text:"-",fontSize:12,lineHeight:17/12,padding:s.labelPadding,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const g=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
|
-
`,h=r.div`
|
|
33
|
-
height: 100%;
|
|
34
|
-
`,b=r.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
`,M=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
|
-
`,f=r.span`
|
|
53
|
-
color: #85858d;
|
|
54
|
-
`,x=r.div`
|
|
55
|
-
margin-top: 20px;
|
|
56
|
-
display: flex;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
margin-bottom: 9px;
|
|
59
|
-
`,P=r(g)`
|
|
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 v({params:t,target:i,isBuy:o=!0}){const r=new e(t.b),n=new e(t.q);let l=new e(t.b0);const s=new e(t.q0),a=new e(t.i),u=new e(t.k),{R:c}=t;1===c&&l.eq(r)&&(l=d.solveQuadraticFunctionForTarget(r,n.minus(s),new e(1).div(a),u));const p=o?r.plus(i):r.minus(i);if(p.lt(l)||r.eq(l)){let t=l.multipliedBy(l).div(p).div(p);return t=new e(1).minus(u).plus(u.multipliedBy(t)),a.multipliedBy(t)}const m=new d.PMMModel;m.RStatus=c,m.B=r,m.B0=l,m.Q=n,m.Q0=s,m.i=a,m.k=u,m.mtFeeRate=new e(0),m.lpFeeRate=new e(0);let g=new e(0);g=o?m.querySellBase(i):m.queryBuyBase(i);const h=o?n.minus(g):n.plus(g);let b=s.multipliedBy(s).div(h).div(h);return b=new e(1).minus(u).plus(u.multipliedBy(b)),a.div(b)}exports.default=({chartId:r,width:n=834,height:l=460,baseTokenSymbol:d,quoteTokenSymbol:p,pmmModel:g,pmmParams:y,midPrice:L=new e(0),colorMap:q,notShowAmountInput:B})=>{(({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 o=document.getElementById(e),r=!!i&&{passive:!1};return null==o||o.addEventListener("wheel",t,r),()=>{null==o||o.removeEventListener("wheel",t)}},[e])})({id:r});const[z,j]=i.useState(""),[w,T]=i.useState(""),[k,C]=i.useState("-"),[S,A]=i.useState("-"),[X,N]=i.useState({baseMin:new e(0),zoomMultiples:s.baseZoomMultiples,targetMarginPriceX:0});i.useEffect(()=>{void 0!==L&&N(e=>({baseMin:s.computeBaseAfterZoom({midPrice:L,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX}))},[L]);const Z=i.useMemo(()=>t.debounce(({type:t,amount:i})=>{""===i&&L&&(N({baseMin:s.computeBaseAfterZoom({midPrice:L,zoomMultiples:s.baseZoomMultiples}),zoomMultiples:s.baseZoomMultiples,targetMarginPriceX:0}),"buy"===t?C("-"):A("-"));const o=new e(i);if(!o.lte(0)&&!o.isNaN()&&(null==y?void 0:y.b)&&!o.gte(y.b)&&L)if("buy"===t){const e=v({params:y,target:o});N(i=>{const o=s.beforePriceImpactEffect({currentBaseMinAndZoomMultiples:i,targetPrice:e,midPrice:L,width:n});if(o.isSkip)return{baseMin:i.baseMin,zoomMultiples:i.zoomMultiples,targetMarginPriceX:o.targetX};if(o.targetX>0)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:o.targetX};const r=s.computeTargetXByTargetPrice({midPrice:L,width:n,type:t,targetPrice:e}),l=r.zoomMultiples.dp(6).toNumber();return{baseMin:s.computeBaseAfterZoom({midPrice:L,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:r.targetX}}),C(`${a.formatPercentageNumber({input:e.minus(L).div(L)})}`)}else{const e=function({params:e,target:t}){return v({params:e,target:t,isBuy:!1})}({params:y,target:o});N(i=>{const o=s.beforePriceImpactEffect({currentBaseMinAndZoomMultiples:i,targetPrice:e,midPrice:L,width:n});if(o.isSkip)return{baseMin:i.baseMin,zoomMultiples:i.zoomMultiples,targetMarginPriceX:o.targetX};if(o.targetX>0)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:o.targetX};const r=s.computeTargetXByTargetPrice({midPrice:L,width:n,type:t,targetPrice:e}),l=r.zoomMultiples.dp(6).toNumber();return{baseMin:s.computeBaseAfterZoom({midPrice:L,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:r.targetX}}),A(`+${a.formatPercentageNumber({input:e.minus(L).div(L)})}`)}},300),[y,L,n]);i.useEffect(()=>{void 0!==z&&Z({type:"buy",amount:z})},[Z,z]),i.useEffect(()=>{void 0!==w&&Z({type:"sell",amount:w})},[Z,w]);const W=e=>{let t=0;t=e?-.1*n:.1*n,N(e=>void 0===e.baseMin?e:{baseMin:s.computeBaseMinByDistance({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:n,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX})},F=e=>{N(t=>{const i=s.computeZoomMultiplesWhenZoom({zoomIn:null!=e&&e,prevZoomMultiples:t.zoomMultiples});return{baseMin:s.computeBaseAfterZoom({midPrice:L,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}})},E=i.useMemo(()=>{if(""===z)return!1;const t=new e(z);return!(!t.lte(0)&&!t.isNaN()&&(null==y?void 0:y.b)&&!t.gte(y.b))},[z,y]),G=i.useMemo(()=>{if(""===w)return!1;const t=new e(w);return!(!t.lte(0)&&!t.isNaN()&&(null==y?void 0:y.b)&&!t.gte(y.b))},[w,y]);return u.jsxs(h,{id:r,children:[B?"":u.jsxs(b,{children:[u.jsxs(M,{borderColor:q&&q.grid,children:[s.chartT("pool.chart.buy-amount",{symbol:d}),u.jsx(c,{value:z,error:E,onChange:e=>{const t=a.fixedInputStringToFormattedNumber(e.target.value,2);null!==t&&j(t)}}),u.jsx(f,{children:s.chartT("pool.chart.price-impact",{amount:k})})]}),u.jsxs(M,{borderColor:q&&q.grid,children:[s.chartT("pool.chart.sell-amount",{symbol:d}),u.jsx(c,{value:w,error:G,onChange:e=>{const t=a.fixedInputStringToFormattedNumber(e.target.value,2);null!==t&&T(t)}}),u.jsx(f,{children:s.chartT("pool.chart.price-impact",{amount:S})})]})]}),void 0!==y&&void 0!==L&&void 0!==g&&void 0!==X.baseMin&&void 0!==L&&u.jsx(m,{width:n,height:l,params:y,midPrice:L,pmmModel:g,baseTokenSymbol:d,quoteTokenSymbol:p,baseMinAndZoomMultiples:X,colorMap:q,setBaseMinAndZoomMultiples:N}),u.jsxs(x,{className:"operate-btn-wrapper",children:[u.jsx(P,{onClick:()=>W(!0),children:u.jsx(o.BiChevronLeft,{})}),u.jsx(P,{onClick:()=>F(!1),children:u.jsx(o.BiMinus,{})}),u.jsx(P,{onClick:()=>F(!0),children:u.jsx(o.BiPlus,{})}),u.jsx(P,{onClick:()=>W(!1),children:u.jsx(o.BiChevronRight,{})})]})]})};
|
|
79
|
-
//# sourceMappingURL=index-DyKuKZOu.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DyKuKZOu.cjs","sources":["../src/components/chart/components/Input.tsx","../src/components/chart/depth-chart/DepthChartKonva.tsx","../src/components/chart/depth-chart/useGridLinePoints.ts","../src/components/chart/depth-chart/useHorizontalLabelPoints.ts","../src/components/chart/depth-chart/useDepthLinePoints.ts","../src/components/chart/components/BaseButton.tsx","../src/components/chart/depth-chart/index.styled.tsx","../src/components/chart/depth-chart/utils.ts","../src/components/chart/depth-chart/index.tsx","../src/components/chart/hooks/usePreventWheel.ts"],"sourcesContent":["import styled from '@emotion/styled';\r\nimport { css } from '@emotion/react';\r\n\r\nexport const Input = styled.input<{ error?: boolean }>`\r\n margin: 4px 10px 4px 6px;\r\n border-radius: 10px;\r\n border: 1px solid #373739;\r\n padding: 4px 9px;\r\n background-color: #1a1a1b;\r\n color: #ffffff;\r\n font-size: 14px;\r\n font-weight: 400;\r\n line-height: 20px;\r\n outline: none;\r\n width: 96px;\r\n &:focus {\r\n border-color: #fff;\r\n\r\n ${({ error }) =>\r\n error &&\r\n css`\r\n border-color: red;\r\n `}\r\n }\r\n`;\r\n","import { PMMModel, PmmModelParams } from '@dodoex/api';\r\nimport BigNumber from 'bignumber.js';\r\nimport Konva from 'konva';\r\nimport { KonvaEventObject } from 'konva/lib/Node';\r\nimport { merge, throttle } from 'lodash';\r\nimport { useEffect, useMemo, useRef } from 'react';\r\nimport {\r\n Circle,\r\n Label,\r\n Layer,\r\n Line,\r\n Rect,\r\n Stage,\r\n Tag,\r\n Text,\r\n} from 'react-konva';\r\nimport { chartT as t } from '../i18n';\r\nimport { chartOffsetYBCToolTip, labelPadding } from '../utils';\r\nimport {\r\n BaseMinAndZoomMultiples,\r\n computeBaseAfterZoom,\r\n computeBaseMinByDistance,\r\n computeBaseVert,\r\n computeZoomMultiplesWhenZoom,\r\n updateTooltip,\r\n} from './helper';\r\nimport { useDepthLinePoints } from './useDepthLinePoints';\r\nimport { useGridLinePoints } from './useGridLinePoints';\r\nimport { useHorizontalLabelPoints } from './useHorizontalLabelPoints';\r\n\r\nexport const bgColor = 'rgba(38, 39, 41, 0.3)';\r\n\r\n// toolTip the height of the arrow\r\nconst toolTipPointerHeight = 8;\r\nconst toolTipPointerWidth = 15;\r\nconst xAxisHight = 18;\r\nconst xPoints = 50;\r\n/** The number of horizontal axis scales or the number of vertical grid lines */\r\nconst xAxisPoints = 7;\r\n// Number of horizontal grid lines\r\nconst horizontalLineCount = 9;\r\n// padding of toolTip\r\nexport interface ColorMap {\r\n grid?: string;\r\n midPriceLine?: string;\r\n leftBg?: (string | number)[];\r\n leftLine?: string;\r\n leftColor?: string;\r\n rightBg?: (string | number)[];\r\n rightLine?: string;\r\n rightColor?: string;\r\n tooltipBg?: string;\r\n tooltipColor?: string;\r\n}\r\n\r\nexport type Props = {\r\n width: number;\r\n height: number;\r\n params: PmmModelParams;\r\n midPrice: BigNumber;\r\n pmmModel: PMMModel;\r\n baseTokenSymbol: string;\r\n quoteTokenSymbol: string;\r\n baseMinAndZoomMultiples: BaseMinAndZoomMultiples;\r\n colorMap?: ColorMap;\r\n setBaseMinAndZoomMultiples: React.Dispatch<\r\n React.SetStateAction<BaseMinAndZoomMultiples>\r\n >;\r\n};\r\n\r\nexport function DepthChartKonva({\r\n width,\r\n height,\r\n midPrice,\r\n pmmModel,\r\n params,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n baseMinAndZoomMultiples,\r\n colorMap,\r\n setBaseMinAndZoomMultiples,\r\n}: Props) {\r\n const colorMapRes = merge(\r\n {\r\n grid: '#2A2A2D',\r\n midPriceLine: '#313335',\r\n leftBg: [0, bgColor, 1, '#31645d'],\r\n leftLine: '#55f6db',\r\n leftColor: '',\r\n rightBg: [0, bgColor, 1, '#67303d'],\r\n rightLine: '#ff4f73',\r\n rightColor: '',\r\n tooltipBg: '#121212',\r\n tooltipColor: undefined,\r\n },\r\n colorMap,\r\n );\r\n\r\n const chartWidth = width;\r\n const chartHeight = height - xAxisHight;\r\n const oneXPx = chartWidth / xAxisPoints;\r\n\r\n const { buyBaseVert, sellBaseVert } = computeBaseVert({\r\n midPrice,\r\n q: params.q,\r\n q0: params.q0,\r\n pmmModel,\r\n });\r\n const buyYPortion = buyBaseVert.div(chartHeight);\r\n const sellYPortion = sellBaseVert.div(chartHeight);\r\n\r\n const tooltipRef = useRef<Konva.Layer>(null);\r\n const stageRef = useRef<Konva.Stage>(null);\r\n const { current: tooltip } = tooltipRef;\r\n const dragStartXRef = useRef<number>(0);\r\n const pointerXRef = useRef<number>();\r\n\r\n const { horizontalGridLines, verticalGridLines } = useGridLinePoints({\r\n chartHeight,\r\n chartWidth,\r\n horizontalLineCount,\r\n verticalLineCount: xAxisPoints,\r\n });\r\n const { horizontalLabelTickPoints, horizontalLabelTextPoints } =\r\n useHorizontalLabelPoints({\r\n chartHeight,\r\n chartWidth,\r\n xAxisPoints,\r\n oneXPx,\r\n baseMinAndZoomMultiples,\r\n });\r\n const {\r\n quoteLinePoints,\r\n quoteLineAreaPoints,\r\n quoteLineAreaLinearGradientEndPointY,\r\n baseLinePoints,\r\n baseLineAreaPoints,\r\n baseLineAreaLinearGradientEndPointY,\r\n midPriceLinePoints,\r\n } = useDepthLinePoints({\r\n chartHeight,\r\n chartWidth,\r\n midPrice,\r\n xPoints,\r\n pmmModel,\r\n baseMinAndZoomMultiples,\r\n buyYPortion,\r\n sellYPortion,\r\n });\r\n\r\n const handleMouseover = (evt: KonvaEventObject<MouseEvent>) => {\r\n const node = evt.target;\r\n if (node && tooltip) {\r\n // update tooltip\r\n const mousePos = node.getStage()?.getPointerPosition();\r\n if (mousePos) {\r\n const { x } = mousePos;\r\n if (x > chartWidth) {\r\n tooltip.hide();\r\n return;\r\n }\r\n updateTooltip({\r\n x,\r\n tooltip,\r\n buyBaseVert,\r\n sellBaseVert,\r\n chartWidth,\r\n chartHeight,\r\n midPrice,\r\n pmmModel,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n baseMinAndZoomMultiples,\r\n t,\r\n isHover: true,\r\n color: colorMapRes.tooltipColor,\r\n leftColor: colorMapRes.leftLine,\r\n rightColor: colorMapRes.rightLine,\r\n });\r\n }\r\n }\r\n };\r\n const handleMouseOut = () => {\r\n if (tooltip) {\r\n tooltip.hide();\r\n }\r\n };\r\n\r\n const updateWhenDrag = useMemo(\r\n () =>\r\n throttle((evt: KonvaEventObject<DragEvent>) => {\r\n const { target } = evt;\r\n const stage = target.getStage();\r\n if (stage) {\r\n stage.container().style.cursor = 'grabbing';\r\n const mousePos = stage?.getPointerPosition();\r\n if (mousePos) {\r\n const dragDistance = mousePos.x - dragStartXRef.current;\r\n dragStartXRef.current = mousePos.x;\r\n pointerXRef.current = mousePos.x;\r\n setBaseMinAndZoomMultiples((prev) => {\r\n if (prev.baseMin === undefined) {\r\n return prev;\r\n }\r\n return {\r\n baseMin: computeBaseMinByDistance({\r\n dragDistance,\r\n prevBaseMin: prev.baseMin,\r\n chartWidth,\r\n zoomMultiples: prev.zoomMultiples,\r\n }),\r\n zoomMultiples: prev.zoomMultiples,\r\n targetMarginPriceX: 0,\r\n };\r\n });\r\n }\r\n }\r\n }, 100),\r\n [chartWidth, setBaseMinAndZoomMultiples],\r\n );\r\n\r\n const updateWhenWheel = useMemo(\r\n () =>\r\n throttle((event: KonvaEventObject<WheelEvent>) => {\r\n // eslint-disable-next-line no-param-reassign\r\n event.cancelBubble = true;\r\n event.evt.preventDefault();\r\n // scroll up\r\n const isScrollUp = event.evt.deltaY < 0;\r\n\r\n setBaseMinAndZoomMultiples((prev) => {\r\n const newZoomMultiples = computeZoomMultiplesWhenZoom({\r\n zoomIn: isScrollUp,\r\n prevZoomMultiples: prev.zoomMultiples,\r\n });\r\n return {\r\n baseMin: computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples: newZoomMultiples,\r\n }),\r\n zoomMultiples: newZoomMultiples,\r\n targetMarginPriceX: prev.targetMarginPriceX,\r\n };\r\n });\r\n }, 100),\r\n [midPrice, setBaseMinAndZoomMultiples],\r\n );\r\n\r\n useEffect(() => {\r\n if (baseMinAndZoomMultiples.targetMarginPriceX > 0 && tooltip !== null) {\r\n updateTooltip({\r\n x: baseMinAndZoomMultiples.targetMarginPriceX,\r\n tooltip,\r\n buyBaseVert,\r\n sellBaseVert,\r\n chartWidth,\r\n chartHeight,\r\n midPrice,\r\n pmmModel,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n baseMinAndZoomMultiples,\r\n t,\r\n color: colorMapRes.tooltipColor,\r\n leftColor: colorMapRes.leftLine,\r\n rightColor: colorMapRes.rightLine,\r\n });\r\n return;\r\n }\r\n if (pointerXRef.current !== undefined && tooltip !== null) {\r\n updateTooltip({\r\n x: pointerXRef.current,\r\n tooltip,\r\n buyBaseVert,\r\n sellBaseVert,\r\n chartWidth,\r\n chartHeight,\r\n midPrice,\r\n pmmModel,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n baseMinAndZoomMultiples,\r\n t,\r\n isHover: true,\r\n color: colorMapRes.tooltipColor,\r\n leftColor: colorMapRes.leftLine,\r\n rightColor: colorMapRes.rightLine,\r\n });\r\n }\r\n }, [\r\n baseMinAndZoomMultiples,\r\n baseTokenSymbol,\r\n buyBaseVert,\r\n chartHeight,\r\n chartWidth,\r\n colorMapRes.leftLine,\r\n colorMapRes.rightLine,\r\n colorMapRes.tooltipColor,\r\n midPrice,\r\n pmmModel,\r\n quoteTokenSymbol,\r\n sellBaseVert,\r\n tooltip,\r\n ]);\r\n\r\n return (\r\n <Stage\r\n ref={stageRef}\r\n width={width}\r\n offsetY={-chartOffsetYBCToolTip}\r\n height={height + chartOffsetYBCToolTip}\r\n draggable\r\n dragBoundFunc={function () {\r\n return {\r\n x: this.absolutePosition().x,\r\n y: this.absolutePosition().y,\r\n };\r\n }}\r\n onMouseMove={handleMouseover}\r\n onMouseOver={handleMouseover}\r\n onMouseOut={handleMouseOut}\r\n onDragStart={function (evt) {\r\n const { target } = evt;\r\n const stage = target.getStage();\r\n if (stage) {\r\n const mousePos = stage.getPointerPosition();\r\n if (mousePos) {\r\n dragStartXRef.current = mousePos.x;\r\n }\r\n }\r\n }}\r\n onDragMove={updateWhenDrag}\r\n onDragEnd={(evt) => {\r\n const { target } = evt;\r\n const stage = target.getStage();\r\n if (stage) {\r\n stage.container().style.cursor = 'pointer';\r\n }\r\n }}\r\n onWheel={updateWhenWheel}\r\n >\r\n <Layer>\r\n {/* border */}\r\n <Rect\r\n x={0}\r\n y={0}\r\n width={width}\r\n height={chartHeight}\r\n stroke={colorMapRes.grid}\r\n strokeWidth={1}\r\n />\r\n\r\n {/* grid lines */}\r\n {horizontalGridLines.map((points, index) => (\r\n <Line\r\n key={index}\r\n points={points}\r\n stroke={colorMapRes.grid}\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n ))}\r\n {verticalGridLines.map((points, index) => (\r\n <Line\r\n key={index}\r\n points={points}\r\n stroke={colorMapRes.grid}\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n ))}\r\n\r\n {/* abscissa tick mark */}\r\n {horizontalLabelTickPoints.map((tickPoints, index) => (\r\n <Line\r\n key={index}\r\n points={tickPoints}\r\n stroke=\"#9d9d9d\"\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n ))}\r\n {horizontalLabelTextPoints.map((textPoint, index) => (\r\n <Text\r\n key={index}\r\n x={textPoint.x}\r\n y={textPoint.y}\r\n text={textPoint.text}\r\n fontFamily=\"Manrope\"\r\n fontSize={12}\r\n fill=\"#9d9d9d\"\r\n width={oneXPx}\r\n padding={0}\r\n align=\"center\"\r\n verticalAlign=\"bottom\"\r\n listening={false}\r\n />\r\n ))}\r\n\r\n {/* Depth map lines */}\r\n <Line\r\n points={quoteLineAreaPoints}\r\n closed\r\n listening={false}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n fillLinearGradientStartPoint={{ x: 0, y: chartHeight }}\r\n fillLinearGradientEndPoint={{\r\n x: 0,\r\n y: quoteLineAreaLinearGradientEndPointY,\r\n }}\r\n fillLinearGradientColorStops={colorMapRes.leftBg}\r\n />\r\n <Line\r\n points={quoteLinePoints}\r\n stroke={colorMapRes.leftLine}\r\n strokeWidth={2}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n <Line\r\n points={baseLineAreaPoints}\r\n closed\r\n listening={false}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n fillLinearGradientStartPoint={{ x: chartWidth, y: chartHeight }}\r\n fillLinearGradientEndPoint={{\r\n x: chartWidth,\r\n y: baseLineAreaLinearGradientEndPointY,\r\n }}\r\n fillLinearGradientColorStops={colorMapRes.rightBg}\r\n />\r\n <Line\r\n points={baseLinePoints}\r\n stroke={colorMapRes.rightLine}\r\n strokeWidth={2}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n <Line\r\n points={midPriceLinePoints}\r\n stroke={colorMapRes.midPriceLine}\r\n strokeWidth={2}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n </Layer>\r\n\r\n <Layer ref={tooltipRef} visible={false} listening={false}>\r\n <Line\r\n points={[]}\r\n stroke=\"#ff4f73\"\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n dash={[4, 6]}\r\n id=\"toolTipVertLine\"\r\n />\r\n <Line\r\n points={[]}\r\n stroke=\"ff4f73\"\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n dash={[4, 6]}\r\n id=\"toolTipHoriLine\"\r\n />\r\n <Circle\r\n x={0}\r\n y={0}\r\n radius={5}\r\n fill=\"#FF5072\"\r\n stroke=\"rgba(255, 80, 114, 0.3)\"\r\n strokeWidth={12}\r\n id=\"joinCircle\"\r\n />\r\n <Label x={0} y={0} id=\"priceTextLabel\">\r\n <Tag fill={colorMapRes.tooltipBg} id=\"priceTextLabel-tag\" />\r\n <Text\r\n text=\"\"\r\n fontSize={12}\r\n fontFamily=\"Manrope\"\r\n padding={4}\r\n fill=\"#FF5072\"\r\n id=\"priceTextLabel-text\"\r\n />\r\n </Label>\r\n <Label x={0} y={0} id=\"slippageTextLabel\">\r\n <Tag fill={colorMapRes.tooltipBg} id=\"slippageTextLabel-tag\" />\r\n <Text\r\n text=\"\"\r\n fontSize={12}\r\n fontFamily=\"Manrope\"\r\n padding={4}\r\n fill=\"#FF5072\"\r\n id=\"slippageTextLabel-text\"\r\n />\r\n </Label>\r\n <Label x={0} y={0} id=\"toolTip\">\r\n <Tag\r\n fill={colorMapRes.tooltipBg}\r\n pointerDirection=\"down\"\r\n pointerWidth={toolTipPointerWidth}\r\n pointerHeight={toolTipPointerHeight}\r\n cornerRadius={toolTipPointerHeight}\r\n lineJoin=\"round\"\r\n id=\"toolTip-tag\"\r\n />\r\n <Text\r\n text=\"-\"\r\n fontSize={12}\r\n lineHeight={17 / 12}\r\n padding={labelPadding}\r\n fontFamily=\"Manrope\"\r\n fill=\"#FFFFFF\"\r\n id=\"toolTip-text\"\r\n />\r\n </Label>\r\n </Layer>\r\n </Stage>\r\n );\r\n}\r\n","import { useMemo } from 'react';\r\n\r\nexport function useGridLinePoints({\r\n chartHeight,\r\n chartWidth,\r\n horizontalLineCount,\r\n verticalLineCount,\r\n}: {\r\n chartHeight: number;\r\n chartWidth: number;\r\n horizontalLineCount: number;\r\n verticalLineCount: number;\r\n}) {\r\n return useMemo(() => {\r\n const horizontalGridLines: Array<Array<number>> = [];\r\n const horizontalGridPerBlockHeight =\r\n chartHeight / (horizontalLineCount + 1);\r\n const verticalGridLines: Array<Array<number>> = [];\r\n const verticalGridPerBlockWidth = chartWidth / verticalLineCount;\r\n for (let index = 0; index < horizontalLineCount; index++) {\r\n const y = horizontalGridPerBlockHeight * (index + 1);\r\n horizontalGridLines.push([0, y, chartWidth, y]);\r\n }\r\n for (let index = 0; index < verticalLineCount; index++) {\r\n const x =\r\n verticalGridPerBlockWidth * index + verticalGridPerBlockWidth / 2;\r\n verticalGridLines.push([x, 0, x, chartHeight]);\r\n }\r\n return {\r\n horizontalGridLines,\r\n verticalGridLines,\r\n };\r\n }, [chartHeight, chartWidth, horizontalLineCount, verticalLineCount]);\r\n}\r\n","import { useMemo } from 'react';\r\nimport { formatShortNumber } from '../../../utils/formatter';\r\nimport { BaseMinAndZoomMultiples, computeXPortion } from './helper';\r\n\r\nexport function useHorizontalLabelPoints({\r\n chartHeight,\r\n chartWidth,\r\n xAxisPoints,\r\n oneXPx,\r\n baseMinAndZoomMultiples,\r\n}: {\r\n chartHeight: number;\r\n chartWidth: number;\r\n xAxisPoints: number;\r\n oneXPx: number;\r\n baseMinAndZoomMultiples: BaseMinAndZoomMultiples;\r\n}) {\r\n return useMemo(() => {\r\n const xPortion = computeXPortion(\r\n chartWidth,\r\n baseMinAndZoomMultiples.zoomMultiples,\r\n );\r\n const horizontalLabelTickPoints: Array<Array<number>> = [];\r\n const horizontalLabelTextPoints: Array<{\r\n x: number;\r\n y: number;\r\n text: string;\r\n }> = [];\r\n for (let i = 0; i < xAxisPoints; i++) {\r\n horizontalLabelTickPoints.push([\r\n i * oneXPx + oneXPx / 2,\r\n chartHeight,\r\n i * oneXPx + oneXPx / 2,\r\n chartHeight + 4,\r\n ]);\r\n\r\n const power = xPortion\r\n .multipliedBy(i)\r\n .multipliedBy(oneXPx)\r\n .plus(xPortion.multipliedBy(oneXPx / 2))\r\n .toNumber();\r\n const axisNum = baseMinAndZoomMultiples.baseMin.multipliedBy(10 ** power);\r\n\r\n const x = i * oneXPx;\r\n const y = chartHeight + 2 + 4;\r\n const text = formatShortNumber(axisNum);\r\n horizontalLabelTextPoints.push({\r\n x,\r\n y,\r\n text,\r\n });\r\n }\r\n\r\n return {\r\n horizontalLabelTickPoints,\r\n horizontalLabelTextPoints,\r\n };\r\n }, [\r\n baseMinAndZoomMultiples.baseMin,\r\n baseMinAndZoomMultiples.zoomMultiples,\r\n chartHeight,\r\n chartWidth,\r\n oneXPx,\r\n xAxisPoints,\r\n ]);\r\n}\r\n","import { PMMModel } from '@dodoex/api';\r\nimport BigNumber from 'bignumber.js';\r\nimport { useMemo } from 'react';\r\nimport { BaseMinAndZoomMultiples, computeXPortion, evalPoint } from './helper';\r\n\r\nexport function useDepthLinePoints({\r\n chartHeight,\r\n chartWidth,\r\n midPrice,\r\n xPoints,\r\n pmmModel,\r\n baseMinAndZoomMultiples,\r\n buyYPortion,\r\n sellYPortion,\r\n}: {\r\n chartHeight: number;\r\n chartWidth: number;\r\n xPoints: number;\r\n midPrice: BigNumber;\r\n baseMinAndZoomMultiples: BaseMinAndZoomMultiples;\r\n buyYPortion: BigNumber;\r\n sellYPortion: BigNumber;\r\n pmmModel: PMMModel;\r\n}) {\r\n return useMemo(() => {\r\n const quoteLinePoints: Array<number> = [];\r\n const baseLinePoints: Array<number> = [];\r\n const midPriceLinePoints: Array<number> = [];\r\n\r\n const { baseMin, zoomMultiples } = baseMinAndZoomMultiples;\r\n\r\n const xPortion = computeXPortion(chartWidth, zoomMultiples);\r\n\r\n // 1 -> 10 -> 100 index increases from 0 to 2\r\n // If the minimum value on the left is not midPrice/10, the existing calculation method is to calculate the maximum value based on the minimum value and multiply by 10^2\r\n const multiplesNum = zoomMultiples * 2;\r\n const step = new BigNumber(multiplesNum).div(xPoints);\r\n // The position of the middle price\r\n let midPriceN = new BigNumber(\r\n Math.log(midPrice.div(baseMin).toNumber()) / Math.log(10),\r\n );\r\n midPriceN = BigNumber.minimum(multiplesNum, midPriceN);\r\n midPriceN = BigNumber.maximum(0, midPriceN);\r\n for (let i = new BigNumber(0); i.lte(midPriceN); ) {\r\n const price = baseMin.multipliedBy(10 ** i.toNumber());\r\n const result = evalPoint({ val: price, model: pmmModel, midPrice });\r\n if (!result.vert.isNaN()) {\r\n const x = i.div(xPortion).toNumber();\r\n const y = chartHeight - result.vert.div(buyYPortion).toNumber();\r\n\r\n quoteLinePoints.push(x, y);\r\n }\r\n i = i.plus(step);\r\n }\r\n\r\n for (let i = midPriceN; i.lte(multiplesNum); ) {\r\n const price = baseMin.multipliedBy(10 ** i.toNumber());\r\n const result = evalPoint({ val: price, model: pmmModel, midPrice });\r\n if (!result.vert.isNaN()) {\r\n const x = i.div(xPortion).toNumber();\r\n const y = chartHeight - result.vert.div(sellYPortion).toNumber();\r\n\r\n baseLinePoints.push(x, y);\r\n }\r\n i = i.plus(step);\r\n }\r\n\r\n const midPriceX = midPriceN.div(xPortion).toNumber();\r\n\r\n const [, firstY] = quoteLinePoints;\r\n // k === 0 means selling coins at a constant price. The curve is two horizontal lines and requires special processing.\r\n const isZeroK = pmmModel.k.eq(0);\r\n if (isZeroK) {\r\n quoteLinePoints.push(midPriceX, firstY || chartHeight);\r\n }\r\n quoteLinePoints.push(midPriceX, chartHeight);\r\n\r\n midPriceLinePoints.push(midPriceX, chartHeight, midPriceX, 0);\r\n\r\n const maxResult = evalPoint({\r\n val: baseMin.multipliedBy(10 ** multiplesNum),\r\n model: pmmModel,\r\n midPrice,\r\n });\r\n let maxHeightY = chartHeight;\r\n const maxHeightX = new BigNumber(multiplesNum).div(xPortion).toNumber();\r\n if (!maxResult.vert.isNaN()) {\r\n maxHeightY = chartHeight - maxResult.vert.div(sellYPortion).toNumber();\r\n }\r\n if (isZeroK && baseLinePoints.length >= 2) {\r\n baseLinePoints.unshift(midPriceX, maxHeightY);\r\n baseLinePoints.unshift(midPriceX, chartHeight);\r\n }\r\n\r\n baseLinePoints.push(maxHeightX, maxHeightY);\r\n // The left side has been dragged to the left side of baseMin\r\n if (midPriceN.lte(0)) {\r\n baseLinePoints.unshift(0, chartHeight);\r\n }\r\n\r\n return {\r\n quoteLinePoints,\r\n quoteLineAreaPoints: [0, chartHeight, 0, firstY, ...quoteLinePoints],\r\n quoteLineAreaLinearGradientEndPointY: firstY,\r\n baseLinePoints,\r\n baseLineAreaPoints: [...baseLinePoints, maxHeightX, chartHeight],\r\n baseLineAreaLinearGradientEndPointY: maxHeightY,\r\n midPriceLinePoints,\r\n };\r\n }, [\r\n baseMinAndZoomMultiples,\r\n chartWidth,\r\n xPoints,\r\n midPrice,\r\n pmmModel,\r\n chartHeight,\r\n buyYPortion,\r\n sellYPortion,\r\n ]);\r\n}\r\n","import styled from '@emotion/styled';\r\n\r\nexport const BaseButton = styled.button`\r\n margin: 0;\r\n border: none;\r\n padding: 0;\r\n background: none;\r\n\r\n &:focus {\r\n outline: none;\r\n }\r\n &:active {\r\n outline: none;\r\n }\r\n`;\r\n","import styled from '@emotion/styled';\nimport { BaseButton } from '../components/BaseButton';\n\nexport const Container = styled.div`\n height: 100%;\n`;\n\nexport const AmountInputContainer = styled.div`\n display: flex;\n align-items: center;\n`;\n\nexport const InputSectionWrapper = styled.div<{ borderColor?: string }>`\n border: 1px solid ${({ borderColor }) => borderColor || '#2a2a2d'};\n flex: 1 0 50%;\n\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: 400;\n line-height: 17px;\n color: #606066;\n\n & + & {\n border-left: none;\n }\n`;\n\nexport const PriceImpactWrapper = styled.span`\n color: #85858d;\n`;\n\nexport const OptButtonGroup = styled.div`\n margin-top: 20px;\n display: flex;\n justify-content: center;\n margin-bottom: 9px;\n`;\n\nexport const OptButton = styled(BaseButton)`\n border-radius: 13px;\n background-color: #373739;\n width: 24px;\n height: 24px;\n font-size: 18px;\n color: #85858d;\n line-height: 0;\n & + & {\n margin-left: 10px;\n }\n &:first-child,\n &:last-child {\n font-size: 20px;\n }\n\n &:hover {\n color: #fff;\n }\n`;\n","import {\r\n PMMModel,\r\n PmmModelParams,\r\n solveQuadraticFunctionForTarget,\r\n} from '@dodoex/api';\r\nimport BigNumber from 'bignumber.js';\r\n\r\n/**\r\n * Calculate marginPrice for buying or selling target baseToken\r\n * @param param0\r\n * @returns\r\n */\r\nexport function computeMarginPrice({\r\n params,\r\n target,\r\n isBuy = true,\r\n}: {\r\n params: PmmModelParams;\r\n target: BigNumber;\r\n isBuy?: boolean;\r\n}) {\r\n const b = new BigNumber(params.b);\r\n const q = new BigNumber(params.q);\r\n let b0 = new BigNumber(params.b0);\r\n const q0 = new BigNumber(params.q0);\r\n const i = new BigNumber(params.i);\r\n const k = new BigNumber(params.k);\r\n const { R } = params;\r\n\r\n // When created, b0 is equal to b, and a b0 needs to be calculated.\r\n if (R === 1 && b0.eq(b)) {\r\n b0 = solveQuadraticFunctionForTarget(\r\n b,\r\n q.minus(q0),\r\n new BigNumber(1).div(i),\r\n k,\r\n );\r\n }\r\n\r\n const newB = isBuy ? b.plus(target) : b.minus(target);\r\n\r\n if (newB.lt(b0) || b.eq(b0)) {\r\n // b < b0: The shortage of baseToken corresponds to the user buying baseToken. At this time, the quoteToken in the pool is higher than the regression target; the price curve is directly used to calculate the marginal price.\r\n let r = b0.multipliedBy(b0).div(newB).div(newB);\r\n r = new BigNumber(1).minus(k).plus(k.multipliedBy(r));\r\n return i.multipliedBy(r);\r\n }\r\n\r\n // There is a shortage of quoteToken, which corresponds to the user selling baseToken, causing the number of quoteTokens in the pool to be lower than the return target at this time; the parameter target is the number of baseTokens sold by the user, and it is necessary to calculate the number of quoteTokens obtained after selling based on this value, that is, the user How many quoteTokens are obtained; then put this value into the price curve equation to calculate the marginal price.\r\n const pmm = new PMMModel();\r\n pmm.RStatus = R;\r\n pmm.B = b;\r\n pmm.B0 = b0;\r\n pmm.Q = q;\r\n pmm.Q0 = q0;\r\n pmm.i = i;\r\n pmm.k = k;\r\n pmm.mtFeeRate = new BigNumber(0);\r\n pmm.lpFeeRate = new BigNumber(0);\r\n\r\n let getAmount: BigNumber = new BigNumber(0);\r\n if (isBuy) {\r\n getAmount = pmm.querySellBase(target);\r\n } else {\r\n getAmount = pmm.queryBuyBase(target);\r\n }\r\n\r\n const deltaQ = isBuy ? q.minus(getAmount) : q.plus(getAmount);\r\n let r = q0.multipliedBy(q0).div(deltaQ).div(deltaQ);\r\n r = new BigNumber(1).minus(k).plus(k.multipliedBy(r));\r\n return i.div(r);\r\n}\r\n\r\n/**\r\n * Calculate the margin price for selling target baseTokens\r\n */\r\nexport function computeSellMarginPrice({\r\n params,\r\n target,\r\n}: {\r\n params: PmmModelParams;\r\n target: BigNumber;\r\n}) {\r\n return computeMarginPrice({\r\n params,\r\n target,\r\n isBuy: false,\r\n });\r\n}\r\n","import BigNumber from 'bignumber.js';\r\nimport { debounce } from 'lodash';\r\nimport { useEffect, useMemo, useState } from 'react';\r\nimport { BiChevronLeft, BiChevronRight, BiMinus, BiPlus } from 'react-icons/bi';\r\nimport { Input } from '../components/Input';\r\nimport { usePreventWheel } from '../hooks/usePreventWheel';\r\nimport { ColorMap, DepthChartKonva } from './DepthChartKonva';\r\nimport { chartT as t } from '../i18n';\r\nimport {\r\n BaseMinAndZoomMultiples,\r\n baseZoomMultiples,\r\n beforePriceImpactEffect,\r\n computeBaseAfterZoom,\r\n computeBaseMinByDistance,\r\n computeTargetXByTargetPrice,\r\n computeZoomMultiplesWhenZoom,\r\n} from './helper';\r\nimport {\r\n AmountInputContainer,\r\n Container,\r\n InputSectionWrapper,\r\n OptButton,\r\n OptButtonGroup,\r\n PriceImpactWrapper,\r\n} from './index.styled';\r\nimport { computeMarginPrice, computeSellMarginPrice } from './utils';\r\nimport { PMMModel, PmmModelParams } from '@dodoex/api';\r\nimport {\r\n fixedInputStringToFormattedNumber,\r\n formatPercentageNumber,\r\n} from '../../../utils/formatter';\r\n\r\ntype Props = {\r\n chartId: string;\r\n width?: number;\r\n baseTokenSymbol: string;\r\n quoteTokenSymbol: string;\r\n pmmModel?: PMMModel;\r\n pmmParams?: PmmModelParams;\r\n midPrice?: BigNumber;\r\n height?: number;\r\n notShowAmountInput?: boolean;\r\n colorMap?: ColorMap;\r\n};\r\n\r\nconst DepthChart: React.FC<Props> = ({\r\n chartId,\r\n width = 834,\r\n height = 460,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n pmmModel,\r\n pmmParams,\r\n midPrice = new BigNumber(0),\r\n colorMap,\r\n notShowAmountInput,\r\n}: Props) => {\r\n usePreventWheel({ id: chartId });\r\n\r\n const [buyAmount, setBuyAmount] = useState<string>('');\r\n const [sellAmount, setSellAmount] = useState<string>('');\r\n const [buyImpact, setBuyImpact] = useState('-');\r\n const [sellImpact, setSellImpact] = useState('-');\r\n\r\n // 横轴起点和缩放比例同时变化,变化也会引起价格冲击点变化\r\n const [baseMinAndZoomMultiples, setBaseMinAndZoomMultiples] =\r\n useState<BaseMinAndZoomMultiples>({\r\n baseMin: new BigNumber(0),\r\n zoomMultiples: baseZoomMultiples,\r\n targetMarginPriceX: 0,\r\n });\r\n\r\n useEffect(() => {\r\n if (midPrice !== undefined) {\r\n setBaseMinAndZoomMultiples((prev) => {\r\n return {\r\n baseMin: computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples: prev.zoomMultiples,\r\n }),\r\n zoomMultiples: prev.zoomMultiples,\r\n targetMarginPriceX: prev.targetMarginPriceX,\r\n };\r\n });\r\n }\r\n }, [midPrice]);\r\n\r\n const amountOnChange = useMemo(\r\n () =>\r\n debounce(({ type, amount }: { type: 'buy' | 'sell'; amount: string }) => {\r\n if (amount === '' && midPrice) {\r\n setBaseMinAndZoomMultiples({\r\n baseMin: computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples: baseZoomMultiples,\r\n }),\r\n zoomMultiples: baseZoomMultiples,\r\n targetMarginPriceX: 0,\r\n });\r\n if (type === 'buy') {\r\n setBuyImpact('-');\r\n } else {\r\n setSellImpact('-');\r\n }\r\n }\r\n const amountB = new BigNumber(amount);\r\n if (\r\n amountB.lte(0) ||\r\n amountB.isNaN() ||\r\n !pmmParams?.b ||\r\n amountB.gte(pmmParams.b) ||\r\n !midPrice\r\n ) {\r\n return;\r\n }\r\n if (type === 'buy') {\r\n const marginPrice = computeMarginPrice({\r\n params: pmmParams,\r\n target: amountB,\r\n });\r\n setBaseMinAndZoomMultiples((prev) => {\r\n const impactResult = beforePriceImpactEffect({\r\n currentBaseMinAndZoomMultiples: prev,\r\n targetPrice: marginPrice,\r\n midPrice,\r\n width,\r\n });\r\n if (impactResult.isSkip) {\r\n return {\r\n baseMin: prev.baseMin,\r\n zoomMultiples: prev.zoomMultiples,\r\n targetMarginPriceX: impactResult.targetX,\r\n };\r\n }\r\n\r\n if (impactResult.targetX > 0) {\r\n return {\r\n baseMin: impactResult.baseMin,\r\n zoomMultiples: impactResult.zoomMultiples,\r\n targetMarginPriceX: impactResult.targetX,\r\n };\r\n }\r\n\r\n const result = computeTargetXByTargetPrice({\r\n midPrice,\r\n width,\r\n type,\r\n targetPrice: marginPrice,\r\n });\r\n const newZoomMultiples = result.zoomMultiples.dp(6).toNumber();\r\n return {\r\n baseMin: computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples: newZoomMultiples,\r\n }),\r\n zoomMultiples: newZoomMultiples,\r\n targetMarginPriceX: result.targetX,\r\n };\r\n });\r\n // console.log(\r\n // 'v2 marginPrice',\r\n // amountB.toFixed(6),\r\n // marginPrice.toFixed(6),\r\n // result.targetX,\r\n // result.zoomMultiples.toFixed(6),\r\n // );\r\n setBuyImpact(\r\n `${formatPercentageNumber({\r\n input: marginPrice.minus(midPrice).div(midPrice),\r\n })}`,\r\n );\r\n } else {\r\n const marginPrice = computeSellMarginPrice({\r\n params: pmmParams,\r\n target: amountB,\r\n });\r\n setBaseMinAndZoomMultiples((prev) => {\r\n const impactResult = beforePriceImpactEffect({\r\n currentBaseMinAndZoomMultiples: prev,\r\n targetPrice: marginPrice,\r\n midPrice,\r\n width,\r\n });\r\n if (impactResult.isSkip) {\r\n return {\r\n baseMin: prev.baseMin,\r\n zoomMultiples: prev.zoomMultiples,\r\n targetMarginPriceX: impactResult.targetX,\r\n };\r\n }\r\n\r\n if (impactResult.targetX > 0) {\r\n return {\r\n baseMin: impactResult.baseMin,\r\n zoomMultiples: impactResult.zoomMultiples,\r\n targetMarginPriceX: impactResult.targetX,\r\n };\r\n }\r\n const result = computeTargetXByTargetPrice({\r\n midPrice,\r\n width,\r\n type,\r\n targetPrice: marginPrice,\r\n });\r\n const newZoomMultiples = result.zoomMultiples.dp(6).toNumber();\r\n return {\r\n baseMin: computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples: newZoomMultiples,\r\n }),\r\n zoomMultiples: newZoomMultiples,\r\n targetMarginPriceX: result.targetX,\r\n };\r\n });\r\n setSellImpact(\r\n `+${formatPercentageNumber({\r\n input: marginPrice.minus(midPrice).div(midPrice),\r\n })}`,\r\n );\r\n }\r\n }, 300),\r\n [pmmParams, midPrice, width],\r\n );\r\n useEffect(() => {\r\n if (buyAmount !== undefined) {\r\n amountOnChange({\r\n type: 'buy',\r\n amount: buyAmount,\r\n });\r\n }\r\n }, [amountOnChange, buyAmount]);\r\n useEffect(() => {\r\n if (sellAmount !== undefined) {\r\n amountOnChange({\r\n type: 'sell',\r\n amount: sellAmount,\r\n });\r\n }\r\n }, [amountOnChange, sellAmount]);\r\n\r\n const handleDragButtonMouseDown = (moveLeft?: boolean) => {\r\n let dragDistance = 0;\r\n if (moveLeft) {\r\n dragDistance = -(width * 0.1);\r\n } else {\r\n dragDistance = width * 0.1;\r\n }\r\n setBaseMinAndZoomMultiples((prev) => {\r\n if (prev.baseMin === undefined) {\r\n return prev;\r\n }\r\n return {\r\n baseMin: computeBaseMinByDistance({\r\n dragDistance,\r\n prevBaseMin: prev.baseMin,\r\n chartWidth: width,\r\n zoomMultiples: prev.zoomMultiples,\r\n }),\r\n zoomMultiples: prev.zoomMultiples,\r\n targetMarginPriceX: prev.targetMarginPriceX,\r\n };\r\n });\r\n };\r\n\r\n const handleZoomButtonMouseDown = (zoomIn?: boolean) => {\r\n setBaseMinAndZoomMultiples((prev) => {\r\n const newZoomMultiples = computeZoomMultiplesWhenZoom({\r\n zoomIn: zoomIn ?? false,\r\n prevZoomMultiples: prev.zoomMultiples,\r\n });\r\n return {\r\n baseMin: computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples: newZoomMultiples,\r\n }),\r\n zoomMultiples: newZoomMultiples,\r\n targetMarginPriceX: prev.targetMarginPriceX,\r\n };\r\n });\r\n };\r\n\r\n const buyInputError = useMemo(() => {\r\n if (buyAmount === '') {\r\n return false;\r\n }\r\n const amountB = new BigNumber(buyAmount);\r\n if (\r\n amountB.lte(0) ||\r\n amountB.isNaN() ||\r\n !pmmParams?.b ||\r\n amountB.gte(pmmParams.b)\r\n ) {\r\n return true;\r\n }\r\n return false;\r\n }, [buyAmount, pmmParams]);\r\n const sellInputError = useMemo(() => {\r\n if (sellAmount === '') {\r\n return false;\r\n }\r\n const amountB = new BigNumber(sellAmount);\r\n if (\r\n amountB.lte(0) ||\r\n amountB.isNaN() ||\r\n !pmmParams?.b ||\r\n amountB.gte(pmmParams.b)\r\n ) {\r\n return true;\r\n }\r\n return false;\r\n }, [sellAmount, pmmParams]);\r\n\r\n return (\r\n <Container id={chartId}>\r\n {!notShowAmountInput ? (\r\n <AmountInputContainer>\r\n <InputSectionWrapper borderColor={colorMap && colorMap.grid}>\r\n {t('pool.chart.buy-amount', { symbol: baseTokenSymbol })}\r\n <Input\r\n value={buyAmount}\r\n error={buyInputError}\r\n onChange={(evt) => {\r\n const amount = fixedInputStringToFormattedNumber(\r\n evt.target.value,\r\n 2,\r\n );\r\n if (amount !== null) {\r\n setBuyAmount(amount);\r\n }\r\n }}\r\n />\r\n <PriceImpactWrapper>\r\n {t('pool.chart.price-impact', { amount: buyImpact })}\r\n </PriceImpactWrapper>\r\n </InputSectionWrapper>\r\n <InputSectionWrapper borderColor={colorMap && colorMap.grid}>\r\n {t('pool.chart.sell-amount', { symbol: baseTokenSymbol })}\r\n <Input\r\n value={sellAmount}\r\n error={sellInputError}\r\n onChange={(evt) => {\r\n const amount = fixedInputStringToFormattedNumber(\r\n evt.target.value,\r\n 2,\r\n );\r\n if (amount !== null) {\r\n setSellAmount(amount);\r\n }\r\n }}\r\n />\r\n <PriceImpactWrapper>\r\n {t('pool.chart.price-impact', { amount: sellImpact })}\r\n </PriceImpactWrapper>\r\n </InputSectionWrapper>\r\n </AmountInputContainer>\r\n ) : (\r\n ''\r\n )}\r\n\r\n {pmmParams !== undefined &&\r\n midPrice !== undefined &&\r\n pmmModel !== undefined &&\r\n baseMinAndZoomMultiples.baseMin !== undefined &&\r\n midPrice !== undefined && (\r\n <DepthChartKonva\r\n width={width}\r\n height={height}\r\n params={pmmParams}\r\n midPrice={midPrice}\r\n pmmModel={pmmModel}\r\n baseTokenSymbol={baseTokenSymbol}\r\n quoteTokenSymbol={quoteTokenSymbol}\r\n baseMinAndZoomMultiples={baseMinAndZoomMultiples}\r\n colorMap={colorMap}\r\n setBaseMinAndZoomMultiples={setBaseMinAndZoomMultiples}\r\n />\r\n )}\r\n\r\n <OptButtonGroup className=\"operate-btn-wrapper\">\r\n <OptButton onClick={() => handleDragButtonMouseDown(true)}>\r\n <BiChevronLeft />\r\n </OptButton>\r\n <OptButton onClick={() => handleZoomButtonMouseDown(false)}>\r\n <BiMinus />\r\n </OptButton>\r\n <OptButton onClick={() => handleZoomButtonMouseDown(true)}>\r\n <BiPlus />\r\n </OptButton>\r\n <OptButton onClick={() => handleDragButtonMouseDown(false)}>\r\n <BiChevronRight />\r\n </OptButton>\r\n </OptButtonGroup>\r\n </Container>\r\n );\r\n};\r\n\r\nexport default DepthChart;\r\n","import { useEffect } from 'react';\r\n\r\ntype Props = {\r\n id: string;\r\n};\r\n\r\n/**\r\n * 防止鼠标在图上滚动滚轮时页面上下滑动\r\n * @param param0\r\n */\r\nexport const usePreventWheel = ({ id }: Props) => {\r\n useEffect(() => {\r\n function handleWheelEvt(event: HTMLElementEventMap['wheel']) {\r\n event.preventDefault();\r\n }\r\n\r\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support\r\n let passiveSupported = false;\r\n\r\n try {\r\n const options = {\r\n get passive() {\r\n // This function will be called when the browser\r\n // attempts to access the passive property.\r\n passiveSupported = true;\r\n return false;\r\n },\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n window.addEventListener('test', () => {}, options);\r\n // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n window.removeEventListener('test', () => {});\r\n } catch (err) {\r\n passiveSupported = false;\r\n }\r\n const container = document.getElementById(id);\r\n // https://github.com/inuyaksa/jquery.nicescroll/issues/799\r\n const options = passiveSupported ? { passive: false } : false;\r\n container?.addEventListener('wheel', handleWheelEvt, options);\r\n return () => {\r\n container?.removeEventListener('wheel', handleWheelEvt);\r\n };\r\n }, [id]);\r\n};\r\n"],"names":["Input","styled","input","error","css","bgColor","DepthChartKonva","width","height","midPrice","pmmModel","params","baseTokenSymbol","quoteTokenSymbol","baseMinAndZoomMultiples","colorMap","setBaseMinAndZoomMultiples","colorMapRes","merge","grid","midPriceLine","leftBg","leftLine","leftColor","rightBg","rightLine","rightColor","tooltipBg","tooltipColor","undefined","chartWidth","chartHeight","oneXPx","buyBaseVert","sellBaseVert","computeBaseVert","q","q0","buyYPortion","div","sellYPortion","tooltipRef","useRef","stageRef","current","tooltip","dragStartXRef","pointerXRef","horizontalGridLines","verticalGridLines","horizontalLineCount","verticalLineCount","useMemo","horizontalGridPerBlockHeight","verticalGridPerBlockWidth","index","y","push","x","useGridLinePoints","horizontalLabelTickPoints","horizontalLabelTextPoints","xAxisPoints","xPortion","computeXPortion","zoomMultiples","i","power","multipliedBy","plus","toNumber","axisNum","baseMin","text","formatShortNumber","useHorizontalLabelPoints","quoteLinePoints","quoteLineAreaPoints","quoteLineAreaLinearGradientEndPointY","baseLinePoints","baseLineAreaPoints","baseLineAreaLinearGradientEndPointY","midPriceLinePoints","xPoints","multiplesNum","step","BigNumber","midPriceN","Math","log","minimum","maximum","lte","price","result","evalPoint","val","model","vert","isNaN","midPriceX","firstY","isZeroK","k","eq","maxResult","maxHeightY","maxHeightX","length","unshift","useDepthLinePoints","handleMouseover","evt","node","target","mousePos","_a","getStage","getPointerPosition","hide","updateTooltip","t","isHover","color","updateWhenDrag","throttle","stage","container","style","cursor","dragDistance","prev","computeBaseMinByDistance","prevBaseMin","targetMarginPriceX","updateWhenWheel","event","cancelBubble","preventDefault","isScrollUp","deltaY","newZoomMultiples","computeZoomMultiplesWhenZoom","zoomIn","prevZoomMultiples","computeBaseAfterZoom","useEffect","_jsxs","Stage","ref","offsetY","chartOffsetYBCToolTip","draggable","dragBoundFunc","this","absolutePosition","onMouseMove","onMouseOver","onMouseOut","handleMouseOut","onDragStart","onDragMove","onDragEnd","onWheel","children","Layer","_jsx","Rect","stroke","strokeWidth","map","points","Line","lineCap","lineJoin","listening","tickPoints","textPoint","Text","fontFamily","fontSize","fill","padding","align","verticalAlign","closed","fillLinearGradientStartPoint","fillLinearGradientEndPoint","fillLinearGradientColorStops","visible","dash","id","Circle","radius","Label","Tag","pointerDirection","pointerWidth","pointerHeight","cornerRadius","lineHeight","labelPadding","BaseButton","button","Container","AmountInputContainer","InputSectionWrapper","borderColor","PriceImpactWrapper","span","OptButtonGroup","OptButton","computeMarginPrice","isBuy","b","b0","R","solveQuadraticFunctionForTarget","minus","newB","lt","r","pmm","PMMModel","RStatus","B","B0","Q","Q0","mtFeeRate","lpFeeRate","getAmount","querySellBase","queryBuyBase","deltaQ","DepthChart","chartId","pmmParams","notShowAmountInput","usePreventWheel","handleWheelEvt","passiveSupported","options","passive","window","addEventListener","removeEventListener","err","document","getElementById","buyAmount","setBuyAmount","useState","sellAmount","setSellAmount","buyImpact","setBuyImpact","sellImpact","setSellImpact","baseZoomMultiples","amountOnChange","debounce","type","amount","amountB","gte","marginPrice","impactResult","beforePriceImpactEffect","currentBaseMinAndZoomMultiples","targetPrice","isSkip","targetX","computeTargetXByTargetPrice","dp","formatPercentageNumber","computeSellMarginPrice","handleDragButtonMouseDown","moveLeft","handleZoomButtonMouseDown","buyInputError","sellInputError","symbol","value","onChange","fixedInputStringToFormattedNumber","className","onClick","BiChevronLeft","BiMinus","BiPlus","BiChevronRight"],"mappings":"q5CAGO,MAAMA,EAAQC,EAAOC,KAA0B;;;;;;;;;;;;;;;MAehD,EAAGC,WACHA,GACAC,EAAAA,GAAG;;;;ECUF,MAAMC,EAAU,wBAwCjB,SAAUC,GAAgBC,MAC9BA,EAAKC,OACLA,EAAMC,SACNA,EAAQC,SACRA,EAAQC,OACRA,EAAMC,gBACNA,EAAeC,iBACfA,EAAgBC,wBAChBA,EAAuBC,SACvBA,EAAQC,2BACRA,IAEA,MAAMC,EAAcC,EAAAA,MAClB,CACEC,KAAM,UACNC,aAAc,UACdC,OAAQ,CAAC,EAAGhB,EAAS,EAAG,WACxBiB,SAAU,UACVC,UAAW,GACXC,QAAS,CAAC,EAAGnB,EAAS,EAAG,WACzBoB,UAAW,UACXC,WAAY,GACZC,UAAW,UACXC,kBAAcC,GAEhBd,GAGIe,EAAavB,EACbwB,EAAcvB,EAhEH,GAiEXwB,EAASF,EA9DG,GAgEZG,YAAEA,EAAWC,aAAEA,GAAiBC,kBAAgB,CACpD1B,WACA2B,EAAGzB,EAAOyB,EACVC,GAAI1B,EAAO0B,GACX3B,aAEI4B,EAAcL,EAAYM,IAAIR,GAC9BS,EAAeN,EAAaK,IAAIR,GAEhCU,EAAaC,EAAAA,OAAoB,MACjCC,EAAWD,EAAAA,OAAoB,OAC7BE,QAASC,GAAYJ,EACvBK,EAAgBJ,EAAAA,OAAe,GAC/BK,EAAcL,EAAAA,UAEdM,oBAAEA,EAAmBC,kBAAEA,GCnHzB,UAA4BlB,YAChCA,EAAWD,WACXA,EAAUoB,oBACVA,EAAmBC,kB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PG,SAAW5K,IACT,MAAMuJ,EAASsB,EAAAA,kCACb7K,EAAIE,OAAOyK,MACX,GAEa,OAAXpB,GACFT,EAAcS,MAIpBjG,EAAAA,IAAC0C,EAAkB,CAAA5C,SAChB3C,EAAAA,OAAE,0BAA2B,CAAE8I,OAAQN,iBAQjCpO,IAAdgN,QACchN,IAAbpB,QACaoB,IAAbnB,QACoCmB,IAApCf,EAAwB0D,cACX3C,IAAbpB,GACE6J,EAAAA,IAAChK,EAAe,CACdC,MAAOA,EACPC,OAAQA,EACRG,OAAQkO,EACRpO,SAAUA,EACVC,SAAUA,EACVE,gBAAiBA,EACjBC,iBAAkBA,EAClBC,wBAAyBA,EACzBC,SAAUA,EACVC,2BAA4BA,IAIlCmI,EAAAA,KAAC+D,EAAc,CAAC4E,UAAU,sBAAqB1H,SAAA,CAC7CE,EAAAA,IAAC6C,EAAS,CAAC4E,QAASA,IAAMV,GAA0B,GAAMjH,SACxDE,EAAAA,IAAC0H,EAAAA,cAAa,CAAA,KAEhB1H,EAAAA,IAAC6C,EAAS,CAAC4E,QAASA,IAAMR,GAA0B,GAAOnH,SACzDE,EAAAA,IAAC2H,EAAAA,QAAO,CAAA,KAEV3H,EAAAA,IAAC6C,EAAS,CAAC4E,QAASA,IAAMR,GAA0B,GAAMnH,SACxDE,EAAAA,IAAC4H,EAAAA,OAAM,CAAA,KAET5H,EAAAA,IAAC6C,EAAS,CAAC4E,QAASA,IAAMV,GAA0B,GAAOjH,SACzDE,EAAAA,IAAC6H,EAAAA,eAAc,CAAA"}
|
package/dist/index-bVmd7uFj.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import e from"bignumber.js";import{merge as t,throttle as i,debounce as o}from"lodash";import{useEffect as r,useMemo as n,useRef as l,useState as a}from"react";import{BiChevronLeft as s,BiMinus as d,BiPlus as p,BiChevronRight as u}from"react-icons/bi";import m from"@emotion/styled";import{css as c}from"@emotion/react";import{Stage as g,Layer as h,Rect as b,Line as M,Text as f,Circle as v,Label as P,Tag as x}from"react-konva";import{c as y,e as L,a as z,b as w,d as k,f as B,u as C,l as S,g as X,h as q,i as A,j as T,k as N}from"./helper-l9rrGqkT.js";import{f as W,a as F,b as j}from"./index-Bp_1xqpK.js";import{jsxs as Z,jsx as G}from"react/jsx-runtime";import{solveQuadraticFunctionForTarget as H,PMMModel as E}from"@dodoex/api";import"@lingui/core";import"@dodoex/components";import"@dodoex/dodo-contract-request";import"@babel/runtime/helpers/interopRequireDefault";import"@babel/runtime/helpers/defineProperty";import"@lingui/react";import"identicon.js";import"zustand";import"zustand/middleware";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@tanstack/react-query";import"@ethersproject/bignumber";import"react-dom";import"react-window";import"dayjs";import"dayjs/plugin/utc";import"dayjs/plugin/duration";import"dayjs/plugin/localizedFormat";import"react-transition-group";import"react-is";import"@dodoex/contract-request";import"axios";import"recharts";import"react-dom/client";import"jsbi";import"tiny-invariant";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";import"rmc-date-picker/assets/index.css";import"react-datetime/css/react-datetime.css";const J=m.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&&c`
|
|
17
|
-
border-color: red;
|
|
18
|
-
`}
|
|
19
|
-
}
|
|
20
|
-
`;const D="rgba(38, 39, 41, 0.3)";function Y({width:o,height:a,midPrice:s,pmmModel:d,params:p,baseTokenSymbol:u,quoteTokenSymbol:m,baseMinAndZoomMultiples:c,colorMap:A,setBaseMinAndZoomMultiples:T}){const N=t({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,D,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,D,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},A),F=o,j=a-18,H=F/7,{buyBaseVert:E,sellBaseVert:J}=z({midPrice:s,q:p.q,q0:p.q0,pmmModel:d}),Y=E.div(j),V=J.div(j),R=l(null),I=l(null),{current:$}=R,O=l(0),Q=l(),{horizontalGridLines:K,verticalGridLines:U}=function({chartHeight:e,chartWidth:t,horizontalLineCount:i,verticalLineCount:o}){return n(()=>{const r=[],n=e/(i+1),l=[],a=t/o;for(let e=0;e<i;e++){const i=n*(e+1);r.push([0,i,t,i])}for(let t=0;t<o;t++){const i=a*t+a/2;l.push([i,0,i,e])}return{horizontalGridLines:r,verticalGridLines:l}},[e,t,i,o])}({chartHeight:j,chartWidth:F,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:_,horizontalLabelTextPoints:ee}=function({chartHeight:e,chartWidth:t,xAxisPoints:i,oneXPx:o,baseMinAndZoomMultiples:r}){return n(()=>{const n=y(t,r.zoomMultiples),l=[],a=[];for(let t=0;t<i;t++){l.push([t*o+o/2,e,t*o+o/2,e+4]);const i=n.multipliedBy(t).multipliedBy(o).plus(n.multipliedBy(o/2)).toNumber(),s=r.baseMin.multipliedBy(10**i),d=t*o,p=e+2+4,u=W(s);a.push({x:d,y:p,text:u})}return{horizontalLabelTickPoints:l,horizontalLabelTextPoints:a}},[r.baseMin,r.zoomMultiples,e,t,o,i])}({chartHeight:j,chartWidth:F,xAxisPoints:7,oneXPx:H,baseMinAndZoomMultiples:c}),{quoteLinePoints:te,quoteLineAreaPoints:ie,quoteLineAreaLinearGradientEndPointY:oe,baseLinePoints:re,baseLineAreaPoints:ne,baseLineAreaLinearGradientEndPointY:le,midPriceLinePoints:ae}=function({chartHeight:t,chartWidth:i,midPrice:o,xPoints:r,pmmModel:l,baseMinAndZoomMultiples:a,buyYPortion:s,sellYPortion:d}){return n(()=>{const n=[],p=[],u=[],{baseMin:m,zoomMultiples:c}=a,g=y(i,c),h=2*c,b=new e(h).div(r);let M=new e(Math.log(o.div(m).toNumber())/Math.log(10));M=e.minimum(h,M),M=e.maximum(0,M);for(let i=new e(0);i.lte(M);){const e=m.multipliedBy(10**i.toNumber()),o=L({val:e,model:l});if(!o.vert.isNaN()){const e=i.div(g).toNumber(),r=t-o.vert.div(s).toNumber();n.push(e,r)}i=i.plus(b)}for(let e=M;e.lte(h);){const i=m.multipliedBy(10**e.toNumber()),o=L({val:i,model:l});if(!o.vert.isNaN()){const i=e.div(g).toNumber(),r=t-o.vert.div(d).toNumber();p.push(i,r)}e=e.plus(b)}const f=M.div(g).toNumber(),[,v]=n,P=l.k.eq(0);P&&n.push(f,v||t),n.push(f,t),u.push(f,t,f,0);const x=L({val:m.multipliedBy(10**h),model:l});let z=t;const w=new e(h).div(g).toNumber();return x.vert.isNaN()||(z=t-x.vert.div(d).toNumber()),P&&p.length>=2&&(p.unshift(f,z),p.unshift(f,t)),p.push(w,z),M.lte(0)&&p.unshift(0,t),{quoteLinePoints:n,quoteLineAreaPoints:[0,t,0,v,...n],quoteLineAreaLinearGradientEndPointY:v,baseLinePoints:p,baseLineAreaPoints:[...p,w,t],baseLineAreaLinearGradientEndPointY:z,midPriceLinePoints:u}},[a,i,r,o,l,t,s,d])}({chartHeight:j,chartWidth:F,midPrice:s,xPoints:50,pmmModel:d,baseMinAndZoomMultiples:c,buyYPortion:Y,sellYPortion:V}),se=e=>{var t;const i=e.target;if(i&&$){const e=null===(t=i.getStage())||void 0===t?void 0:t.getPointerPosition();if(e){const{x:t}=e;if(t>F)return void $.hide();C({x:t,tooltip:$,buyBaseVert:E,sellBaseVert:J,chartWidth:F,chartHeight:j,midPrice:s,pmmModel:d,baseTokenSymbol:u,quoteTokenSymbol:m,baseMinAndZoomMultiples:c,t:q,isHover:!0,color:N.tooltipColor,leftColor:N.leftLine,rightColor:N.rightLine})}}},de=n(()=>i(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-O.current;O.current=e.x,Q.current=e.x,T(e=>void 0===e.baseMin?e:{baseMin:w({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:F,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:0})}}},100),[F,T]),pe=n(()=>i(e=>{e.cancelBubble=!0,e.evt.preventDefault();const t=e.evt.deltaY<0;T(e=>{const i=k({zoomIn:t,prevZoomMultiples:e.zoomMultiples});return{baseMin:B({midPrice:s,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}})},100),[s,T]);return r(()=>{c.targetMarginPriceX>0&&null!==$?C({x:c.targetMarginPriceX,tooltip:$,buyBaseVert:E,sellBaseVert:J,chartWidth:F,chartHeight:j,midPrice:s,pmmModel:d,baseTokenSymbol:u,quoteTokenSymbol:m,baseMinAndZoomMultiples:c,t:q,color:N.tooltipColor,leftColor:N.leftLine,rightColor:N.rightLine}):void 0!==Q.current&&null!==$&&C({x:Q.current,tooltip:$,buyBaseVert:E,sellBaseVert:J,chartWidth:F,chartHeight:j,midPrice:s,pmmModel:d,baseTokenSymbol:u,quoteTokenSymbol:m,baseMinAndZoomMultiples:c,t:q,isHover:!0,color:N.tooltipColor,leftColor:N.leftLine,rightColor:N.rightLine})},[c,u,E,j,F,N.leftLine,N.rightLine,N.tooltipColor,s,d,m,J,$]),Z(g,{ref:I,width:o,offsetY:-X,height:a+X,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:se,onMouseOver:se,onMouseOut:()=>{$&&$.hide()},onDragStart:function(e){const{target:t}=e,i=t.getStage();if(i){const e=i.getPointerPosition();e&&(O.current=e.x)}},onDragMove:de,onDragEnd:e=>{const{target:t}=e,i=t.getStage();i&&(i.container().style.cursor="pointer")},onWheel:pe,children:[Z(h,{children:[G(b,{x:0,y:0,width:o,height:j,stroke:N.grid,strokeWidth:1}),K.map((e,t)=>G(M,{points:e,stroke:N.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t)),U.map((e,t)=>G(M,{points:e,stroke:N.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t)),_.map((e,t)=>G(M,{points:e,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t)),ee.map((e,t)=>G(f,{x:e.x,y:e.y,text:e.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:H,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t)),G(M,{points:ie,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:j},fillLinearGradientEndPoint:{x:0,y:oe},fillLinearGradientColorStops:N.leftBg}),G(M,{points:te,stroke:N.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),G(M,{points:ne,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:F,y:j},fillLinearGradientEndPoint:{x:F,y:le},fillLinearGradientColorStops:N.rightBg}),G(M,{points:re,stroke:N.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),G(M,{points:ae,stroke:N.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),Z(h,{ref:R,visible:!1,listening:!1,children:[G(M,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),G(M,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),G(v,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),Z(P,{x:0,y:0,id:"priceTextLabel",children:[G(x,{fill:N.tooltipBg,id:"priceTextLabel-tag"}),G(f,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),Z(P,{x:0,y:0,id:"slippageTextLabel",children:[G(x,{fill:N.tooltipBg,id:"slippageTextLabel-tag"}),G(f,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),Z(P,{x:0,y:0,id:"toolTip",children:[G(x,{fill:N.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),G(f,{text:"-",fontSize:12,lineHeight:17/12,padding:S,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const V=m.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
|
-
`,R=m.div`
|
|
33
|
-
height: 100%;
|
|
34
|
-
`,I=m.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
`,$=m.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
|
-
`,O=m.span`
|
|
53
|
-
color: #85858d;
|
|
54
|
-
`,Q=m.div`
|
|
55
|
-
margin-top: 20px;
|
|
56
|
-
display: flex;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
margin-bottom: 9px;
|
|
59
|
-
`,K=m(V)`
|
|
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 U({params:t,target:i,isBuy:o=!0}){const r=new e(t.b),n=new e(t.q);let l=new e(t.b0);const a=new e(t.q0),s=new e(t.i),d=new e(t.k),{R:p}=t;1===p&&l.eq(r)&&(l=H(r,n.minus(a),new e(1).div(s),d));const u=o?r.plus(i):r.minus(i);if(u.lt(l)||r.eq(l)){let t=l.multipliedBy(l).div(u).div(u);return t=new e(1).minus(d).plus(d.multipliedBy(t)),s.multipliedBy(t)}const m=new E;m.RStatus=p,m.B=r,m.B0=l,m.Q=n,m.Q0=a,m.i=s,m.k=d,m.mtFeeRate=new e(0),m.lpFeeRate=new e(0);let c=new e(0);c=o?m.querySellBase(i):m.queryBuyBase(i);const g=o?n.minus(c):n.plus(c);let h=a.multipliedBy(a).div(g).div(g);return h=new e(1).minus(d).plus(d.multipliedBy(h)),s.div(h)}const _=({chartId:t,width:i=834,height:l=460,baseTokenSymbol:m,quoteTokenSymbol:c,pmmModel:g,pmmParams:h,midPrice:b=new e(0),colorMap:M,notShowAmountInput:f})=>{(({id:e})=>{r(()=>{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 o=document.getElementById(e),r=!!i&&{passive:!1};return null==o||o.addEventListener("wheel",t,r),()=>{null==o||o.removeEventListener("wheel",t)}},[e])})({id:t});const[v,P]=a(""),[x,y]=a(""),[L,z]=a("-"),[C,S]=a("-"),[X,W]=a({baseMin:new e(0),zoomMultiples:A,targetMarginPriceX:0});r(()=>{void 0!==b&&W(e=>({baseMin:B({midPrice:b,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX}))},[b]);const H=n(()=>o(({type:t,amount:o})=>{""===o&&b&&(W({baseMin:B({midPrice:b,zoomMultiples:A}),zoomMultiples:A,targetMarginPriceX:0}),"buy"===t?z("-"):S("-"));const r=new e(o);if(!r.lte(0)&&!r.isNaN()&&(null==h?void 0:h.b)&&!r.gte(h.b)&&b)if("buy"===t){const e=U({params:h,target:r});W(o=>{const r=T({currentBaseMinAndZoomMultiples:o,targetPrice:e,midPrice:b,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:b,width:i,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:B({midPrice:b,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}}),z(`${F({input:e.minus(b).div(b)})}`)}else{const e=function({params:e,target:t}){return U({params:e,target:t,isBuy:!1})}({params:h,target:r});W(o=>{const r=T({currentBaseMinAndZoomMultiples:o,targetPrice:e,midPrice:b,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:b,width:i,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:B({midPrice:b,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}}),S(`+${F({input:e.minus(b).div(b)})}`)}},300),[h,b,i]);r(()=>{void 0!==v&&H({type:"buy",amount:v})},[H,v]),r(()=>{void 0!==x&&H({type:"sell",amount:x})},[H,x]);const E=e=>{let t=0;t=e?-.1*i:.1*i,W(e=>void 0===e.baseMin?e:{baseMin:w({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:i,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX})},D=e=>{W(t=>{const i=k({zoomIn:null!=e&&e,prevZoomMultiples:t.zoomMultiples});return{baseMin:B({midPrice:b,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}})},V=n(()=>{if(""===v)return!1;const t=new e(v);return!(!t.lte(0)&&!t.isNaN()&&(null==h?void 0:h.b)&&!t.gte(h.b))},[v,h]),_=n(()=>{if(""===x)return!1;const t=new e(x);return!(!t.lte(0)&&!t.isNaN()&&(null==h?void 0:h.b)&&!t.gte(h.b))},[x,h]);return Z(R,{id:t,children:[f?"":Z(I,{children:[Z($,{borderColor:M&&M.grid,children:[q("pool.chart.buy-amount",{symbol:m}),G(J,{value:v,error:V,onChange:e=>{const t=j(e.target.value,2);null!==t&&P(t)}}),G(O,{children:q("pool.chart.price-impact",{amount:L})})]}),Z($,{borderColor:M&&M.grid,children:[q("pool.chart.sell-amount",{symbol:m}),G(J,{value:x,error:_,onChange:e=>{const t=j(e.target.value,2);null!==t&&y(t)}}),G(O,{children:q("pool.chart.price-impact",{amount:C})})]})]}),void 0!==h&&void 0!==b&&void 0!==g&&void 0!==X.baseMin&&void 0!==b&&G(Y,{width:i,height:l,params:h,midPrice:b,pmmModel:g,baseTokenSymbol:m,quoteTokenSymbol:c,baseMinAndZoomMultiples:X,colorMap:M,setBaseMinAndZoomMultiples:W}),Z(Q,{className:"operate-btn-wrapper",children:[G(K,{onClick:()=>E(!0),children:G(s,{})}),G(K,{onClick:()=>D(!1),children:G(d,{})}),G(K,{onClick:()=>D(!0),children:G(p,{})}),G(K,{onClick:()=>E(!1),children:G(u,{})})]})]})};export{_ as default};
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TokenInfo } from '../../../hooks/Token';
|
|
2
|
-
export default function SwapPreviewInfoCard({ slippage, receiveAmount, receiveToken, priceImpact, }: {
|
|
3
|
-
slippage: number;
|
|
4
|
-
receiveAmount: number | null;
|
|
5
|
-
receiveToken: TokenInfo | null;
|
|
6
|
-
priceImpact: string;
|
|
7
|
-
}): import("react").JSX.Element | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
import { Actions, Connector } from '@web3-react/types';
|
|
3
|
-
export default class JsonRpcConnector extends Connector {
|
|
4
|
-
customProvider: JsonRpcProvider;
|
|
5
|
-
constructor(actions: Actions, customProvider: JsonRpcProvider, onError?: (error: Error) => void);
|
|
6
|
-
private activateAccounts;
|
|
7
|
-
connectEagerly(): Promise<void>;
|
|
8
|
-
activate(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Provider as Eip1193Provider } from '@web3-react/types';
|
|
2
|
-
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
3
|
-
import { ChainId } from '@dodoex/api';
|
|
4
|
-
import { Web3Connection } from './web3';
|
|
5
|
-
import { WalletType } from '../../constants/wallet';
|
|
6
|
-
export interface Web3ConnectorsProps {
|
|
7
|
-
provider?: Eip1193Provider | JsonRpcProvider;
|
|
8
|
-
jsonRpcUrlMap?: {
|
|
9
|
-
[chainId: number]: string[];
|
|
10
|
-
};
|
|
11
|
-
defaultChainId?: ChainId;
|
|
12
|
-
}
|
|
13
|
-
export declare function useWeb3Connectors({ provider, jsonRpcUrlMap: jsonRpcUrlMapProps, defaultChainId, }: Web3ConnectorsProps): {
|
|
14
|
-
connectors: Web3Connection[];
|
|
15
|
-
key: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function connectToWallet(type: WalletType, chainId: number | undefined, onError: (error: Error) => void): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Web3ReactHooks } from '@web3-react/core';
|
|
2
|
-
import { Connector, Provider as Eip1193Provider } from '@web3-react/types';
|
|
3
|
-
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
4
|
-
import { ChainId } from '@dodoex/api';
|
|
5
|
-
export type Web3Connection = [Connector, Web3ReactHooks];
|
|
6
|
-
export declare function getConnectionFromProvider(onError: (error: Error) => void, provider?: JsonRpcProvider | Eip1193Provider): Web3Connection | undefined;
|
|
7
|
-
export declare function getConnectionFromWalletConnect(useDefault: boolean, jsonRpcUrlMap: {
|
|
8
|
-
[chainId: number]: string[];
|
|
9
|
-
}, defaultChainId: ChainId | undefined, onError: (error: Error) => void): Web3Connection;
|
|
10
|
-
export declare function getConnectionFromMetaMask(onError: (error: Error) => void): Web3Connection;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BoxProps } from '@dodoex/components';
|
|
2
|
-
export interface OnlyV3ToggleProps {
|
|
3
|
-
onlyV3: boolean;
|
|
4
|
-
setOnlyV3: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
-
sx?: BoxProps['sx'];
|
|
6
|
-
}
|
|
7
|
-
export declare const OnlyV3Toggle: ({ onlyV3, setOnlyV3, sx }: OnlyV3ToggleProps) => import("react").JSX.Element;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FetchMyLiquidityListLqList } from '../utils';
|
|
2
|
-
import BigNumber from 'bignumber.js';
|
|
3
|
-
export declare function usePoolListMyLiquidity({ account, lqList, }: {
|
|
4
|
-
account?: string;
|
|
5
|
-
lqList: FetchMyLiquidityListLqList;
|
|
6
|
-
}): {
|
|
7
|
-
needRealtimeBalance: boolean;
|
|
8
|
-
userLpBalanceMap: Map<string, {
|
|
9
|
-
userBaseLpBalance?: BigNumber;
|
|
10
|
-
userQuoteLpBalance?: BigNumber;
|
|
11
|
-
poolTokenPercentage?: BigNumber;
|
|
12
|
-
}>;
|
|
13
|
-
isLpLoading: boolean;
|
|
14
|
-
isPoolShareLoading: boolean;
|
|
15
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|