@dodoex/widgets 3.0.2-zetachain.108.refund.1 → 3.0.2-zetachain.108.ton.2

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.
Files changed (36) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/locales/en-US.js +1 -1
  3. package/dist/cjs/locales/zh-CN.js +1 -1
  4. package/dist/{helper-VrdR3uWp.js → helper-BhnlkePU.js} +1 -1
  5. package/dist/{helper-BXvQPmv7.cjs → helper-xbWu0aGJ.cjs} +1 -1
  6. package/dist/{index-HqXiTr51.cjs → index--IQw92GO.cjs} +3 -3
  7. package/dist/index-BNjT4_s4.js +31 -0
  8. package/dist/{index-DcS0uyec.js → index-BXOd9Dl2.js} +2 -2
  9. package/dist/{index-BKgkOSup.js → index-CsrFbHKk.js} +4 -4
  10. package/dist/index-DMfCNiUx.cjs +31 -0
  11. package/dist/{index-DD0_Ss45.cjs → index-gSLR54il.cjs} +2 -2
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/locales/en-US.js +1 -1
  15. package/dist/locales/zh-CN.js +1 -1
  16. package/dist/types/components/Swap/SwapOrderHistory/CrossOrderCard.d.ts +1 -2
  17. package/dist/types/constants/address.d.ts +2 -0
  18. package/dist/types/constants/api.d.ts +1 -2
  19. package/dist/types/constants/chainList.d.ts +2 -0
  20. package/dist/types/hooks/Swap/useCrossSwapOrderList.d.ts +12 -24
  21. package/dist/types/hooks/Token/useTokenStatus.d.ts +2 -6
  22. package/dist/types/index.d.ts +2 -1
  23. package/dist/types/tests/1-get-account-state.d.ts +1 -0
  24. package/dist/types/tests/1-send-ton.d.ts +1 -0
  25. package/dist/types/utils/CaipNetworksUtil.d.ts +5 -0
  26. package/dist/types/utils/constants.d.ts +0 -1
  27. package/dist/types/utils/index.d.ts +2 -2
  28. package/dist/types/utils/reown-types.d.ts +28 -0
  29. package/dist/types/utils/ton.d.ts +9 -0
  30. package/dist/types/utils/ton_test.d.ts +1 -0
  31. package/dist/types/utils/wallet.d.ts +1 -1
  32. package/dist/types/widgets/PoolWidget/PoolOperate/hooks/useRemoveLiquidityTokenStatus.d.ts +2 -6
  33. package/package.json +14 -6
  34. package/dist/index-0-iXV94m.cjs +0 -31
  35. package/dist/index-S6xeLliD.js +0 -31
  36. package/dist/types/components/Swap/SwapOrderHistory/RefundModal.d.ts +0 -9
