@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("@emotion/styled"),t=require("lodash"),i=require("react"),r=require("./helper-
|
|
1
|
+
"use strict";var e=require("@emotion/styled"),t=require("lodash"),i=require("react"),r=require("./helper-D6742XFo.cjs"),n=require("react-konva"),o=require("./index-D_4shicA.cjs"),a=require("bignumber.js"),l=require("react/jsx-runtime"),s=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 u=e.div`
|
|
2
2
|
height: 100%;
|
|
3
3
|
position: relative;
|
|
4
4
|
`,d=e.div`
|
|
@@ -10,3 +10,4 @@
|
|
|
10
10
|
line-height: 17px;
|
|
11
11
|
font-weight: 400;
|
|
12
12
|
`;function g({maxHeight:e,gridAreaHeight:t,value:i}){const r=new a(t).minus(36),n=r.div(e);return r.minus(i.multipliedBy(n)).plus(36).toNumber()}function c({targetPrice:e,areaPoints:t,isLeft:i}){for(let r=0;r<t.length;r++){const n=t[r],o=r<t.length-1?t[r+1]:null;if(!o)return{targetAreaStatPoint:n,targetAreaStatPoints:t};if(i){if(e.lte(n.middlePrice)&&e.gte(o.middlePrice))return{targetAreaStatPoint:n,targetAreaStatPoints:t.slice(0,r+1)}}else if(e.gte(n.middlePrice)&&e.lte(o.middlePrice))return{targetAreaStatPoint:n,targetAreaStatPoints:t.slice(0,r+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function h({x:e,width:t,minXLN10:i,maxXLN10:r}){const n=new a(e).div(t).multipliedBy(r.minus(i)).plus(i);return new a(10**n.toNumber())}function m({width:e,targetLN10:t,minXLN10:i,maxXLN10:r}){return t.minus(i).div(r.minus(i)).multipliedBy(e).toNumber()}function p({target:e}){return new a(Math.log10(e.toNumber()))}const f="rgba(38, 39, 41, 0.3)";function x({width:e,height:u,params:d,baseTokenSymbol:x,quoteTokenSymbol:L,colorMap:b}){const{maxLeftHeight:w,maxRightHeight:A,leftStatAreaPoints:y,rightStatAreaPoints:N,minXLN10:q,maxXLN10:P}=function({params:e}){return i.useMemo(()=>{const t=new a(e.b),i=new a(e.q);let r=new a(e.b0);const n=new a(e.q0),o=new a(e.i),l=new a(e.k),{R:u}=e;1===u&&r.eq(t)&&(r=s.solveQuadraticFunctionForTarget(t,i.minus(n),new a(1).div(o),l));const d=new s.PMMState({i:o,K:l,B:t,Q:i,B0:r,Q0:n,R:u,mtFeeRate:new a(0),lpFeeRate:new a(0)}),g=new s.PMMHelper,c=new a(d.B),h=[],m=[];let p=new a(0),f=new a(0);const x=g.GetMidPrice(d),L=i.gt(0)?t.div(i):new a(1);for(let e=0;e<=250;e++){let t=c.multipliedBy(e/100).multipliedBy(x.multipliedBy(L).multipliedBy(4));0===e&&(t=c.multipliedBy(1e-11));const i=null==g?void 0:g.QuerySellBase(t,d);if(!i.isNaN()&&i.gt(0)){const e=i.div(t);h.push({giveAmount:t,getAmount:i,price:e});continue}h.push({giveAmount:t,getAmount:new a(0),price:new a(0)})}for(let e=0;e<=250;e++){let t=c.multipliedBy(e/100).multipliedBy(x.multipliedBy(4));0===e&&(t=c.multipliedBy(1e-11));const i=null==g?void 0:g.QuerySellQuote(t,d);if(!i.isNaN()&&i.gt(0)){const e=t.dividedBy(i);m.push({giveAmount:t,getAmount:i,price:e});continue}m.push({giveAmount:t,getAmount:new a(0),price:new a(0)})}if(h.length<2&&m.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new a(10).multipliedBy(1.2),maxRightHeight:new a(10).multipliedBy(1.2),middlePriceLN10:new a(0),minXLN10:new a(-1),maxXLN10:new a(1)};const b=[];for(let e=1;e<h.length;e++){const t=h[e],{giveAmount:i,getAmount:r,price:n}=t,o=h[e-1];if(!n.isNaN()&&n.gt(0)&&o){const t=n.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),s=r.minus(o.getAmount).abs().multipliedBy(l);1===e&&b.push({area:r,price:n,middlePrice:n.plus(t.div(1.1)),rectangleHeight:s.plus(s.multipliedBy(.03))}),b.push({area:r,price:n,middlePrice:n.plus(t.div(2)),rectangleHeight:s}),p=a.max(s,p)}}const w=[];for(let e=1;e<m.length;e++){const t=m[e],{giveAmount:i,getAmount:r,price:n}=t,o=m[e-1],l=o.price,s=o.giveAmount,u=o.getAmount;if(!n.isNaN()&&n.gt(0)&&o){const t=n.minus(l).abs(),o=i.minus(s).abs(),d=r.minus(u).abs().multipliedBy(o);1===e&&w.push({area:r,price:n,middlePrice:n.minus(t.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),w.push({area:r,price:n,middlePrice:n.minus(t.div(2)),rectangleHeight:d}),f=a.max(d,f)}}const A=h.length>0?h[h.length-1]:m[0],y=m.length>0?m[0]:h[0],N=m.length>0?m[m.length-1]:h[0],q=A.price,P=N.price,v=y.price,S=new a(Math.log10(v.toNumber()));let j=q.gt(0)?new a(Math.log10(q.toNumber())):new a(-Math.log10(P.toNumber())),H=P.gt(0)?new a(Math.log10(P.toNumber())):new a(-Math.log10(q.toNumber()));const k=a.max(S.minus(j).abs(),H.minus(S).abs());return j=S.minus(k),H=S.plus(k),{leftStatAreaPoints:b,rightStatAreaPoints:w,maxLeftHeight:p.multipliedBy(1.2),maxRightHeight:f.multipliedBy(1.2),minXLN10:j,maxXLN10:H,middlePriceLN10:S}},[e])}({params:d}),v=u-30.13,S=i.useRef(null),j=t.merge({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,f,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,f,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},b),H=t=>{var i;const{current:n}=S,a=t.target;if(a&&n){const t=null===(i=a.getStage())||void 0===i?void 0:i.getPointerPosition();if(t){const{x:i}=t,a=e/2;if(Math.abs(i-a)<=2)return;if(i<=2||e-i<=2)return;const l=h({x:i,width:e,minXLN10:q,maxXLN10:P});let s=null,u=[];const d=i<a;if(d){const e=c({areaPoints:y,targetPrice:l,isLeft:d});s=e.targetAreaStatPoint,u=e.targetAreaStatPoints}else{const e=c({areaPoints:N,targetPrice:l,isLeft:d});s=e.targetAreaStatPoint,u=e.targetAreaStatPoints}if(s){const t=p({target:s.middlePrice}),a=m({minXLN10:q,maxXLN10:P,width:e,targetLN10:t}),l=g({maxHeight:d?w:A,gridAreaHeight:v,value:s.rectangleHeight}),c=n.findOne("#tooltip"),h=n.findOne("#toolTipVertLine"),f=n.findOne("#joinCircle"),b=n.findOne("#tooltip-Text"),y=n.findOne("#tooltip-tag"),N=n.findOne("#priceTextLabel"),S=null==N?void 0:N.findOne("#priceTextLabel-text"),H=n.findOne("#area");null==c||c.position({x:a,y:l-5-6}),null==b||b.fill(j.tooltipColor||(d?"#00FAD9":"#FF5072")),null==b||b.text(d?r.chartT("pool.chart.liquidity-chart-buy",{amount:o.formatShortNumber(s.area),symbol:x,price:o.formatShortNumber(s.price)}):r.chartT("pool.chart.liquidity-chart-sell",{amount:o.formatShortNumber(s.area),symbol:L,price:o.formatShortNumber(s.price)})),c&&y&&(c.width()/2>i?(y.pointerDirection("left"),y.pointerHeight(15),y.pointerWidth(8),c.offsetX(-11),c.offsetY(-11)):c.width()/2+i>e?(y.pointerDirection("right"),y.pointerHeight(15),y.pointerWidth(8),c.offsetX(11),c.offsetY(-11)):(y.pointerDirection("down"),y.pointerHeight(8),y.pointerWidth(15),c.offsetX(0),c.offsetY(0))),null==h||h.points([a,v,a,l]),null==h||h.stroke(d?"#55f6db":"#ff4f73");let k=d?"rgb(86, 246, 218)":"#FF5072",X=d?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";j.leftLine&&j.rightLine&&(k=d?j.leftLine:j.rightLine,X=d?`rgba(${r.colorRgb(j.leftLine)}, 0.4)`:`rgba(${r.colorRgb(j.rightLine)}, 0.4)`),f&&(f.x(a),f.y(l),f.fill(k),f.stroke(X)),N&&(N.x(a),N.y(v+8.08+1),N.offsetX(N.width()/2),N.x()-N.width()/2<0?N.x(N.width()/2):N.x()+N.width()/2>e?N.x(e-N.width()/2):N.x(i)),S&&(S.fill(j.tooltipColor||(d?"#00FAD9":"#FF5072")),S.text(o.formatShortNumber(s.price)));const M=[];for(const t of u){const{middlePrice:i,rectangleHeight:r}=t,n=p({target:i}),o=m({minXLN10:q,maxXLN10:P,width:e,targetLN10:n}),a=g({maxHeight:d?w:A,gridAreaHeight:v,value:r});M.push(o,a+1)}const B=M.slice(),[C,F]=B;d?(B.push(a,l),B.push(a,v),B.push(C,v),B.push(C,F)):(B.unshift(C,v),B.unshift(a,v),B.unshift(a,l)),H&&(H.points(B),H.fill(d?j.leftLine||"#2c5b56":j.rightLine||"#7b3a48")),n.show()}}}},k=function({gridAreaHeight:e,gridAreaWidth:t,horizontalLineCount:r,verticalLineCount:o,color:a="#2A2A2D"}){return i.useMemo(()=>{const i=[],s=e/(r+1),u=[],d=t/(o+1);for(let e=0;e<r;e++){const r=s*(e+1);i.push([0,r,t,r])}for(let t=0;t<o;t++){const i=d*(t+1);u.push([i,0,i,e])}return l.jsxs(l.Fragment,{children:[i.map((e,t)=>l.jsx(n.Line,{points:e,stroke:a,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},t)),u.map((e,t)=>l.jsx(n.Line,{points:e,stroke:a,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},t))]})},[e,t,r,o,a])}({gridAreaHeight:v,gridAreaWidth:e,horizontalLineCount:9,verticalLineCount:7,color:j.grid}),X=function({minXLN10:e,maxXLN10:t,labelCount:r,gridAreaHeight:a,gridAreaWidth:s,color:u="#606066"}){return i.useMemo(()=>{const i=s/(r+1),d=[],g=[];for(let n=0;n<r;n++){const r=i/2+i*n;d.push({x:r,y:a+10.08+1,text:o.formatShortNumber(h({x:i*(n+1),width:s,minXLN10:e,maxXLN10:t}))});const l=i*(n+1);g.push([l,a+1,l,a+4+1])}return l.jsxs(l.Fragment,{children:[d.map((e,t)=>l.jsx(n.Text,{x:e.x,y:e.y,text:e.text,fontSize:14,fontFamily:"Manrope",fill:u,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t)),g.map((e,t)=>l.jsx(n.Line,{points:e,stroke:u,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},t))]})},[e,t,a,s,r])}({gridAreaHeight:v,gridAreaWidth:e,labelCount:7,minXLN10:q,maxXLN10:P,color:j.textColor}),M=function({gridAreaHeight:e,gridAreaWidth:t,color:r="#606066"}){return i.useMemo(()=>{const i=t/2;return l.jsx(n.Line,{points:[i,0,i,e-1],stroke:r,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})},[e,t,r])}({gridAreaHeight:v,gridAreaWidth:e,color:j.midPriceLine}),{leftLine:B,rightLine:C}=function({leftStatAreaPoints:e,rightStatAreaPoints:t,minXLN10:r,maxXLN10:o,maxLeftHeight:a,maxRightHeight:s,gridAreaWidth:u,gridAreaHeight:d,colorMap:c}){return{leftLine:i.useMemo(()=>{if(e.length<1)return l.jsx(l.Fragment,{});const t=[];let i=d;for(const n of e){const{middlePrice:e,rectangleHeight:l}=n,s=p({target:e}),c=m({minXLN10:r,maxXLN10:o,width:u,targetLN10:s}),h=g({maxHeight:a,gridAreaHeight:d,value:l});t.push(c,h),h<i&&(i=h)}const s=t.slice(),[h,f]=s,x=s[s.length-1],L=s[s.length-2];return s.push(L,x),s.push(L,d),s.push(h,d),s.push(h,f),l.jsxs(l.Fragment,{children:[l.jsx(n.Line,{points:s,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:c.leftBg}),l.jsx(n.Line,{points:t,stroke:c.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})},[e,u,r,o,d,a]),rightLine:i.useMemo(()=>{if(t.length<1)return l.jsx(l.Fragment,{});const e=[];let i=d;for(const n of t){const{middlePrice:t,rectangleHeight:a}=n,l=p({target:t}),c=m({minXLN10:r,maxXLN10:o,width:u,targetLN10:l}),h=g({maxHeight:s,gridAreaHeight:d,value:a});e.push(c,h),h<i&&(i=h)}const a=e.slice(),[h]=a;return a.unshift(h,d),a.unshift(u,d),l.jsxs(l.Fragment,{children:[l.jsx(n.Line,{points:a,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:c.rightBg}),l.jsx(n.Line,{points:e,stroke:c.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})},[t,u,r,o,d,s])}}({leftStatAreaPoints:y,rightStatAreaPoints:N,minXLN10:q,maxXLN10:P,maxLeftHeight:w,maxRightHeight:A,gridAreaWidth:e,gridAreaHeight:v,colorMap:j});return l.jsxs(n.Stage,{width:e,height:u,onMouseMove:H,onMouseOver:H,onMouseEnter:H,onMouseOut:()=>{const{current:e}=S;e&&e.hide()},children:[l.jsxs(n.Layer,{children:[l.jsx(n.Rect,{x:0,y:0,width:e,height:v,stroke:j.grid,strokeWidth:1}),k,X,B,C,M]}),l.jsxs(n.Layer,{ref:S,visible:!1,children:[l.jsx(n.Line,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),l.jsx(n.Line,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),l.jsx(n.Circle,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),l.jsxs(n.Label,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[l.jsx(n.Tag,{fill:j.tooltipBg,id:"priceTextLabel-tag"}),l.jsx(n.Text,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),l.jsxs(n.Label,{listening:!1,id:"tooltip",children:[l.jsx(n.Tag,{fill:j.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),l.jsx(n.Text,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r.labelPadding,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}exports.default=({width:e=834,height:t=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:o,pmmParams:a,midPrice:s,notShowTipText:g,colorMap:c})=>l.jsxs(u,{children:[void 0!==a&&void 0!==s&&void 0!==o&&void 0!==s&&l.jsx(x,{width:e,height:t,params:a,midPrice:s,pmmModel:o,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:c}),g?"":l.jsxs(d,{children:["* ",r.chartT("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});
|
|
13
|
+
//# sourceMappingURL=index-Btu6is6Z.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Btu6is6Z.cjs","sources":["../src/components/chart/liquidity-chart/index.styled.tsx","../src/components/chart/liquidity-chart/helper.ts","../src/components/chart/liquidity-chart/LiquidityChartKonva.tsx","../src/components/chart/liquidity-chart/usePoints.ts","../src/components/chart/liquidity-chart/useGridLine.tsx","../src/components/chart/liquidity-chart/useHorizontalLabel.tsx","../src/components/chart/liquidity-chart/useMiddleLine.tsx","../src/components/chart/liquidity-chart/useLiquidityLine.tsx","../src/components/chart/liquidity-chart/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\r\n\r\nexport const Container = styled.div`\r\n height: 100%;\r\n position: relative;\r\n`;\r\nexport const TipWrapper = styled.div`\r\n text-align: center;\r\n margin-top: 17.1px;\r\n margin-bottom: 88.41px;\r\n color: #606066;\r\n font-size: 12px;\r\n line-height: 17px;\r\n font-weight: 400;\r\n`;\r\n","import BigNumber from 'bignumber.js';\r\nimport { StatAreaPoint } from './usePoints';\r\n\r\n// The space reserved at the top\r\nconst topEmptyHeight = 36;\r\n\r\nexport function computePointYByHeight({\r\n maxHeight,\r\n gridAreaHeight,\r\n value,\r\n}: {\r\n maxHeight: BigNumber;\r\n gridAreaHeight: number;\r\n value: BigNumber;\r\n}) {\r\n const height = new BigNumber(gridAreaHeight).minus(topEmptyHeight);\r\n const onePXY = height.div(maxHeight);\r\n const y = height.minus(value.multipliedBy(onePXY)).plus(topEmptyHeight);\r\n return y.toNumber();\r\n}\r\n\r\nexport function computeHeightByPointY({\r\n maxY,\r\n gridAreaHeight,\r\n y,\r\n}: {\r\n maxY: BigNumber;\r\n gridAreaHeight: number;\r\n y: number;\r\n}) {\r\n const height = new BigNumber(gridAreaHeight).minus(topEmptyHeight);\r\n const onePXY = height.div(maxY);\r\n const h = height.minus(new BigNumber(y).minus(topEmptyHeight)).div(onePXY);\r\n return h;\r\n}\r\n\r\n/**\r\n * Obtain the closest data point from the data point collection through the coordinate point x and a series of point data subsets from the point to the center line.\r\n */\r\nexport function getStatAreaPointByX({\r\n targetPrice,\r\n areaPoints,\r\n isLeft,\r\n}: {\r\n targetPrice: BigNumber;\r\n areaPoints: StatAreaPoint[];\r\n isLeft: boolean;\r\n}): {\r\n targetAreaStatPoint: StatAreaPoint | null;\r\n targetAreaStatPoints: StatAreaPoint[];\r\n} {\r\n for (let index = 0; index < areaPoints.length; index++) {\r\n const point = areaPoints[index];\r\n\r\n const nextPoint =\r\n index < areaPoints.length - 1 ? areaPoints[index + 1] : null;\r\n\r\n if (!nextPoint) {\r\n return { targetAreaStatPoint: point, targetAreaStatPoints: areaPoints };\r\n }\r\n\r\n if (isLeft) {\r\n if (\r\n targetPrice.lte(point.middlePrice) &&\r\n targetPrice.gte(nextPoint.middlePrice)\r\n ) {\r\n return {\r\n targetAreaStatPoint: point,\r\n targetAreaStatPoints: areaPoints.slice(0, index + 1),\r\n };\r\n }\r\n } else if (\r\n targetPrice.gte(point.middlePrice) &&\r\n targetPrice.lte(nextPoint.middlePrice)\r\n ) {\r\n return {\r\n targetAreaStatPoint: point,\r\n targetAreaStatPoints: areaPoints.slice(0, index + 1),\r\n };\r\n }\r\n }\r\n\r\n return { targetAreaStatPoint: null, targetAreaStatPoints: [] };\r\n}\r\n\r\n/**\r\n * Given a pixel's x-coordinate, width, logarithm of the minimum value of the abscissa, and logarithm of the maximum value of the abscissa, calculate the logarithmic coordinate corresponding to the point\r\n */\r\nexport function computeTargetPrice({\r\n x,\r\n width,\r\n minXLN10,\r\n maxXLN10,\r\n}: {\r\n x: number;\r\n width: number;\r\n minXLN10: BigNumber;\r\n maxXLN10: BigNumber;\r\n}) {\r\n const xLN10 = new BigNumber(x)\r\n .div(width)\r\n .multipliedBy(maxXLN10.minus(minXLN10));\r\n const power = xLN10.plus(minXLN10);\r\n return new BigNumber(10 ** power.toNumber());\r\n}\r\n\r\n/**\r\n * Given the logarithm of a coordinate, the width, the logarithm of the minimum value of the abscissa, and the logarithm of the maximum value of the abscissa, calculate the x coordinate corresponding to the point\r\n */\r\nexport function computeTargetX({\r\n width,\r\n targetLN10,\r\n minXLN10,\r\n maxXLN10,\r\n}: {\r\n width: number;\r\n targetLN10: BigNumber;\r\n minXLN10: BigNumber;\r\n maxXLN10: BigNumber;\r\n}) {\r\n return targetLN10\r\n .minus(minXLN10)\r\n .div(maxXLN10.minus(minXLN10))\r\n .multipliedBy(width)\r\n .toNumber();\r\n}\r\n\r\n/**\r\n * Calculate logarithm\r\n */\r\nexport function computeTargetLN({ target }: { target: BigNumber }) {\r\n return new BigNumber(Math.log10(target.toNumber()));\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 } from 'lodash';\r\nimport { useRef } from 'react';\r\nimport { chartT as t } from '../i18n';\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 { formatShortNumber } from '../../../utils/formatter';\r\nimport { colorRgb } from '../depth-chart/helper';\r\nimport { labelPadding } from '../utils';\r\nimport {\r\n computePointYByHeight,\r\n computeTargetLN,\r\n computeTargetPrice,\r\n computeTargetX,\r\n getStatAreaPointByX,\r\n} from './helper';\r\nimport { useGridLine } from './useGridLine';\r\nimport { useHorizontalLabel } from './useHorizontalLabel';\r\nimport { useLiquidityLine } from './useLiquidityLine';\r\nimport { useMiddleLine } from './useMiddleLine';\r\nimport { StatAreaPoint, usePoints } from './usePoints';\r\n\r\nexport const bgColor = 'rgba(38, 39, 41, 0.3)';\r\n\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 textColor?: 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 colorMap?: ColorMap;\r\n};\r\n\r\nexport function LiquidityChartKonva({\r\n width,\r\n height,\r\n params,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n colorMap,\r\n}: Props) {\r\n const {\r\n maxLeftHeight,\r\n maxRightHeight,\r\n leftStatAreaPoints,\r\n rightStatAreaPoints,\r\n minXLN10,\r\n maxXLN10,\r\n } = usePoints({\r\n params,\r\n });\r\n\r\n const xAxisLabelHeight = 30.13;\r\n const gridAreaHeight = height - xAxisLabelHeight;\r\n const horizontalLineCount = 9;\r\n // The number of vertical grid lines or the number of horizontal axis scales\r\n const verticalLineCount = 7;\r\n\r\n const tooltipRef = useRef<Konva.Layer>(null);\r\n\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 textColor: '#606066',\r\n },\r\n colorMap,\r\n );\r\n\r\n const handleMouseover = (evt: KonvaEventObject<MouseEvent>) => {\r\n const { current: tooltip } = tooltipRef;\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 const middleX = width / 2;\r\n if (Math.abs(x - middleX) <= 2) {\r\n return;\r\n }\r\n if (x <= 2 || width - x <= 2) {\r\n return;\r\n }\r\n const targetPrice = computeTargetPrice({\r\n x,\r\n width,\r\n minXLN10,\r\n maxXLN10,\r\n });\r\n\r\n let targetAreaStatPoint: StatAreaPoint | null = null;\r\n let targetAreaStatPoints: Array<StatAreaPoint> = [];\r\n const isLeft = x < middleX;\r\n if (isLeft) {\r\n const result = getStatAreaPointByX({\r\n areaPoints: leftStatAreaPoints,\r\n targetPrice,\r\n isLeft,\r\n });\r\n targetAreaStatPoint = result.targetAreaStatPoint;\r\n targetAreaStatPoints = result.targetAreaStatPoints;\r\n } else {\r\n const result = getStatAreaPointByX({\r\n areaPoints: rightStatAreaPoints,\r\n targetPrice,\r\n isLeft,\r\n });\r\n targetAreaStatPoint = result.targetAreaStatPoint;\r\n targetAreaStatPoints = result.targetAreaStatPoints;\r\n }\r\n if (targetAreaStatPoint) {\r\n const targetLN10 = computeTargetLN({\r\n target: targetAreaStatPoint.middlePrice,\r\n });\r\n const targetAreaPointX = computeTargetX({\r\n minXLN10,\r\n maxXLN10,\r\n width,\r\n targetLN10,\r\n });\r\n const targetAreaPointY = computePointYByHeight({\r\n maxHeight: isLeft ? maxLeftHeight : maxRightHeight,\r\n gridAreaHeight,\r\n value: targetAreaStatPoint.rectangleHeight,\r\n });\r\n const tooltipLabel = tooltip.findOne<Konva.Label>('#tooltip');\r\n const toolTipVertLine =\r\n tooltip.findOne<Konva.Line>('#toolTipVertLine');\r\n const joinCircle = tooltip.findOne<Konva.Line>('#joinCircle');\r\n const tooltipText = tooltip.findOne<Konva.Text>('#tooltip-Text');\r\n const tooltipTag = tooltip.findOne<Konva.Tag>('#tooltip-tag');\r\n const priceTextLabel =\r\n tooltip.findOne<Konva.Label>('#priceTextLabel');\r\n const priceTextLabelText = priceTextLabel?.findOne<Konva.Text>(\r\n '#priceTextLabel-text',\r\n );\r\n const area = tooltip.findOne<Konva.Line>('#area');\r\n\r\n tooltipLabel?.position({\r\n x: targetAreaPointX,\r\n y: targetAreaPointY - 5 - 6,\r\n });\r\n\r\n tooltipText?.fill(\r\n colorMapRes.tooltipColor || (isLeft ? '#00FAD9' : '#FF5072'),\r\n );\r\n tooltipText?.text(\r\n isLeft\r\n ? t('pool.chart.liquidity-chart-buy', {\r\n amount: formatShortNumber(targetAreaStatPoint.area),\r\n symbol: baseTokenSymbol,\r\n price: formatShortNumber(targetAreaStatPoint.price),\r\n })\r\n : t('pool.chart.liquidity-chart-sell', {\r\n amount: formatShortNumber(targetAreaStatPoint.area),\r\n symbol: quoteTokenSymbol,\r\n price: formatShortNumber(targetAreaStatPoint.price),\r\n }),\r\n );\r\n\r\n if (tooltipLabel && tooltipTag) {\r\n if (tooltipLabel.width() / 2 > x) {\r\n tooltipTag.pointerDirection('left');\r\n tooltipTag.pointerHeight(15);\r\n tooltipTag.pointerWidth(8);\r\n tooltipLabel.offsetX(-(5 + 6));\r\n tooltipLabel.offsetY(-(5 + 6));\r\n } else if (tooltipLabel.width() / 2 + x > width) {\r\n tooltipTag.pointerDirection('right');\r\n tooltipTag.pointerHeight(15);\r\n tooltipTag.pointerWidth(8);\r\n tooltipLabel.offsetX(5 + 6);\r\n tooltipLabel.offsetY(-(5 + 6));\r\n } else {\r\n // @ts-ignore\r\n tooltipTag.pointerDirection('down');\r\n tooltipTag.pointerHeight(8);\r\n tooltipTag.pointerWidth(15);\r\n tooltipLabel.offsetX(0);\r\n tooltipLabel.offsetY(0);\r\n }\r\n }\r\n\r\n toolTipVertLine?.points([\r\n targetAreaPointX,\r\n gridAreaHeight,\r\n targetAreaPointX,\r\n targetAreaPointY,\r\n ]);\r\n toolTipVertLine?.stroke(isLeft ? '#55f6db' : '#ff4f73');\r\n\r\n let joinFill = isLeft ? 'rgb(86, 246, 218)' : '#FF5072';\r\n let joinStroke = isLeft\r\n ? 'rgba(86, 246, 218, 0.3)'\r\n : 'rgba(255, 80, 114, 0.3)';\r\n if (colorMapRes.leftLine && colorMapRes.rightLine) {\r\n joinFill = isLeft ? colorMapRes.leftLine : colorMapRes.rightLine;\r\n joinStroke = isLeft\r\n ? `rgba(${colorRgb(colorMapRes.leftLine)}, 0.4)`\r\n : `rgba(${colorRgb(colorMapRes.rightLine)}, 0.4)`;\r\n }\r\n if (joinCircle) {\r\n joinCircle.x(targetAreaPointX);\r\n joinCircle.y(targetAreaPointY);\r\n joinCircle.fill(joinFill);\r\n joinCircle.stroke(joinStroke);\r\n }\r\n\r\n if (priceTextLabel) {\r\n priceTextLabel.x(targetAreaPointX);\r\n priceTextLabel.y(gridAreaHeight + 8.08 + 1);\r\n priceTextLabel.offsetX(priceTextLabel.width() / 2);\r\n if (priceTextLabel.x() - priceTextLabel.width() / 2 < 0) {\r\n priceTextLabel.x(priceTextLabel.width() / 2);\r\n } else if (\r\n priceTextLabel.x() + priceTextLabel.width() / 2 >\r\n width\r\n ) {\r\n priceTextLabel.x(width - priceTextLabel.width() / 2);\r\n } else {\r\n priceTextLabel.x(x);\r\n }\r\n }\r\n\r\n if (priceTextLabelText) {\r\n priceTextLabelText.fill(\r\n colorMapRes.tooltipColor || (isLeft ? '#00FAD9' : '#FF5072'),\r\n );\r\n priceTextLabelText.text(\r\n formatShortNumber(targetAreaStatPoint.price),\r\n );\r\n }\r\n\r\n // Gradient colored dots\r\n const points: Array<number> = [];\r\n for (const statPoint of targetAreaStatPoints) {\r\n const { middlePrice, rectangleHeight } = statPoint;\r\n const targetLN10Gradient = computeTargetLN({ target: middlePrice });\r\n const xGradient = computeTargetX({\r\n minXLN10,\r\n maxXLN10,\r\n width,\r\n targetLN10: targetLN10Gradient,\r\n });\r\n const y = computePointYByHeight({\r\n maxHeight: isLeft ? maxLeftHeight : maxRightHeight,\r\n gridAreaHeight,\r\n value: rectangleHeight,\r\n });\r\n points.push(xGradient, y + 1);\r\n }\r\n const linearGradientPoints = points.slice();\r\n const [firstPointX, firstPointY] = linearGradientPoints;\r\n if (isLeft) {\r\n linearGradientPoints.push(targetAreaPointX, targetAreaPointY);\r\n linearGradientPoints.push(targetAreaPointX, gridAreaHeight);\r\n linearGradientPoints.push(firstPointX, gridAreaHeight);\r\n linearGradientPoints.push(firstPointX, firstPointY);\r\n } else {\r\n linearGradientPoints.unshift(firstPointX, gridAreaHeight);\r\n linearGradientPoints.unshift(targetAreaPointX, gridAreaHeight);\r\n linearGradientPoints.unshift(targetAreaPointX, targetAreaPointY);\r\n }\r\n if (area) {\r\n area.points(linearGradientPoints);\r\n area.fill(\r\n isLeft\r\n ? colorMapRes.leftLine || '#2c5b56'\r\n : colorMapRes.rightLine || '#7b3a48',\r\n );\r\n }\r\n\r\n tooltip.show();\r\n }\r\n }\r\n }\r\n };\r\n\r\n const handleMouseOut = () => {\r\n const { current: tooltip } = tooltipRef;\r\n if (tooltip) {\r\n tooltip.hide();\r\n }\r\n };\r\n\r\n const gridLine = useGridLine({\r\n gridAreaHeight,\r\n gridAreaWidth: width,\r\n horizontalLineCount,\r\n verticalLineCount,\r\n color: colorMapRes.grid,\r\n });\r\n const horizontalLabel = useHorizontalLabel({\r\n gridAreaHeight,\r\n gridAreaWidth: width,\r\n labelCount: verticalLineCount,\r\n minXLN10,\r\n maxXLN10,\r\n color: colorMapRes.textColor,\r\n });\r\n const middleLine = useMiddleLine({\r\n gridAreaHeight,\r\n gridAreaWidth: width,\r\n color: colorMapRes.midPriceLine,\r\n });\r\n const { leftLine, rightLine } = useLiquidityLine({\r\n leftStatAreaPoints,\r\n rightStatAreaPoints,\r\n minXLN10,\r\n maxXLN10,\r\n maxLeftHeight,\r\n maxRightHeight,\r\n gridAreaWidth: width,\r\n gridAreaHeight,\r\n colorMap: colorMapRes,\r\n });\r\n\r\n return (\r\n <Stage\r\n width={width}\r\n height={height}\r\n onMouseMove={handleMouseover}\r\n onMouseOver={handleMouseover}\r\n onMouseEnter={handleMouseover}\r\n onMouseOut={handleMouseOut}\r\n >\r\n <Layer>\r\n <Rect\r\n x={0}\r\n y={0}\r\n width={width}\r\n height={gridAreaHeight}\r\n stroke={colorMapRes.grid}\r\n strokeWidth={1}\r\n />\r\n\r\n {gridLine}\r\n\r\n {horizontalLabel}\r\n\r\n {leftLine}\r\n\r\n {rightLine}\r\n\r\n {middleLine}\r\n </Layer>\r\n\r\n <Layer ref={tooltipRef} visible={false}>\r\n <Line\r\n points={[]}\r\n closed\r\n listening={false}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n id=\"area\"\r\n />\r\n\r\n <Line\r\n points={[]}\r\n strokeWidth={1}\r\n stroke=\"#ff4f73\"\r\n lineJoin=\"round\"\r\n lineCap=\"round\"\r\n dash={[4, 6]}\r\n id=\"toolTipVertLine\"\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 listening={false} x={0} y={0} id=\"priceTextLabel\">\r\n <Tag fill={colorMapRes.tooltipBg} id=\"priceTextLabel-tag\" />\r\n <Text\r\n text=\"-\"\r\n fontSize={14}\r\n fontFamily=\"Manrope\"\r\n padding={2}\r\n fill=\"#FF5072\"\r\n id=\"priceTextLabel-text\"\r\n />\r\n </Label>\r\n\r\n <Label listening={false} id=\"tooltip\">\r\n <Tag\r\n fill={colorMapRes.tooltipBg}\r\n pointerDirection=\"down\"\r\n pointerWidth={15}\r\n pointerHeight={8}\r\n cornerRadius={8}\r\n lineJoin=\"round\"\r\n id=\"tooltip-tag\"\r\n />\r\n <Text\r\n text=\"\"\r\n fontFamily=\"Manrope\"\r\n fontSize={12}\r\n lineHeight={17 / 12}\r\n // width={210}\r\n padding={labelPadding}\r\n fill=\"#FF5072\"\r\n id=\"tooltip-Text\"\r\n />\r\n </Label>\r\n </Layer>\r\n </Stage>\r\n );\r\n}\r\n","import {\r\n PMMHelper,\r\n PmmModelParams,\r\n PMMState as PMMStateFromSDK,\r\n solveQuadraticFunctionForTarget,\r\n} from '@dodoex/api';\r\n\r\nimport BigNumber from 'bignumber.js';\r\nimport { useMemo } from 'react';\r\n\r\n/**\r\n * data point\r\n */\r\n\r\nexport type StatPoint = {\r\n giveAmount: BigNumber;\r\n getAmount: BigNumber;\r\n price: BigNumber;\r\n};\r\n\r\n/**\r\n * Drawing method:\r\n Substitute the minimum value to get the height of the center point, which is the bottom edge of the area chart. Substitute the maximum value to get the vertex of the area chart. The length of the bottom edge from the vertex is the price range.\r\n\r\n Divide the total area into one hundred equal parts. Calculate each part on the basis of the previous part. Substitute the new area into the formula to get a new price. The difference from the previous price is the width of the rectangle. The area is divided by The width is the height of the rectangle, which is the ordinate.\r\n\r\n First, calculate a series of points as a point set based on the rectangular accumulation method.\r\n\r\n When the mouse hovers, the abscissa is the price. Find the closest price in the point set. Use this price as the end point and the center line as the starting point to get a subset of the point set. You can draw a line by combining the center line and the abscissa. The area of the trapezoid can be drawn.\r\n\r\n Update: Taking Δl as the ordinate, Δl = (the difference between the quantity passed in from the previous point and the next point) * (the difference between the quantity obtained from the previous point and the next point)\r\n */\r\nexport type StatAreaPoint = {\r\n area: BigNumber;\r\n price: BigNumber;\r\n // The midpoint between the current price and the previous price is used as the abscissa\r\n middlePrice: BigNumber;\r\n rectangleHeight: BigNumber;\r\n};\r\n\r\nexport function usePoints({ params }: { params: PmmModelParams }) {\r\n return useMemo(() => {\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 pmmState = new PMMStateFromSDK({\r\n i,\r\n K,\r\n B: b,\r\n Q: q,\r\n B0: b0,\r\n Q0: q0,\r\n R,\r\n mtFeeRate: new BigNumber(0),\r\n lpFeeRate: new BigNumber(0),\r\n });\r\n\r\n const pmm = new PMMHelper();\r\n const B = new BigNumber(pmmState.B);\r\n // const Q = new BigNumber(pmmState.Q);\r\n\r\n // A collection of data points, mapped into points on the graph through equal width and height proportions\r\n const leftStatPoints: StatPoint[] = [];\r\n const rightStatPoints: StatPoint[] = [];\r\n let maxLeftHeight = new BigNumber(0);\r\n let maxRightHeight = new BigNumber(0);\r\n\r\n const midPrice = pmm.GetMidPrice(pmmState);\r\n const portion = q.gt(0) ? b.div(q) : new BigNumber(1);\r\n // console.log('v2 midPrice', midPrice.toString(), portion.toString());\r\n\r\n for (let index = 0; index <= 250; index++) {\r\n let giveAmount = B.multipliedBy(index / 100).multipliedBy(\r\n midPrice.multipliedBy(portion).multipliedBy(4),\r\n );\r\n // let giveAmount = B.multipliedBy(index / 100).multipliedBy(4);\r\n // let giveAmount = B.multipliedBy(index / 100);\r\n if (index === 0) {\r\n giveAmount = B.multipliedBy(1 / 100000000000);\r\n }\r\n // sellBase needs to pass in the number of quotes and gets the number of bases\r\n const getAmount = pmm?.QuerySellBase(giveAmount, pmmState);\r\n // console.log('v2 QuerySellBase', giveAmount.toString(), getAmount.toString());\r\n\r\n if (!getAmount.isNaN() && getAmount.gt(0)) {\r\n // Price on the left\r\n const price = getAmount.div(giveAmount);\r\n leftStatPoints.push({\r\n giveAmount,\r\n getAmount,\r\n price,\r\n });\r\n continue;\r\n }\r\n leftStatPoints.push({\r\n giveAmount,\r\n getAmount: new BigNumber(0),\r\n price: new BigNumber(0),\r\n });\r\n }\r\n\r\n for (let index = 0; index <= 250; index++) {\r\n let giveAmount = B.multipliedBy(index / 100).multipliedBy(\r\n midPrice.multipliedBy(4),\r\n );\r\n // let giveAmount = B.multipliedBy(index / 100);\r\n if (index === 0) {\r\n giveAmount = B.multipliedBy(1 / 100000000000);\r\n }\r\n // sellQuote needs to pass in the number of bases and get the number of quotes\r\n const getAmount = pmm?.QuerySellQuote(giveAmount, pmmState);\r\n // console.log('v2 QuerySellQuote', giveAmount.toString(), getAmount.toString());\r\n\r\n if (!getAmount.isNaN() && getAmount.gt(0)) {\r\n // Price on the right\r\n const price = giveAmount.dividedBy(getAmount);\r\n rightStatPoints.push({\r\n giveAmount,\r\n getAmount,\r\n price,\r\n });\r\n continue;\r\n }\r\n rightStatPoints.push({\r\n giveAmount,\r\n getAmount: new BigNumber(0),\r\n price: new BigNumber(0),\r\n });\r\n }\r\n\r\n if (leftStatPoints.length < 2 && rightStatPoints.length < 2) {\r\n return {\r\n leftStatAreaPoints: [],\r\n rightStatAreaPoints: [],\r\n maxLeftHeight: new BigNumber(10).multipliedBy(1.2),\r\n maxRightHeight: new BigNumber(10).multipliedBy(1.2),\r\n middlePriceLN10: new BigNumber(0),\r\n minXLN10: new BigNumber(-1),\r\n maxXLN10: new BigNumber(1),\r\n };\r\n }\r\n\r\n // The data points are divided into two groups on the left and right, and the width and height corresponding to the area are calculated.\r\n const leftStatAreaPoints: StatAreaPoint[] = [];\r\n for (let index = 1; index < leftStatPoints.length; index++) {\r\n const statPoint = leftStatPoints[index];\r\n const { giveAmount, getAmount, price } = statPoint;\r\n\r\n const lastStatPoint = leftStatPoints[index - 1];\r\n\r\n if (!price.isNaN() && price.gt(0) && lastStatPoint) {\r\n const priceChange = price.minus(lastStatPoint.price).abs();\r\n const giveAmountChange = giveAmount\r\n .minus(lastStatPoint.giveAmount)\r\n .abs();\r\n const getAmountChange = getAmount.minus(lastStatPoint.getAmount).abs();\r\n const leftRectangleHeight =\r\n getAmountChange.multipliedBy(giveAmountChange);\r\n\r\n if (index === 1) {\r\n leftStatAreaPoints.push({\r\n area: getAmount,\r\n price,\r\n middlePrice: price.plus(priceChange.div(1.1)),\r\n rectangleHeight: leftRectangleHeight.plus(\r\n leftRectangleHeight.multipliedBy(0.03),\r\n ),\r\n });\r\n }\r\n leftStatAreaPoints.push({\r\n area: getAmount,\r\n price,\r\n middlePrice: price.plus(priceChange.div(2)),\r\n rectangleHeight: leftRectangleHeight,\r\n });\r\n\r\n maxLeftHeight = BigNumber.max(leftRectangleHeight, maxLeftHeight);\r\n }\r\n }\r\n\r\n const rightStatAreaPoints: StatAreaPoint[] = [];\r\n for (let index = 1; index < rightStatPoints.length; index++) {\r\n const statPoint = rightStatPoints[index];\r\n const { giveAmount, getAmount, price } = statPoint;\r\n\r\n const lastStatPoint = rightStatPoints[index - 1];\r\n const lastPrice = lastStatPoint.price;\r\n const lastGiveAmount = lastStatPoint.giveAmount;\r\n const lastGetAmount = lastStatPoint.getAmount;\r\n\r\n if (!price.isNaN() && price.gt(0) && lastStatPoint) {\r\n const priceChange = price.minus(lastPrice).abs();\r\n const giveAmountChange = giveAmount.minus(lastGiveAmount).abs();\r\n const getAmountChange = getAmount.minus(lastGetAmount).abs();\r\n const rightRectangleHeight =\r\n getAmountChange.multipliedBy(giveAmountChange);\r\n\r\n if (index === 1) {\r\n rightStatAreaPoints.push({\r\n area: getAmount,\r\n price,\r\n middlePrice: price.minus(priceChange.div(1.1)),\r\n rectangleHeight: rightRectangleHeight.plus(\r\n rightRectangleHeight.multipliedBy(0.03),\r\n ),\r\n });\r\n }\r\n\r\n rightStatAreaPoints.push({\r\n area: getAmount,\r\n price,\r\n middlePrice: price.minus(priceChange.div(2)),\r\n rectangleHeight: rightRectangleHeight,\r\n });\r\n\r\n maxRightHeight = BigNumber.max(rightRectangleHeight, maxRightHeight);\r\n }\r\n }\r\n\r\n // Intuitively, the data points on the left are distributed from the middle to the left, and the data points on the right are distributed from the middle to the right.\r\n // Left starting point\r\n const leftStartStatPoint =\r\n leftStatPoints.length > 0\r\n ? leftStatPoints[leftStatPoints.length - 1]\r\n : rightStatPoints[0];\r\n // midpoint\r\n const middleStatPoint =\r\n rightStatPoints.length > 0 ? rightStatPoints[0] : leftStatPoints[0];\r\n // Right end point\r\n const rightEndStatPoint =\r\n rightStatPoints.length > 0\r\n ? rightStatPoints[rightStatPoints.length - 1]\r\n : leftStatPoints[0];\r\n\r\n const minX = leftStartStatPoint.price;\r\n const maxX = rightEndStatPoint.price;\r\n const middlePrice = middleStatPoint.price;\r\n const middlePriceLN10 = new BigNumber(Math.log10(middlePrice.toNumber()));\r\n // Center the graphic\r\n let minXLN10 = minX.gt(0)\r\n ? new BigNumber(Math.log10(minX.toNumber()))\r\n : new BigNumber(-Math.log10(maxX.toNumber()));\r\n let maxXLN10 = maxX.gt(0)\r\n ? new BigNumber(Math.log10(maxX.toNumber()))\r\n : new BigNumber(-Math.log10(minX.toNumber()));\r\n const rangeLN10 = BigNumber.max(\r\n middlePriceLN10.minus(minXLN10).abs(),\r\n maxXLN10.minus(middlePriceLN10).abs(),\r\n );\r\n minXLN10 = middlePriceLN10.minus(rangeLN10);\r\n maxXLN10 = middlePriceLN10.plus(rangeLN10);\r\n // console.log('v2 price', {\r\n // // middlePrice: middlePrice.toString(),\r\n // minX: minX.toString(),\r\n // // maxX: maxX.toString(),\r\n // middlePriceLN10: middlePriceLN10.toString(),\r\n // minXLN10: minXLN10.toString(),\r\n // maxXLN10: maxXLN10.toString(),\r\n // });\r\n\r\n return {\r\n leftStatAreaPoints,\r\n rightStatAreaPoints,\r\n maxLeftHeight: maxLeftHeight.multipliedBy(1.2),\r\n maxRightHeight: maxRightHeight.multipliedBy(1.2),\r\n minXLN10,\r\n maxXLN10,\r\n middlePriceLN10,\r\n };\r\n }, [params]);\r\n}\r\n","import { useMemo } from 'react';\r\nimport { Line } from 'react-konva';\r\n\r\nexport function useGridLine({\r\n gridAreaHeight,\r\n gridAreaWidth,\r\n horizontalLineCount,\r\n verticalLineCount,\r\n color = '#2A2A2D',\r\n}: {\r\n gridAreaHeight: number;\r\n gridAreaWidth: number;\r\n horizontalLineCount: number;\r\n verticalLineCount: number;\r\n color?: string;\r\n}) {\r\n return useMemo(() => {\r\n const horizontalGridLines: Array<Array<number>> = [];\r\n const horizontalGridPerBlockHeight =\r\n gridAreaHeight / (horizontalLineCount + 1);\r\n const verticalGridLines: Array<Array<number>> = [];\r\n const verticalGridPerBlockHeight = gridAreaWidth / (verticalLineCount + 1);\r\n for (let index = 0; index < horizontalLineCount; index++) {\r\n const y = horizontalGridPerBlockHeight * (index + 1);\r\n horizontalGridLines.push([0, y, gridAreaWidth, y]);\r\n }\r\n for (let index = 0; index < verticalLineCount; index++) {\r\n const x = verticalGridPerBlockHeight * (index + 1);\r\n verticalGridLines.push([x, 0, x, gridAreaHeight]);\r\n }\r\n return (\r\n <>\r\n {horizontalGridLines.map((points, index) => (\r\n <Line\r\n key={index}\r\n points={points}\r\n stroke={color}\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n tension={1}\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={color}\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n tension={1}\r\n listening={false}\r\n />\r\n ))}\r\n </>\r\n );\r\n }, [\r\n gridAreaHeight,\r\n gridAreaWidth,\r\n horizontalLineCount,\r\n verticalLineCount,\r\n color,\r\n ]);\r\n}\r\n","import BigNumber from 'bignumber.js';\r\nimport { useMemo } from 'react';\r\nimport { Line, Text } from 'react-konva';\r\nimport { formatShortNumber } from '../../../utils/formatter';\r\nimport { computeTargetPrice } from './helper';\r\n\r\nexport function useHorizontalLabel({\r\n minXLN10,\r\n maxXLN10,\r\n labelCount,\r\n gridAreaHeight,\r\n gridAreaWidth,\r\n color = '#606066',\r\n}: {\r\n minXLN10: BigNumber;\r\n maxXLN10: BigNumber;\r\n labelCount: number;\r\n gridAreaHeight: number;\r\n gridAreaWidth: number;\r\n color?: string;\r\n}) {\r\n return useMemo(() => {\r\n const labelWidth = gridAreaWidth / (labelCount + 1);\r\n const labelTextList: Array<{\r\n x: number;\r\n y: number;\r\n text: string;\r\n }> = [];\r\n const labelLines: Array<Array<number>> = [];\r\n for (let index = 0; index < labelCount; index++) {\r\n const x = labelWidth / 2 + labelWidth * index;\r\n labelTextList.push({\r\n x,\r\n y: gridAreaHeight + 10.08 + 1,\r\n text: formatShortNumber(\r\n computeTargetPrice({\r\n x: labelWidth * (index + 1),\r\n width: gridAreaWidth,\r\n minXLN10,\r\n maxXLN10,\r\n }),\r\n ),\r\n });\r\n\r\n const lineX = labelWidth * (index + 1);\r\n labelLines.push([\r\n lineX,\r\n gridAreaHeight + 1,\r\n lineX,\r\n gridAreaHeight + 4 + 1,\r\n ]);\r\n }\r\n return (\r\n <>\r\n {labelTextList.map((labelText, index) => (\r\n <Text\r\n key={index}\r\n x={labelText.x}\r\n y={labelText.y}\r\n text={labelText.text}\r\n fontSize={14}\r\n fontFamily=\"Manrope\"\r\n fill={color}\r\n width={labelWidth}\r\n padding={0}\r\n align=\"center\"\r\n verticalAlign=\"bottom\"\r\n listening={false}\r\n />\r\n ))}\r\n\r\n {labelLines.map((points, index) => (\r\n <Line\r\n key={index}\r\n points={points}\r\n stroke={color}\r\n strokeWidth={1}\r\n lineCap=\"butt\"\r\n lineJoin=\"miter\"\r\n tension={1}\r\n listening={false}\r\n />\r\n ))}\r\n </>\r\n );\r\n }, [minXLN10, maxXLN10, gridAreaHeight, gridAreaWidth, labelCount]);\r\n}\r\n","import { useMemo } from 'react';\r\nimport { Line } from 'react-konva';\r\n\r\nexport function useMiddleLine({\r\n gridAreaHeight,\r\n gridAreaWidth,\r\n color = '#606066',\r\n}: {\r\n gridAreaHeight: number;\r\n gridAreaWidth: number;\r\n color?: string;\r\n}) {\r\n return useMemo(() => {\r\n const topPointX = gridAreaWidth / 2;\r\n return (\r\n <Line\r\n points={[topPointX, 0, topPointX, gridAreaHeight - 1]}\r\n stroke={color}\r\n strokeWidth={1}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n tension={1}\r\n listening={false}\r\n />\r\n );\r\n }, [gridAreaHeight, gridAreaWidth, color]);\r\n}\r\n","import BigNumber from 'bignumber.js';\r\nimport { useMemo } from 'react';\r\nimport { Line } from 'react-konva';\r\nimport {\r\n computePointYByHeight,\r\n computeTargetLN,\r\n computeTargetX,\r\n} from './helper';\r\nimport { ColorMap } from './LiquidityChartKonva';\r\nimport { StatAreaPoint } from './usePoints';\r\n\r\nexport function useLiquidityLine({\r\n leftStatAreaPoints,\r\n rightStatAreaPoints,\r\n minXLN10,\r\n maxXLN10,\r\n maxLeftHeight,\r\n maxRightHeight,\r\n gridAreaWidth,\r\n gridAreaHeight,\r\n colorMap,\r\n}: {\r\n leftStatAreaPoints: Array<StatAreaPoint>;\r\n rightStatAreaPoints: Array<StatAreaPoint>;\r\n minXLN10: BigNumber;\r\n maxXLN10: BigNumber;\r\n maxLeftHeight: BigNumber;\r\n maxRightHeight: BigNumber;\r\n gridAreaWidth: number;\r\n gridAreaHeight: number;\r\n colorMap: ColorMap;\r\n}) {\r\n const leftLine = useMemo(() => {\r\n if (leftStatAreaPoints.length < 1) {\r\n return <></>;\r\n }\r\n const points: Array<number> = [];\r\n let minPointY = gridAreaHeight;\r\n for (const statPoint of leftStatAreaPoints) {\r\n const { middlePrice, rectangleHeight } = statPoint;\r\n const targetLN10 = computeTargetLN({ target: middlePrice });\r\n const x = computeTargetX({\r\n minXLN10,\r\n maxXLN10,\r\n width: gridAreaWidth,\r\n targetLN10,\r\n });\r\n const y = computePointYByHeight({\r\n maxHeight: maxLeftHeight,\r\n gridAreaHeight,\r\n value: rectangleHeight,\r\n });\r\n points.push(x, y);\r\n if (y < minPointY) {\r\n minPointY = y;\r\n }\r\n }\r\n\r\n // Gradient color points: from center to left\r\n const linearGradientPoints = points.slice();\r\n const [rightEndPointX, rightEndPointY] = linearGradientPoints;\r\n const leftStartPointY =\r\n linearGradientPoints[linearGradientPoints.length - 1];\r\n const leftStartPointX =\r\n linearGradientPoints[linearGradientPoints.length - 2];\r\n linearGradientPoints.push(leftStartPointX, leftStartPointY);\r\n linearGradientPoints.push(leftStartPointX, gridAreaHeight);\r\n linearGradientPoints.push(rightEndPointX, gridAreaHeight);\r\n linearGradientPoints.push(rightEndPointX, rightEndPointY);\r\n return (\r\n <>\r\n <Line\r\n points={linearGradientPoints}\r\n closed\r\n listening={false}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n fillLinearGradientStartPoint={{ x: 0, y: gridAreaHeight }}\r\n fillLinearGradientEndPoint={{ x: 0, y: minPointY }}\r\n fillLinearGradientColorStops={colorMap.leftBg}\r\n />\r\n <Line\r\n points={points}\r\n stroke={colorMap.leftLine}\r\n strokeWidth={2}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n </>\r\n );\r\n }, [\r\n leftStatAreaPoints,\r\n gridAreaWidth,\r\n minXLN10,\r\n maxXLN10,\r\n gridAreaHeight,\r\n maxLeftHeight,\r\n ]);\r\n\r\n const rightLine = useMemo(() => {\r\n if (rightStatAreaPoints.length < 1) {\r\n return <></>;\r\n }\r\n const points: Array<number> = [];\r\n let minPointY = gridAreaHeight;\r\n for (const statPoint of rightStatAreaPoints) {\r\n const { middlePrice, rectangleHeight } = statPoint;\r\n const targetLN10 = computeTargetLN({ target: middlePrice });\r\n const x = computeTargetX({\r\n minXLN10,\r\n maxXLN10,\r\n width: gridAreaWidth,\r\n targetLN10,\r\n });\r\n const y = computePointYByHeight({\r\n maxHeight: maxRightHeight,\r\n gridAreaHeight,\r\n value: rectangleHeight,\r\n });\r\n points.push(x, y);\r\n if (y < minPointY) {\r\n minPointY = y;\r\n }\r\n }\r\n // Gradient colored dots\r\n const linearGradientPoints = points.slice();\r\n const [firstPointX] = linearGradientPoints;\r\n linearGradientPoints.unshift(firstPointX, gridAreaHeight);\r\n linearGradientPoints.unshift(gridAreaWidth, gridAreaHeight);\r\n return (\r\n <>\r\n <Line\r\n points={linearGradientPoints}\r\n closed\r\n listening={false}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n fillLinearGradientStartPoint={{ x: 0, y: gridAreaHeight }}\r\n fillLinearGradientEndPoint={{ x: 0, y: minPointY }}\r\n fillLinearGradientColorStops={colorMap.rightBg}\r\n />\r\n <Line\r\n points={points}\r\n stroke={colorMap.rightLine}\r\n strokeWidth={2}\r\n lineCap=\"round\"\r\n lineJoin=\"round\"\r\n listening={false}\r\n />\r\n </>\r\n );\r\n }, [\r\n rightStatAreaPoints,\r\n gridAreaWidth,\r\n minXLN10,\r\n maxXLN10,\r\n gridAreaHeight,\r\n maxRightHeight,\r\n ]);\r\n\r\n return {\r\n leftLine,\r\n rightLine,\r\n };\r\n}\r\n","import { PMMModel, PmmModelParams } from '@dodoex/api';\r\nimport BigNumber from 'bignumber.js';\r\nimport { Container, TipWrapper } from './index.styled';\r\nimport { ColorMap, LiquidityChartKonva } from './LiquidityChartKonva';\r\nimport { chartT as t } from '../i18n';\r\n\r\ntype Props = {\r\n width?: number;\r\n height?: number;\r\n baseTokenSymbol: string;\r\n quoteTokenSymbol: string;\r\n pmmModel?: PMMModel;\r\n pmmParams?: PmmModelParams;\r\n midPrice?: BigNumber;\r\n notShowTipText?: boolean;\r\n colorMap?: ColorMap;\r\n};\r\n\r\nconst LiquidityChart: React.FC<Props> = ({\r\n width = 834,\r\n height = 462,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n pmmModel,\r\n pmmParams,\r\n midPrice,\r\n notShowTipText,\r\n colorMap,\r\n}: Props) => {\r\n return (\r\n <Container>\r\n {pmmParams !== undefined &&\r\n midPrice !== undefined &&\r\n pmmModel !== undefined &&\r\n midPrice !== undefined && (\r\n <LiquidityChartKonva\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 colorMap={colorMap}\r\n />\r\n )}\r\n\r\n {!notShowTipText ? (\r\n <TipWrapper>\r\n * \r\n {t('pool.chart.liquidity-chart-tip', {\r\n baseTokenSymbol,\r\n })}\r\n </TipWrapper>\r\n ) : (\r\n ''\r\n )}\r\n </Container>\r\n );\r\n};\r\n\r\nexport default LiquidityChart;\r\n"],"names":["Container","styled","div","TipWrapper","computePointYByHeight","maxHeight","gridAreaHeight","value","height","BigNumber","minus","onePXY","multipliedBy","plus","toNumber","getStatAreaPointByX","targetPrice","areaPoints","isLeft","index","length","point","nextPoint","targetAreaStatPoint","targetAreaStatPoints","lte","middlePrice","gte","slice","computeTargetPrice","x","width","minXLN10","maxXLN10","power","computeTargetX","targetLN10","computeTargetLN","target","Math","log10","bgColor","LiquidityChartKonva","params","baseTokenSymbol","quoteTokenSymbol","colorMap","maxLeftHeight","maxRightHeight","leftStatAreaPoints","rightStatAreaPoints","useMemo","b","q","b0","q0","i","K","k","R","eq","solveQuadraticFunctionForTarget","pmmState","PMMStateFromSDK","B","Q","B0","Q0","mtFeeRate","lpFeeRate","pmm","PMMHelper","leftStatPoints","rightStatPoints","midPrice","GetMidPrice","portion","gt","giveAmount","getAmount","QuerySellBase","isNaN","price","push","QuerySellQuote","dividedBy","middlePriceLN10","statPoint","lastStatPoint","priceChange","abs","giveAmountChange","leftRectangleHeight","area","rectangleHeight","max","lastPrice","lastGiveAmount","lastGetAmount","rightRectangleHeight","leftStartStatPoint","middleStatPoint","rightEndStatPoint","minX","maxX","rangeLN10","usePoints","tooltipRef","useRef","colorMapRes","merge","grid","midPriceLine","leftBg","leftLine","leftColor","rightBg","rightLine","rightColor","tooltipBg","tooltipColor","undefined","textColor","handleMouseover","evt","current","tooltip","node","mousePos","_a","getStage","getPointerPosition","middleX","result","targetAreaPointX","targetAreaPointY","tooltipLabel","findOne","toolTipVertLine","joinCircle","tooltipText","tooltipTag","priceTextLabel","priceTextLabelText","position","y","fill","text","t","amount","formatShortNumber","symbol","pointerDirection","pointerHeight","pointerWidth","offsetX","offsetY","points","stroke","joinFill","joinStroke","colorRgb","targetLN10Gradient","xGradient","linearGradientPoints","firstPointX","firstPointY","unshift","show","gridLine","gridAreaWidth","horizontalLineCount","verticalLineCount","color","horizontalGridLines","horizontalGridPerBlockHeight","verticalGridLines","verticalGridPerBlockHeight","_jsxs","_Fragment","children","map","_jsx","Line","strokeWidth","lineCap","lineJoin","tension","listening","useGridLine","horizontalLabel","labelCount","labelWidth","labelTextList","labelLines","lineX","labelText","Text","fontSize","fontFamily","padding","align","verticalAlign","useHorizontalLabel","middleLine","topPointX","useMiddleLine","minPointY","rightEndPointX","rightEndPointY","leftStartPointY","leftStartPointX","closed","fillLinearGradientStartPoint","fillLinearGradientEndPoint","fillLinearGradientColorStops","useLiquidityLine","Stage","onMouseMove","onMouseOver","onMouseEnter","onMouseOut","handleMouseOut","hide","Layer","Rect","ref","visible","id","dash","Circle","radius","Label","Tag","cornerRadius","lineHeight","labelPadding","LiquidityChart","pmmModel","pmmParams","notShowTipText"],"mappings":"61CAEO,MAAMA,EAAYC,EAAOC,GAAG;;;EAItBC,EAAaF,EAAOC,GAAG;;;;;;;;ECA9B,SAAUE,GAAsBC,UACpCA,EAASC,eACTA,EAAcC,MACdA,IAMA,MAAMC,EAAS,IAAIC,EAAUH,GAAgBI,MAXxB,IAYfC,EAASH,EAAON,IAAIG,GAE1B,OADUG,EAAOE,MAAMH,EAAMK,aAAaD,IAASE,KAb9B,IAcZC,UACX,CAoBM,SAAUC,GAAoBC,YAClCA,EAAWC,WACXA,EAAUC,OACVA,IASA,IAAK,IAAIC,EAAQ,EAAGA,EAAQF,EAAWG,OAAQD,IAAS,CACtD,MAAME,EAAQ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AAA,IAACmD,MAAG,CACFvF,KAAMrC,EAAYU,UAClBiC,iBAAiB,OACjBE,aAAc,GACdD,cAAe,EACfiF,aAAc,EACdhD,SAAS,QACT0C,GAAG,gBAEL9C,EAAAA,IAACe,OAAI,CACHlD,KAAK,GACLoD,WAAW,UACXD,SAAU,GACVqC,WAAY,GAAK,GAEjBnC,QAASoC,EAAAA,aACT1F,KAAK,UACLkF,GAAG,yBAMf,iBM7awCS,EACtC9M,QAAQ,IACRvB,SAAS,IACToC,kBACAC,mBACAiM,WACAC,YACArK,WACAsK,iBACAlM,cAGEoI,EAAAA,KAAClL,EAAS,CAAAoL,eACO3D,IAAdsH,QACctH,IAAb/C,QACa+C,IAAbqH,QACarH,IAAb/C,GACE4G,EAAAA,IAAC5I,EAAmB,CAClBX,MAAOA,EACPvB,OAAQA,EACRmC,OAAQoM,EACRrK,SAAUA,EACVoK,SAAUA,EACVlM,gBAAiBA,EACjBC,iBAAkBA,EAClBC,SAAUA,IAIdkM,EAQA,GAPA9D,EAAAA,KAAC/K,EAAU,CAAAiL,UACT,KACChC,EAAAA,OAAE,iCAAkC,CACnCxG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import t from"@emotion/styled";import{merge as e}from"lodash";import{useMemo as i,useRef as n}from"react";import{l as r,h as o,m as l}from"./helper-
|
|
1
|
+
import t from"@emotion/styled";import{merge as e}from"lodash";import{useMemo as i,useRef as n}from"react";import{l as r,h as o,m as l}from"./helper-BRhItVhp.js";import{Line as a,Text as s,Stage as d,Layer as m,Rect as p,Circle as g,Label as u,Tag as c}from"react-konva";import{f as h}from"./index-9qJDllXY.js";import f from"bignumber.js";import{jsxs as x,Fragment as L,jsx as b}from"react/jsx-runtime";import{solveQuadraticFunctionForTarget as w,PMMState as A,PMMHelper as y}from"@dodoex/api";import"@lingui/core";import"@dodoex/components";import"@dodoex/dodo-contract-request";import"@babel/runtime/helpers/interopRequireDefault";import"@babel/runtime/helpers/defineProperty";import"@lingui/react";import"identicon.js";import"zustand";import"zustand/middleware";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@tanstack/react-query";import"@ethersproject/bignumber";import"react-dom";import"react-window";import"dayjs";import"dayjs/plugin/utc";import"dayjs/plugin/duration";import"dayjs/plugin/localizedFormat";import"react-transition-group";import"react-is";import"@dodoex/contract-request";import"axios";import"recharts";import"react-dom/client";import"jsbi";import"tiny-invariant";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";import"rmc-date-picker/assets/index.css";import"react-datetime/css/react-datetime.css";const P=t.div`
|
|
2
2
|
height: 100%;
|
|
3
3
|
position: relative;
|
|
4
4
|
`,N=t.div`
|