@dodoex/widgets 3.14.1-react.2 → 3.14.1-react.4
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/{helper-5M79rMcu.js → helper-BRhItVhp.js} +1 -1
- package/dist/{helper-BjErvAPT.cjs → helper-D6742XFo.cjs} +2 -1
- package/dist/helper-D6742XFo.cjs.map +1 -0
- package/dist/{index-DXkJy6xu.js → index-74NX8N3I.js} +1 -1
- package/dist/index-9qJDllXY.js +14 -0
- package/dist/{index-CzGOlGFO.cjs → index-Btu6is6Z.cjs} +2 -1
- package/dist/index-Btu6is6Z.cjs.map +1 -0
- package/dist/{index-waICfk4T.js → index-CimkjRmy.js} +1 -1
- package/dist/index-D_4shicA.cjs +15 -0
- package/dist/index-D_4shicA.cjs.map +1 -0
- package/dist/{index-CfUamTLh.cjs → index-YdI7RJEJ.cjs} +2 -1
- package/dist/index-YdI7RJEJ.cjs.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +1 -1
- package/dist/types/hooks/Swap/useSwapSettingStore.d.ts +5 -3
- package/dist/types/hooks/useTokenState.d.ts +5 -3
- package/package.json +2 -2
- package/dist/index-DDvJb4bR.cjs +0 -14
- package/dist/index-DG3l6Gjm.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-D6742XFo.cjs"),a=require("./index-D_4shicA.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
2
|
margin: 4px 10px 4px 6px;
|
|
3
3
|
border-radius: 10px;
|
|
4
4
|
border: 1px solid #373739;
|
|
@@ -76,3 +76,4 @@
|
|
|
76
76
|
color: #fff;
|
|
77
77
|
}
|
|
78
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-YdI7RJEJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-YdI7RJEJ.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,G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V3H,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.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-D_4shicA.cjs");require("react-dom/client"),require("react/jsx-runtime"),require("bignumber.js"),require("lodash"),require("@dodoex/components"),require("@dodoex/api"),require("@dodoex/dodo-contract-request"),require("react"),require("@babel/runtime/helpers/interopRequireDefault"),require("@babel/runtime/helpers/defineProperty"),require("@lingui/core"),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("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"),exports.AMMV2Create=e.AMMV2Create,exports.AMMV3PositionManage=e.AMMV3PositionManage,exports.AMMV3PositionsView=e.AMMV3PositionsView,exports.AddLiquidityV3=e.AddLiquidityV3,exports.EmptyList=e.EmptyList,exports.FailedList=e.FailedList,exports.InitSwapWidget=e.InitSwapWidget,exports.Message=e.Message,Object.defineProperty(exports,"MetadataFlag",{enumerable:!0,get:function(){return e.MetadataFlag}}),exports.MiningCreate=e.MiningCreate,exports.MiningDetail=e.MiningDetail,exports.MiningList=e.MiningList,Object.defineProperty(exports,"PageType",{enumerable:!0,get:function(){return e.PageType}}),exports.Pool=e.Pool,exports.PoolCreate=e.PoolCreate,exports.PoolDetail=e.PoolDetail,exports.PoolList=e.PoolList,exports.PoolModify=e.PoolModify,exports.PoolOperate=e.PoolOperate,exports.PoolOperateDialog=e.PoolOperateDialog,exports.PoolWidget=e.PoolWidget,exports.Swap=e.Swap,exports.SwapOrderHistory=e.SwapOrderHistory,exports.SwapWidget=e.SwapWidget,exports.TokenCard=e.TokenCard,exports.TokenLogo=e.TokenLogo,exports.TokenPairStatusButton=e.TokenPairStatusButton,exports.TokenStatusButton=e.TokenStatusButton,exports.UnstyleWidget=e.UnstyleWidget,exports.WIDGET_CLASS_NAME=e.WIDGET_CLASS_NAME,exports.WIDGET_MODULE_CLASS_NAME=e.WIDGET_MODULE_CLASS_NAME,exports.Widget=e.Widget,exports.chainListMap=e.chainListMap,exports.formatPercentageNumber=e.formatPercentageNumber,exports.formatReadableNumber=e.formatReadableNumber,exports.formatShortNumber=e.formatShortNumber,exports.formatTokenAmountNumber=e.formatTokenAmountNumber,exports.getEtherscanPage=e.getEtherscanPage,exports.rpcServerMap=e.rpcServerMap,exports.scanUrlDomainMap=e.scanUrlDomainMap,exports.useMessageState=e.useMessageState,exports.usePoolBalanceInfo=e.usePoolBalanceInfo,exports.useRouterStore=e.useRouterStore,exports.useTokenStatus=e.useTokenStatus,exports.useTradeSwapOrderList=e.useTradeSwapOrderList;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as AMMV2Create,D as AMMV3PositionManage,C as AMMV3PositionsView,B as AddLiquidityV3,K as EmptyList,J as FailedList,I as InitSwapWidget,g as Message,M as MetadataFlag,z as MiningCreate,y as MiningDetail,x as MiningList,c as PageType,m as Pool,o as PoolCreate,q as PoolDetail,n as PoolList,p as PoolModify,v as PoolOperate,t as PoolOperateDialog,P as PoolWidget,j as Swap,k as SwapOrderHistory,S as SwapWidget,G as TokenCard,H as TokenLogo,F as TokenPairStatusButton,T as TokenStatusButton,U as UnstyleWidget,W as WIDGET_CLASS_NAME,h as WIDGET_MODULE_CLASS_NAME,e as Widget,d as chainListMap,a as formatPercentageNumber,N as formatReadableNumber,f as formatShortNumber,O as formatTokenAmountNumber,L as getEtherscanPage,r as rpcServerMap,s as scanUrlDomainMap,i as useMessageState,w as usePoolBalanceInfo,u as useRouterStore,E as useTokenStatus,l as useTradeSwapOrderList}from"./index-
|
|
1
|
+
export{A as AMMV2Create,D as AMMV3PositionManage,C as AMMV3PositionsView,B as AddLiquidityV3,K as EmptyList,J as FailedList,I as InitSwapWidget,g as Message,M as MetadataFlag,z as MiningCreate,y as MiningDetail,x as MiningList,c as PageType,m as Pool,o as PoolCreate,q as PoolDetail,n as PoolList,p as PoolModify,v as PoolOperate,t as PoolOperateDialog,P as PoolWidget,j as Swap,k as SwapOrderHistory,S as SwapWidget,G as TokenCard,H as TokenLogo,F as TokenPairStatusButton,T as TokenStatusButton,U as UnstyleWidget,W as WIDGET_CLASS_NAME,h as WIDGET_MODULE_CLASS_NAME,e as Widget,d as chainListMap,a as formatPercentageNumber,N as formatReadableNumber,f as formatShortNumber,O as formatTokenAmountNumber,L as getEtherscanPage,r as rpcServerMap,s as scanUrlDomainMap,i as useMessageState,w as usePoolBalanceInfo,u as useRouterStore,E as useTokenStatus,l as useTradeSwapOrderList}from"./index-9qJDllXY.js";import"react-dom/client";import"react/jsx-runtime";import"bignumber.js";import"lodash";import"@dodoex/components";import"@dodoex/api";import"@dodoex/dodo-contract-request";import"react";import"@babel/runtime/helpers/interopRequireDefault";import"@babel/runtime/helpers/defineProperty";import"@lingui/core";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"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";
|
|
@@ -23,15 +23,17 @@ interface SwapSettingState {
|
|
|
23
23
|
expertMode: boolean;
|
|
24
24
|
disableIndirectRouting: boolean;
|
|
25
25
|
}
|
|
26
|
-
export declare const useSwapSettingStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SwapSettingState>, "persist"> & {
|
|
26
|
+
export declare const useSwapSettingStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SwapSettingState>, "setState" | "persist"> & {
|
|
27
|
+
setState(partial: SwapSettingState | Partial<SwapSettingState> | ((state: SwapSettingState) => SwapSettingState | Partial<SwapSettingState>), replace?: false | undefined): unknown;
|
|
28
|
+
setState(state: SwapSettingState | ((state: SwapSettingState) => SwapSettingState), replace: true): unknown;
|
|
27
29
|
persist: {
|
|
28
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SwapSettingState, SwapSettingState>>) => void;
|
|
30
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SwapSettingState, SwapSettingState, unknown>>) => void;
|
|
29
31
|
clearStorage: () => void;
|
|
30
32
|
rehydrate: () => Promise<void> | void;
|
|
31
33
|
hasHydrated: () => boolean;
|
|
32
34
|
onHydrate: (fn: (state: SwapSettingState) => void) => () => void;
|
|
33
35
|
onFinishHydration: (fn: (state: SwapSettingState) => void) => () => void;
|
|
34
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SwapSettingState, SwapSettingState>>;
|
|
36
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SwapSettingState, SwapSettingState, unknown>>;
|
|
35
37
|
};
|
|
36
38
|
}>;
|
|
37
39
|
export {};
|
|
@@ -12,15 +12,17 @@ interface TokenState {
|
|
|
12
12
|
popularTokenList: TokenList;
|
|
13
13
|
customTokenList: TokenList;
|
|
14
14
|
}
|
|
15
|
-
export declare const useTokenState: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TokenState>, "persist"> & {
|
|
15
|
+
export declare const useTokenState: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TokenState>, "setState" | "persist"> & {
|
|
16
|
+
setState(partial: TokenState | Partial<TokenState> | ((state: TokenState) => TokenState | Partial<TokenState>), replace?: false | undefined): unknown;
|
|
17
|
+
setState(state: TokenState | ((state: TokenState) => TokenState), replace: true): unknown;
|
|
16
18
|
persist: {
|
|
17
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TokenState, TokenState>>) => void;
|
|
19
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TokenState, TokenState, unknown>>) => void;
|
|
18
20
|
clearStorage: () => void;
|
|
19
21
|
rehydrate: () => Promise<void> | void;
|
|
20
22
|
hasHydrated: () => boolean;
|
|
21
23
|
onHydrate: (fn: (state: TokenState) => void) => () => void;
|
|
22
24
|
onFinishHydration: (fn: (state: TokenState) => void) => () => void;
|
|
23
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<TokenState, TokenState>>;
|
|
25
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<TokenState, TokenState, unknown>>;
|
|
24
26
|
};
|
|
25
27
|
}>;
|
|
26
28
|
export declare function getAllTokenList(state?: TokenState): TokenInfo[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodoex/widgets",
|
|
3
|
-
"version": "3.14.1-react.
|
|
3
|
+
"version": "3.14.1-react.04",
|
|
4
4
|
"description": "DODO Widgets",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"recharts": "^2.15.0",
|
|
101
101
|
"rmc-date-picker": "^6.0.10",
|
|
102
102
|
"tiny-invariant": "^1.1.0",
|
|
103
|
-
"zustand": "^
|
|
103
|
+
"zustand": "^5.0.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"@babel/runtime": ">=7.17.0",
|