@dodoex/widgets 2.6.6 → 3.0.0-beta.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/dist/b3f16b2626f03378.svg +10 -0
- package/dist/cjs/b3f16b2626f03378.svg +10 -0
- package/dist/cjs/helper-889c5e9a.cjs +1 -0
- package/dist/cjs/index-256d5f78.cjs +12 -0
- package/dist/cjs/index-4190bae6.cjs +58 -0
- package/dist/cjs/index-457c65f3.cjs +78 -0
- package/dist/cjs/index.cjs +1 -45
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/cjs/lottie-edc8e0b8.cjs +1 -0
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +1 -2
- package/dist/cjs/src/components/Confirm.d.ts +15 -0
- package/dist/cjs/src/components/ConnectWallet/NeedConnectButton.d.ts +2 -1
- package/dist/cjs/src/components/GoBack.d.ts +6 -0
- package/dist/cjs/src/components/HowItWorks.d.ts +11 -0
- package/dist/cjs/src/components/RiskDialog.d.ts +7 -0
- package/dist/cjs/src/components/Swap/components/ConnectWallet/index.d.ts +1 -3
- package/dist/cjs/src/components/Swap/components/Dialog.d.ts +2 -1
- package/dist/cjs/src/components/Swap/components/TokenCard/BalanceText.d.ts +4 -2
- package/dist/cjs/src/components/Swap/components/TokenCard/NumberInput.d.ts +12 -9
- package/dist/cjs/src/components/Swap/components/TokenCard/PercentageSelectButtonGroup.d.ts +7 -0
- package/dist/cjs/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +4 -3
- package/dist/cjs/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +6 -1
- package/dist/cjs/src/components/Swap/components/TokenCard/index.d.ts +16 -3
- package/dist/cjs/src/components/Swap/index.d.ts +1 -3
- package/dist/cjs/src/components/Token/TokenItem.d.ts +9 -0
- package/dist/cjs/src/components/TokenLogo.d.ts +3 -1
- package/dist/cjs/src/components/TokenLogoPair.d.ts +3 -2
- package/dist/cjs/src/components/TokenPicker/TokenItem.d.ts +3 -1
- package/dist/cjs/src/components/TokenPicker/index.d.ts +8 -3
- package/dist/cjs/src/components/TokenStatusButton.d.ts +7 -0
- package/dist/cjs/src/components/Widget/index.d.ts +3 -1
- package/dist/cjs/src/components/WidgetConfirm.d.ts +15 -0
- package/dist/cjs/src/components/WidgetContainer.d.ts +3 -0
- package/dist/cjs/src/components/WidgetDialog.d.ts +15 -0
- package/dist/cjs/src/components/chart/components/BaseButton.d.ts +5 -0
- package/dist/cjs/src/components/chart/components/Display.d.ts +9 -0
- package/dist/cjs/src/components/chart/components/Input.d.ts +7 -0
- package/dist/cjs/src/components/chart/components/NumberInput.d.ts +6 -0
- package/dist/cjs/src/components/chart/components/TogglePriceIcon.d.ts +8 -0
- package/dist/cjs/src/components/chart/components/TokenLogo.d.ts +5 -0
- package/dist/cjs/src/components/chart/depth-chart/DepthChartKonva.d.ts +30 -0
- package/dist/cjs/src/components/chart/depth-chart/__tests__/utils.test.d.ts +1 -0
- package/dist/cjs/src/components/chart/depth-chart/helper.d.ts +125 -0
- package/dist/cjs/src/components/chart/depth-chart/index.d.ts +18 -0
- package/dist/cjs/src/components/chart/depth-chart/index.styled.d.ts +29 -0
- package/dist/cjs/src/components/chart/depth-chart/useDepthLinePoints.d.ts +21 -0
- package/dist/cjs/src/components/chart/depth-chart/useGridLinePoints.d.ts +9 -0
- package/dist/cjs/src/components/chart/depth-chart/useHorizontalLabelPoints.d.ts +15 -0
- package/dist/cjs/src/components/chart/depth-chart/utils.d.ts +19 -0
- package/dist/cjs/src/components/chart/depth-chart-v2/index.d.ts +10 -0
- package/dist/cjs/src/components/chart/depth-chart-v2/index.styled.d.ts +15 -0
- package/dist/cjs/src/components/chart/hooks/usePreventWheel.d.ts +9 -0
- package/dist/cjs/src/components/chart/i18n.d.ts +1 -0
- package/dist/cjs/src/components/chart/liquidity-chart/LiquidityChartKonva.d.ts +28 -0
- package/dist/cjs/src/components/chart/liquidity-chart/__tests__/helper.test.d.ts +1 -0
- package/dist/cjs/src/components/chart/liquidity-chart/helper.d.ts +47 -0
- package/dist/cjs/src/components/chart/liquidity-chart/index.d.ts +17 -0
- package/dist/cjs/src/components/chart/liquidity-chart/index.styled.d.ts +9 -0
- package/dist/cjs/src/components/chart/liquidity-chart/useGridLine.d.ts +8 -0
- package/dist/cjs/src/components/chart/liquidity-chart/useHorizontalLabel.d.ts +10 -0
- package/dist/cjs/src/components/chart/liquidity-chart/useLiquidityLine.d.ts +18 -0
- package/dist/cjs/src/components/chart/liquidity-chart/useMiddleLine.d.ts +6 -0
- package/dist/cjs/src/components/chart/liquidity-chart/usePoints.d.ts +39 -0
- package/dist/cjs/src/components/chart/utils.d.ts +3 -0
- package/dist/cjs/src/constants/api.d.ts +5 -0
- package/dist/cjs/src/constants/chainList.d.ts +1 -0
- package/dist/cjs/src/constants/chains.d.ts +24 -31
- package/dist/cjs/src/constants/localstorage.d.ts +2 -0
- package/dist/cjs/src/constants/pool.d.ts +5 -0
- package/dist/cjs/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +2 -1
- package/dist/cjs/src/hooks/Submission/types.d.ts +31 -2
- package/dist/cjs/src/hooks/Submission/useExecution.d.ts +3 -2
- package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.d.ts +3 -3
- package/dist/cjs/src/hooks/Token/useTokenList.d.ts +9 -3
- package/dist/cjs/src/hooks/Token/useTokenListDefaultToken.d.ts +30 -0
- package/dist/cjs/src/hooks/Token/useTokenListFetchBalance.d.ts +5 -2
- package/dist/cjs/src/hooks/Token/useTokenStatus.d.ts +4 -1
- package/dist/cjs/src/hooks/contract/index.d.ts +0 -2
- package/dist/cjs/src/hooks/contract/useFetchETHBalance.d.ts +21 -1
- package/dist/cjs/src/hooks/contract/useFetchTokens.d.ts +4 -10
- package/dist/cjs/src/hooks/contract/wallet.d.ts +1 -1
- package/dist/cjs/src/index.d.ts +6 -0
- package/dist/cjs/src/providers/GlobalConfigContext.d.ts +14 -0
- package/dist/cjs/src/router/index.d.ts +2 -0
- package/dist/cjs/src/router/types.d.ts +17 -4
- package/dist/cjs/src/store/actions/token.d.ts +1 -8
- package/dist/cjs/src/store/actions/wallet.d.ts +2 -0
- package/dist/cjs/src/store/index.d.ts +7 -1
- package/dist/cjs/src/store/reducers/token.d.ts +0 -7
- package/dist/cjs/src/store/reducers/wallet.d.ts +4 -0
- package/dist/cjs/src/store/selectors/token.d.ts +0 -10
- package/dist/cjs/src/store/selectors/wallet.d.ts +5 -2
- package/dist/cjs/src/utils/address.d.ts +2 -2
- package/dist/cjs/src/utils/bytes.d.ts +3 -0
- package/dist/cjs/src/utils/formatter.d.ts +24 -1
- package/dist/cjs/src/utils/token.d.ts +21 -0
- package/dist/cjs/src/widgets/MiningWidget/LpTokenMiningOperate/index.d.ts +7 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/AssociateMine.d.ts +20 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/ClaimButton.d.ts +5 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/GetLpLink.d.ts +5 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/RewardListCard.d.ts +8 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/StakeButton.d.ts +9 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/UnstakeButton.d.ts +8 -0
- package/dist/cjs/src/widgets/MiningWidget/OperateArea/index.d.ts +13 -0
- package/dist/cjs/src/widgets/MiningWidget/helper.d.ts +2 -0
- package/dist/cjs/src/widgets/MiningWidget/hooks/useClaimMiningSubmit.d.ts +4 -0
- package/dist/cjs/src/widgets/MiningWidget/hooks/useRewardListAmount.d.ts +17 -0
- package/dist/cjs/src/widgets/MiningWidget/hooks/useStakeMiningSubmit.d.ts +5 -0
- package/dist/cjs/src/widgets/MiningWidget/hooks/useStatusAndStartBlockNumber.d.ts +13 -0
- package/dist/cjs/src/widgets/MiningWidget/hooks/useUnstakeMiningSubmit.d.ts +5 -0
- package/dist/cjs/src/widgets/MiningWidget/types.d.ts +58 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/ConfirmInfoDialog.d.ts +10 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/DepthAndLiquidityChart.d.ts +11 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/DepthChartWrapper.d.ts +11 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/EmptyChart.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/FeeRateCard.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/FixedInitPriceConfirm.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/LqSettingsShow.d.ts +13 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/RadioButton.d.ts +12 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/RadioButtonIcon.d.ts +4 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/RadioButtonTag.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/SectionTitle.d.ts +7 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/SelectAndInput.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/StepTitle.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/components/VersionChartExample.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/contract/useCreatePoolSubmit.d.ts +14 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/useCreatePmm.d.ts +26 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/useDefaultTokens.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/useFeeRateList.d.ts +13 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/useSlippageCoefficientList.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/useValidation.d.ts +4 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/hooks/useVersionList.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/index.d.ts +2 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/operate-widgets/BottomButtonGroup.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/operate-widgets/FeeRateSetting.d.ts +7 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/operate-widgets/InitPriceSetting.d.ts +12 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/operate-widgets/SlippageCoefficientSetting.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/operate-widgets/VersionSelect.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/reducer.d.ts +78 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/types.d.ts +35 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolCreate/utils.d.ts +18 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/BaseQuotePie.d.ts +24 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/ChartInfo.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/LiquidityProvidersTable.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/ParametersTable.d.ts +15 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/SwapsTable.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/index.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/Overview.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/StatBarChart.d.ts +10 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/TitleInfo.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/hooks/useLiquidityProviders.d.ts +159 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/hooks/usePoolDashboard.d.ts +290 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/hooks/usePoolDayData.d.ts +166 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/hooks/usePoolSwapList.d.ts +245 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolDetail/index.d.ts +2 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/AddLiquidity.d.ts +12 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/MyCreated.d.ts +11 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/MyLiquidity.d.ts +11 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/AddingOrRemovingBtn.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/FilterAddressTags.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/FilterTokenTags.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/LiquidityTable.d.ts +3 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/LoadingCard.d.ts +5 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.d.ts +18 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/TokenAndPoolFilter.d.ts +9 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/components/TokenListPoolItem.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/hooks/usePoolListFilterChainId.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/hooks/usePoolListFilterTokenAndPool.d.ts +48 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/hooks/usePoolListTabs.d.ts +15 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolList/index.d.ts +2 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolModify/SectionTitle.d.ts +4 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolModify/index.d.ts +2 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolModify/operate-widgets/BottomButtonGroup.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolModify/operate-widgets/FeeRateSetting.d.ts +7 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.d.ts +3 -2
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/PoolOperateInner.d.ts +4 -1
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.d.ts +9 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/ComparePrice.d.ts +9 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.d.ts +10 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/OperateBtn.d.ts +6 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/Ratio.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/SliderPercentageCard.d.ts +8 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/SlippageSetting.d.ts +18 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/components/TokenList.d.ts +12 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/useCheckToken.d.ts +13 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/useComparePrice.d.ts +19 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/useLiquidityOperateAmount.d.ts +4 -2
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/usePercentageRemove.d.ts +26 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.d.ts +1 -1
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.d.ts +3 -1
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/hooks/useRemoveLiquidityTokenStatus.d.ts +33 -0
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/index.d.ts +9 -3
- package/dist/cjs/src/widgets/PoolWidget/PoolOperate/types.d.ts +0 -2
- package/dist/cjs/src/widgets/PoolWidget/hooks/contract/getModifyDPPPoolParams.d.ts +86 -0
- package/dist/cjs/src/widgets/PoolWidget/hooks/contract/useModifyDppPool.d.ts +22 -0
- package/dist/cjs/src/widgets/PoolWidget/hooks/contract/useOperateLiquidity.d.ts +36 -0
- package/dist/cjs/src/widgets/PoolWidget/hooks/contract/useWithdrawInfo.d.ts +33 -0
- package/dist/cjs/src/widgets/PoolWidget/hooks/usePoolBalanceInfo.d.ts +8 -3
- package/dist/cjs/src/widgets/PoolWidget/hooks/usePoolDetail.d.ts +341 -0
- package/dist/cjs/src/widgets/PoolWidget/hooks/usePoolTypeTag.d.ts +16 -0
- package/dist/cjs/src/widgets/PoolWidget/utils.d.ts +4 -7
- package/dist/helper-7cc29594.js +1 -0
- package/dist/index-ae19eed4.js +12 -0
- package/dist/index-d9d9a2cd.js +78 -0
- package/dist/index-db2c9b8f.js +58 -0
- package/dist/index.js +1 -45
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/lottie-f76894b7.js +1 -0
- package/dist/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +1 -2
- package/dist/src/components/Confirm.d.ts +15 -0
- package/dist/src/components/ConnectWallet/NeedConnectButton.d.ts +2 -1
- package/dist/src/components/GoBack.d.ts +6 -0
- package/dist/src/components/HowItWorks.d.ts +11 -0
- package/dist/src/components/RiskDialog.d.ts +7 -0
- package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +1 -3
- package/dist/src/components/Swap/components/Dialog.d.ts +2 -1
- package/dist/src/components/Swap/components/TokenCard/BalanceText.d.ts +4 -2
- package/dist/src/components/Swap/components/TokenCard/NumberInput.d.ts +12 -9
- package/dist/src/components/Swap/components/TokenCard/PercentageSelectButtonGroup.d.ts +7 -0
- package/dist/src/components/Swap/components/TokenCard/TokenLogoCollapse.d.ts +4 -3
- package/dist/src/components/Swap/components/TokenCard/TokenPickerDialog.d.ts +6 -1
- package/dist/src/components/Swap/components/TokenCard/index.d.ts +16 -3
- package/dist/src/components/Swap/index.d.ts +1 -3
- package/dist/src/components/Token/TokenItem.d.ts +9 -0
- package/dist/src/components/TokenLogo.d.ts +3 -1
- package/dist/src/components/TokenLogoPair.d.ts +3 -2
- package/dist/src/components/TokenPicker/TokenItem.d.ts +3 -1
- package/dist/src/components/TokenPicker/index.d.ts +8 -3
- package/dist/src/components/TokenStatusButton.d.ts +7 -0
- package/dist/src/components/Widget/index.d.ts +3 -1
- package/dist/src/components/WidgetConfirm.d.ts +15 -0
- package/dist/src/components/WidgetContainer.d.ts +3 -0
- package/dist/src/components/WidgetDialog.d.ts +15 -0
- package/dist/src/components/chart/components/BaseButton.d.ts +5 -0
- package/dist/src/components/chart/components/Display.d.ts +9 -0
- package/dist/src/components/chart/components/Input.d.ts +7 -0
- package/dist/src/components/chart/components/NumberInput.d.ts +6 -0
- package/dist/src/components/chart/components/TogglePriceIcon.d.ts +8 -0
- package/dist/src/components/chart/components/TokenLogo.d.ts +5 -0
- package/dist/src/components/chart/depth-chart/DepthChartKonva.d.ts +30 -0
- package/dist/src/components/chart/depth-chart/__tests__/utils.test.d.ts +1 -0
- package/dist/src/components/chart/depth-chart/helper.d.ts +125 -0
- package/dist/src/components/chart/depth-chart/index.d.ts +18 -0
- package/dist/src/components/chart/depth-chart/index.styled.d.ts +29 -0
- package/dist/src/components/chart/depth-chart/useDepthLinePoints.d.ts +21 -0
- package/dist/src/components/chart/depth-chart/useGridLinePoints.d.ts +9 -0
- package/dist/src/components/chart/depth-chart/useHorizontalLabelPoints.d.ts +15 -0
- package/dist/src/components/chart/depth-chart/utils.d.ts +19 -0
- package/dist/src/components/chart/depth-chart-v2/index.d.ts +10 -0
- package/dist/src/components/chart/depth-chart-v2/index.styled.d.ts +15 -0
- package/dist/src/components/chart/hooks/usePreventWheel.d.ts +9 -0
- package/dist/src/components/chart/i18n.d.ts +1 -0
- package/dist/src/components/chart/liquidity-chart/LiquidityChartKonva.d.ts +28 -0
- package/dist/src/components/chart/liquidity-chart/__tests__/helper.test.d.ts +1 -0
- package/dist/src/components/chart/liquidity-chart/helper.d.ts +47 -0
- package/dist/src/components/chart/liquidity-chart/index.d.ts +17 -0
- package/dist/src/components/chart/liquidity-chart/index.styled.d.ts +9 -0
- package/dist/src/components/chart/liquidity-chart/useGridLine.d.ts +8 -0
- package/dist/src/components/chart/liquidity-chart/useHorizontalLabel.d.ts +10 -0
- package/dist/src/components/chart/liquidity-chart/useLiquidityLine.d.ts +18 -0
- package/dist/src/components/chart/liquidity-chart/useMiddleLine.d.ts +6 -0
- package/dist/src/components/chart/liquidity-chart/usePoints.d.ts +39 -0
- package/dist/src/components/chart/utils.d.ts +3 -0
- package/dist/src/constants/api.d.ts +5 -0
- package/dist/src/constants/chainList.d.ts +1 -0
- package/dist/src/constants/chains.d.ts +24 -31
- package/dist/src/constants/localstorage.d.ts +2 -0
- package/dist/src/constants/pool.d.ts +5 -0
- package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +2 -1
- package/dist/src/hooks/Submission/types.d.ts +31 -2
- package/dist/src/hooks/Submission/useExecution.d.ts +3 -2
- package/dist/src/hooks/Swap/useFetchFiatPrice.d.ts +3 -3
- package/dist/src/hooks/Token/useTokenList.d.ts +9 -3
- package/dist/src/hooks/Token/useTokenListDefaultToken.d.ts +30 -0
- package/dist/src/hooks/Token/useTokenListFetchBalance.d.ts +5 -2
- package/dist/src/hooks/Token/useTokenStatus.d.ts +4 -1
- package/dist/src/hooks/contract/index.d.ts +0 -2
- package/dist/src/hooks/contract/useFetchETHBalance.d.ts +21 -1
- package/dist/src/hooks/contract/useFetchTokens.d.ts +4 -10
- package/dist/src/hooks/contract/wallet.d.ts +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/providers/GlobalConfigContext.d.ts +14 -0
- package/dist/src/router/index.d.ts +2 -0
- package/dist/src/router/types.d.ts +17 -4
- package/dist/src/store/actions/token.d.ts +1 -8
- package/dist/src/store/actions/wallet.d.ts +2 -0
- package/dist/src/store/index.d.ts +7 -1
- package/dist/src/store/reducers/token.d.ts +0 -7
- package/dist/src/store/reducers/wallet.d.ts +4 -0
- package/dist/src/store/selectors/token.d.ts +0 -10
- package/dist/src/store/selectors/wallet.d.ts +5 -2
- package/dist/src/utils/address.d.ts +2 -2
- package/dist/src/utils/bytes.d.ts +3 -0
- package/dist/src/utils/formatter.d.ts +24 -1
- package/dist/src/utils/token.d.ts +21 -0
- package/dist/src/widgets/MiningWidget/LpTokenMiningOperate/index.d.ts +7 -0
- package/dist/src/widgets/MiningWidget/OperateArea/AssociateMine.d.ts +20 -0
- package/dist/src/widgets/MiningWidget/OperateArea/ClaimButton.d.ts +5 -0
- package/dist/src/widgets/MiningWidget/OperateArea/GetLpLink.d.ts +5 -0
- package/dist/src/widgets/MiningWidget/OperateArea/RewardListCard.d.ts +8 -0
- package/dist/src/widgets/MiningWidget/OperateArea/StakeButton.d.ts +9 -0
- package/dist/src/widgets/MiningWidget/OperateArea/UnstakeButton.d.ts +8 -0
- package/dist/src/widgets/MiningWidget/OperateArea/index.d.ts +13 -0
- package/dist/src/widgets/MiningWidget/helper.d.ts +2 -0
- package/dist/src/widgets/MiningWidget/hooks/useClaimMiningSubmit.d.ts +4 -0
- package/dist/src/widgets/MiningWidget/hooks/useRewardListAmount.d.ts +17 -0
- package/dist/src/widgets/MiningWidget/hooks/useStakeMiningSubmit.d.ts +5 -0
- package/dist/src/widgets/MiningWidget/hooks/useStatusAndStartBlockNumber.d.ts +13 -0
- package/dist/src/widgets/MiningWidget/hooks/useUnstakeMiningSubmit.d.ts +5 -0
- package/dist/src/widgets/MiningWidget/types.d.ts +58 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/ConfirmInfoDialog.d.ts +10 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/DepthAndLiquidityChart.d.ts +11 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/DepthChartWrapper.d.ts +11 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/EmptyChart.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/FeeRateCard.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/FixedInitPriceConfirm.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/LqSettingsShow.d.ts +13 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/RadioButton.d.ts +12 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/RadioButtonIcon.d.ts +4 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/RadioButtonTag.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/SectionTitle.d.ts +7 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/SelectAndInput.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/StepTitle.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/components/VersionChartExample.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/contract/useCreatePoolSubmit.d.ts +14 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/useCreatePmm.d.ts +26 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/useDefaultTokens.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/useFeeRateList.d.ts +13 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/useSlippageCoefficientList.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/useValidation.d.ts +4 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/hooks/useVersionList.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/index.d.ts +2 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/operate-widgets/BottomButtonGroup.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/operate-widgets/FeeRateSetting.d.ts +7 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/operate-widgets/InitPriceSetting.d.ts +12 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/operate-widgets/SlippageCoefficientSetting.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/operate-widgets/VersionSelect.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/reducer.d.ts +78 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/types.d.ts +35 -0
- package/dist/src/widgets/PoolWidget/PoolCreate/utils.d.ts +18 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/BaseQuotePie.d.ts +24 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/ChartInfo.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/LiquidityProvidersTable.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/ParametersTable.d.ts +15 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/SwapsTable.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/MoreDetail/index.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/Overview.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/StatBarChart.d.ts +10 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/TitleInfo.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/components/TotalLiquidity.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/hooks/useLiquidityProviders.d.ts +159 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/hooks/usePoolDashboard.d.ts +290 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/hooks/usePoolDayData.d.ts +166 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/hooks/usePoolSwapList.d.ts +245 -0
- package/dist/src/widgets/PoolWidget/PoolDetail/index.d.ts +2 -0
- package/dist/src/widgets/PoolWidget/PoolList/AddLiquidity.d.ts +12 -0
- package/dist/src/widgets/PoolWidget/PoolList/MyCreated.d.ts +11 -0
- package/dist/src/widgets/PoolWidget/PoolList/MyLiquidity.d.ts +11 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/AddingOrRemovingBtn.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/FilterAddressTags.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/FilterTokenTags.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/LiquidityTable.d.ts +3 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/LoadingCard.d.ts +5 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.d.ts +18 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/TokenAndPoolFilter.d.ts +9 -0
- package/dist/src/widgets/PoolWidget/PoolList/components/TokenListPoolItem.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolList/hooks/usePoolListFilterChainId.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolList/hooks/usePoolListFilterTokenAndPool.d.ts +48 -0
- package/dist/src/widgets/PoolWidget/PoolList/hooks/usePoolListTabs.d.ts +15 -0
- package/dist/src/widgets/PoolWidget/PoolList/index.d.ts +2 -0
- package/dist/src/widgets/PoolWidget/PoolModify/SectionTitle.d.ts +4 -0
- package/dist/src/widgets/PoolWidget/PoolModify/index.d.ts +2 -0
- package/dist/src/widgets/PoolWidget/PoolModify/operate-widgets/BottomButtonGroup.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolModify/operate-widgets/FeeRateSetting.d.ts +7 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/AddPoolOperate.d.ts +3 -2
- package/dist/src/widgets/PoolWidget/PoolOperate/PoolOperateInner.d.ts +4 -1
- package/dist/src/widgets/PoolWidget/PoolOperate/RemovePoolOperate.d.ts +9 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/ComparePrice.d.ts +9 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/LiquidityInfo.d.ts +10 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/OperateBtn.d.ts +6 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/Ratio.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/SliderPercentageCard.d.ts +8 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/SlippageSetting.d.ts +18 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/components/TokenList.d.ts +12 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/useCheckToken.d.ts +13 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/useComparePrice.d.ts +19 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/useLiquidityOperateAmount.d.ts +4 -2
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/usePercentageRemove.d.ts +26 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOperateTabs.d.ts +1 -1
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/usePoolOrMiningTabs.d.ts +3 -1
- package/dist/src/widgets/PoolWidget/PoolOperate/hooks/useRemoveLiquidityTokenStatus.d.ts +33 -0
- package/dist/src/widgets/PoolWidget/PoolOperate/index.d.ts +9 -3
- package/dist/src/widgets/PoolWidget/PoolOperate/types.d.ts +0 -2
- package/dist/src/widgets/PoolWidget/hooks/contract/getModifyDPPPoolParams.d.ts +86 -0
- package/dist/src/widgets/PoolWidget/hooks/contract/useModifyDppPool.d.ts +22 -0
- package/dist/src/widgets/PoolWidget/hooks/contract/useOperateLiquidity.d.ts +36 -0
- package/dist/src/widgets/PoolWidget/hooks/contract/useWithdrawInfo.d.ts +33 -0
- package/dist/src/widgets/PoolWidget/hooks/usePoolBalanceInfo.d.ts +8 -3
- package/dist/src/widgets/PoolWidget/hooks/usePoolDetail.d.ts +341 -0
- package/dist/src/widgets/PoolWidget/hooks/usePoolTypeTag.d.ts +16 -0
- package/dist/src/widgets/PoolWidget/utils.d.ts +4 -7
- package/package.json +12 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PoolType } from '@dodoex/api';
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
import { TokenInfo } from '../../../../hooks/Token';
|
|
4
|
+
import { usePoolBalanceInfo } from '../usePoolBalanceInfo';
|
|
5
|
+
export interface SubmitLiquidityParams {
|
|
6
|
+
balanceInfo?: ReturnType<typeof usePoolBalanceInfo>;
|
|
7
|
+
baseAmount: string;
|
|
8
|
+
quoteAmount: string;
|
|
9
|
+
slippageProtection: number;
|
|
10
|
+
SLIPPAGE_PROTECTION: number;
|
|
11
|
+
txTitle: string;
|
|
12
|
+
isRemove?: boolean;
|
|
13
|
+
submittedBack?: () => void;
|
|
14
|
+
successBack?: () => void;
|
|
15
|
+
withdrawInfo?: {
|
|
16
|
+
withdrawFee: string;
|
|
17
|
+
receiveBaseAmount: string;
|
|
18
|
+
receiveQuoteAmount: string;
|
|
19
|
+
receiveAmountBg: BigNumber | undefined;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const useOperateLiquidity: (pool?: {
|
|
23
|
+
chainId: number;
|
|
24
|
+
address: string;
|
|
25
|
+
type: PoolType;
|
|
26
|
+
baseToken: TokenInfo;
|
|
27
|
+
quoteToken: TokenInfo;
|
|
28
|
+
baseLpToken?: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
quoteLpToken?: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}) => {
|
|
35
|
+
operateLiquidityMutation: import("@tanstack/react-query/build/legacy/types").UseMutationResult<void, Error, SubmitLiquidityParams, unknown>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PoolType } from '@dodoex/api';
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
export declare const useWithdrawInfo: ({ pool, isBase, baseAmount, quoteAmount, }: {
|
|
4
|
+
pool?: {
|
|
5
|
+
chainId: number;
|
|
6
|
+
address: string;
|
|
7
|
+
type: PoolType;
|
|
8
|
+
baseToken: {
|
|
9
|
+
symbol: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
};
|
|
12
|
+
quoteToken: {
|
|
13
|
+
symbol: string;
|
|
14
|
+
decimals: number;
|
|
15
|
+
};
|
|
16
|
+
} | undefined;
|
|
17
|
+
isBase?: boolean | undefined;
|
|
18
|
+
baseAmount: string;
|
|
19
|
+
quoteAmount: string;
|
|
20
|
+
}) => {
|
|
21
|
+
withdrawFee: string;
|
|
22
|
+
baseWithdrawFee: string;
|
|
23
|
+
quoteWithdrawFee: string;
|
|
24
|
+
receiveBaseAmount: string;
|
|
25
|
+
receiveQuoteAmount: string;
|
|
26
|
+
receiveAmountBg: BigNumber | undefined;
|
|
27
|
+
receiveList: {
|
|
28
|
+
amount: string;
|
|
29
|
+
symbol: string;
|
|
30
|
+
}[];
|
|
31
|
+
loading: boolean;
|
|
32
|
+
error: Error | null;
|
|
33
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { PoolType } from '@dodoex/api';
|
|
2
2
|
import { BigNumber } from 'bignumber.js';
|
|
3
|
-
import { ChainId } from '../../../constants/chains';
|
|
4
3
|
import { TokenInfo } from '../../../hooks/Token';
|
|
5
4
|
declare type Balance = BigNumber | null | undefined;
|
|
6
|
-
export declare function
|
|
7
|
-
|
|
5
|
+
export declare function getLpToTokenBalance(userLpBalance: Balance, totalLpBalance: Balance, reserve: Balance, target: Balance, address: string | undefined, type: PoolType | undefined, decimals: number | undefined): BigNumber | null | undefined;
|
|
6
|
+
export declare function usePoolBalanceInfo({ account, pool, }: {
|
|
8
7
|
account?: string;
|
|
9
8
|
pool?: {
|
|
10
9
|
address: string;
|
|
@@ -34,10 +33,16 @@ export declare function usePoolBalanceInfo({ chainId, account, pool, }: {
|
|
|
34
33
|
userBaseLpToTokenBalance: BigNumber | null | undefined;
|
|
35
34
|
/** The number of quote that can be obtained when a user withdraws from the pool */
|
|
36
35
|
userQuoteLpToTokenBalance: BigNumber | null | undefined;
|
|
36
|
+
baseLpToTokenProportion: BigNumber | undefined;
|
|
37
|
+
quoteLpToTokenProportion: BigNumber | undefined;
|
|
38
|
+
isSinglePool: boolean;
|
|
37
39
|
userLpBalanceLoading: boolean;
|
|
38
40
|
userLpToTokenBalanceLoading: boolean;
|
|
39
41
|
userLpBalanceError: boolean;
|
|
40
42
|
userLpToTokenBalanceError: boolean;
|
|
41
43
|
userLpToTokenBalanceRefetch: () => void;
|
|
44
|
+
error: boolean;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
refetch: () => void;
|
|
42
47
|
};
|
|
43
48
|
export {};
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { ChainId, PoolType } from '@dodoex/api';
|
|
2
|
+
import { TokenInfo } from '../../../hooks/Token';
|
|
3
|
+
export declare function usePoolDetail({ id, chainId, }: {
|
|
4
|
+
id: string | undefined;
|
|
5
|
+
chainId: ChainId | undefined;
|
|
6
|
+
}): {
|
|
7
|
+
poolDetail: {
|
|
8
|
+
address: string;
|
|
9
|
+
type: PoolType;
|
|
10
|
+
chainId: ChainId;
|
|
11
|
+
baseToken: TokenInfo;
|
|
12
|
+
quoteToken: TokenInfo;
|
|
13
|
+
miningAddress: string;
|
|
14
|
+
baseApy: string | undefined;
|
|
15
|
+
quoteApy: string | undefined;
|
|
16
|
+
isCpPool: boolean;
|
|
17
|
+
cpAddress: string | undefined;
|
|
18
|
+
cpLiquidator: string | undefined;
|
|
19
|
+
cpCreator: string | undefined;
|
|
20
|
+
cpCreatedAtTimestamp: string | undefined;
|
|
21
|
+
id: string;
|
|
22
|
+
creator: any;
|
|
23
|
+
owner?: any;
|
|
24
|
+
traderCount: any;
|
|
25
|
+
volumeBaseToken: any;
|
|
26
|
+
volumeQuoteToken: any;
|
|
27
|
+
volumeUSD: any;
|
|
28
|
+
feeBase: any;
|
|
29
|
+
feeQuote: any;
|
|
30
|
+
mtFeeRate: any;
|
|
31
|
+
lpFeeRate: any;
|
|
32
|
+
i?: any;
|
|
33
|
+
k?: any;
|
|
34
|
+
baseReserve: any;
|
|
35
|
+
quoteReserve: any;
|
|
36
|
+
createdAtTimestamp: any;
|
|
37
|
+
lastTradePrice: any;
|
|
38
|
+
baseLpToken?: {
|
|
39
|
+
id: string;
|
|
40
|
+
symbol: string;
|
|
41
|
+
name: string;
|
|
42
|
+
} | null | undefined;
|
|
43
|
+
quoteLpToken?: {
|
|
44
|
+
id: string;
|
|
45
|
+
symbol: string;
|
|
46
|
+
name: string;
|
|
47
|
+
} | null | undefined;
|
|
48
|
+
} | null;
|
|
49
|
+
data: import("@dodoex/api/dist/gql/graphql").FetchPoolQuery;
|
|
50
|
+
error: Error;
|
|
51
|
+
isError: true;
|
|
52
|
+
isPending: false;
|
|
53
|
+
isLoading: false;
|
|
54
|
+
isLoadingError: false;
|
|
55
|
+
isRefetchError: true;
|
|
56
|
+
isSuccess: false;
|
|
57
|
+
status: "error";
|
|
58
|
+
dataUpdatedAt: number;
|
|
59
|
+
errorUpdatedAt: number;
|
|
60
|
+
failureCount: number;
|
|
61
|
+
failureReason: Error | null;
|
|
62
|
+
errorUpdateCount: number;
|
|
63
|
+
isFetched: boolean;
|
|
64
|
+
isFetchedAfterMount: boolean;
|
|
65
|
+
isFetching: boolean;
|
|
66
|
+
isInitialLoading: boolean;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
isPlaceholderData: boolean;
|
|
69
|
+
isRefetching: boolean;
|
|
70
|
+
isStale: boolean;
|
|
71
|
+
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa")._ | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").ae<import("@dodoex/api/dist/gql/graphql").FetchPoolQuery, Error>>;
|
|
72
|
+
fetchStatus: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").a6;
|
|
73
|
+
} | {
|
|
74
|
+
poolDetail: {
|
|
75
|
+
address: string;
|
|
76
|
+
type: PoolType;
|
|
77
|
+
chainId: ChainId;
|
|
78
|
+
baseToken: TokenInfo;
|
|
79
|
+
quoteToken: TokenInfo;
|
|
80
|
+
miningAddress: string;
|
|
81
|
+
baseApy: string | undefined;
|
|
82
|
+
quoteApy: string | undefined;
|
|
83
|
+
isCpPool: boolean;
|
|
84
|
+
cpAddress: string | undefined;
|
|
85
|
+
cpLiquidator: string | undefined;
|
|
86
|
+
cpCreator: string | undefined;
|
|
87
|
+
cpCreatedAtTimestamp: string | undefined;
|
|
88
|
+
id: string;
|
|
89
|
+
creator: any;
|
|
90
|
+
owner?: any;
|
|
91
|
+
traderCount: any;
|
|
92
|
+
volumeBaseToken: any;
|
|
93
|
+
volumeQuoteToken: any;
|
|
94
|
+
volumeUSD: any;
|
|
95
|
+
feeBase: any;
|
|
96
|
+
feeQuote: any;
|
|
97
|
+
mtFeeRate: any;
|
|
98
|
+
lpFeeRate: any;
|
|
99
|
+
i?: any;
|
|
100
|
+
k?: any;
|
|
101
|
+
baseReserve: any;
|
|
102
|
+
quoteReserve: any;
|
|
103
|
+
createdAtTimestamp: any;
|
|
104
|
+
lastTradePrice: any;
|
|
105
|
+
baseLpToken?: {
|
|
106
|
+
id: string;
|
|
107
|
+
symbol: string;
|
|
108
|
+
name: string;
|
|
109
|
+
} | null | undefined;
|
|
110
|
+
quoteLpToken?: {
|
|
111
|
+
id: string;
|
|
112
|
+
symbol: string;
|
|
113
|
+
name: string;
|
|
114
|
+
} | null | undefined;
|
|
115
|
+
} | null;
|
|
116
|
+
data: import("@dodoex/api/dist/gql/graphql").FetchPoolQuery;
|
|
117
|
+
error: null;
|
|
118
|
+
isError: false;
|
|
119
|
+
isPending: false;
|
|
120
|
+
isLoading: false;
|
|
121
|
+
isLoadingError: false;
|
|
122
|
+
isRefetchError: false;
|
|
123
|
+
isSuccess: true;
|
|
124
|
+
status: "success";
|
|
125
|
+
dataUpdatedAt: number;
|
|
126
|
+
errorUpdatedAt: number;
|
|
127
|
+
failureCount: number;
|
|
128
|
+
failureReason: Error | null;
|
|
129
|
+
errorUpdateCount: number;
|
|
130
|
+
isFetched: boolean;
|
|
131
|
+
isFetchedAfterMount: boolean;
|
|
132
|
+
isFetching: boolean;
|
|
133
|
+
isInitialLoading: boolean;
|
|
134
|
+
isPaused: boolean;
|
|
135
|
+
isPlaceholderData: boolean;
|
|
136
|
+
isRefetching: boolean;
|
|
137
|
+
isStale: boolean;
|
|
138
|
+
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa")._ | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").ae<import("@dodoex/api/dist/gql/graphql").FetchPoolQuery, Error>>;
|
|
139
|
+
fetchStatus: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").a6;
|
|
140
|
+
} | {
|
|
141
|
+
poolDetail: {
|
|
142
|
+
address: string;
|
|
143
|
+
type: PoolType;
|
|
144
|
+
chainId: ChainId;
|
|
145
|
+
baseToken: TokenInfo;
|
|
146
|
+
quoteToken: TokenInfo;
|
|
147
|
+
miningAddress: string;
|
|
148
|
+
baseApy: string | undefined;
|
|
149
|
+
quoteApy: string | undefined;
|
|
150
|
+
isCpPool: boolean;
|
|
151
|
+
cpAddress: string | undefined;
|
|
152
|
+
cpLiquidator: string | undefined;
|
|
153
|
+
cpCreator: string | undefined;
|
|
154
|
+
cpCreatedAtTimestamp: string | undefined;
|
|
155
|
+
id: string;
|
|
156
|
+
creator: any;
|
|
157
|
+
owner?: any;
|
|
158
|
+
traderCount: any;
|
|
159
|
+
volumeBaseToken: any;
|
|
160
|
+
volumeQuoteToken: any;
|
|
161
|
+
volumeUSD: any;
|
|
162
|
+
feeBase: any;
|
|
163
|
+
feeQuote: any;
|
|
164
|
+
mtFeeRate: any;
|
|
165
|
+
lpFeeRate: any;
|
|
166
|
+
i?: any;
|
|
167
|
+
k?: any;
|
|
168
|
+
baseReserve: any;
|
|
169
|
+
quoteReserve: any;
|
|
170
|
+
createdAtTimestamp: any;
|
|
171
|
+
lastTradePrice: any;
|
|
172
|
+
baseLpToken?: {
|
|
173
|
+
id: string;
|
|
174
|
+
symbol: string;
|
|
175
|
+
name: string;
|
|
176
|
+
} | null | undefined;
|
|
177
|
+
quoteLpToken?: {
|
|
178
|
+
id: string;
|
|
179
|
+
symbol: string;
|
|
180
|
+
name: string;
|
|
181
|
+
} | null | undefined;
|
|
182
|
+
} | null;
|
|
183
|
+
data: undefined;
|
|
184
|
+
error: Error;
|
|
185
|
+
isError: true;
|
|
186
|
+
isPending: false;
|
|
187
|
+
isLoading: false;
|
|
188
|
+
isLoadingError: true;
|
|
189
|
+
isRefetchError: false;
|
|
190
|
+
isSuccess: false;
|
|
191
|
+
status: "error";
|
|
192
|
+
dataUpdatedAt: number;
|
|
193
|
+
errorUpdatedAt: number;
|
|
194
|
+
failureCount: number;
|
|
195
|
+
failureReason: Error | null;
|
|
196
|
+
errorUpdateCount: number;
|
|
197
|
+
isFetched: boolean;
|
|
198
|
+
isFetchedAfterMount: boolean;
|
|
199
|
+
isFetching: boolean;
|
|
200
|
+
isInitialLoading: boolean;
|
|
201
|
+
isPaused: boolean;
|
|
202
|
+
isPlaceholderData: boolean;
|
|
203
|
+
isRefetching: boolean;
|
|
204
|
+
isStale: boolean;
|
|
205
|
+
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa")._ | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").ae<import("@dodoex/api/dist/gql/graphql").FetchPoolQuery, Error>>;
|
|
206
|
+
fetchStatus: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").a6;
|
|
207
|
+
} | {
|
|
208
|
+
poolDetail: {
|
|
209
|
+
address: string;
|
|
210
|
+
type: PoolType;
|
|
211
|
+
chainId: ChainId;
|
|
212
|
+
baseToken: TokenInfo;
|
|
213
|
+
quoteToken: TokenInfo;
|
|
214
|
+
miningAddress: string;
|
|
215
|
+
baseApy: string | undefined;
|
|
216
|
+
quoteApy: string | undefined;
|
|
217
|
+
isCpPool: boolean;
|
|
218
|
+
cpAddress: string | undefined;
|
|
219
|
+
cpLiquidator: string | undefined;
|
|
220
|
+
cpCreator: string | undefined;
|
|
221
|
+
cpCreatedAtTimestamp: string | undefined;
|
|
222
|
+
id: string;
|
|
223
|
+
creator: any;
|
|
224
|
+
owner?: any;
|
|
225
|
+
traderCount: any;
|
|
226
|
+
volumeBaseToken: any;
|
|
227
|
+
volumeQuoteToken: any;
|
|
228
|
+
volumeUSD: any;
|
|
229
|
+
feeBase: any;
|
|
230
|
+
feeQuote: any;
|
|
231
|
+
mtFeeRate: any;
|
|
232
|
+
lpFeeRate: any;
|
|
233
|
+
i?: any;
|
|
234
|
+
k?: any;
|
|
235
|
+
baseReserve: any;
|
|
236
|
+
quoteReserve: any;
|
|
237
|
+
createdAtTimestamp: any;
|
|
238
|
+
lastTradePrice: any;
|
|
239
|
+
baseLpToken?: {
|
|
240
|
+
id: string;
|
|
241
|
+
symbol: string;
|
|
242
|
+
name: string;
|
|
243
|
+
} | null | undefined;
|
|
244
|
+
quoteLpToken?: {
|
|
245
|
+
id: string;
|
|
246
|
+
symbol: string;
|
|
247
|
+
name: string;
|
|
248
|
+
} | null | undefined;
|
|
249
|
+
} | null;
|
|
250
|
+
data: undefined;
|
|
251
|
+
error: null;
|
|
252
|
+
isError: false;
|
|
253
|
+
isPending: true;
|
|
254
|
+
isLoading: true;
|
|
255
|
+
isLoadingError: false;
|
|
256
|
+
isRefetchError: false;
|
|
257
|
+
isSuccess: false;
|
|
258
|
+
status: "pending";
|
|
259
|
+
dataUpdatedAt: number;
|
|
260
|
+
errorUpdatedAt: number;
|
|
261
|
+
failureCount: number;
|
|
262
|
+
failureReason: Error | null;
|
|
263
|
+
errorUpdateCount: number;
|
|
264
|
+
isFetched: boolean;
|
|
265
|
+
isFetchedAfterMount: boolean;
|
|
266
|
+
isFetching: boolean;
|
|
267
|
+
isInitialLoading: boolean;
|
|
268
|
+
isPaused: boolean;
|
|
269
|
+
isPlaceholderData: boolean;
|
|
270
|
+
isRefetching: boolean;
|
|
271
|
+
isStale: boolean;
|
|
272
|
+
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa")._ | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").ae<import("@dodoex/api/dist/gql/graphql").FetchPoolQuery, Error>>;
|
|
273
|
+
fetchStatus: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").a6;
|
|
274
|
+
} | {
|
|
275
|
+
poolDetail: {
|
|
276
|
+
address: string;
|
|
277
|
+
type: PoolType;
|
|
278
|
+
chainId: ChainId;
|
|
279
|
+
baseToken: TokenInfo;
|
|
280
|
+
quoteToken: TokenInfo;
|
|
281
|
+
miningAddress: string;
|
|
282
|
+
baseApy: string | undefined;
|
|
283
|
+
quoteApy: string | undefined;
|
|
284
|
+
isCpPool: boolean;
|
|
285
|
+
cpAddress: string | undefined;
|
|
286
|
+
cpLiquidator: string | undefined;
|
|
287
|
+
cpCreator: string | undefined;
|
|
288
|
+
cpCreatedAtTimestamp: string | undefined;
|
|
289
|
+
id: string;
|
|
290
|
+
creator: any;
|
|
291
|
+
owner?: any;
|
|
292
|
+
traderCount: any;
|
|
293
|
+
volumeBaseToken: any;
|
|
294
|
+
volumeQuoteToken: any;
|
|
295
|
+
volumeUSD: any;
|
|
296
|
+
feeBase: any;
|
|
297
|
+
feeQuote: any;
|
|
298
|
+
mtFeeRate: any;
|
|
299
|
+
lpFeeRate: any;
|
|
300
|
+
i?: any;
|
|
301
|
+
k?: any;
|
|
302
|
+
baseReserve: any;
|
|
303
|
+
quoteReserve: any;
|
|
304
|
+
createdAtTimestamp: any;
|
|
305
|
+
lastTradePrice: any;
|
|
306
|
+
baseLpToken?: {
|
|
307
|
+
id: string;
|
|
308
|
+
symbol: string;
|
|
309
|
+
name: string;
|
|
310
|
+
} | null | undefined;
|
|
311
|
+
quoteLpToken?: {
|
|
312
|
+
id: string;
|
|
313
|
+
symbol: string;
|
|
314
|
+
name: string;
|
|
315
|
+
} | null | undefined;
|
|
316
|
+
} | null;
|
|
317
|
+
data: undefined;
|
|
318
|
+
error: null;
|
|
319
|
+
isError: false;
|
|
320
|
+
isPending: true;
|
|
321
|
+
isLoadingError: false;
|
|
322
|
+
isRefetchError: false;
|
|
323
|
+
isSuccess: false;
|
|
324
|
+
status: "pending";
|
|
325
|
+
dataUpdatedAt: number;
|
|
326
|
+
errorUpdatedAt: number;
|
|
327
|
+
failureCount: number;
|
|
328
|
+
failureReason: Error | null;
|
|
329
|
+
errorUpdateCount: number;
|
|
330
|
+
isFetched: boolean;
|
|
331
|
+
isFetchedAfterMount: boolean;
|
|
332
|
+
isFetching: boolean;
|
|
333
|
+
isLoading: boolean;
|
|
334
|
+
isInitialLoading: boolean;
|
|
335
|
+
isPaused: boolean;
|
|
336
|
+
isPlaceholderData: boolean;
|
|
337
|
+
isRefetching: boolean;
|
|
338
|
+
isStale: boolean;
|
|
339
|
+
refetch: (options?: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa")._ | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").ae<import("@dodoex/api/dist/gql/graphql").FetchPoolQuery, Error>>;
|
|
340
|
+
fetchStatus: import("@tanstack/query-core/build/legacy/queryClient-MRqjmcFa").a6;
|
|
341
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PoolType } from '@dodoex/api';
|
|
2
|
+
import { Theme } from '@dodoex/components';
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
4
|
+
export declare const getPoolTypeTag: (type: PoolType, quoteReserve: BigNumber | undefined | null, theme: Theme) => {
|
|
5
|
+
typeLabel: string;
|
|
6
|
+
typeColor: any;
|
|
7
|
+
typeBgColor: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const usePoolTypeTag: ({ type, quoteReserve, }: {
|
|
10
|
+
type: PoolType;
|
|
11
|
+
quoteReserve: BigNumber | undefined | null;
|
|
12
|
+
}) => {
|
|
13
|
+
typeLabel: string;
|
|
14
|
+
typeColor: any;
|
|
15
|
+
typeBgColor: string;
|
|
16
|
+
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { PoolApi, ExcludeNone
|
|
1
|
+
import { PoolApi, ExcludeNone } from '@dodoex/api';
|
|
2
2
|
import { ChainId } from '../../constants/chains';
|
|
3
3
|
import { TokenInfo } from '../../hooks/Token';
|
|
4
4
|
import { OperatePool } from './PoolOperate/types';
|
|
5
5
|
export declare const poolApi: PoolApi;
|
|
6
6
|
export declare type FetchLiquidityListLqList = ExcludeNone<ReturnType<Exclude<typeof PoolApi.graphql.fetchLiquidityList['__apiType'], undefined>>['liquidity_list']>['lqList'];
|
|
7
|
+
export declare type FetchMyLiquidityListLqList = ExcludeNone<ReturnType<Exclude<typeof PoolApi.graphql.fetchMyLiquidityList['__apiType'], undefined>>['liquidity_list']>['lqList'];
|
|
8
|
+
export declare type FetchPoolList = ExcludeNone<ReturnType<Exclude<typeof PoolApi.graphql.fetchPoolList['__apiType'], undefined>>['pairs']>;
|
|
7
9
|
export declare function convertLiquidityTokenToTokenInfo(token: {
|
|
8
10
|
id: string;
|
|
9
11
|
symbol: string;
|
|
10
12
|
name: string;
|
|
11
13
|
decimals: number;
|
|
12
|
-
usdPrice: number;
|
|
13
14
|
logoImg?: string | null;
|
|
14
15
|
} | undefined, chainId: ChainId | number): TokenInfo | undefined;
|
|
15
|
-
export declare function canOperatePool(account: string | undefined, { owner, creator, type, }: {
|
|
16
|
-
owner?: string | null;
|
|
17
|
-
creator?: string | null;
|
|
18
|
-
type?: PoolType;
|
|
19
|
-
}): boolean;
|
|
20
16
|
export declare function convertFetchLiquidityToOperateData(lqData: ExcludeNone<FetchLiquidityListLqList>[0]): OperatePool;
|
|
17
|
+
export declare function convertFetchPoolToOperateData(pool: FetchPoolList[0], chainId: number): OperatePool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-db2c9b8f.js";function o(t,i){switch(t){case"depth-chart.tips.buy":return e._({id:"q+Q952",message:"Users pay {0} {1} and receive {2} {3}\\nPrice {4} ({5}%)",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol,4:i.priceText,5:i.slippageText}});case"depth-chart.tips.mid-price":return e._({id:"cnbRVW",message:"Initial Price {0} {1} = {2} {3}",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol}});case"depth-chart.tips.sell":return e._({id:"q+Q952",message:"Users pay {0} {1} and receive {2} {3}\\nPrice {4} ({5}%)",values:{0:i.oppositeAmountText,1:i.quoteTokenSymbol,2:i.amountText,3:i.baseTokenSymbol,4:i.priceText,5:i.slippageText}});case"pool.chart.buy-amount":return e._({id:"TaScUS",message:"Users sell {0} amount:",values:{0:i.symbol}});case"pool.chart.price-impact":return e._({id:"I0LXan",message:"Price Impact: {0}",values:{0:i.amount}});case"pool.chart.sell-amount":return e._({id:"F2vX4t",message:"Users buy {0} amount:",values:{0:i.symbol}});case"pool.create.disabled-token-amount":return e._({id:"5QDjef",message:"The token amount is calculated by initial price."});case"pool.create.set-pool.emulator.title":return e._({id:"FQfStS",message:"Emulator"});case"pool.create.set-pool.emulator.title.question":return e._({id:"9D2g7k",message:"The liquidity of DODO is continuous, which is different from the discrete liquidity of UniV3. The ticks shown in the illustration are for demonstration purposes only."});case"pool.chart.liquidity-chart-tip":return e._({id:"YvXHDU",message:"The area of the chart indicates the buy/sell volume of {0} that can be carried by the market when the current price changes to the hover price.",values:{0:i.baseTokenSymbol}});case"pool.chart.liquidity-chart-buy":return e._({id:"TvH4Ym",message:"Bought {0} {1}, price in the pool decreased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});case"pool.chart.liquidity-chart-sell":return e._({id:"0O1wzf",message:"Traders sold {0} {1}, price in the pool increased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});default:throw new Error(`Unknown key ${t}`)}}const l=12,n=18;function s(e){let t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){let e="#";for(let i=1;i<4;i+=1)e+=t.slice(i,i+1).concat(t.slice(i,i+1));t=e}const e=[];for(let i=1;i<7;i+=2)e.push(parseInt(`0x${t.slice(i,i+2)}`));return e.join(",")}return t}function r({val:e,model:i}){let o=e;if(e.isNaN())return{side:"no-one",vert:new t(0),base:new t(0),quote:new t(0)};i.Q0.eq(0)&&e.lt(i.i)&&(o=i.i),i.B0.eq(0)&&e.gt(i.i)&&(o=i.i);const l=i.getPriceDepth(o),n=l.baseAmount,s=l.quoteAmount,{isBuy:r}=l;return{side:r?"ask":"bid",vert:r?n:s,base:n,quote:s}}function a({midPrice:e,q:i,q0:o,pmmModel:l}){let n=t.maximum(i,o,l.B.multipliedBy(e));return n.isNaN()&&(n=new t(10)),n.eq(0)&&(n=new t(1)),{buyBaseVert:n.multipliedBy(1.2),sellBaseVert:n.div(e).multipliedBy(1.2)}}function u(e,i=1){return new t(i).div(e/2)}function m({tooltip:e,x:o,chartWidth:l,chartHeight:n,buyBaseVert:a,sellBaseVert:m,pmmModel:p,midPrice:d,baseTokenSymbol:c,quoteTokenSymbol:h,t:b,baseMinAndZoomMultiples:f,isHover:y,color:g,leftColor:T,rightColor:x}){const{zoomMultiples:v,baseMin:w}=f,k=u(l,v),M=a.div(n),B=m.div(n),q=2*v,S=w.multipliedBy(10**k.multipliedBy(o).toNumber());let N=new t(Math.log(d.div(w).toNumber())/Math.log(10));N=t.minimum(q,N),N=t.maximum(0,N);const P=N.div(k),X=r({val:S,model:p,midPrice:d});if(X.vert.isNaN())return;const A=S.lt(d);let _=n-X.vert.div(M).toNumber();A||(_=n-X.vert.div(B).toNumber());const z=i(S),O=i(X.vert),$=S.minus(d).abs().div(d).multipliedBy(100).toFixed(2),D=P.toNumber(),H=e.findOne("#toolTipVertLine"),L=e.findOne("#toolTipHoriLine"),U=e.findOne("#joinCircle"),V=e.findOne("#toolTip"),j=e.findOne("#priceTextLabel"),W=e.findOne("#slippageTextLabel");if(!V)return;V.x(o),V.y(_-5-6);const Y=V.getText(),F=V.getTag();let I="ask"===X.side?i(X.quote):i(X.base);const Q=p.k.lte(0);Q&&(I=O);const C=i(d),Z={amountText:O,baseTokenSymbol:c,oppositeAmountText:I,quoteTokenSymbol:h,priceText:Q?C:z,slippageText:`${A?"-":"+"}${$}`};if(P.minus(4).lte(o)&&P.plus(2).gte(o)&&y)Y.text(b("depth-chart.tips.mid-price",{amountText:1,baseTokenSymbol:c,oppositeAmountText:C,quoteTokenSymbol:h})),V.x(D),V.y(n/2),null==H||H.hide(),null==L||L.hide(),null==U||U.hide(),null==j||j.hide(),null==W||W.hide();else{Y.text(A?b("depth-chart.tips.buy",{amountText:I,baseTokenSymbol:c,oppositeAmountText:O,quoteTokenSymbol:h,priceText:Q?C:z,slippageText:`${A?"-":"+"}${$}`}):b("depth-chart.tips.sell",Z));const e=g||(A?"#55f6db":"#ff4f73"),t=A?T||"#55f6db":x||"#ff4f73";Y.fill(e),V.width()/2>o?(F.pointerDirection("left"),F.pointerHeight(15),F.pointerWidth(8),V.offsetX(-11),V.offsetY(-11)):V.width()/2+o>l?(F.pointerDirection("right"),F.pointerHeight(15),F.pointerWidth(8),V.offsetX(11),V.offsetY(-11)):(F.pointerDirection("down"),F.pointerHeight(8),F.pointerWidth(15),V.offsetX(0),V.offsetY(0)),null==H||H.points([o,n,o,_]),null==H||H.stroke(t),null==L||L.points(A?[o,_,D,_]:[D,_,o,_]),null==L||L.stroke(t),null==U||U.x(o),null==U||U.y(_),null==U||U.fill(A?T||"rgb(86, 246, 218)":x||"#FF5072"),null==U||U.stroke(A?T?`rgba(${s(T)}, 0.4)`:"rgba(86, 246, 218, 0.3)":x?`rgba(${s(x)}, 0.4)`:"rgba(255, 80, 114, 0.3)"),j&&(j.x(o),j.y(n),j.offsetX(j.width()/2),j.x()-j.width()/2<0?j.x(j.width()/2):j.x()+j.width()/2>l?j.x(l-j.width()/2):j.x(o));const i=null==j?void 0:j.findOne("#priceTextLabel-text");i&&(i.fill(e),i.text(z)),W&&(W.x(A?o+(D-o)/2:o-(o-D)/2),W.y(_),W.offsetY(W.height()/2),W.offsetX(W.width()/2));const r=null==W?void 0:W.findOne("#slippageTextLabel-text");r&&(r.fill(e),r.text(`${A?"-":"+"}${$}%`)),null==H||H.show(),null==L||L.show(),null==U||U.show(),null==j||j.show(),null==W||W.show()}e.show()}function p({dragDistance:e,prevBaseMin:i,chartWidth:o,zoomMultiples:l}){const n=u(o,l);return e>0?i.multipliedBy(1-n.multipliedBy(e).toNumber()):i.multipliedBy(10**n.multipliedBy(new t(e).abs()).plus(0).toNumber())}const d=1;function c({prevZoomMultiples:e,zoomIn:t}){return!t&&e<=.1?e:t?e+.1:e-.1}function h({type:e,targetPrice:i,midPrice:o,width:l}){if("sell"===e){return{zoomMultiples:new t(Math.log10(i.div(o).toNumber())).minus(0).div(3/4).abs(),targetX:l/2*(3/4)+l/2}}const n=new t(Math.log10(i.div(o).toNumber()));return{zoomMultiples:new t(0).minus(n).div(3/4).abs(),targetX:l/2*(1/4)}}function b({currentBaseMinAndZoomMultiples:e,targetPrice:i,midPrice:o,width:l}){const{baseMin:n,zoomMultiples:s}=e,r=new t(Math.log10(n.div(o).toNumber())),a=r.plus(2*s),u=new t(o.multipliedBy(10**a.toNumber()));if(i.gte(n)&&i.lte(u)){return{isSkip:!0,targetX:new t(Math.log10(i.div(o).toNumber())).minus(r).div(2*s).multipliedBy(l).toNumber(),baseMin:new t(0),zoomMultiples:1}}const m=new t(o.multipliedBy(.1)),p=new t(o.multipliedBy(10));if(i.gte(m)&&i.lte(p)){return{isSkip:!1,targetX:new t(Math.log10(i.div(o).toNumber())).minus(-1).div(2).multipliedBy(l).toNumber(),baseMin:m,zoomMultiples:1}}return{isSkip:!1,targetX:-1,baseMin:new t(0),zoomMultiples:1}}function f({midPrice:e,zoomMultiples:t}){return e.multipliedBy(10**-t)}export{a,p as b,u as c,c as d,r as e,f,o as g,n as h,d as i,b as j,h as k,l,s as m,m as u};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import t from"@emotion/styled";import{merge as e}from"lodash";import{useMemo as i,useRef as r}from"react";import{l as n,g as o,m as l}from"./helper-7cc29594.js";import{Line as s,Text as a,Stage as d,Layer as p,Rect as g,Circle as m,Label as u,Tag as h}from"react-konva";import{j as c,f as x}from"./index-db2c9b8f.js";import f from"bignumber.js";import{solveQuadraticFunctionForTarget as L,PMMState as b,PMMHelper as w}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/icons";import"react-dom";import"react-redux";import"identicon.js";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@reduxjs/toolkit";import"redux";import"@tanstack/react-query";import"react-window";import"@ethersproject/bignumber";import"dayjs";import"axios";import"zustand";import"react-infinite-scroller";import"@emotion/react";import"recharts";const A=t.div`
|
|
2
|
+
height: 100%;
|
|
3
|
+
position: relative;
|
|
4
|
+
`,y=t.div`
|
|
5
|
+
text-align: center;
|
|
6
|
+
margin-top: 17.1px;
|
|
7
|
+
margin-bottom: 88.41px;
|
|
8
|
+
color: #606066;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
line-height: 17px;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
`;function N({maxHeight:t,gridAreaHeight:e,value:i}){const r=new f(e).minus(36),n=r.div(t);return r.minus(i.multipliedBy(n)).plus(36).toNumber()}function P({targetPrice:t,areaPoints:e,isLeft:i}){for(let r=0;r<e.length;r++){const n=e[r],o=r<e.length-1?e[r+1]:null;if(!o)return{targetAreaStatPoint:n,targetAreaStatPoints:e};if(i){if(t.lte(n.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:n,targetAreaStatPoints:e.slice(0,r+1)}}else if(t.gte(n.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:n,targetAreaStatPoints:e.slice(0,r+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function v({x:t,width:e,minXLN10:i,maxXLN10:r}){const n=new f(t).div(e).multipliedBy(r.minus(i)).plus(i);return new f(10**n.toNumber())}function j({width:t,targetLN10:e,minXLN10:i,maxXLN10:r}){return e.minus(i).div(r.minus(i)).multipliedBy(t).toNumber()}function H({target:t}){return new f(Math.log10(t.toNumber()))}function S({width:t,height:A,params:y,baseTokenSymbol:S,quoteTokenSymbol:X,colorMap:k}){const{maxLeftHeight:B,maxRightHeight:C,leftStatAreaPoints:F,rightStatAreaPoints:M,minXLN10:W,maxXLN10:T}=function({params:t}){return i((()=>{const e=new f(t.b),i=new f(t.q);let r=new f(t.b0);const n=new f(t.q0),o=new f(t.i),l=new f(t.k),{R:s}=t;1===s&&r.eq(e)&&(r=L(e,i.minus(n),new f(1).div(o),l));const a=new b({i:o,K:l,B:e,Q:i,B0:r,Q0:n,R:s,mtFeeRate:new f(0),lpFeeRate:new f(0)}),d=new w,p=new f(a.B),g=[],m=[];let u=new f(0),h=new f(0);const c=d.GetMidPrice(a),x=i.gt(0)?e.div(i):new f(1);for(let t=0;t<=250;t++){let e=p.multipliedBy(t/100).multipliedBy(c.multipliedBy(x).multipliedBy(4));0===t&&(e=p.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,a);if(i.isNaN()||!i.gt(0))g.push({giveAmount:e,getAmount:new f(0),price:new f(0)});else{const t=i.div(e);g.push({giveAmount:e,getAmount:i,price:t})}}for(let t=0;t<=250;t++){let e=p.multipliedBy(t/100).multipliedBy(c.multipliedBy(4));0===t&&(e=p.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,a);if(i.isNaN()||!i.gt(0))m.push({giveAmount:e,getAmount:new f(0),price:new f(0)});else{const t=e.dividedBy(i);m.push({giveAmount:e,getAmount:i,price:t})}}if(g.length<2&&m.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 A=[];for(let t=1;t<g.length;t++){const e=g[t],{giveAmount:i,getAmount:r,price:n}=e,o=g[t-1];if(!n.isNaN()&&n.gt(0)&&o){const e=n.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),s=r.minus(o.getAmount).abs().multipliedBy(l);1===t&&A.push({area:r,price:n,middlePrice:n.plus(e.div(1.1)),rectangleHeight:s.plus(s.multipliedBy(.03))}),A.push({area:r,price:n,middlePrice:n.plus(e.div(2)),rectangleHeight:s}),u=f.max(s,u)}}const y=[];for(let t=1;t<m.length;t++){const e=m[t],{giveAmount:i,getAmount:r,price:n}=e,o=m[t-1],l=o.price,s=o.giveAmount,a=o.getAmount;if(!n.isNaN()&&n.gt(0)&&o){const e=n.minus(l).abs(),o=i.minus(s).abs(),d=r.minus(a).abs().multipliedBy(o);1===t&&y.push({area:r,price:n,middlePrice:n.minus(e.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:r,price:n,middlePrice:n.minus(e.div(2)),rectangleHeight:d}),h=f.max(d,h)}}const N=g.length>0?g[g.length-1]:m[0],P=m.length>0?m[0]:g[0],v=m.length>0?m[m.length-1]:g[0],j=N.price,H=v.price,S=P.price,X=new f(Math.log10(S.toNumber()));let k=j.gt(0)?new f(Math.log10(j.toNumber())):new f(-Math.log10(H.toNumber())),B=H.gt(0)?new f(Math.log10(H.toNumber())):new f(-Math.log10(j.toNumber()));const C=f.max(X.minus(k).abs(),B.minus(X).abs());return k=X.minus(C),B=X.plus(C),{leftStatAreaPoints:A,rightStatAreaPoints:y,maxLeftHeight:u.multipliedBy(1.2),maxRightHeight:h.multipliedBy(1.2),minXLN10:k,maxXLN10:B,middlePriceLN10:X}}),[t])}({params:y}),J=A-30.13,q=r(null),O=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,"rgba(38, 39, 41, 0.3)",1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,"rgba(38, 39, 41, 0.3)",1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},k),R=e=>{var i;const{current:r}=q,n=e.target;if(n&&r){const e=null===(i=n.getStage())||void 0===i?void 0:i.getPointerPosition();if(e){const{x:i}=e,n=t/2;if(Math.abs(i-n)<=2)return;if(i<=2||t-i<=2)return;const s=v({x:i,width:t,minXLN10:W,maxXLN10:T});let a=null,d=[];const p=i<n;if(p){const t=P({areaPoints:F,targetPrice:s,isLeft:p});a=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=P({areaPoints:M,targetPrice:s,isLeft:p});a=t.targetAreaStatPoint,d=t.targetAreaStatPoints}if(a){const e=H({target:a.middlePrice}),n=j({minXLN10:W,maxXLN10:T,width:t,targetLN10:e}),s=N({maxHeight:p?B:C,gridAreaHeight:J,value:a.rectangleHeight}),g=r.findOne("#tooltip"),m=r.findOne("#toolTipVertLine"),u=r.findOne("#joinCircle"),h=r.findOne("#tooltip-Text"),c=r.findOne("#tooltip-tag"),f=r.findOne("#priceTextLabel"),L=null==f?void 0:f.findOne("#priceTextLabel-text"),b=r.findOne("#area");null==g||g.position({x:n,y:s-5-6}),null==h||h.fill(O.tooltipColor||(p?"#00FAD9":"#FF5072")),null==h||h.text(p?o("pool.chart.liquidity-chart-buy",{amount:x(a.area),symbol:S,price:x(a.price)}):o("pool.chart.liquidity-chart-sell",{amount:x(a.area),symbol:X,price:x(a.price)})),g&&c&&(g.width()/2>i?(c.pointerDirection("left"),c.pointerHeight(15),c.pointerWidth(8),g.offsetX(-11),g.offsetY(-11)):g.width()/2+i>t?(c.pointerDirection("right"),c.pointerHeight(15),c.pointerWidth(8),g.offsetX(11),g.offsetY(-11)):(c.pointerDirection("down"),c.pointerHeight(8),c.pointerWidth(15),g.offsetX(0),g.offsetY(0))),null==m||m.points([n,J,n,s]),null==m||m.stroke(p?"#55f6db":"#ff4f73");let w=p?"rgb(86, 246, 218)":"#FF5072",A=p?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";O.leftLine&&O.rightLine&&(w=p?O.leftLine:O.rightLine,A=p?`rgba(${l(O.leftLine)}, 0.4)`:`rgba(${l(O.rightLine)}, 0.4)`),u&&(u.x(n),u.y(s),u.fill(w),u.stroke(A)),f&&(f.x(n),f.y(J+8.08+1),f.offsetX(f.width()/2),f.x()-f.width()/2<0?f.x(f.width()/2):f.x()+f.width()/2>t?f.x(t-f.width()/2):f.x(i)),L&&(L.fill(O.tooltipColor||(p?"#00FAD9":"#FF5072")),L.text(x(a.price)));const y=[];for(const e of d){const{middlePrice:i,rectangleHeight:r}=e,n=H({target:i}),o=j({minXLN10:W,maxXLN10:T,width:t,targetLN10:n}),l=N({maxHeight:p?B:C,gridAreaHeight:J,value:r});y.push(o,l+1)}const P=y.slice(),[v,k]=P;p?(P.push(n,s),P.push(n,J),P.push(v,J),P.push(v,k)):(P.unshift(v,J),P.unshift(n,J),P.unshift(n,s)),b&&(b.points(P),b.fill(p?O.leftLine||"#2c5b56":O.rightLine||"#7b3a48")),r.show()}}}},D=function({gridAreaHeight:t,gridAreaWidth:e,horizontalLineCount:r,verticalLineCount:n,color:o="#2A2A2D"}){return i((()=>{const i=[],l=t/(r+1),a=[],d=e/(n+1);for(let t=0;t<r;t++){const r=l*(t+1);i.push([0,r,e,r])}for(let e=0;e<n;e++){const i=d*(e+1);a.push([i,0,i,t])}return c.exports.jsxs(c.exports.Fragment,{children:[i.map(((t,e)=>c.exports.jsx(s,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e))),a.map(((t,e)=>c.exports.jsx(s,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e)))]})}),[t,e,r,n,o])}({gridAreaHeight:J,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:O.grid}),z=function({minXLN10:t,maxXLN10:e,labelCount:r,gridAreaHeight:n,gridAreaWidth:o,color:l="#606066"}){return i((()=>{const i=o/(r+1),d=[],p=[];for(let l=0;l<r;l++){const r=i/2+i*l;d.push({x:r,y:n+10.08+1,text:x(v({x:i*(l+1),width:o,minXLN10:t,maxXLN10:e}))});const s=i*(l+1);p.push([s,n+1,s,n+4+1])}return c.exports.jsxs(c.exports.Fragment,{children:[d.map(((t,e)=>c.exports.jsx(a,{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))),p.map(((t,e)=>c.exports.jsx(s,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},e)))]})}),[t,e,n,o,r])}({gridAreaHeight:J,gridAreaWidth:t,labelCount:7,minXLN10:W,maxXLN10:T,color:O.textColor}),G=function({gridAreaHeight:t,gridAreaWidth:e,color:r="#606066"}){return i((()=>{const i=e/2;return c.exports.jsx(s,{points:[i,0,i,t-1],stroke:r,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,e,r])}({gridAreaHeight:J,gridAreaWidth:t,color:O.midPriceLine}),{leftLine:Q,rightLine:E}=function({leftStatAreaPoints:t,rightStatAreaPoints:e,minXLN10:r,maxXLN10:n,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:a,gridAreaHeight:d,colorMap:p}){return{leftLine:i((()=>{if(t.length<1)return c.exports.jsx(c.exports.Fragment,{});const e=[];let i=d;for(const l of t){const{middlePrice:t,rectangleHeight:s}=l,p=H({target:t}),g=j({minXLN10:r,maxXLN10:n,width:a,targetLN10:p}),m=N({maxHeight:o,gridAreaHeight:d,value:s});e.push(g,m),m<i&&(i=m)}const l=e.slice(),[g,m]=l,u=l[l.length-1],h=l[l.length-2];return l.push(h,u),l.push(h,d),l.push(g,d),l.push(g,m),c.exports.jsxs(c.exports.Fragment,{children:[c.exports.jsx(s,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:p.leftBg}),c.exports.jsx(s,{points:e,stroke:p.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,a,r,n,d,o]),rightLine:i((()=>{if(e.length<1)return c.exports.jsx(c.exports.Fragment,{});const t=[];let i=d;for(const o of e){const{middlePrice:e,rectangleHeight:s}=o,p=H({target:e}),g=j({minXLN10:r,maxXLN10:n,width:a,targetLN10:p}),m=N({maxHeight:l,gridAreaHeight:d,value:s});t.push(g,m),m<i&&(i=m)}const o=t.slice(),[g]=o;return o.unshift(g,d),o.unshift(a,d),c.exports.jsxs(c.exports.Fragment,{children:[c.exports.jsx(s,{points:o,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:p.rightBg}),c.exports.jsx(s,{points:t,stroke:p.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,a,r,n,d,l])}}({leftStatAreaPoints:F,rightStatAreaPoints:M,minXLN10:W,maxXLN10:T,maxLeftHeight:B,maxRightHeight:C,gridAreaWidth:t,gridAreaHeight:J,colorMap:O});return c.exports.jsxs(d,{width:t,height:A,onMouseMove:R,onMouseOver:R,onMouseEnter:R,onMouseOut:()=>{const{current:t}=q;t&&t.hide()},children:[c.exports.jsxs(p,{children:[c.exports.jsx(g,{x:0,y:0,width:t,height:J,stroke:O.grid,strokeWidth:1}),D,z,Q,E,G]}),c.exports.jsxs(p,{ref:q,visible:!1,children:[c.exports.jsx(s,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),c.exports.jsx(s,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),c.exports.jsx(m,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),c.exports.jsxs(u,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[c.exports.jsx(h,{fill:O.tooltipBg,id:"priceTextLabel-tag"}),c.exports.jsx(a,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),c.exports.jsxs(u,{listening:!1,id:"tooltip",children:[c.exports.jsx(h,{fill:O.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),c.exports.jsx(a,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:n,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}const X=({width:t=834,height:e=462,baseTokenSymbol:i,quoteTokenSymbol:r,pmmModel:n,pmmParams:l,midPrice:s,notShowTipText:a,colorMap:d})=>c.exports.jsxs(A,{children:[void 0!==l&&void 0!==s&&void 0!==n&&void 0!==s&&c.exports.jsx(S,{width:t,height:e,params:l,midPrice:s,pmmModel:n,baseTokenSymbol:i,quoteTokenSymbol:r,colorMap:d}),a?"":c.exports.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});export{X as default};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import e from"bignumber.js";import{merge as t,throttle as i,debounce as o}from"lodash";import r,{useEffect as n,useMemo as l,useRef as s,useState as a}from"react";import p from"@emotion/styled";import{css as d}from"@emotion/react";import{Stage as u,Layer as c,Rect as m,Line as g,Text as h,Circle as b,Label as x,Tag as f}from"react-konva";import{c as M,e as v,a as y,b as P,d as j,f as w,u as z,g as L,h as k,l as B,i as C,j as S,k as N}from"./helper-7cc29594.js";import{f as O,j as X,a as T,b as A}from"./index-db2c9b8f.js";import{solveQuadraticFunctionForTarget as q,PMMModel as W}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/icons";import"react-dom";import"react-redux";import"identicon.js";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@reduxjs/toolkit";import"redux";import"@tanstack/react-query";import"react-window";import"@ethersproject/bignumber";import"dayjs";import"axios";import"zustand";import"react-infinite-scroller";import"recharts";var E={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},F=r.createContext&&r.createContext(E),H=["attr","size","title"];function Z(e,t){if(null==e)return{};var i,o,r=function(e,t){if(null==e)return{};var i,o,r={},n=Object.keys(e);for(o=0;o<n.length;o++)i=n[o],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)i=n[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},G.apply(this,arguments)}function D(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function J(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?D(Object(i),!0).forEach((function(t){V(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):D(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function V(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){return e&&e.map(((e,t)=>r.createElement(e.tag,J({key:t},e.attr),Y(e.child))))}function I(e){return t=>r.createElement(R,G({attr:J({},e.attr)},t),Y(e.child))}function R(e){var t=t=>{var i,{attr:o,size:n,title:l}=e,s=Z(e,H),a=n||t.size||"1em";return t.className&&(i=t.className),e.className&&(i=(i?i+" ":"")+e.className),r.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,o,s,{className:i,style:J(J({color:e.color||t.color},t.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&r.createElement("title",null,l),e.children)};return void 0!==F?r.createElement(F.Consumer,null,(e=>t(e))):t(E)}function $(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M13.293 6.293 7.586 12l5.707 5.707 1.414-1.414L10.414 12l4.293-4.293z"},child:[]}]})(e)}function Q(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10.707 17.707 16.414 12l-5.707-5.707-1.414 1.414L13.586 12l-4.293 4.293z"},child:[]}]})(e)}function K(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5 11h14v2H5z"},child:[]}]})(e)}function U(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(e)}const _=p.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&&d`
|
|
17
|
+
border-color: red;
|
|
18
|
+
`}
|
|
19
|
+
}
|
|
20
|
+
`;function ee({width:o,height:r,midPrice:a,pmmModel:p,params:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,colorMap:T,setBaseMinAndZoomMultiples:A}){const q=t({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,"rgba(38, 39, 41, 0.3)",1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,"rgba(38, 39, 41, 0.3)",1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},T),W=o,E=r-18,F=W/7,{buyBaseVert:H,sellBaseVert:Z}=y({midPrice:a,q:d.q,q0:d.q0,pmmModel:p}),G=H.div(E),D=Z.div(E),J=s(null),V=s(null),{current:Y}=J,I=s(0),R=s(),{horizontalGridLines:$,verticalGridLines:Q}=function({chartHeight:e,chartWidth:t,horizontalLineCount:i,verticalLineCount:o}){return l((()=>{const r=[],n=e/(i+1),l=[],s=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=s*t+s/2;l.push([i,0,i,e])}return{horizontalGridLines:r,verticalGridLines:l}}),[e,t,i,o])}({chartHeight:E,chartWidth:W,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:K,horizontalLabelTextPoints:U}=function({chartHeight:e,chartWidth:t,xAxisPoints:i,oneXPx:o,baseMinAndZoomMultiples:r}){return l((()=>{const n=M(t,r.zoomMultiples),l=[],s=[];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(),a=r.baseMin.multipliedBy(10**i),p=t*o,d=e+2+4,u=O(a);s.push({x:p,y:d,text:u})}return{horizontalLabelTickPoints:l,horizontalLabelTextPoints:s}}),[r.baseMin,r.zoomMultiples,e,t,o,i])}({chartHeight:E,chartWidth:W,xAxisPoints:7,oneXPx:F,baseMinAndZoomMultiples:N}),{quoteLinePoints:_,quoteLineAreaPoints:ee,quoteLineAreaLinearGradientEndPointY:te,baseLinePoints:ie,baseLineAreaPoints:oe,baseLineAreaLinearGradientEndPointY:re,midPriceLinePoints:ne}=function({chartHeight:t,chartWidth:i,midPrice:o,xPoints:r,pmmModel:n,baseMinAndZoomMultiples:s,buyYPortion:a,sellYPortion:p}){return l((()=>{const l=[],d=[],u=[],{baseMin:c,zoomMultiples:m}=s,g=M(i,m),h=2*m,b=new e(h).div(r);let x=new e(Math.log(o.div(c).toNumber())/Math.log(10));x=e.minimum(h,x),x=e.maximum(0,x);for(let i=new e(0);i.lte(x);){const e=c.multipliedBy(10**i.toNumber()),r=v({val:e,model:n,midPrice:o});if(!r.vert.isNaN()){const e=i.div(g).toNumber(),o=t-r.vert.div(a).toNumber();l.push(e,o)}i=i.plus(b)}for(let e=x;e.lte(h);){const i=c.multipliedBy(10**e.toNumber()),r=v({val:i,model:n,midPrice:o});if(!r.vert.isNaN()){const i=e.div(g).toNumber(),o=t-r.vert.div(p).toNumber();d.push(i,o)}e=e.plus(b)}const f=x.div(g).toNumber(),[,y]=l,P=n.k.eq(0);P&&l.push(f,y||t),l.push(f,t),u.push(f,t,f,0);const j=v({val:c.multipliedBy(10**h),model:n,midPrice:o});let w=t;const z=new e(h).div(g).toNumber();return j.vert.isNaN()||(w=t-j.vert.div(p).toNumber()),P&&d.length>=2&&(d.unshift(f,w),d.unshift(f,t)),d.push(z,w),x.lte(0)&&d.unshift(0,t),{quoteLinePoints:l,quoteLineAreaPoints:[0,t,0,y,...l],quoteLineAreaLinearGradientEndPointY:y,baseLinePoints:d,baseLineAreaPoints:[...d,z,t],baseLineAreaLinearGradientEndPointY:w,midPriceLinePoints:u}}),[s,i,r,o,n,t,a,p])}({chartHeight:E,chartWidth:W,midPrice:a,xPoints:50,pmmModel:p,baseMinAndZoomMultiples:N,buyYPortion:G,sellYPortion:D}),le=e=>{var t;const i=e.target;if(i&&Y){const e=null===(t=i.getStage())||void 0===t?void 0:t.getPointerPosition();if(e){const{x:t}=e;if(t>W)return void Y.hide();z({x:t,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:p,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}}},se=l((()=>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-I.current;I.current=e.x,R.current=e.x,A((e=>void 0===e.baseMin?e:{baseMin:P({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:W,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:0}))}}}),100)),[W,A]),ae=l((()=>i((e=>{e.cancelBubble=!0,e.evt.preventDefault();const t=e.evt.deltaY<0;A((e=>{const i=j({zoomIn:t,prevZoomMultiples:e.zoomMultiples});return{baseMin:w({midPrice:a,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}}))}),100)),[a,A]);return n((()=>{N.targetMarginPriceX>0&&null!==Y?z({x:N.targetMarginPriceX,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:p,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine}):void 0!==R.current&&null!==Y&&z({x:R.current,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:p,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}),[N,C,H,E,W,q.leftLine,q.rightLine,q.tooltipColor,a,p,S,Z,Y]),X.exports.jsxs(u,{ref:V,width:o,offsetY:-k,height:r+k,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:le,onMouseOver:le,onMouseOut:()=>{Y&&Y.hide()},onDragStart:function(e){const{target:t}=e,i=t.getStage();if(i){const e=i.getPointerPosition();e&&(I.current=e.x)}},onDragMove:se,onDragEnd:e=>{const{target:t}=e,i=t.getStage();i&&(i.container().style.cursor="pointer")},onWheel:ae,children:[X.exports.jsxs(c,{children:[X.exports.jsx(m,{x:0,y:0,width:o,height:E,stroke:q.grid,strokeWidth:1}),$.map(((e,t)=>X.exports.jsx(g,{points:e,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),Q.map(((e,t)=>X.exports.jsx(g,{points:e,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),K.map(((e,t)=>X.exports.jsx(g,{points:e,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),U.map(((e,t)=>X.exports.jsx(h,{x:e.x,y:e.y,text:e.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:F,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t))),X.exports.jsx(g,{points:ee,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:E},fillLinearGradientEndPoint:{x:0,y:te},fillLinearGradientColorStops:q.leftBg}),X.exports.jsx(g,{points:_,stroke:q.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.exports.jsx(g,{points:oe,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:W,y:E},fillLinearGradientEndPoint:{x:W,y:re},fillLinearGradientColorStops:q.rightBg}),X.exports.jsx(g,{points:ie,stroke:q.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.exports.jsx(g,{points:ne,stroke:q.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),X.exports.jsxs(c,{ref:J,visible:!1,listening:!1,children:[X.exports.jsx(g,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),X.exports.jsx(g,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),X.exports.jsx(b,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),X.exports.jsxs(x,{x:0,y:0,id:"priceTextLabel",children:[X.exports.jsx(f,{fill:q.tooltipBg,id:"priceTextLabel-tag"}),X.exports.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),X.exports.jsxs(x,{x:0,y:0,id:"slippageTextLabel",children:[X.exports.jsx(f,{fill:q.tooltipBg,id:"slippageTextLabel-tag"}),X.exports.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),X.exports.jsxs(x,{x:0,y:0,id:"toolTip",children:[X.exports.jsx(f,{fill:q.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),X.exports.jsx(h,{text:"-",fontSize:12,lineHeight:17/12,padding:B,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const te=p.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
|
+
`,ie=p.div`
|
|
33
|
+
height: 100%;
|
|
34
|
+
`,oe=p.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
`,re=p.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
|
+
`,ne=p.span`
|
|
53
|
+
color: #85858d;
|
|
54
|
+
`,le=p.div`
|
|
55
|
+
margin-top: 20px;
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
margin-bottom: 9px;
|
|
59
|
+
`,se=p(te)`
|
|
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 ae({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),p=new e(t.k),{R:d}=t;1===d&&l.eq(r)&&(l=q(r,n.minus(s),new e(1).div(a),p));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(p).plus(p.multipliedBy(t)),a.multipliedBy(t)}const c=new W;c.RStatus=d,c.B=r,c.B0=l,c.Q=n,c.Q0=s,c.i=a,c.k=p,c.mtFeeRate=new e(0),c.lpFeeRate=new e(0);let m=new e(0);m=o?c.querySellBase(i):c.queryBuyBase(i);const g=o?n.minus(m):n.plus(m);let h=s.multipliedBy(s).div(g).div(g);return h=new e(1).minus(p).plus(p.multipliedBy(h)),a.div(h)}const pe=({chartId:t,width:i=834,height:r=460,baseTokenSymbol:s,quoteTokenSymbol:p,pmmModel:d,pmmParams:u,midPrice:c=new e(0),colorMap:m,notShowAmountInput:g})=>{(({id:e})=>{n((()=>{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[h,b]=a(""),[x,f]=a(""),[M,v]=a("-"),[y,z]=a("-"),[k,B]=a({baseMin:new e(0),zoomMultiples:C,targetMarginPriceX:0});n((()=>{void 0!==c&&B((e=>({baseMin:w({midPrice:c,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX})))}),[c]);const O=l((()=>o((({type:t,amount:o})=>{""===o&&c&&(B({baseMin:w({midPrice:c,zoomMultiples:C}),zoomMultiples:C,targetMarginPriceX:0}),"buy"===t?v("-"):z("-"));const r=new e(o);if(!r.lte(0)&&!r.isNaN()&&(null==u?void 0:u.b)&&!r.gte(u.b)&&c)if("buy"===t){const e=ae({params:u,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:e,midPrice:c,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:c,width:i,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:c,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),v(`${T({input:e.minus(c).div(c)})}`)}else{const e=function({params:e,target:t}){return ae({params:e,target:t,isBuy:!1})}({params:u,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:e,midPrice:c,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:c,width:i,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:c,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),z(`+${T({input:e.minus(c).div(c)})}`)}}),300)),[u,c,i]);n((()=>{void 0!==h&&O({type:"buy",amount:h})}),[O,h]),n((()=>{void 0!==x&&O({type:"sell",amount:x})}),[O,x]);const q=e=>{let t=0;t=e?-.1*i:.1*i,B((e=>void 0===e.baseMin?e:{baseMin:P({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:i,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX}))},W=e=>{B((t=>{const i=j({zoomIn:null!=e&&e,prevZoomMultiples:t.zoomMultiples});return{baseMin:w({midPrice:c,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}}))},E=l((()=>{if(""===h)return!1;const t=new e(h);return!(!t.lte(0)&&!t.isNaN()&&(null==u?void 0:u.b)&&!t.gte(u.b))}),[h,u]),F=l((()=>{if(""===x)return!1;const t=new e(x);return!(!t.lte(0)&&!t.isNaN()&&(null==u?void 0:u.b)&&!t.gte(u.b))}),[x,u]);return X.exports.jsxs(ie,{id:t,children:[g?"":X.exports.jsxs(oe,{children:[X.exports.jsxs(re,{borderColor:m&&m.grid,children:[L("pool.chart.buy-amount",{symbol:s}),X.exports.jsx(_,{value:h,error:E,onChange:e=>{const t=A(e.target.value,2);null!==t&&b(t)}}),X.exports.jsx(ne,{children:L("pool.chart.price-impact",{amount:M})})]}),X.exports.jsxs(re,{borderColor:m&&m.grid,children:[L("pool.chart.sell-amount",{symbol:s}),X.exports.jsx(_,{value:x,error:F,onChange:e=>{const t=A(e.target.value,2);null!==t&&f(t)}}),X.exports.jsx(ne,{children:L("pool.chart.price-impact",{amount:y})})]})]}),void 0!==u&&void 0!==c&&void 0!==d&&void 0!==k.baseMin&&void 0!==c&&X.exports.jsx(ee,{width:i,height:r,params:u,midPrice:c,pmmModel:d,baseTokenSymbol:s,quoteTokenSymbol:p,baseMinAndZoomMultiples:k,colorMap:m,setBaseMinAndZoomMultiples:B}),X.exports.jsxs(le,{className:"operate-btn-wrapper",children:[X.exports.jsx(se,{onClick:()=>q(!0),children:X.exports.jsx($,{})}),X.exports.jsx(se,{onClick:()=>W(!1),children:X.exports.jsx(K,{})}),X.exports.jsx(se,{onClick:()=>W(!0),children:X.exports.jsx(U,{})}),X.exports.jsx(se,{onClick:()=>q(!1),children:X.exports.jsx(Q,{})})]})]})};export{pe as default};
|