@dodoex/widgets 3.0.2-zetachain.110.ton.1 → 3.0.2-zetachain.111
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/README.md +0 -4
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/{helper-DIkbm_U5.cjs → helper-CCTu9er9.cjs} +1 -1
- package/dist/{helper-BTJpgu2t.js → helper-Ci7geM5m.js} +1 -1
- package/dist/{index-DR4KO5Dk.cjs → index-B6Ej3z_K.cjs} +2 -2
- package/dist/{index-8hgb8akZ.js → index-BfkpRw0P.js} +4 -4
- package/dist/index-DF6wZx-Z.cjs +31 -0
- package/dist/{index-DwtxxFKB.js → index-Dm_FEZCG.js} +2 -2
- package/dist/index-DrDSLedU.js +31 -0
- package/dist/{index-6EYQJsAq.cjs → index-YMKJjycL.cjs} +3 -3
- 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/constants/address.d.ts +0 -2
- package/dist/types/constants/chainList.d.ts +0 -2
- package/dist/types/hooks/Swap/useCrossSwapOrderList.d.ts +6 -6
- package/dist/types/index.d.ts +1 -2
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/wallet.d.ts +1 -1
- package/package.json +6 -14
- package/dist/index-BENIDbsM.js +0 -34
- package/dist/index-CpuninTL.cjs +0 -34
- package/dist/types/tests/1-get-account-state.d.ts +0 -1
- package/dist/types/tests/1-send-ton.d.ts +0 -1
- package/dist/types/utils/CaipNetworksUtil.d.ts +0 -5
- package/dist/types/utils/reown-types.d.ts +0 -28
- package/dist/types/utils/sui_test.d.ts +0 -1
- package/dist/types/utils/ton.d.ts +0 -3
- package/dist/types/utils/ton_test.d.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import t from"@emotion/styled";import{merge as i}from"lodash";import{useMemo as e,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 i}from"lodash";import{useMemo as e,useRef as n}from"react";import{l as r,g as o,m as l}from"./helper-Ci7geM5m.js";import{Line as a,Text as s,Stage as d,Layer as g,Rect as m,Circle as p,Label as u,Tag as h}from"react-konva";import{j as c,f}from"./index-DrDSLedU.js";import x from"bignumber.js";import{solveQuadraticFunctionForTarget as L,PMMState as w,PMMHelper as b}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/components";import"@reown/appkit-utils";import"@solana/web3.js";import"@reown/appkit/networks";import"@tanstack/react-query";import"zustand";import"@dodoex/dodo-contract-request";import"@ethersproject/providers";import"@reown/appkit/react";import"@ethersproject/bignumber";import"axios";import"@ethersproject/contracts";import"react-dom";import"identicon.js";import"@bitcoinerlab/secp256k1";import"bitcoinjs-lib";import"dayjs";import"@dodoex/contract-request";import"react-transition-group";import"recharts";import"react-window";import"jsbi";import"tiny-invariant";import"@ethersproject/units";import"react-infinite-scroller";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"d3";const A=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 i}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:i,value:e}){const n=new x(i).minus(N),r=n.div(t);return n.minus(e.multipliedBy(r)).plus(N).toNumber()}function v({targetPrice:t,areaPoints:i,isLeft:e}){for(let n=0;n<i.length;n++){const r=i[n],o=n<i.length-1?i[n+1]:null;if(!o)return{targetAreaStatPoint:r,targetAreaStatPoints:i};if(e){if(t.lte(r.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:i.slice(0,n+1)}}else if(t.gte(r.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:i.slice(0,n+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function j({x:t,width:i,minXLN10:e,maxXLN10:n}){const r=new x(t).div(i).multipliedBy(n.minus(e)).plus(e);return new x(10**r.toNumber())}function H({width:t,targetLN10:i,minXLN10:e,maxXLN10:n}){return i.minus(e).div(n.minus(e)).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:A,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 e((()=>{const i=new x(t.b),e=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(i)&&(n=L(i,e.minus(r),new x(1).div(o),l));const s=new w({i:o,K:l,B:i,Q:e,B0:n,Q0:r,R:a,mtFeeRate:new x(0),lpFeeRate:new x(0)}),d=new b,g=new x(s.B),m=[],p=[];let u=new x(0),c=new x(0);const h=d.GetMidPrice(s),f=e.gt(0)?i.div(e):new x(1);for(let t=0;t<=250;t++){let i=g.multipliedBy(t/100).multipliedBy(h.multipliedBy(f).multipliedBy(4));0===t&&(i=g.multipliedBy(1e-11));const e=null==d?void 0:d.QuerySellBase(i,s);if(e.isNaN()||!e.gt(0))m.push({giveAmount:i,getAmount:new x(0),price:new x(0)});else{const t=e.div(i);m.push({giveAmount:i,getAmount:e,price:t})}}for(let t=0;t<=250;t++){let i=g.multipliedBy(t/100).multipliedBy(h.multipliedBy(4));0===t&&(i=g.multipliedBy(1e-11));const e=null==d?void 0:d.QuerySellQuote(i,s);if(e.isNaN()||!e.gt(0))p.push({giveAmount:i,getAmount:new x(0),price:new x(0)});else{const t=i.dividedBy(e);p.push({giveAmount:i,getAmount:e,price:t})}}if(m.length<2&&p.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 A=[];for(let t=1;t<m.length;t++){const i=m[t],{giveAmount:e,getAmount:n,price:r}=i,o=m[t-1];if(!r.isNaN()&&r.gt(0)&&o){const i=r.minus(o.price).abs(),l=e.minus(o.giveAmount).abs(),a=n.minus(o.getAmount).abs().multipliedBy(l);1===t&&A.push({area:n,price:r,middlePrice:r.plus(i.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),A.push({area:n,price:r,middlePrice:r.plus(i.div(2)),rectangleHeight:a}),u=x.max(a,u)}}const y=[];for(let t=1;t<p.length;t++){const i=p[t],{giveAmount:e,getAmount:n,price:r}=i,o=p[t-1],l=o.price,a=o.giveAmount,s=o.getAmount;if(!r.isNaN()&&r.gt(0)&&o){const i=r.minus(l).abs(),o=e.minus(a).abs(),d=n.minus(s).abs().multipliedBy(o);1===t&&y.push({area:n,price:r,middlePrice:r.minus(i.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:n,price:r,middlePrice:r.minus(i.div(2)),rectangleHeight:d}),c=x.max(d,c)}}const N=m.length>0?m[m.length-1]:p[0],P=p.length>0?p[0]:m[0],v=p.length>0?p[p.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:A,rightStatAreaPoints:y,maxLeftHeight:u.multipliedBy(1.2),maxRightHeight:c.multipliedBy(1.2),minXLN10:X,maxXLN10:B,middlePriceLN10:k}}),[t])}({params:y}),J=A-30.13,O=n(null),R=i({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=i=>{var e;const{current:n}=O,r=i.target;if(r&&n){const i=null===(e=r.getStage())||void 0===e?void 0:e.getPointerPosition();if(i){const{x:e}=i,r=t/2;if(Math.abs(e-r)<=2)return;if(e<=2||t-e<=2)return;const a=j({x:e,width:t,minXLN10:T,maxXLN10:q});let s=null,d=[];const g=e<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 i=S({target:s.middlePrice}),r=H({minXLN10:T,maxXLN10:q,width:t,targetLN10:i}),a=P({maxHeight:g?C:F,gridAreaHeight:J,value:s.rectangleHeight}),m=n.findOne("#tooltip"),p=n.findOne("#toolTipVertLine"),u=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>e?(h.pointerDirection("left"),h.pointerHeight(15),h.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+e>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==p||p.points([r,J,r,a]),null==p||p.stroke(g?"#55f6db":"#ff4f73");let b=g?"rgb(86, 246, 218)":"#FF5072",A=g?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(b=g?R.leftLine:R.rightLine,A=g?`rgba(${l(R.leftLine)}, 0.4)`:`rgba(${l(R.rightLine)}, 0.4)`),u&&(u.x(r),u.y(a),u.fill(b),u.stroke(A)),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(e)),L&&(L.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),L.text(f(s.price)));const y=[];for(const i of d){const{middlePrice:e,rectangleHeight:n}=i,r=S({target:e}),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:i,horizontalLineCount:n,verticalLineCount:r,color:o="#2A2A2D"}){return e((()=>{const e=[],l=t/(n+1),s=[],d=i/(r+1);for(let t=0;t<n;t++){const n=l*(t+1);e.push([0,n,i,n])}for(let i=0;i<r;i++){const e=d*(i+1);s.push([e,0,e,t])}return h.jsxs(h.Fragment,{children:[e.map(((t,i)=>h.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},i))),s.map(((t,i)=>h.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},i)))]})}),[t,i,n,r,o])}({gridAreaHeight:J,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:R.grid}),G=function({minXLN10:t,maxXLN10:i,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return e((()=>{const e=o/(n+1),d=[],g=[];for(let l=0;l<n;l++){const n=e/2+e*l;d.push({x:n,y:r+10.08+1,text:f(j({x:e*(l+1),width:o,minXLN10:t,maxXLN10:i}))});const a=e*(l+1);g.push([a,r+1,a,r+4+1])}return h.jsxs(h.Fragment,{children:[d.map(((t,i)=>h.jsx(s,{x:t.x,y:t.y,text:t.text,fontSize:14,fontFamily:"Manrope",fill:l,width:e,padding:0,align:"center",verticalAlign:"bottom",listening:!1},i))),g.map(((t,i)=>h.jsx(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},i)))]})}),[t,i,r,o,n])}({gridAreaHeight:J,gridAreaWidth:t,labelCount:7,minXLN10:T,maxXLN10:q,color:R.textColor}),Q=function({gridAreaHeight:t,gridAreaWidth:i,color:n="#606066"}){return e((()=>{const e=i/2;return h.jsx(a,{points:[e,0,e,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,i,n])}({gridAreaHeight:J,gridAreaWidth:t,color:R.midPriceLine}),{leftLine:E,rightLine:Y}=function({leftStatAreaPoints:t,rightStatAreaPoints:i,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:g}){return{leftLine:e((()=>{if(t.length<1)return h.jsx(h.Fragment,{});const i=[];let e=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}),p=P({maxHeight:o,gridAreaHeight:d,value:a});i.push(m,p),p<e&&(e=p)}const l=i.slice(),[m,p]=l,u=l[l.length-1],c=l[l.length-2];return l.push(c,u),l.push(c,d),l.push(m,d),l.push(m,p),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:e},fillLinearGradientColorStops:g.leftBg}),h.jsx(a,{points:i,stroke:g.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,s,n,r,d,o]),rightLine:e((()=>{if(i.length<1)return h.jsx(h.Fragment,{});const t=[];let e=d;for(const o of i){const{middlePrice:i,rectangleHeight:a}=o,g=S({target:i}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),p=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,p),p<e&&(e=p)}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:e},fillLinearGradientColorStops:g.rightBg}),h.jsx(a,{points:t,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[i,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:A,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(p,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),h.jsxs(u,{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(u,{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:i=462,baseTokenSymbol:e,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>h.jsxs(A,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&h.jsx(X,{width:t,height:i,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:e,quoteTokenSymbol:n,colorMap:d}),s?"":h.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:e})]})]});export{B as default};
|
|
12
|
+
`,N=36;function P({maxHeight:t,gridAreaHeight:i,value:e}){const n=new x(i).minus(N),r=n.div(t);return n.minus(e.multipliedBy(r)).plus(N).toNumber()}function v({targetPrice:t,areaPoints:i,isLeft:e}){for(let n=0;n<i.length;n++){const r=i[n],o=n<i.length-1?i[n+1]:null;if(!o)return{targetAreaStatPoint:r,targetAreaStatPoints:i};if(e){if(t.lte(r.middlePrice)&&t.gte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:i.slice(0,n+1)}}else if(t.gte(r.middlePrice)&&t.lte(o.middlePrice))return{targetAreaStatPoint:r,targetAreaStatPoints:i.slice(0,n+1)}}return{targetAreaStatPoint:null,targetAreaStatPoints:[]}}function j({x:t,width:i,minXLN10:e,maxXLN10:n}){const r=new x(t).div(i).multipliedBy(n.minus(e)).plus(e);return new x(10**r.toNumber())}function H({width:t,targetLN10:i,minXLN10:e,maxXLN10:n}){return i.minus(e).div(n.minus(e)).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:A,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 e((()=>{const i=new x(t.b),e=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(i)&&(n=L(i,e.minus(r),new x(1).div(o),l));const s=new w({i:o,K:l,B:i,Q:e,B0:n,Q0:r,R:a,mtFeeRate:new x(0),lpFeeRate:new x(0)}),d=new b,g=new x(s.B),m=[],p=[];let u=new x(0),h=new x(0);const c=d.GetMidPrice(s),f=e.gt(0)?i.div(e):new x(1);for(let t=0;t<=250;t++){let i=g.multipliedBy(t/100).multipliedBy(c.multipliedBy(f).multipliedBy(4));0===t&&(i=g.multipliedBy(1e-11));const e=null==d?void 0:d.QuerySellBase(i,s);if(e.isNaN()||!e.gt(0))m.push({giveAmount:i,getAmount:new x(0),price:new x(0)});else{const t=e.div(i);m.push({giveAmount:i,getAmount:e,price:t})}}for(let t=0;t<=250;t++){let i=g.multipliedBy(t/100).multipliedBy(c.multipliedBy(4));0===t&&(i=g.multipliedBy(1e-11));const e=null==d?void 0:d.QuerySellQuote(i,s);if(e.isNaN()||!e.gt(0))p.push({giveAmount:i,getAmount:new x(0),price:new x(0)});else{const t=i.dividedBy(e);p.push({giveAmount:i,getAmount:e,price:t})}}if(m.length<2&&p.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 A=[];for(let t=1;t<m.length;t++){const i=m[t],{giveAmount:e,getAmount:n,price:r}=i,o=m[t-1];if(!r.isNaN()&&r.gt(0)&&o){const i=r.minus(o.price).abs(),l=e.minus(o.giveAmount).abs(),a=n.minus(o.getAmount).abs().multipliedBy(l);1===t&&A.push({area:n,price:r,middlePrice:r.plus(i.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),A.push({area:n,price:r,middlePrice:r.plus(i.div(2)),rectangleHeight:a}),u=x.max(a,u)}}const y=[];for(let t=1;t<p.length;t++){const i=p[t],{giveAmount:e,getAmount:n,price:r}=i,o=p[t-1],l=o.price,a=o.giveAmount,s=o.getAmount;if(!r.isNaN()&&r.gt(0)&&o){const i=r.minus(l).abs(),o=e.minus(a).abs(),d=n.minus(s).abs().multipliedBy(o);1===t&&y.push({area:n,price:r,middlePrice:r.minus(i.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),y.push({area:n,price:r,middlePrice:r.minus(i.div(2)),rectangleHeight:d}),h=x.max(d,h)}}const N=m.length>0?m[m.length-1]:p[0],P=p.length>0?p[0]:m[0],v=p.length>0?p[p.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:A,rightStatAreaPoints:y,maxLeftHeight:u.multipliedBy(1.2),maxRightHeight:h.multipliedBy(1.2),minXLN10:X,maxXLN10:B,middlePriceLN10:k}}),[t])}({params:y}),J=A-30.13,O=n(null),R=i({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=i=>{var e;const{current:n}=O,r=i.target;if(r&&n){const i=null===(e=r.getStage())||void 0===e?void 0:e.getPointerPosition();if(i){const{x:e}=i,r=t/2;if(Math.abs(e-r)<=2)return;if(e<=2||t-e<=2)return;const a=j({x:e,width:t,minXLN10:T,maxXLN10:q});let s=null,d=[];const g=e<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 i=S({target:s.middlePrice}),r=H({minXLN10:T,maxXLN10:q,width:t,targetLN10:i}),a=P({maxHeight:g?C:F,gridAreaHeight:J,value:s.rectangleHeight}),m=n.findOne("#tooltip"),p=n.findOne("#toolTipVertLine"),u=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>e?(c.pointerDirection("left"),c.pointerHeight(15),c.pointerWidth(8),m.offsetX(-11),m.offsetY(-11)):m.width()/2+e>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==p||p.points([r,J,r,a]),null==p||p.stroke(g?"#55f6db":"#ff4f73");let b=g?"rgb(86, 246, 218)":"#FF5072",A=g?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(b=g?R.leftLine:R.rightLine,A=g?`rgba(${l(R.leftLine)}, 0.4)`:`rgba(${l(R.rightLine)}, 0.4)`),u&&(u.x(r),u.y(a),u.fill(b),u.stroke(A)),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(e)),L&&(L.fill(R.tooltipColor||(g?"#00FAD9":"#FF5072")),L.text(f(s.price)));const y=[];for(const i of d){const{middlePrice:e,rectangleHeight:n}=i,r=S({target:e}),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:i,horizontalLineCount:n,verticalLineCount:r,color:o="#2A2A2D"}){return e((()=>{const e=[],l=t/(n+1),s=[],d=i/(r+1);for(let t=0;t<n;t++){const n=l*(t+1);e.push([0,n,i,n])}for(let i=0;i<r;i++){const e=d*(i+1);s.push([e,0,e,t])}return c.jsxs(c.Fragment,{children:[e.map(((t,i)=>c.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},i))),s.map(((t,i)=>c.jsx(a,{points:t,stroke:o,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1},i)))]})}),[t,i,n,r,o])}({gridAreaHeight:J,gridAreaWidth:t,horizontalLineCount:9,verticalLineCount:7,color:R.grid}),G=function({minXLN10:t,maxXLN10:i,labelCount:n,gridAreaHeight:r,gridAreaWidth:o,color:l="#606066"}){return e((()=>{const e=o/(n+1),d=[],g=[];for(let l=0;l<n;l++){const n=e/2+e*l;d.push({x:n,y:r+10.08+1,text:f(j({x:e*(l+1),width:o,minXLN10:t,maxXLN10:i}))});const a=e*(l+1);g.push([a,r+1,a,r+4+1])}return c.jsxs(c.Fragment,{children:[d.map(((t,i)=>c.jsx(s,{x:t.x,y:t.y,text:t.text,fontSize:14,fontFamily:"Manrope",fill:l,width:e,padding:0,align:"center",verticalAlign:"bottom",listening:!1},i))),g.map(((t,i)=>c.jsx(a,{points:t,stroke:l,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},i)))]})}),[t,i,r,o,n])}({gridAreaHeight:J,gridAreaWidth:t,labelCount:7,minXLN10:T,maxXLN10:q,color:R.textColor}),Q=function({gridAreaHeight:t,gridAreaWidth:i,color:n="#606066"}){return e((()=>{const e=i/2;return c.jsx(a,{points:[e,0,e,t-1],stroke:n,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[t,i,n])}({gridAreaHeight:J,gridAreaWidth:t,color:R.midPriceLine}),{leftLine:E,rightLine:Y}=function({leftStatAreaPoints:t,rightStatAreaPoints:i,minXLN10:n,maxXLN10:r,maxLeftHeight:o,maxRightHeight:l,gridAreaWidth:s,gridAreaHeight:d,colorMap:g}){return{leftLine:e((()=>{if(t.length<1)return c.jsx(c.Fragment,{});const i=[];let e=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}),p=P({maxHeight:o,gridAreaHeight:d,value:a});i.push(m,p),p<e&&(e=p)}const l=i.slice(),[m,p]=l,u=l[l.length-1],h=l[l.length-2];return l.push(h,u),l.push(h,d),l.push(m,d),l.push(m,p),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:e},fillLinearGradientColorStops:g.leftBg}),c.jsx(a,{points:i,stroke:g.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,s,n,r,d,o]),rightLine:e((()=>{if(i.length<1)return c.jsx(c.Fragment,{});const t=[];let e=d;for(const o of i){const{middlePrice:i,rectangleHeight:a}=o,g=S({target:i}),m=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:g}),p=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,p),p<e&&(e=p)}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:e},fillLinearGradientColorStops:g.rightBg}),c.jsx(a,{points:t,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[i,s,n,r,d,l])}}({leftStatAreaPoints:M,rightStatAreaPoints:W,minXLN10:T,maxXLN10:q,maxLeftHeight:C,maxRightHeight:F,gridAreaWidth:t,gridAreaHeight:J,colorMap:R});return c.jsxs(d,{width:t,height:A,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:J,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(p,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),c.jsxs(u,{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(u,{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:i=462,baseTokenSymbol:e,quoteTokenSymbol:n,pmmModel:r,pmmParams:l,midPrice:a,notShowTipText:s,colorMap:d})=>c.jsxs(A,{children:[void 0!==l&&void 0!==a&&void 0!==r&&void 0!==a&&c.jsx(X,{width:t,height:i,params:l,midPrice:a,pmmModel:r,baseTokenSymbol:e,quoteTokenSymbol:n,colorMap:d}),s?"":c.jsxs(y,{children:["* ",o("pool.chart.liquidity-chart-tip",{baseTokenSymbol:e})]})]});export{B as default};
|