@dodoex/widgets 3.0.1-taiko.3 → 3.0.1-taiko.5
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/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/{helper-DmjwW_gd.cjs → helper-DTXcoDXs.cjs} +1 -1
- package/dist/{helper-BMMzIGFj.js → helper-KeBGXRew.js} +1 -1
- package/dist/index-BCoTzVYp.js +31 -0
- package/dist/{index-BnVBU0Xm.cjs → index-BVyYAG1R.cjs} +2 -2
- package/dist/{index-5HwYLdhB.js → index-C1G7IqbB.js} +2 -2
- package/dist/{index-CBFzdqif.js → index-CRdhNZQN.js} +1 -1
- package/dist/index-DDh_2pyp.cjs +31 -0
- package/dist/{index-B--4K0hM.cjs → index-Dj1QosYL.cjs} +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/types/components/Widget/index.d.ts +1 -0
- package/dist/types/hooks/Submission/types.d.ts +1 -0
- package/dist/types/providers/useInitContractRequest.d.ts +1 -0
- package/dist/types/widgets/PoolWidget/AMMV2Create/ConfirmDialog.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/PoolList/components/GoPoolDetailBtn.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/PoolList/hooks/usePoolListFilterTokenAndPool.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/PoolOperate/components/Ratio.d.ts +2 -1
- package/dist/types/widgets/PoolWidget/PoolOperate/components/SlippageSetting.d.ts +6 -2
- package/dist/types/widgets/PoolWidget/PoolOperate/hooks/useLiquidityOperateAmount.d.ts +19 -13
- package/dist/types/widgets/PoolWidget/hooks/useAMMV2AddLiquidity.d.ts +1 -1
- package/dist/types/widgets/PoolWidget/hooks/useAMMV2RemoveLiquidity.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/hooks/useUniV2CreatePairs.d.ts +18 -0
- package/dist/types/widgets/PoolWidget/hooks/useUniV2Pairs.d.ts +19 -12
- package/dist/types/widgets/PoolWidget/utils.d.ts +2 -1
- package/package.json +5 -3
- package/dist/index-CnDtN3r_.js +0 -31
- package/dist/index-D1INyInw.cjs +0 -31
|
@@ -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-DTXcoDXs.cjs"),n=require("react-konva"),o=require("./index-DDh_2pyp.cjs"),s=require("bignumber.js"),l=require("@dodoex/api");require("@lingui/core"),require("@lingui/react"),require("@dodoex/components"),require("react-redux"),require("identicon.js"),require("@web3-react/core"),require("@web3-react/eip1193"),require("@web3-react/walletconnect-v2"),require("@web3-react/metamask"),require("@web3-react/types"),require("@reduxjs/toolkit"),require("redux"),require("@tanstack/react-query"),require("react-dom"),require("react-window"),require("@ethersproject/bignumber"),require("dayjs"),require("react-transition-group"),require("zustand"),require("@dodoex/contract-request"),require("@dodoex/dodo-contract-request"),require("axios"),require("recharts"),require("react-infinite-scroller"),require("@uniswap/sdk-core"),require("@uniswap/v2-sdk"),require("rmc-date-picker");const a=e.div`
|
|
2
2
|
height: 100%;
|
|
3
3
|
position: relative;
|
|
4
4
|
`,u=e.div`
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
font-size: 12px;
|
|
10
10
|
line-height: 17px;
|
|
11
11
|
font-weight: 400;
|
|
12
|
-
`,d=36;function g({maxHeight:e,gridAreaHeight:t,value:i}){const r=new s(t).minus(d),n=r.div(e);return r.minus(i.multipliedBy(n)).plus(d).toNumber()}function m({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 p({x:e,width:t,minXLN10:i,maxXLN10:r}){const n=new s(e).div(t).multipliedBy(r.minus(i)).plus(i);return new s(10**n.toNumber())}function c({width:e,targetLN10:t,minXLN10:i,maxXLN10:r}){return t.minus(i).div(r.minus(i)).multipliedBy(e).toNumber()}function h({target:e}){return new s(Math.log10(e.toNumber()))}const x="rgba(38, 39, 41, 0.3)";function f({width:e,height:a,params:u,baseTokenSymbol:d,quoteTokenSymbol:f,colorMap:L}){const{maxLeftHeight:j,maxRightHeight:b,leftStatAreaPoints:w,rightStatAreaPoints:A,minXLN10:N,maxXLN10:y}=function({params:e}){return i.useMemo((()=>{const t=new s(e.b),i=new s(e.q);let r=new s(e.b0);const n=new s(e.q0),o=new s(e.i),a=new s(e.k),{R:u}=e;1===u&&r.eq(t)&&(r=l.solveQuadraticFunctionForTarget(t,i.minus(n),new s(1).div(o),a));const d=new l.PMMState({i:o,K:a,B:t,Q:i,B0:r,Q0:n,R:u,mtFeeRate:new s(0),lpFeeRate:new s(0)}),g=new l.PMMHelper,m=new s(d.B),p=[],c=[];let h=new s(0),x=new s(0);const f=g.GetMidPrice(d),L=i.gt(0)?t.div(i):new s(1);for(let e=0;e<=250;e++){let t=m.multipliedBy(e/100).multipliedBy(f.multipliedBy(L).multipliedBy(4));0===e&&(t=m.multipliedBy(1e-11));const i=null==g?void 0:g.QuerySellBase(t,d);if(i.isNaN()||!i.gt(0))p.push({giveAmount:t,getAmount:new s(0),price:new s(0)});else{const e=i.div(t);p.push({giveAmount:t,getAmount:i,price:e})}}for(let e=0;e<=250;e++){let t=m.multipliedBy(e/100).multipliedBy(f.multipliedBy(4));0===e&&(t=m.multipliedBy(1e-11));const i=null==g?void 0:g.QuerySellQuote(t,d);if(i.isNaN()||!i.gt(0))c.push({giveAmount:t,getAmount:new s(0),price:new s(0)});else{const e=t.dividedBy(i);c.push({giveAmount:t,getAmount:i,price:e})}}if(p.length<2&&c.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new s(10).multipliedBy(1.2),maxRightHeight:new s(10).multipliedBy(1.2),middlePriceLN10:new s(0),minXLN10:new s(-1),maxXLN10:new s(1)};const j=[];for(let e=1;e<p.length;e++){const t=p[e],{giveAmount:i,getAmount:r,price:n}=t,o=p[e-1];if(!n.isNaN()&&n.gt(0)&&o){const t=n.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),a=r.minus(o.getAmount).abs().multipliedBy(l);1===e&&j.push({area:r,price:n,middlePrice:n.plus(t.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),j.push({area:r,price:n,middlePrice:n.plus(t.div(2)),rectangleHeight:a}),h=s.max(a,h)}}const b=[];for(let e=1;e<c.length;e++){const t=c[e],{giveAmount:i,getAmount:r,price:n}=t,o=c[e-1],l=o.price,a=o.giveAmount,u=o.getAmount;if(!n.isNaN()&&n.gt(0)&&o){const t=n.minus(l).abs(),o=i.minus(a).abs(),d=r.minus(u).abs().multipliedBy(o);1===e&&b.push({area:r,price:n,middlePrice:n.minus(t.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),b.push({area:r,price:n,middlePrice:n.minus(t.div(2)),rectangleHeight:d}),x=s.max(d,x)}}const w=p.length>0?p[p.length-1]:c[0],A=c.length>0?c[0]:p[0],N=c.length>0?c[c.length-1]:p[0],y=w.price,P=N.price,R=A.price,v=new s(Math.log10(R.toNumber()));let S=y.gt(0)?new s(Math.log10(y.toNumber())):new s(-Math.log10(P.toNumber())),q=P.gt(0)?new s(Math.log10(P.toNumber())):new s(-Math.log10(y.toNumber()));const H=s.max(v.minus(S).abs(),q.minus(v).abs());return S=v.minus(H),q=v.plus(H),{leftStatAreaPoints:j,rightStatAreaPoints:b,maxLeftHeight:h.multipliedBy(1.2),maxRightHeight:x.multipliedBy(1.2),minXLN10:S,maxXLN10:q,middlePriceLN10:v}}),[e])}({params:u}),P=a-30.13,R=i.useRef(null),v=t.merge({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,x,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,x,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},L),S=t=>{var i;const{current:n}=R,s=t.target;if(s&&n){const t=null===(i=s.getStage())||void 0===i?void 0:i.getPointerPosition();if(t){const{x:i}=t,s=e/2;if(Math.abs(i-s)<=2)return;if(i<=2||e-i<=2)return;const l=p({x:i,width:e,minXLN10:N,maxXLN10:y});let a=null,u=[];const x=i<s;if(x){const e=m({areaPoints:w,targetPrice:l,isLeft:x});a=e.targetAreaStatPoint,u=e.targetAreaStatPoints}else{const e=m({areaPoints:A,targetPrice:l,isLeft:x});a=e.targetAreaStatPoint,u=e.targetAreaStatPoints}if(a){const t=h({target:a.middlePrice}),s=c({minXLN10:N,maxXLN10:y,width:e,targetLN10:t}),l=g({maxHeight:x?j:b,gridAreaHeight:P,value:a.rectangleHeight}),m=n.findOne("#tooltip"),p=n.findOne("#toolTipVertLine"),L=n.findOne("#joinCircle"),w=n.findOne("#tooltip-Text"),A=n.findOne("#tooltip-tag"),R=n.findOne("#priceTextLabel"),S=null==R?void 0:R.findOne("#priceTextLabel-text"),q=n.findOne("#area");null==m||m.position({x:s,y:l-5-6}),null==w||w.fill(v.tooltipColor||(x?"#00FAD9":"#FF5072")),null==w||w.text(x?r.chartT("pool.chart.liquidity-chart-buy",{amount:o.formatShortNumber(a.area),symbol:d,price:o.formatShortNumber(a.price)}):r.chartT("pool.chart.liquidity-chart-sell",{amount:o.formatShortNumber(a.area),symbol:f,price:o.formatShortNumber(a.price)})),m&&A&&(m.width()/2>i?(A.pointerDirection("left"),A.pointerHeight(15),A.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+i>e?(A.pointerDirection("right"),A.pointerHeight(15),A.pointerWidth(8),m.offsetX(11),m.offsetY(-11)):(A.pointerDirection("down"),A.pointerHeight(8),A.pointerWidth(15),m.offsetX(0),m.offsetY(0))),null==p||p.points([s,P,s,l]),null==p||p.stroke(x?"#55f6db":"#ff4f73");let H=x?"rgb(86, 246, 218)":"#FF5072",E=x?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";v.leftLine&&v.rightLine&&(H=x?v.leftLine:v.rightLine,E=x?`rgba(${r.colorRgb(v.leftLine)}, 0.4)`:`rgba(${r.colorRgb(v.rightLine)}, 0.4)`),L&&(L.x(s),L.y(l),L.fill(H),L.stroke(E)),R&&(R.x(s),R.y(P+8.08+1),R.offsetX(R.width()/2),R.x()-R.width()/2<0?R.x(R.width()/2):R.x()+R.width()/2>e?R.x(e-R.width()/2):R.x(i)),S&&(S.fill(v.tooltipColor||(x?"#00FAD9":"#FF5072")),S.text(o.formatShortNumber(a.price)));const k=[];for(const t of u){const{middlePrice:i,rectangleHeight:r}=t,n=h({target:i}),o=c({minXLN10:N,maxXLN10:y,width:e,targetLN10:n}),s=g({maxHeight:x?j:b,gridAreaHeight:P,value:r});k.push(o,s+1)}const X=k.slice(),[M,B]=X;x?(X.push(s,l),X.push(s,P),X.push(M,P),X.push(M,B)):(X.unshift(M,P),X.unshift(s,P),X.unshift(s,l)),q&&(q.points(X),q.fill(x?v.leftLine||"#2c5b56":v.rightLine||"#7b3a48")),n.show()}}}},q=function({gridAreaHeight:e,gridAreaWidth:t,horizontalLineCount:r,verticalLineCount:s,color:l="#2A2A2D"}){return i.useMemo((()=>{const i=[],a=e/(r+1),u=[],d=t/(s+1);for(let e=0;e<r;e++){const r=a*(e+1);i.push([0,r,t,r])}for(let t=0;t<s;t++){const i=d*(t+1);u.push([i,0,i,e])}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[i.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:l,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},t))),u.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:l,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},t)))]})}),[e,t,r,s,l])}({gridAreaHeight:P,gridAreaWidth:e,horizontalLineCount:9,verticalLineCount:7,color:v.grid}),H=function({minXLN10:e,maxXLN10:t,labelCount:r,gridAreaHeight:s,gridAreaWidth:l,color:a="#606066"}){return i.useMemo((()=>{const i=l/(r+1),u=[],d=[];for(let n=0;n<r;n++){const r=i/2+i*n;u.push({x:r,y:s+10.08+1,text:o.formatShortNumber(p({x:i*(n+1),width:l,minXLN10:e,maxXLN10:t}))});const a=i*(n+1);d.push([a,s+1,a,s+4+1])}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[u.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Text,{x:e.x,y:e.y,text:e.text,fontSize:14,fontFamily:"Manrope",fill:a,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t))),d.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:a,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},t)))]})}),[e,t,s,l,r])}({gridAreaHeight:P,gridAreaWidth:e,labelCount:7,minXLN10:N,maxXLN10:y,color:v.textColor}),E=function({gridAreaHeight:e,gridAreaWidth:t,color:r="#606066"}){return i.useMemo((()=>{const i=t/2;return o.jsxRuntimeExports.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:P,gridAreaWidth:e,color:v.midPriceLine}),{leftLine:k,rightLine:X}=function({leftStatAreaPoints:e,rightStatAreaPoints:t,minXLN10:r,maxXLN10:s,maxLeftHeight:l,maxRightHeight:a,gridAreaWidth:u,gridAreaHeight:d,colorMap:m}){return{leftLine:i.useMemo((()=>{if(e.length<1)return o.jsxRuntimeExports.jsx(o.jsxRuntimeExports.Fragment,{});const t=[];let i=d;for(const n of e){const{middlePrice:e,rectangleHeight:o}=n,a=h({target:e}),m=c({minXLN10:r,maxXLN10:s,width:u,targetLN10:a}),p=g({maxHeight:l,gridAreaHeight:d,value:o});t.push(m,p),p<i&&(i=p)}const a=t.slice(),[p,x]=a,f=a[a.length-1],L=a[a.length-2];return a.push(L,f),a.push(L,d),a.push(p,d),a.push(p,x),o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(n.Line,{points:a,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:m.leftBg}),o.jsxRuntimeExports.jsx(n.Line,{points:t,stroke:m.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,u,r,s,d,l]),rightLine:i.useMemo((()=>{if(t.length<1)return o.jsxRuntimeExports.jsx(o.jsxRuntimeExports.Fragment,{});const e=[];let i=d;for(const n of t){const{middlePrice:t,rectangleHeight:o}=n,l=h({target:t}),m=c({minXLN10:r,maxXLN10:s,width:u,targetLN10:l}),p=g({maxHeight:a,gridAreaHeight:d,value:o});e.push(m,p),p<i&&(i=p)}const l=e.slice(),[p]=l;return l.unshift(p,d),l.unshift(u,d),o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(n.Line,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:m.rightBg}),o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:m.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,u,r,s,d,a])}}({leftStatAreaPoints:w,rightStatAreaPoints:A,minXLN10:N,maxXLN10:y,maxLeftHeight:j,maxRightHeight:b,gridAreaWidth:e,gridAreaHeight:P,colorMap:v});return o.jsxRuntimeExports.jsxs(n.Stage,{width:e,height:a,onMouseMove:S,onMouseOver:S,onMouseEnter:S,onMouseOut:()=>{const{current:e}=R;e&&e.hide()},children:[o.jsxRuntimeExports.jsxs(n.Layer,{children:[o.jsxRuntimeExports.jsx(n.Rect,{x:0,y:0,width:e,height:P,stroke:v.grid,strokeWidth:1}),q,H,k,X,E]}),o.jsxRuntimeExports.jsxs(n.Layer,{ref:R,visible:!1,children:[o.jsxRuntimeExports.jsx(n.Line,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),o.jsxRuntimeExports.jsx(n.Line,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),o.jsxRuntimeExports.jsx(n.Circle,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),o.jsxRuntimeExports.jsxs(n.Label,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[o.jsxRuntimeExports.jsx(n.Tag,{fill:v.tooltipBg,id:"priceTextLabel-tag"}),o.jsxRuntimeExports.jsx(n.Text,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),o.jsxRuntimeExports.jsxs(n.Label,{listening:!1,id:"tooltip",children:[o.jsxRuntimeExports.jsx(n.Tag,{fill:v.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),o.jsxRuntimeExports.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:s,pmmParams:l,midPrice:d,notShowTipText:g,colorMap:m})=>o.jsxRuntimeExports.jsxs(a,{children:[void 0!==l&&void 0!==d&&void 0!==s&&void 0!==d&&o.jsxRuntimeExports.jsx(f,{width:e,height:t,params:l,midPrice:d,pmmModel:s,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:m}),g?"":o.jsxRuntimeExports.jsxs(u,{children:["* ",r.chartT("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});
|
|
12
|
+
`,d=36;function g({maxHeight:e,gridAreaHeight:t,value:i}){const r=new s(t).minus(d),n=r.div(e);return r.minus(i.multipliedBy(n)).plus(d).toNumber()}function m({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 c({x:e,width:t,minXLN10:i,maxXLN10:r}){const n=new s(e).div(t).multipliedBy(r.minus(i)).plus(i);return new s(10**n.toNumber())}function p({width:e,targetLN10:t,minXLN10:i,maxXLN10:r}){return t.minus(i).div(r.minus(i)).multipliedBy(e).toNumber()}function h({target:e}){return new s(Math.log10(e.toNumber()))}const x="rgba(38, 39, 41, 0.3)";function f({width:e,height:a,params:u,baseTokenSymbol:d,quoteTokenSymbol:f,colorMap:L}){const{maxLeftHeight:j,maxRightHeight:b,leftStatAreaPoints:w,rightStatAreaPoints:A,minXLN10:N,maxXLN10:y}=function({params:e}){return i.useMemo((()=>{const t=new s(e.b),i=new s(e.q);let r=new s(e.b0);const n=new s(e.q0),o=new s(e.i),a=new s(e.k),{R:u}=e;1===u&&r.eq(t)&&(r=l.solveQuadraticFunctionForTarget(t,i.minus(n),new s(1).div(o),a));const d=new l.PMMState({i:o,K:a,B:t,Q:i,B0:r,Q0:n,R:u,mtFeeRate:new s(0),lpFeeRate:new s(0)}),g=new l.PMMHelper,m=new s(d.B),c=[],p=[];let h=new s(0),x=new s(0);const f=g.GetMidPrice(d),L=i.gt(0)?t.div(i):new s(1);for(let e=0;e<=250;e++){let t=m.multipliedBy(e/100).multipliedBy(f.multipliedBy(L).multipliedBy(4));0===e&&(t=m.multipliedBy(1e-11));const i=null==g?void 0:g.QuerySellBase(t,d);if(i.isNaN()||!i.gt(0))c.push({giveAmount:t,getAmount:new s(0),price:new s(0)});else{const e=i.div(t);c.push({giveAmount:t,getAmount:i,price:e})}}for(let e=0;e<=250;e++){let t=m.multipliedBy(e/100).multipliedBy(f.multipliedBy(4));0===e&&(t=m.multipliedBy(1e-11));const i=null==g?void 0:g.QuerySellQuote(t,d);if(i.isNaN()||!i.gt(0))p.push({giveAmount:t,getAmount:new s(0),price:new s(0)});else{const e=t.dividedBy(i);p.push({giveAmount:t,getAmount:i,price:e})}}if(c.length<2&&p.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new s(10).multipliedBy(1.2),maxRightHeight:new s(10).multipliedBy(1.2),middlePriceLN10:new s(0),minXLN10:new s(-1),maxXLN10:new s(1)};const j=[];for(let e=1;e<c.length;e++){const t=c[e],{giveAmount:i,getAmount:r,price:n}=t,o=c[e-1];if(!n.isNaN()&&n.gt(0)&&o){const t=n.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),a=r.minus(o.getAmount).abs().multipliedBy(l);1===e&&j.push({area:r,price:n,middlePrice:n.plus(t.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),j.push({area:r,price:n,middlePrice:n.plus(t.div(2)),rectangleHeight:a}),h=s.max(a,h)}}const b=[];for(let e=1;e<p.length;e++){const t=p[e],{giveAmount:i,getAmount:r,price:n}=t,o=p[e-1],l=o.price,a=o.giveAmount,u=o.getAmount;if(!n.isNaN()&&n.gt(0)&&o){const t=n.minus(l).abs(),o=i.minus(a).abs(),d=r.minus(u).abs().multipliedBy(o);1===e&&b.push({area:r,price:n,middlePrice:n.minus(t.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),b.push({area:r,price:n,middlePrice:n.minus(t.div(2)),rectangleHeight:d}),x=s.max(d,x)}}const w=c.length>0?c[c.length-1]:p[0],A=p.length>0?p[0]:c[0],N=p.length>0?p[p.length-1]:c[0],y=w.price,P=N.price,R=A.price,v=new s(Math.log10(R.toNumber()));let S=y.gt(0)?new s(Math.log10(y.toNumber())):new s(-Math.log10(P.toNumber())),q=P.gt(0)?new s(Math.log10(P.toNumber())):new s(-Math.log10(y.toNumber()));const H=s.max(v.minus(S).abs(),q.minus(v).abs());return S=v.minus(H),q=v.plus(H),{leftStatAreaPoints:j,rightStatAreaPoints:b,maxLeftHeight:h.multipliedBy(1.2),maxRightHeight:x.multipliedBy(1.2),minXLN10:S,maxXLN10:q,middlePriceLN10:v}}),[e])}({params:u}),P=a-30.13,R=i.useRef(null),v=t.merge({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,x,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,x,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},L),S=t=>{var i;const{current:n}=R,s=t.target;if(s&&n){const t=null===(i=s.getStage())||void 0===i?void 0:i.getPointerPosition();if(t){const{x:i}=t,s=e/2;if(Math.abs(i-s)<=2)return;if(i<=2||e-i<=2)return;const l=c({x:i,width:e,minXLN10:N,maxXLN10:y});let a=null,u=[];const x=i<s;if(x){const e=m({areaPoints:w,targetPrice:l,isLeft:x});a=e.targetAreaStatPoint,u=e.targetAreaStatPoints}else{const e=m({areaPoints:A,targetPrice:l,isLeft:x});a=e.targetAreaStatPoint,u=e.targetAreaStatPoints}if(a){const t=h({target:a.middlePrice}),s=p({minXLN10:N,maxXLN10:y,width:e,targetLN10:t}),l=g({maxHeight:x?j:b,gridAreaHeight:P,value:a.rectangleHeight}),m=n.findOne("#tooltip"),c=n.findOne("#toolTipVertLine"),L=n.findOne("#joinCircle"),w=n.findOne("#tooltip-Text"),A=n.findOne("#tooltip-tag"),R=n.findOne("#priceTextLabel"),S=null==R?void 0:R.findOne("#priceTextLabel-text"),q=n.findOne("#area");null==m||m.position({x:s,y:l-5-6}),null==w||w.fill(v.tooltipColor||(x?"#00FAD9":"#FF5072")),null==w||w.text(x?r.chartT("pool.chart.liquidity-chart-buy",{amount:o.formatShortNumber(a.area),symbol:d,price:o.formatShortNumber(a.price)}):r.chartT("pool.chart.liquidity-chart-sell",{amount:o.formatShortNumber(a.area),symbol:f,price:o.formatShortNumber(a.price)})),m&&A&&(m.width()/2>i?(A.pointerDirection("left"),A.pointerHeight(15),A.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+i>e?(A.pointerDirection("right"),A.pointerHeight(15),A.pointerWidth(8),m.offsetX(11),m.offsetY(-11)):(A.pointerDirection("down"),A.pointerHeight(8),A.pointerWidth(15),m.offsetX(0),m.offsetY(0))),null==c||c.points([s,P,s,l]),null==c||c.stroke(x?"#55f6db":"#ff4f73");let H=x?"rgb(86, 246, 218)":"#FF5072",E=x?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";v.leftLine&&v.rightLine&&(H=x?v.leftLine:v.rightLine,E=x?`rgba(${r.colorRgb(v.leftLine)}, 0.4)`:`rgba(${r.colorRgb(v.rightLine)}, 0.4)`),L&&(L.x(s),L.y(l),L.fill(H),L.stroke(E)),R&&(R.x(s),R.y(P+8.08+1),R.offsetX(R.width()/2),R.x()-R.width()/2<0?R.x(R.width()/2):R.x()+R.width()/2>e?R.x(e-R.width()/2):R.x(i)),S&&(S.fill(v.tooltipColor||(x?"#00FAD9":"#FF5072")),S.text(o.formatShortNumber(a.price)));const k=[];for(const t of u){const{middlePrice:i,rectangleHeight:r}=t,n=h({target:i}),o=p({minXLN10:N,maxXLN10:y,width:e,targetLN10:n}),s=g({maxHeight:x?j:b,gridAreaHeight:P,value:r});k.push(o,s+1)}const X=k.slice(),[M,B]=X;x?(X.push(s,l),X.push(s,P),X.push(M,P),X.push(M,B)):(X.unshift(M,P),X.unshift(s,P),X.unshift(s,l)),q&&(q.points(X),q.fill(x?v.leftLine||"#2c5b56":v.rightLine||"#7b3a48")),n.show()}}}},q=function({gridAreaHeight:e,gridAreaWidth:t,horizontalLineCount:r,verticalLineCount:s,color:l="#2A2A2D"}){return i.useMemo((()=>{const i=[],a=e/(r+1),u=[],d=t/(s+1);for(let e=0;e<r;e++){const r=a*(e+1);i.push([0,r,t,r])}for(let t=0;t<s;t++){const i=d*(t+1);u.push([i,0,i,e])}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[i.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:l,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},t))),u.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:l,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},t)))]})}),[e,t,r,s,l])}({gridAreaHeight:P,gridAreaWidth:e,horizontalLineCount:9,verticalLineCount:7,color:v.grid}),H=function({minXLN10:e,maxXLN10:t,labelCount:r,gridAreaHeight:s,gridAreaWidth:l,color:a="#606066"}){return i.useMemo((()=>{const i=l/(r+1),u=[],d=[];for(let n=0;n<r;n++){const r=i/2+i*n;u.push({x:r,y:s+10.08+1,text:o.formatShortNumber(c({x:i*(n+1),width:l,minXLN10:e,maxXLN10:t}))});const a=i*(n+1);d.push([a,s+1,a,s+4+1])}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[u.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Text,{x:e.x,y:e.y,text:e.text,fontSize:14,fontFamily:"Manrope",fill:a,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t))),d.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:a,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},t)))]})}),[e,t,s,l,r])}({gridAreaHeight:P,gridAreaWidth:e,labelCount:7,minXLN10:N,maxXLN10:y,color:v.textColor}),E=function({gridAreaHeight:e,gridAreaWidth:t,color:r="#606066"}){return i.useMemo((()=>{const i=t/2;return o.jsxRuntimeExports.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:P,gridAreaWidth:e,color:v.midPriceLine}),{leftLine:k,rightLine:X}=function({leftStatAreaPoints:e,rightStatAreaPoints:t,minXLN10:r,maxXLN10:s,maxLeftHeight:l,maxRightHeight:a,gridAreaWidth:u,gridAreaHeight:d,colorMap:m}){return{leftLine:i.useMemo((()=>{if(e.length<1)return o.jsxRuntimeExports.jsx(o.jsxRuntimeExports.Fragment,{});const t=[];let i=d;for(const n of e){const{middlePrice:e,rectangleHeight:o}=n,a=h({target:e}),m=p({minXLN10:r,maxXLN10:s,width:u,targetLN10:a}),c=g({maxHeight:l,gridAreaHeight:d,value:o});t.push(m,c),c<i&&(i=c)}const a=t.slice(),[c,x]=a,f=a[a.length-1],L=a[a.length-2];return a.push(L,f),a.push(L,d),a.push(c,d),a.push(c,x),o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(n.Line,{points:a,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:m.leftBg}),o.jsxRuntimeExports.jsx(n.Line,{points:t,stroke:m.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,u,r,s,d,l]),rightLine:i.useMemo((()=>{if(t.length<1)return o.jsxRuntimeExports.jsx(o.jsxRuntimeExports.Fragment,{});const e=[];let i=d;for(const n of t){const{middlePrice:t,rectangleHeight:o}=n,l=h({target:t}),m=p({minXLN10:r,maxXLN10:s,width:u,targetLN10:l}),c=g({maxHeight:a,gridAreaHeight:d,value:o});e.push(m,c),c<i&&(i=c)}const l=e.slice(),[c]=l;return l.unshift(c,d),l.unshift(u,d),o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(n.Line,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:m.rightBg}),o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:m.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,u,r,s,d,a])}}({leftStatAreaPoints:w,rightStatAreaPoints:A,minXLN10:N,maxXLN10:y,maxLeftHeight:j,maxRightHeight:b,gridAreaWidth:e,gridAreaHeight:P,colorMap:v});return o.jsxRuntimeExports.jsxs(n.Stage,{width:e,height:a,onMouseMove:S,onMouseOver:S,onMouseEnter:S,onMouseOut:()=>{const{current:e}=R;e&&e.hide()},children:[o.jsxRuntimeExports.jsxs(n.Layer,{children:[o.jsxRuntimeExports.jsx(n.Rect,{x:0,y:0,width:e,height:P,stroke:v.grid,strokeWidth:1}),q,H,k,X,E]}),o.jsxRuntimeExports.jsxs(n.Layer,{ref:R,visible:!1,children:[o.jsxRuntimeExports.jsx(n.Line,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),o.jsxRuntimeExports.jsx(n.Line,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),o.jsxRuntimeExports.jsx(n.Circle,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),o.jsxRuntimeExports.jsxs(n.Label,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[o.jsxRuntimeExports.jsx(n.Tag,{fill:v.tooltipBg,id:"priceTextLabel-tag"}),o.jsxRuntimeExports.jsx(n.Text,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),o.jsxRuntimeExports.jsxs(n.Label,{listening:!1,id:"tooltip",children:[o.jsxRuntimeExports.jsx(n.Tag,{fill:v.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),o.jsxRuntimeExports.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:s,pmmParams:l,midPrice:d,notShowTipText:g,colorMap:m})=>o.jsxRuntimeExports.jsxs(a,{children:[void 0!==l&&void 0!==d&&void 0!==s&&void 0!==d&&o.jsxRuntimeExports.jsx(f,{width:e,height:t,params:l,midPrice:d,pmmModel:s,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:m}),g?"":o.jsxRuntimeExports.jsxs(u,{children:["* ",r.chartT("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});
|
|
@@ -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,g 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,g as o,m as l}from"./helper-KeBGXRew.js";import{Line as a,Text as s,Stage as d,Layer as g,Rect as m,Circle as u,Label as p,Tag as c}from"react-konva";import{j as h,f}from"./index-BCoTzVYp.js";import x from"bignumber.js";import{solveQuadraticFunctionForTarget as L,PMMState as w,PMMHelper as A}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/components";import"react-redux";import"identicon.js";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@reduxjs/toolkit";import"redux";import"@tanstack/react-query";import"react-dom";import"react-window";import"@ethersproject/bignumber";import"dayjs";import"react-transition-group";import"zustand";import"@dodoex/contract-request";import"@dodoex/dodo-contract-request";import"axios";import"recharts";import"react-infinite-scroller";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"rmc-date-picker";const b=t.div`
|
|
2
2
|
height: 100%;
|
|
3
3
|
position: relative;
|
|
4
4
|
`,y=t.div`
|
|
@@ -9,4 +9,4 @@ import t from"@emotion/styled";import{merge as e}from"lodash";import{useMemo as
|
|
|
9
9
|
font-size: 12px;
|
|
10
10
|
line-height: 17px;
|
|
11
11
|
font-weight: 400;
|
|
12
|
-
`,N=36;function P({maxHeight:t,gridAreaHeight:e,value:i}){const n=new x(e).minus(N),r=n.div(t);return n.minus(i.multipliedBy(r)).plus(N).toNumber()}function v({targetPrice:t,areaPoints:e,isLeft:i}){for(let n=0;n<e.length;n++){const r=e[n],o=n<e.length-1?e[n+1]:null;if(!o)return{targetAreaStatPoint:r,targetAreaStatPoints:e};if(i){if(t.lte(r.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}else if(t.gte(r.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function j({x:t,width:e,minXLN10:i,maxXLN10:n}){const r=new x(t).div(e).multipliedBy(n.minus(i)).plus(i);return new x(10**r.toNumber())}function H({width:t,targetLN10:e,minXLN10:i,maxXLN10:n}){return e.minus(i).div(n.minus(i)).multipliedBy(t).toNumber()}function S({target:t}){return new x(Math.log10(t.toNumber()))}const k="rgba(38, 39, 41, 0.3)";function X({width:t,height:b,params:y,baseTokenSymbol:N,quoteTokenSymbol:X,colorMap:B}){const{maxLeftHeight:C,maxRightHeight:F,leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:J}=function({params:t}){return i((()=>{const e=new x(t.b),i=new x(t.q);let n=new x(t.b0);const r=new x(t.q0),o=new x(t.i),l=new x(t.k),{R:a}=t;1===a&&n.eq(e)&&(n=L(e,i.minus(r),new x(1).div(o),l));const s=new w({i:o,K:l,B:e,Q:i,B0:n,Q0:r,R:a,mtFeeRate:new x(0),lpFeeRate:new x(0)}),d=new A,g=new x(s.B),m=[],u=[];let p=new x(0),h=new x(0);const c=d.GetMidPrice(s),f=i.gt(0)?e.div(i):new x(1);for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(c.multipliedBy(f).multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,s);if(i.isNaN()||!i.gt(0))m.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=i.div(e);m.push({giveAmount:e,getAmount:i,price:t})}}for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(c.multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,s);if(i.isNaN()||!i.gt(0))u.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=e.dividedBy(i);u.push({giveAmount:e,getAmount:i,price:t})}}if(m.length<2&&u.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new x(10).multipliedBy(1.2),maxRightHeight:new x(10).multipliedBy(1.2),middlePriceLN10:new x(0),minXLN10:new x(-1),maxXLN10:new x(1)};const b=[];for(let t=1;t<m.length;t++){const e=m[t],{giveAmount:i,getAmount:n,price:r}=e,o=m[t-1];if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),a=n.minus(o.getAmount).abs().multipliedBy(l);1===t&&b.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),b.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),p=x.max(a,p)}}const y=[];for(let t=1;t<u.length;t++){const e=u[t],{giveAmount:i,getAmount:n,price:r}=e,o=u[t-1],l=o.price,a=o.giveAmount,s=o.getAmount;if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(l).abs(),o=i.minus(a).abs(),d=n.minus(s).abs().multipliedBy(o);1===t&&y.push({area:n,price:r,middlePrice:r.minus(e.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:n,price:r,middlePrice:r.minus(e.div(2)),rectangleHeight:d}),h=x.max(d,h)}}const N=m.length>0?m[m.length-1]:u[0],P=u.length>0?u[0]:m[0],v=u.length>0?u[u.length-1]:m[0],j=N.price,H=v.price,S=P.price,k=new x(Math.log10(S.toNumber()));let X=j.gt(0)?new x(Math.log10(j.toNumber())):new x(-Math.log10(H.toNumber())),B=H.gt(0)?new x(Math.log10(H.toNumber())):new x(-Math.log10(j.toNumber()));const C=x.max(k.minus(X).abs(),B.minus(k).abs());return X=k.minus(C),B=k.plus(C),{leftStatAreaPoints:b,rightStatAreaPoints:y,maxLeftHeight:p.multipliedBy(1.2),maxRightHeight:h.multipliedBy(1.2),minXLN10:X,maxXLN10:B,middlePriceLN10:k}}),[t])}({params:y}),q=b-30.13,O=n(null),R=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,k,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,k,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},B),D=e=>{var i;const{current:n}=O,r=e.target;if(r&&n){const e=null===(i=r.getStage())||void 0===i?void 0:i.getPointerPosition();if(e){const{x:i}=e,r=t/2;if(Math.abs(i-r)<=2)return;if(i<=2||t-i<=2)return;const a=j({x:i,width:t,minXLN10:T,maxXLN10:J});let s=null,d=[];const g=i<r;if(g){const t=v({areaPoints:M,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=v({areaPoints:W,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}if(s){const e=S({target:s.middlePrice}),r=H({minXLN10:T,maxXLN10:J,width:t,targetLN10:e}),a=P({maxHeight:g?C:F,gridAreaHeight:q,value:s.rectangleHeight}),m=n.findOne("#tooltip"),u=n.findOne("#toolTipVertLine"),p=n.findOne("#joinCircle"),h=n.findOne("#tooltip-Text"),c=n.findOne("#tooltip-tag"),x=n.findOne("#priceTextLabel"),L=null==x?void 0:x.findOne("#priceTextLabel-text"),w=n.findOne("#area");null==m||m.position({x:r,y:a-5-6}),null==h||h.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),null==h||h.text(g?o("pool.chart.liquidity-chart-buy",{amount:f(s.area),symbol:N,price:f(s.price)}):o("pool.chart.liquidity-chart-sell",{amount:f(s.area),symbol:X,price:f(s.price)})),m&&c&&(m.width()/2>i?(c.pointerDirection("left"),c.pointerHeight(15),c.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+i>t?(c.pointerDirection("right"),c.pointerHeight(15),c.pointerWidth(8),m.offsetX(11),m.offsetY(-11)):(c.pointerDirection("down"),c.pointerHeight(8),c.pointerWidth(15),m.offsetX(0),m.offsetY(0))),null==u||u.points([r,q,r,a]),null==u||u.stroke(g?"#55f6db":"#ff4f73");let A=g?"rgb(86, 246, 218)":"#FF5072",b=g?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(A=g?R.leftLine:R.rightLine,b=g?`rgba(${l(R.leftLine)}, 0.4)`:`rgba(${l(R.rightLine)}, 0.4)`),p&&(p.x(r),p.y(a),p.fill(A),p.stroke(b)),x&&(x.x(r),x.y(q+8.08+1),x.offsetX(x.width()/2),x.x()-x.width()/2<0?x.x(x.width()/2):x.x()+x.width()/2>t?x.x(t-x.width()/2):x.x(i)),L&&(L.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),L.text(f(s.price)));const y=[];for(const e of d){const{middlePrice:i,rectangleHeight:n}=e,r=S({target:i}),o=H({minXLN10:T,maxXLN10:J,width:t,targetLN10:r}),l=P({maxHeight:g?C:F,gridAreaHeight:q,value:n});y.push(o,l+1)}const v=y.slice(),[j,k]=v;g?(v.push(r,a),v.push(r,q),v.push(j,q),v.push(j,k)):(v.unshift(j,q),v.unshift(r,q),v.unshift(r,a)),w&&(w.points(v),w.fill(g?R.leftLine||"#2c5b56":R.rightLine||"#7b3a48")),n.show()}}}},z=function({gridAreaHeight:t,gridAreaWidth:e,horizontalLineCount:n,verticalLineCount:r,color:o="#2A2A2D"}){return i((()=>{const i=[],l=t/(n+1),s=[],d=e/(r+1);for(let t=0;t<n;t++){const n=l*(t+1);i.push([0,n,e,n])}for(let e=0;e<r;e++){const i=d*(e+1);s.push([i,0,i,t])}return c.jsxs(c.Fragment,{children:[i.map(((t,e)=>c.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e))),s.map(((t,e)=>c.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e)))]})}),[t,e,n,r,o])}({gridAreaHeight:q,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:R.grid}),G=function({minXLN10:t,maxXLN10:e,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return i((()=>{const i=o/(n+1),d=[],g=[];for(let l=0;l<n;l++){const n=i/2+i*l;d.push({x:n,y:r+10.08+1,text:f(j({x:i*(l+1),width:o,minXLN10:t,maxXLN10:e}))});const a=i*(l+1);g.push([a,r+1,a,r+4+1])}return c.jsxs(c.Fragment,{children:[d.map(((t,e)=>c.jsx(s,{x:t.x,y:t.y,text:t.text,fontSize:14,fontFamily:"Manrope",fill:l,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},e))),g.map(((t,e)=>c.jsx(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},e)))]})}),[t,e,r,o,n])}({gridAreaHeight:q,gridAreaWidth:t,labelCount:7,minXLN10:T,maxXLN10:J,color:R.textColor}),Q=function({gridAreaHeight:t,gridAreaWidth:e,color:n="#606066"}){return i((()=>{const i=e/2;return c.jsx(a,{points:[i,0,i,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,e,n])}({gridAreaHeight:q,gridAreaWidth:t,color:R.midPriceLine}),{leftLine:E,rightLine:Y}=function({leftStatAreaPoints:t,rightStatAreaPoints:e,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:g}){return{leftLine:i((()=>{if(t.length<1)return c.jsx(c.Fragment,{});const e=[];let i=d;for(const l of t){const{middlePrice:t,rectangleHeight:a}=l,g=S({target:t}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:o,gridAreaHeight:d,value:a});e.push(m,u),u<i&&(i=u)}const l=e.slice(),[m,u]=l,p=l[l.length-1],h=l[l.length-2];return l.push(h,p),l.push(h,d),l.push(m,d),l.push(m,u),c.jsxs(c.Fragment,{children:[c.jsx(a,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.leftBg}),c.jsx(a,{points:e,stroke:g.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,s,n,r,d,o]),rightLine:i((()=>{if(e.length<1)return c.jsx(c.Fragment,{});const t=[];let i=d;for(const o of e){const{middlePrice:e,rectangleHeight:a}=o,g=S({target:e}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,u),u<i&&(i=u)}const o=t.slice(),[m]=o;return o.unshift(m,d),o.unshift(s,d),c.jsxs(c.Fragment,{children:[c.jsx(a,{points:o,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.rightBg}),c.jsx(a,{points:t,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,s,n,r,d,l])}}({leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:J,maxLeftHeight:C,maxRightHeight:F,gridAreaWidth:t,gridAreaHeight:q,colorMap:R});return c.jsxs(d,{width:t,height:b,onMouseMove:D,onMouseOver:D,onMouseEnter:D,onMouseOut:()=>{const{current:t}=O;t&&t.hide()},children:[c.jsxs(g,{children:[c.jsx(m,{x:0,y:0,width:t,height:q,stroke:R.grid,strokeWidth:1}),z,G,E,Y,Q]}),c.jsxs(g,{ref:O,visible:!1,children:[c.jsx(a,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),c.jsx(a,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),c.jsx(u,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),c.jsxs(p,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[c.jsx(h,{fill:R.tooltipBg,id:"priceTextLabel-tag"}),c.jsx(s,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),c.jsxs(p,{listening:!1,id:"tooltip",children:[c.jsx(h,{fill:R.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),c.jsx(s,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}const B=({width:t=834,height:e=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>c.jsxs(b,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&c.jsx(X,{width:t,height:e,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:d}),s?"":c.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});export{B as default};
|
|
12
|
+
`,N=36;function P({maxHeight:t,gridAreaHeight:e,value:i}){const n=new x(e).minus(N),r=n.div(t);return n.minus(i.multipliedBy(r)).plus(N).toNumber()}function v({targetPrice:t,areaPoints:e,isLeft:i}){for(let n=0;n<e.length;n++){const r=e[n],o=n<e.length-1?e[n+1]:null;if(!o)return{targetAreaStatPoint:r,targetAreaStatPoints:e};if(i){if(t.lte(r.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}else if(t.gte(r.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:e.slice(0,n+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function j({x:t,width:e,minXLN10:i,maxXLN10:n}){const r=new x(t).div(e).multipliedBy(n.minus(i)).plus(i);return new x(10**r.toNumber())}function H({width:t,targetLN10:e,minXLN10:i,maxXLN10:n}){return e.minus(i).div(n.minus(i)).multipliedBy(t).toNumber()}function S({target:t}){return new x(Math.log10(t.toNumber()))}const k="rgba(38, 39, 41, 0.3)";function X({width:t,height:b,params:y,baseTokenSymbol:N,quoteTokenSymbol:X,colorMap:B}){const{maxLeftHeight:C,maxRightHeight:F,leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:q}=function({params:t}){return i((()=>{const e=new x(t.b),i=new x(t.q);let n=new x(t.b0);const r=new x(t.q0),o=new x(t.i),l=new x(t.k),{R:a}=t;1===a&&n.eq(e)&&(n=L(e,i.minus(r),new x(1).div(o),l));const s=new w({i:o,K:l,B:e,Q:i,B0:n,Q0:r,R:a,mtFeeRate:new x(0),lpFeeRate:new x(0)}),d=new A,g=new x(s.B),m=[],u=[];let p=new x(0),c=new x(0);const h=d.GetMidPrice(s),f=i.gt(0)?e.div(i):new x(1);for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(h.multipliedBy(f).multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,s);if(i.isNaN()||!i.gt(0))m.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=i.div(e);m.push({giveAmount:e,getAmount:i,price:t})}}for(let t=0;t<=250;t++){let e=g.multipliedBy(t/100).multipliedBy(h.multipliedBy(4));0===t&&(e=g.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,s);if(i.isNaN()||!i.gt(0))u.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=e.dividedBy(i);u.push({giveAmount:e,getAmount:i,price:t})}}if(m.length<2&&u.length<2)return{leftStatAreaPoints:[],rightStatAreaPoints:[],maxLeftHeight:new x(10).multipliedBy(1.2),maxRightHeight:new x(10).multipliedBy(1.2),middlePriceLN10:new x(0),minXLN10:new x(-1),maxXLN10:new x(1)};const b=[];for(let t=1;t<m.length;t++){const e=m[t],{giveAmount:i,getAmount:n,price:r}=e,o=m[t-1];if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(o.price).abs(),l=i.minus(o.giveAmount).abs(),a=n.minus(o.getAmount).abs().multipliedBy(l);1===t&&b.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),b.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),p=x.max(a,p)}}const y=[];for(let t=1;t<u.length;t++){const e=u[t],{giveAmount:i,getAmount:n,price:r}=e,o=u[t-1],l=o.price,a=o.giveAmount,s=o.getAmount;if(!r.isNaN()&&r.gt(0)&&o){const e=r.minus(l).abs(),o=i.minus(a).abs(),d=n.minus(s).abs().multipliedBy(o);1===t&&y.push({area:n,price:r,middlePrice:r.minus(e.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:n,price:r,middlePrice:r.minus(e.div(2)),rectangleHeight:d}),c=x.max(d,c)}}const N=m.length>0?m[m.length-1]:u[0],P=u.length>0?u[0]:m[0],v=u.length>0?u[u.length-1]:m[0],j=N.price,H=v.price,S=P.price,k=new x(Math.log10(S.toNumber()));let X=j.gt(0)?new x(Math.log10(j.toNumber())):new x(-Math.log10(H.toNumber())),B=H.gt(0)?new x(Math.log10(H.toNumber())):new x(-Math.log10(j.toNumber()));const C=x.max(k.minus(X).abs(),B.minus(k).abs());return X=k.minus(C),B=k.plus(C),{leftStatAreaPoints:b,rightStatAreaPoints:y,maxLeftHeight:p.multipliedBy(1.2),maxRightHeight:c.multipliedBy(1.2),minXLN10:X,maxXLN10:B,middlePriceLN10:k}}),[t])}({params:y}),J=b-30.13,O=n(null),R=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,k,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,k,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},B),D=e=>{var i;const{current:n}=O,r=e.target;if(r&&n){const e=null===(i=r.getStage())||void 0===i?void 0:i.getPointerPosition();if(e){const{x:i}=e,r=t/2;if(Math.abs(i-r)<=2)return;if(i<=2||t-i<=2)return;const a=j({x:i,width:t,minXLN10:T,maxXLN10:q});let s=null,d=[];const g=i<r;if(g){const t=v({areaPoints:M,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=v({areaPoints:W,targetPrice:a,isLeft:g});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}if(s){const e=S({target:s.middlePrice}),r=H({minXLN10:T,maxXLN10:q,width:t,targetLN10:e}),a=P({maxHeight:g?C:F,gridAreaHeight:J,value:s.rectangleHeight}),m=n.findOne("#tooltip"),u=n.findOne("#toolTipVertLine"),p=n.findOne("#joinCircle"),c=n.findOne("#tooltip-Text"),h=n.findOne("#tooltip-tag"),x=n.findOne("#priceTextLabel"),L=null==x?void 0:x.findOne("#priceTextLabel-text"),w=n.findOne("#area");null==m||m.position({x:r,y:a-5-6}),null==c||c.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),null==c||c.text(g?o("pool.chart.liquidity-chart-buy",{amount:f(s.area),symbol:N,price:f(s.price)}):o("pool.chart.liquidity-chart-sell",{amount:f(s.area),symbol:X,price:f(s.price)})),m&&h&&(m.width()/2>i?(h.pointerDirection("left"),h.pointerHeight(15),h.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+i>t?(h.pointerDirection("right"),h.pointerHeight(15),h.pointerWidth(8),m.offsetX(11),m.offsetY(-11)):(h.pointerDirection("down"),h.pointerHeight(8),h.pointerWidth(15),m.offsetX(0),m.offsetY(0))),null==u||u.points([r,J,r,a]),null==u||u.stroke(g?"#55f6db":"#ff4f73");let A=g?"rgb(86, 246, 218)":"#FF5072",b=g?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(A=g?R.leftLine:R.rightLine,b=g?`rgba(${l(R.leftLine)}, 0.4)`:`rgba(${l(R.rightLine)}, 0.4)`),p&&(p.x(r),p.y(a),p.fill(A),p.stroke(b)),x&&(x.x(r),x.y(J+8.08+1),x.offsetX(x.width()/2),x.x()-x.width()/2<0?x.x(x.width()/2):x.x()+x.width()/2>t?x.x(t-x.width()/2):x.x(i)),L&&(L.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),L.text(f(s.price)));const y=[];for(const e of d){const{middlePrice:i,rectangleHeight:n}=e,r=S({target:i}),o=H({minXLN10:T,maxXLN10:q,width:t,targetLN10:r}),l=P({maxHeight:g?C:F,gridAreaHeight:J,value:n});y.push(o,l+1)}const v=y.slice(),[j,k]=v;g?(v.push(r,a),v.push(r,J),v.push(j,J),v.push(j,k)):(v.unshift(j,J),v.unshift(r,J),v.unshift(r,a)),w&&(w.points(v),w.fill(g?R.leftLine||"#2c5b56":R.rightLine||"#7b3a48")),n.show()}}}},z=function({gridAreaHeight:t,gridAreaWidth:e,horizontalLineCount:n,verticalLineCount:r,color:o="#2A2A2D"}){return i((()=>{const i=[],l=t/(n+1),s=[],d=e/(r+1);for(let t=0;t<n;t++){const n=l*(t+1);i.push([0,n,e,n])}for(let e=0;e<r;e++){const i=d*(e+1);s.push([i,0,i,t])}return h.jsxs(h.Fragment,{children:[i.map(((t,e)=>h.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e))),s.map(((t,e)=>h.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},e)))]})}),[t,e,n,r,o])}({gridAreaHeight:J,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:R.grid}),G=function({minXLN10:t,maxXLN10:e,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return i((()=>{const i=o/(n+1),d=[],g=[];for(let l=0;l<n;l++){const n=i/2+i*l;d.push({x:n,y:r+10.08+1,text:f(j({x:i*(l+1),width:o,minXLN10:t,maxXLN10:e}))});const a=i*(l+1);g.push([a,r+1,a,r+4+1])}return h.jsxs(h.Fragment,{children:[d.map(((t,e)=>h.jsx(s,{x:t.x,y:t.y,text:t.text,fontSize:14,fontFamily:"Manrope",fill:l,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},e))),g.map(((t,e)=>h.jsx(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},e)))]})}),[t,e,r,o,n])}({gridAreaHeight:J,gridAreaWidth:t,labelCount:7,minXLN10:T,maxXLN10:q,color:R.textColor}),Q=function({gridAreaHeight:t,gridAreaWidth:e,color:n="#606066"}){return i((()=>{const i=e/2;return h.jsx(a,{points:[i,0,i,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,e,n])}({gridAreaHeight:J,gridAreaWidth:t,color:R.midPriceLine}),{leftLine:E,rightLine:Y}=function({leftStatAreaPoints:t,rightStatAreaPoints:e,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:g}){return{leftLine:i((()=>{if(t.length<1)return h.jsx(h.Fragment,{});const e=[];let i=d;for(const l of t){const{middlePrice:t,rectangleHeight:a}=l,g=S({target:t}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:o,gridAreaHeight:d,value:a});e.push(m,u),u<i&&(i=u)}const l=e.slice(),[m,u]=l,p=l[l.length-1],c=l[l.length-2];return l.push(c,p),l.push(c,d),l.push(m,d),l.push(m,u),h.jsxs(h.Fragment,{children:[h.jsx(a,{points:l,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.leftBg}),h.jsx(a,{points:e,stroke:g.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,s,n,r,d,o]),rightLine:i((()=>{if(e.length<1)return h.jsx(h.Fragment,{});const t=[];let i=d;for(const o of e){const{middlePrice:e,rectangleHeight:a}=o,g=S({target:e}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),u=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,u),u<i&&(i=u)}const o=t.slice(),[m]=o;return o.unshift(m,d),o.unshift(s,d),h.jsxs(h.Fragment,{children:[h.jsx(a,{points:o,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:d},fillLinearGradientEndPoint:{x:0,y:i},fillLinearGradientColorStops:g.rightBg}),h.jsx(a,{points:t,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[e,s,n,r,d,l])}}({leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:q,maxLeftHeight:C,maxRightHeight:F,gridAreaWidth:t,gridAreaHeight:J,colorMap:R});return h.jsxs(d,{width:t,height:b,onMouseMove:D,onMouseOver:D,onMouseEnter:D,onMouseOut:()=>{const{current:t}=O;t&&t.hide()},children:[h.jsxs(g,{children:[h.jsx(m,{x:0,y:0,width:t,height:J,stroke:R.grid,strokeWidth:1}),z,G,E,Y,Q]}),h.jsxs(g,{ref:O,visible:!1,children:[h.jsx(a,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),h.jsx(a,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),h.jsx(u,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),h.jsxs(p,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[h.jsx(c,{fill:R.tooltipBg,id:"priceTextLabel-tag"}),h.jsx(s,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),h.jsxs(p,{listening:!1,id:"tooltip",children:[h.jsx(c,{fill:R.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),h.jsx(s,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}const B=({width:t=834,height:e=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>h.jsxs(b,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&h.jsx(X,{width:t,height:e,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:i,quoteTokenSymbol:n,colorMap:d}),s?"":h.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});export{B as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"bignumber.js";import{merge as t,throttle as i,debounce as o}from"lodash";import r,{useEffect as n,useMemo as l,useRef as s,useState as a}from"react";import d from"@emotion/styled";import{css as u}from"@emotion/react";import{Stage as c,Layer as p,Rect as m,Line as g,Text as h,Circle as b,Label as f,Tag as M}from"react-konva";import{c as x,e as v,a as y,b as P,d as j,f as w,u as z,g as L,h as k,l as B,i as C,j as S,k as N}from"./helper-
|
|
1
|
+
import e from"bignumber.js";import{merge as t,throttle as i,debounce as o}from"lodash";import r,{useEffect as n,useMemo as l,useRef as s,useState as a}from"react";import d from"@emotion/styled";import{css as u}from"@emotion/react";import{Stage as c,Layer as p,Rect as m,Line as g,Text as h,Circle as b,Label as f,Tag as M}from"react-konva";import{c as x,e as v,a as y,b as P,d as j,f as w,u as z,g as L,h as k,l as B,i as C,j as S,k as N}from"./helper-KeBGXRew.js";import{f as O,j as X,a as T,b as A}from"./index-BCoTzVYp.js";import{solveQuadraticFunctionForTarget as q,PMMModel as W}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/components";import"react-redux";import"identicon.js";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@reduxjs/toolkit";import"redux";import"@tanstack/react-query";import"react-dom";import"react-window";import"@ethersproject/bignumber";import"dayjs";import"react-transition-group";import"zustand";import"@dodoex/contract-request";import"@dodoex/dodo-contract-request";import"axios";import"recharts";import"react-infinite-scroller";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"rmc-date-picker";var E={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},F=r.createContext&&r.createContext(E),H=["attr","size","title"];function Z(e,t){if(null==e)return{};var i,o,r=function(e,t){if(null==e)return{};var i,o,r={},n=Object.keys(e);for(o=0;o<n.length;o++)i=n[o],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)i=n[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},G.apply(this,arguments)}function D(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function J(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?D(Object(i),!0).forEach((function(t){V(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):D(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function V(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){return e&&e.map(((e,t)=>r.createElement(e.tag,J({key:t},e.attr),Y(e.child))))}function I(e){return t=>r.createElement(R,G({attr:J({},e.attr)},t),Y(e.child))}function R(e){var t=t=>{var i,{attr:o,size:n,title:l}=e,s=Z(e,H),a=n||t.size||"1em";return t.className&&(i=t.className),e.className&&(i=(i?i+" ":"")+e.className),r.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,o,s,{className:i,style:J(J({color:e.color||t.color},t.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&r.createElement("title",null,l),e.children)};return void 0!==F?r.createElement(F.Consumer,null,(e=>t(e))):t(E)}function $(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M13.293 6.293 7.586 12l5.707 5.707 1.414-1.414L10.414 12l4.293-4.293z"},child:[]}]})(e)}function Q(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10.707 17.707 16.414 12l-5.707-5.707-1.414 1.414L13.586 12l-4.293 4.293z"},child:[]}]})(e)}function K(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5 11h14v2H5z"},child:[]}]})(e)}function U(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(e)}const _=d.input`
|
|
2
2
|
margin: 4px 10px 4px 6px;
|
|
3
3
|
border-radius: 10px;
|
|
4
4
|
border: 1px solid #373739;
|