@@ -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-VrdR3uWp.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-S6xeLliD.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`
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-BhnlkePU.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 c}from"react-konva";import{j as h,f}from"./index-BNjT4_s4.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"@mysten/sui/client";import"@solana/web3.js";import"@reown/appkit/networks";import"@tanstack/react-query";import"zustand";import"@dodoex/dodo-contract-request";import"@ethersproject/providers";import"@mysten/dapp-kit";import"@reown/appkit/react";import"@tonconnect/ui-react";import"@ethersproject/bignumber";import"axios";import"@ethersproject/contracts";import"react-dom";import"identicon.js";import"@ton/core";import"@bitcoinerlab/secp256k1";import"bitcoinjs-lib";import"@ton/ton";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),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};
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};
@@ -1,4 +1,4 @@
1
- import t from"bignumber.js";import{merge as e,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-VrdR3uWp.js";import{f as O,j as X,a as T,b as A}from"./index-S6xeLliD.js";import{solveQuadraticFunctionForTarget as q,PMMModel as W}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";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(t,e){if(null==t)return{};var i,o,r=function(t,e){if(null==t)return{};var i,o,r={},n=Object.keys(t);for(o=0;o<n.length;o++)i=n[o],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)i=n[o],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function G(){return G=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},G.apply(this,arguments)}function D(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}function J(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?D(Object(i),!0).forEach((function(e){V(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):D(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function V(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Y(t){return t&&t.map(((t,e)=>r.createElement(t.tag,J({key:e},t.attr),Y(t.child))))}function I(t){return e=>r.createElement(R,G({attr:J({},t.attr)},e),Y(t.child))}function R(t){var e=e=>{var i,{attr:o,size:n,title:l}=t,s=Z(t,H),a=n||e.size||"1em";return e.className&&(i=e.className),t.className&&(i=(i?i+" ":"")+t.className),r.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,o,s,{className:i,style:J(J({color:t.color||e.color},e.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&r.createElement("title",null,l),t.children)};return void 0!==F?r.createElement(F.Consumer,null,(t=>e(t))):e(E)}function $(t){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:[]}]})(t)}function Q(t){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:[]}]})(t)}function K(t){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5 11h14v2H5z"},child:[]}]})(t)}function U(t){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(t)}const _=d.input`
1
+ import t from"bignumber.js";import{merge as e,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 c}from"@emotion/react";import{Stage as u,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-BhnlkePU.js";import{f as O,j as X,a as T,b as A}from"./index-BNjT4_s4.js";import{solveQuadraticFunctionForTarget as q,PMMModel as W}from"@dodoex/api";import"@lingui/core";import"@lingui/react";import"@dodoex/components";import"@mysten/sui/client";import"@solana/web3.js";import"@reown/appkit/networks";import"@tanstack/react-query";import"zustand";import"@dodoex/dodo-contract-request";import"@ethersproject/providers";import"@mysten/dapp-kit";import"@reown/appkit/react";import"@tonconnect/ui-react";import"@ethersproject/bignumber";import"axios";import"@ethersproject/contracts";import"react-dom";import"identicon.js";import"@ton/core";import"@bitcoinerlab/secp256k1";import"bitcoinjs-lib";import"@ton/ton";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";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(t,e){if(null==t)return{};var i,o,r=function(t,e){if(null==t)return{};var i,o,r={},n=Object.keys(t);for(o=0;o<n.length;o++)i=n[o],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)i=n[o],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function G(){return G=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},G.apply(this,arguments)}function D(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}function J(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?D(Object(i),!0).forEach((function(e){V(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):D(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function V(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Y(t){return t&&t.map(((t,e)=>r.createElement(t.tag,J({key:e},t.attr),Y(t.child))))}function I(t){return e=>r.createElement(R,G({attr:J({},t.attr)},e),Y(t.child))}function R(t){var e=e=>{var i,{attr:o,size:n,title:l}=t,s=Z(t,H),a=n||e.size||"1em";return e.className&&(i=e.className),t.className&&(i=(i?i+" ":"")+t.className),r.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,o,s,{className:i,style:J(J({color:t.color||e.color},e.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&r.createElement("title",null,l),t.children)};return void 0!==F?r.createElement(F.Consumer,null,(t=>e(t))):e(E)}function $(t){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:[]}]})(t)}function Q(t){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:[]}]})(t)}function K(t){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5 11h14v2H5z"},child:[]}]})(t)}function U(t){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(t)}const _=d.input`
2
2
  margin: 4px 10px 4px 6px;
3
3
  border-radius: 10px;
4
4
  border: 1px solid #373739;
@@ -13,11 +13,11 @@ import t from"bignumber.js";import{merge as e,throttle as i,debounce as o}from"l
13
13
  &:focus {
14
14
  border-color: #fff;
15
15
 
16
- ${({error:t})=>t&&u`
16
+ ${({error:t})=>t&&c`
17
17
  border-color: red;
18
18
  `}
19
19
  }
20
- `;const tt="rgba(38, 39, 41, 0.3)";function et({width:o,height:r,midPrice:a,pmmModel:d,params:u,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,colorMap:T,setBaseMinAndZoomMultiples:A}){const q=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,tt,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,tt,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},T),W=o,E=r-18,F=W/7,{buyBaseVert:H,sellBaseVert:Z}=y({midPrice:a,q:u.q,q0:u.q0,pmmModel:d}),G=H.div(E),D=Z.div(E),J=s(null),V=s(null),{current:Y}=J,I=s(0),R=s(),{horizontalGridLines:$,verticalGridLines:Q}=function({chartHeight:t,chartWidth:e,horizontalLineCount:i,verticalLineCount:o}){return l((()=>{const r=[],n=t/(i+1),l=[],s=e/o;for(let t=0;t<i;t++){const i=n*(t+1);r.push([0,i,e,i])}for(let e=0;e<o;e++){const i=s*e+s/2;l.push([i,0,i,t])}return{horizontalGridLines:r,verticalGridLines:l}}),[t,e,i,o])}({chartHeight:E,chartWidth:W,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:K,horizontalLabelTextPoints:U}=function({chartHeight:t,chartWidth:e,xAxisPoints:i,oneXPx:o,baseMinAndZoomMultiples:r}){return l((()=>{const n=x(e,r.zoomMultiples),l=[],s=[];for(let e=0;e<i;e++){l.push([e*o+o/2,t,e*o+o/2,t+4]);const i=n.multipliedBy(e).multipliedBy(o).plus(n.multipliedBy(o/2)).toNumber(),a=r.baseMin.multipliedBy(10**i),d=e*o,u=t+2+4,c=O(a);s.push({x:d,y:u,text:c})}return{horizontalLabelTickPoints:l,horizontalLabelTextPoints:s}}),[r.baseMin,r.zoomMultiples,t,e,o,i])}({chartHeight:E,chartWidth:W,xAxisPoints:7,oneXPx:F,baseMinAndZoomMultiples:N}),{quoteLinePoints:_,quoteLineAreaPoints:et,quoteLineAreaLinearGradientEndPointY:it,baseLinePoints:ot,baseLineAreaPoints:rt,baseLineAreaLinearGradientEndPointY:nt,midPriceLinePoints:lt}=function({chartHeight:e,chartWidth:i,midPrice:o,xPoints:r,pmmModel:n,baseMinAndZoomMultiples:s,buyYPortion:a,sellYPortion:d}){return l((()=>{const l=[],u=[],c=[],{baseMin:p,zoomMultiples:m}=s,g=x(i,m),h=2*m,b=new t(h).div(r);let f=new t(Math.log(o.div(p).toNumber())/Math.log(10));f=t.minimum(h,f),f=t.maximum(0,f);for(let i=new t(0);i.lte(f);){const t=p.multipliedBy(10**i.toNumber()),r=v({val:t,model:n,midPrice:o});if(!r.vert.isNaN()){const t=i.div(g).toNumber(),o=e-r.vert.div(a).toNumber();l.push(t,o)}i=i.plus(b)}for(let t=f;t.lte(h);){const i=p.multipliedBy(10**t.toNumber()),r=v({val:i,model:n,midPrice:o});if(!r.vert.isNaN()){const i=t.div(g).toNumber(),o=e-r.vert.div(d).toNumber();u.push(i,o)}t=t.plus(b)}const M=f.div(g).toNumber(),[,y]=l,P=n.k.eq(0);P&&l.push(M,y||e),l.push(M,e),c.push(M,e,M,0);const j=v({val:p.multipliedBy(10**h),model:n,midPrice:o});let w=e;const z=new t(h).div(g).toNumber();return j.vert.isNaN()||(w=e-j.vert.div(d).toNumber()),P&&u.length>=2&&(u.unshift(M,w),u.unshift(M,e)),u.push(z,w),f.lte(0)&&u.unshift(0,e),{quoteLinePoints:l,quoteLineAreaPoints:[0,e,0,y,...l],quoteLineAreaLinearGradientEndPointY:y,baseLinePoints:u,baseLineAreaPoints:[...u,z,e],baseLineAreaLinearGradientEndPointY:w,midPriceLinePoints:c}}),[s,i,r,o,n,e,a,d])}({chartHeight:E,chartWidth:W,midPrice:a,xPoints:50,pmmModel:d,baseMinAndZoomMultiples:N,buyYPortion:G,sellYPortion:D}),st=t=>{var e;const i=t.target;if(i&&Y){const t=null===(e=i.getStage())||void 0===e?void 0:e.getPointerPosition();if(t){const{x:e}=t;if(e>W)return void Y.hide();z({x:e,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}}},at=l((()=>i((t=>{const{target:e}=t,i=e.getStage();if(i){i.container().style.cursor="grabbing";const t=null==i?void 0:i.getPointerPosition();if(t){const e=t.x-I.current;I.current=t.x,R.current=t.x,A((t=>void 0===t.baseMin?t:{baseMin:P({dragDistance:e,prevBaseMin:t.baseMin,chartWidth:W,zoomMultiples:t.zoomMultiples}),zoomMultiples:t.zoomMultiples,targetMarginPriceX:0}))}}}),100)),[W,A]),dt=l((()=>i((t=>{t.cancelBubble=!0,t.evt.preventDefault();const e=t.evt.deltaY<0;A((t=>{const i=j({zoomIn:e,prevZoomMultiples:t.zoomMultiples});return{baseMin:w({midPrice:a,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}}))}),100)),[a,A]);return n((()=>{N.targetMarginPriceX>0&&null!==Y?z({x:N.targetMarginPriceX,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine}):void 0!==R.current&&null!==Y&&z({x:R.current,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}),[N,C,H,E,W,q.leftLine,q.rightLine,q.tooltipColor,a,d,S,Z,Y]),X.jsxs(c,{ref:V,width:o,offsetY:-k,height:r+k,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:st,onMouseOver:st,onMouseOut:()=>{Y&&Y.hide()},onDragStart:function(t){const{target:e}=t,i=e.getStage();if(i){const t=i.getPointerPosition();t&&(I.current=t.x)}},onDragMove:at,onDragEnd:t=>{const{target:e}=t,i=e.getStage();i&&(i.container().style.cursor="pointer")},onWheel:dt,children:[X.jsxs(p,{children:[X.jsx(m,{x:0,y:0,width:o,height:E,stroke:q.grid,strokeWidth:1}),$.map(((t,e)=>X.jsx(g,{points:t,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},e))),Q.map(((t,e)=>X.jsx(g,{points:t,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},e))),K.map(((t,e)=>X.jsx(g,{points:t,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},e))),U.map(((t,e)=>X.jsx(h,{x:t.x,y:t.y,text:t.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:F,padding:0,align:"center",verticalAlign:"bottom",listening:!1},e))),X.jsx(g,{points:et,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:E},fillLinearGradientEndPoint:{x:0,y:it},fillLinearGradientColorStops:q.leftBg}),X.jsx(g,{points:_,stroke:q.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.jsx(g,{points:rt,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:W,y:E},fillLinearGradientEndPoint:{x:W,y:nt},fillLinearGradientColorStops:q.rightBg}),X.jsx(g,{points:ot,stroke:q.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.jsx(g,{points:lt,stroke:q.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),X.jsxs(p,{ref:J,visible:!1,listening:!1,children:[X.jsx(g,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),X.jsx(g,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),X.jsx(b,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),X.jsxs(f,{x:0,y:0,id:"priceTextLabel",children:[X.jsx(M,{fill:q.tooltipBg,id:"priceTextLabel-tag"}),X.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),X.jsxs(f,{x:0,y:0,id:"slippageTextLabel",children:[X.jsx(M,{fill:q.tooltipBg,id:"slippageTextLabel-tag"}),X.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),X.jsxs(f,{x:0,y:0,id:"toolTip",children:[X.jsx(M,{fill:q.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),X.jsx(h,{text:"-",fontSize:12,lineHeight:17/12,padding:B,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const it=d.button`
20
+ `;const tt="rgba(38, 39, 41, 0.3)";function et({width:o,height:r,midPrice:a,pmmModel:d,params:c,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,colorMap:T,setBaseMinAndZoomMultiples:A}){const q=e({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,tt,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,tt,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},T),W=o,E=r-18,F=W/7,{buyBaseVert:H,sellBaseVert:Z}=y({midPrice:a,q:c.q,q0:c.q0,pmmModel:d}),G=H.div(E),D=Z.div(E),J=s(null),V=s(null),{current:Y}=J,I=s(0),R=s(),{horizontalGridLines:$,verticalGridLines:Q}=function({chartHeight:t,chartWidth:e,horizontalLineCount:i,verticalLineCount:o}){return l((()=>{const r=[],n=t/(i+1),l=[],s=e/o;for(let t=0;t<i;t++){const i=n*(t+1);r.push([0,i,e,i])}for(let e=0;e<o;e++){const i=s*e+s/2;l.push([i,0,i,t])}return{horizontalGridLines:r,verticalGridLines:l}}),[t,e,i,o])}({chartHeight:E,chartWidth:W,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:K,horizontalLabelTextPoints:U}=function({chartHeight:t,chartWidth:e,xAxisPoints:i,oneXPx:o,baseMinAndZoomMultiples:r}){return l((()=>{const n=x(e,r.zoomMultiples),l=[],s=[];for(let e=0;e<i;e++){l.push([e*o+o/2,t,e*o+o/2,t+4]);const i=n.multipliedBy(e).multipliedBy(o).plus(n.multipliedBy(o/2)).toNumber(),a=r.baseMin.multipliedBy(10**i),d=e*o,c=t+2+4,u=O(a);s.push({x:d,y:c,text:u})}return{horizontalLabelTickPoints:l,horizontalLabelTextPoints:s}}),[r.baseMin,r.zoomMultiples,t,e,o,i])}({chartHeight:E,chartWidth:W,xAxisPoints:7,oneXPx:F,baseMinAndZoomMultiples:N}),{quoteLinePoints:_,quoteLineAreaPoints:et,quoteLineAreaLinearGradientEndPointY:it,baseLinePoints:ot,baseLineAreaPoints:rt,baseLineAreaLinearGradientEndPointY:nt,midPriceLinePoints:lt}=function({chartHeight:e,chartWidth:i,midPrice:o,xPoints:r,pmmModel:n,baseMinAndZoomMultiples:s,buyYPortion:a,sellYPortion:d}){return l((()=>{const l=[],c=[],u=[],{baseMin:p,zoomMultiples:m}=s,g=x(i,m),h=2*m,b=new t(h).div(r);let f=new t(Math.log(o.div(p).toNumber())/Math.log(10));f=t.minimum(h,f),f=t.maximum(0,f);for(let i=new t(0);i.lte(f);){const t=p.multipliedBy(10**i.toNumber()),r=v({val:t,model:n,midPrice:o});if(!r.vert.isNaN()){const t=i.div(g).toNumber(),o=e-r.vert.div(a).toNumber();l.push(t,o)}i=i.plus(b)}for(let t=f;t.lte(h);){const i=p.multipliedBy(10**t.toNumber()),r=v({val:i,model:n,midPrice:o});if(!r.vert.isNaN()){const i=t.div(g).toNumber(),o=e-r.vert.div(d).toNumber();c.push(i,o)}t=t.plus(b)}const M=f.div(g).toNumber(),[,y]=l,P=n.k.eq(0);P&&l.push(M,y||e),l.push(M,e),u.push(M,e,M,0);const j=v({val:p.multipliedBy(10**h),model:n,midPrice:o});let w=e;const z=new t(h).div(g).toNumber();return j.vert.isNaN()||(w=e-j.vert.div(d).toNumber()),P&&c.length>=2&&(c.unshift(M,w),c.unshift(M,e)),c.push(z,w),f.lte(0)&&c.unshift(0,e),{quoteLinePoints:l,quoteLineAreaPoints:[0,e,0,y,...l],quoteLineAreaLinearGradientEndPointY:y,baseLinePoints:c,baseLineAreaPoints:[...c,z,e],baseLineAreaLinearGradientEndPointY:w,midPriceLinePoints:u}}),[s,i,r,o,n,e,a,d])}({chartHeight:E,chartWidth:W,midPrice:a,xPoints:50,pmmModel:d,baseMinAndZoomMultiples:N,buyYPortion:G,sellYPortion:D}),st=t=>{var e;const i=t.target;if(i&&Y){const t=null===(e=i.getStage())||void 0===e?void 0:e.getPointerPosition();if(t){const{x:e}=t;if(e>W)return void Y.hide();z({x:e,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}}},at=l((()=>i((t=>{const{target:e}=t,i=e.getStage();if(i){i.container().style.cursor="grabbing";const t=null==i?void 0:i.getPointerPosition();if(t){const e=t.x-I.current;I.current=t.x,R.current=t.x,A((t=>void 0===t.baseMin?t:{baseMin:P({dragDistance:e,prevBaseMin:t.baseMin,chartWidth:W,zoomMultiples:t.zoomMultiples}),zoomMultiples:t.zoomMultiples,targetMarginPriceX:0}))}}}),100)),[W,A]),dt=l((()=>i((t=>{t.cancelBubble=!0,t.evt.preventDefault();const e=t.evt.deltaY<0;A((t=>{const i=j({zoomIn:e,prevZoomMultiples:t.zoomMultiples});return{baseMin:w({midPrice:a,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}}))}),100)),[a,A]);return n((()=>{N.targetMarginPriceX>0&&null!==Y?z({x:N.targetMarginPriceX,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine}):void 0!==R.current&&null!==Y&&z({x:R.current,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}),[N,C,H,E,W,q.leftLine,q.rightLine,q.tooltipColor,a,d,S,Z,Y]),X.jsxs(u,{ref:V,width:o,offsetY:-k,height:r+k,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:st,onMouseOver:st,onMouseOut:()=>{Y&&Y.hide()},onDragStart:function(t){const{target:e}=t,i=e.getStage();if(i){const t=i.getPointerPosition();t&&(I.current=t.x)}},onDragMove:at,onDragEnd:t=>{const{target:e}=t,i=e.getStage();i&&(i.container().style.cursor="pointer")},onWheel:dt,children:[X.jsxs(p,{children:[X.jsx(m,{x:0,y:0,width:o,height:E,stroke:q.grid,strokeWidth:1}),$.map(((t,e)=>X.jsx(g,{points:t,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},e))),Q.map(((t,e)=>X.jsx(g,{points:t,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},e))),K.map(((t,e)=>X.jsx(g,{points:t,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},e))),U.map(((t,e)=>X.jsx(h,{x:t.x,y:t.y,text:t.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:F,padding:0,align:"center",verticalAlign:"bottom",listening:!1},e))),X.jsx(g,{points:et,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:E},fillLinearGradientEndPoint:{x:0,y:it},fillLinearGradientColorStops:q.leftBg}),X.jsx(g,{points:_,stroke:q.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.jsx(g,{points:rt,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:W,y:E},fillLinearGradientEndPoint:{x:W,y:nt},fillLinearGradientColorStops:q.rightBg}),X.jsx(g,{points:ot,stroke:q.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.jsx(g,{points:lt,stroke:q.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),X.jsxs(p,{ref:J,visible:!1,listening:!1,children:[X.jsx(g,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),X.jsx(g,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),X.jsx(b,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),X.jsxs(f,{x:0,y:0,id:"priceTextLabel",children:[X.jsx(M,{fill:q.tooltipBg,id:"priceTextLabel-tag"}),X.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),X.jsxs(f,{x:0,y:0,id:"slippageTextLabel",children:[X.jsx(M,{fill:q.tooltipBg,id:"slippageTextLabel-tag"}),X.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),X.jsxs(f,{x:0,y:0,id:"toolTip",children:[X.jsx(M,{fill:q.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),X.jsx(h,{text:"-",fontSize:12,lineHeight:17/12,padding:B,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const it=d.button`
21
21
  margin: 0;
22
22
  border: none;
23
23
  padding: 0;
@@ -75,4 +75,4 @@ import t from"bignumber.js";import{merge as e,throttle as i,debounce as o}from"l
75
75
  &:hover {
76
76
  color: #fff;
77
77
  }
78
- `;function dt({params:e,target:i,isBuy:o=!0}){const r=new t(e.b),n=new t(e.q);let l=new t(e.b0);const s=new t(e.q0),a=new t(e.i),d=new t(e.k),{R:u}=e;1===u&&l.eq(r)&&(l=q(r,n.minus(s),new t(1).div(a),d));const c=o?r.plus(i):r.minus(i);if(c.lt(l)||r.eq(l)){let e=l.multipliedBy(l).div(c).div(c);return e=new t(1).minus(d).plus(d.multipliedBy(e)),a.multipliedBy(e)}const p=new W;p.RStatus=u,p.B=r,p.B0=l,p.Q=n,p.Q0=s,p.i=a,p.k=d,p.mtFeeRate=new t(0),p.lpFeeRate=new t(0);let m=new t(0);m=o?p.querySellBase(i):p.queryBuyBase(i);const g=o?n.minus(m):n.plus(m);let h=s.multipliedBy(s).div(g).div(g);return h=new t(1).minus(d).plus(d.multipliedBy(h)),a.div(h)}const ut=({chartId:e,width:i=834,height:r=460,baseTokenSymbol:s,quoteTokenSymbol:d,pmmModel:u,pmmParams:c,midPrice:p=new t(0),colorMap:m,notShowAmountInput:g})=>{(({id:t})=>{n((()=>{function e(t){t.preventDefault()}let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",(()=>{}),t),window.removeEventListener("test",(()=>{}))}catch(t){i=!1}const o=document.getElementById(t),r=!!i&&{passive:!1};return null==o||o.addEventListener("wheel",e,r),()=>{null==o||o.removeEventListener("wheel",e)}}),[t])})({id:e});const[h,b]=a(""),[f,M]=a(""),[x,v]=a("-"),[y,z]=a("-"),[k,B]=a({baseMin:new t(0),zoomMultiples:C,targetMarginPriceX:0});n((()=>{void 0!==p&&B((t=>({baseMin:w({midPrice:p,zoomMultiples:t.zoomMultiples}),zoomMultiples:t.zoomMultiples,targetMarginPriceX:t.targetMarginPriceX})))}),[p]);const O=l((()=>o((({type:e,amount:o})=>{""===o&&p&&(B({baseMin:w({midPrice:p,zoomMultiples:C}),zoomMultiples:C,targetMarginPriceX:0}),"buy"===e?v("-"):z("-"));const r=new t(o);if(!r.lte(0)&&!r.isNaN()&&(null==c?void 0:c.b)&&!r.gte(c.b)&&p)if("buy"===e){const t=dt({params:c,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:t,midPrice:p,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:p,width:i,type:e,targetPrice:t}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),v(`${T({input:t.minus(p).div(p)})}`)}else{const t=function({params:t,target:e}){return dt({params:t,target:e,isBuy:!1})}({params:c,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:t,midPrice:p,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:p,width:i,type:e,targetPrice:t}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),z(`+${T({input:t.minus(p).div(p)})}`)}}),300)),[c,p,i]);n((()=>{void 0!==h&&O({type:"buy",amount:h})}),[O,h]),n((()=>{void 0!==f&&O({type:"sell",amount:f})}),[O,f]);const q=t=>{let e=0;e=t?-.1*i:.1*i,B((t=>void 0===t.baseMin?t:{baseMin:P({dragDistance:e,prevBaseMin:t.baseMin,chartWidth:i,zoomMultiples:t.zoomMultiples}),zoomMultiples:t.zoomMultiples,targetMarginPriceX:t.targetMarginPriceX}))},W=t=>{B((e=>{const i=j({zoomIn:null!=t&&t,prevZoomMultiples:e.zoomMultiples});return{baseMin:w({midPrice:p,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}}))},E=l((()=>{if(""===h)return!1;const e=new t(h);return!(!e.lte(0)&&!e.isNaN()&&(null==c?void 0:c.b)&&!e.gte(c.b))}),[h,c]),F=l((()=>{if(""===f)return!1;const e=new t(f);return!(!e.lte(0)&&!e.isNaN()&&(null==c?void 0:c.b)&&!e.gte(c.b))}),[f,c]);return X.jsxs(ot,{id:e,children:[g?"":X.jsxs(rt,{children:[X.jsxs(nt,{borderColor:m&&m.grid,children:[L("pool.chart.buy-amount",{symbol:s}),X.jsx(_,{value:h,error:E,onChange:t=>{const e=A(t.target.value,2);null!==e&&b(e)}}),X.jsx(lt,{children:L("pool.chart.price-impact",{amount:x})})]}),X.jsxs(nt,{borderColor:m&&m.grid,children:[L("pool.chart.sell-amount",{symbol:s}),X.jsx(_,{value:f,error:F,onChange:t=>{const e=A(t.target.value,2);null!==e&&M(e)}}),X.jsx(lt,{children:L("pool.chart.price-impact",{amount:y})})]})]}),void 0!==c&&void 0!==p&&void 0!==u&&void 0!==k.baseMin&&void 0!==p&&X.jsx(et,{width:i,height:r,params:c,midPrice:p,pmmModel:u,baseTokenSymbol:s,quoteTokenSymbol:d,baseMinAndZoomMultiples:k,colorMap:m,setBaseMinAndZoomMultiples:B}),X.jsxs(st,{className:"operate-btn-wrapper",children:[X.jsx(at,{onClick:()=>q(!0),children:X.jsx($,{})}),X.jsx(at,{onClick:()=>W(!1),children:X.jsx(K,{})}),X.jsx(at,{onClick:()=>W(!0),children:X.jsx(U,{})}),X.jsx(at,{onClick:()=>q(!1),children:X.jsx(Q,{})})]})]})};export{ut as default};
78
+ `;function dt({params:e,target:i,isBuy:o=!0}){const r=new t(e.b),n=new t(e.q);let l=new t(e.b0);const s=new t(e.q0),a=new t(e.i),d=new t(e.k),{R:c}=e;1===c&&l.eq(r)&&(l=q(r,n.minus(s),new t(1).div(a),d));const u=o?r.plus(i):r.minus(i);if(u.lt(l)||r.eq(l)){let e=l.multipliedBy(l).div(u).div(u);return e=new t(1).minus(d).plus(d.multipliedBy(e)),a.multipliedBy(e)}const p=new W;p.RStatus=c,p.B=r,p.B0=l,p.Q=n,p.Q0=s,p.i=a,p.k=d,p.mtFeeRate=new t(0),p.lpFeeRate=new t(0);let m=new t(0);m=o?p.querySellBase(i):p.queryBuyBase(i);const g=o?n.minus(m):n.plus(m);let h=s.multipliedBy(s).div(g).div(g);return h=new t(1).minus(d).plus(d.multipliedBy(h)),a.div(h)}const ct=({chartId:e,width:i=834,height:r=460,baseTokenSymbol:s,quoteTokenSymbol:d,pmmModel:c,pmmParams:u,midPrice:p=new t(0),colorMap:m,notShowAmountInput:g})=>{(({id:t})=>{n((()=>{function e(t){t.preventDefault()}let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",(()=>{}),t),window.removeEventListener("test",(()=>{}))}catch(t){i=!1}const o=document.getElementById(t),r=!!i&&{passive:!1};return null==o||o.addEventListener("wheel",e,r),()=>{null==o||o.removeEventListener("wheel",e)}}),[t])})({id:e});const[h,b]=a(""),[f,M]=a(""),[x,v]=a("-"),[y,z]=a("-"),[k,B]=a({baseMin:new t(0),zoomMultiples:C,targetMarginPriceX:0});n((()=>{void 0!==p&&B((t=>({baseMin:w({midPrice:p,zoomMultiples:t.zoomMultiples}),zoomMultiples:t.zoomMultiples,targetMarginPriceX:t.targetMarginPriceX})))}),[p]);const O=l((()=>o((({type:e,amount:o})=>{""===o&&p&&(B({baseMin:w({midPrice:p,zoomMultiples:C}),zoomMultiples:C,targetMarginPriceX:0}),"buy"===e?v("-"):z("-"));const r=new t(o);if(!r.lte(0)&&!r.isNaN()&&(null==u?void 0:u.b)&&!r.gte(u.b)&&p)if("buy"===e){const t=dt({params:u,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:t,midPrice:p,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:p,width:i,type:e,targetPrice:t}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),v(`${T({input:t.minus(p).div(p)})}`)}else{const t=function({params:t,target:e}){return dt({params:t,target:e,isBuy:!1})}({params:u,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:t,midPrice:p,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:p,width:i,type:e,targetPrice:t}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),z(`+${T({input:t.minus(p).div(p)})}`)}}),300)),[u,p,i]);n((()=>{void 0!==h&&O({type:"buy",amount:h})}),[O,h]),n((()=>{void 0!==f&&O({type:"sell",amount:f})}),[O,f]);const q=t=>{let e=0;e=t?-.1*i:.1*i,B((t=>void 0===t.baseMin?t:{baseMin:P({dragDistance:e,prevBaseMin:t.baseMin,chartWidth:i,zoomMultiples:t.zoomMultiples}),zoomMultiples:t.zoomMultiples,targetMarginPriceX:t.targetMarginPriceX}))},W=t=>{B((e=>{const i=j({zoomIn:null!=t&&t,prevZoomMultiples:e.zoomMultiples});return{baseMin:w({midPrice:p,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}}))},E=l((()=>{if(""===h)return!1;const e=new t(h);return!(!e.lte(0)&&!e.isNaN()&&(null==u?void 0:u.b)&&!e.gte(u.b))}),[h,u]),F=l((()=>{if(""===f)return!1;const e=new t(f);return!(!e.lte(0)&&!e.isNaN()&&(null==u?void 0:u.b)&&!e.gte(u.b))}),[f,u]);return X.jsxs(ot,{id:e,children:[g?"":X.jsxs(rt,{children:[X.jsxs(nt,{borderColor:m&&m.grid,children:[L("pool.chart.buy-amount",{symbol:s}),X.jsx(_,{value:h,error:E,onChange:t=>{const e=A(t.target.value,2);null!==e&&b(e)}}),X.jsx(lt,{children:L("pool.chart.price-impact",{amount:x})})]}),X.jsxs(nt,{borderColor:m&&m.grid,children:[L("pool.chart.sell-amount",{symbol:s}),X.jsx(_,{value:f,error:F,onChange:t=>{const e=A(t.target.value,2);null!==e&&M(e)}}),X.jsx(lt,{children:L("pool.chart.price-impact",{amount:y})})]})]}),void 0!==u&&void 0!==p&&void 0!==c&&void 0!==k.baseMin&&void 0!==p&&X.jsx(et,{width:i,height:r,params:u,midPrice:p,pmmModel:c,baseTokenSymbol:s,quoteTokenSymbol:d,baseMinAndZoomMultiples:k,colorMap:m,setBaseMinAndZoomMultiples:B}),X.jsxs(st,{className:"operate-btn-wrapper",children:[X.jsx(at,{onClick:()=>q(!0),children:X.jsx($,{})}),X.jsx(at,{onClick:()=>W(!1),children:X.jsx(K,{})}),X.jsx(at,{onClick:()=>W(!0),children:X.jsx(U,{})}),X.jsx(at,{onClick:()=>q(!1),children:X.jsx(Q,{})})]})]})};export{ct as default};