@dodoex/widgets 3.0.2-zetachain.24 → 3.0.2-zetachain.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{helper-BJWViNGA.cjs → helper-h-U1v1Cd.cjs} +1 -1
- package/dist/{helper-CqVYcunS.js → helper-nBm2Iobe.js} +1 -1
- package/dist/{index-B2e5jMRC.cjs → index-BRbjxFQm.cjs} +3 -3
- package/dist/{index-Cfn7WKzq.js → index-CK9l9sYe.js} +6 -6
- package/dist/{index-h3O0jv8i.cjs → index-C__sVv0Y.cjs} +6 -6
- package/dist/{index-Bf7osrkq.js → index-DPbaPgJn.js} +2 -2
- package/dist/{index-P0I7mT2T.cjs → index-DhANJSRi.cjs} +2 -2
- package/dist/{index-CNogQ3nw.js → index-Qlewc1eS.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/utils/btc.d.ts +13 -0
- package/package.json +4 -3
|
@@ -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-nBm2Iobe.js";import{Line as a,Text as s,Stage as d,Layer as m,Rect as g,Circle as p,Label as u,Tag as c}from"react-konva";import{j as h,f}from"./index-CK9l9sYe.js";import x from"bignumber.js";import{solveQuadraticFunctionForTarget as L,PMMState as w,PMMHelper as b}from"@dodoex/api";import"@lingui/core";import"react-dom";import"@lingui/react";import"@dodoex/components";import"@reown/appkit-utils";import"@solana/web3.js";import"@reown/appkit/networks";import"@ethersproject/bignumber";import"@tanstack/react-query";import"zustand";import"@web3-react/core";import"@dodoex/dodo-contract-request";import"@reown/appkit/react";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"axios";import"@ethersproject/contracts";import"identicon.js";import"bitcoinjs-lib";import"@bitcoinerlab/secp256k1";import"dayjs";import"react-transition-group";import"@dodoex/contract-request";import"recharts";import"react-window";import"jsbi";import"tiny-invariant";import"@ethersproject/units";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";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 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: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 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 b,g=new x(s.B),m=[],p=[];let u=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))p.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=e.dividedBy(i);p.push({giveAmount:e,getAmount:i,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 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&&A.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),A.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),u=x.max(a,u)}}const y=[];for(let t=1;t<p.length;t++){const e=p[t],{giveAmount:i,getAmount:n,price:r}=e,o=p[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]: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=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"),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>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==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(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}),p=P({maxHeight:o,gridAreaHeight:d,value:a});e.push(m,p),p<i&&(i=p)}const l=e.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: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}),p=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(m,p),p<i&&(i=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: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: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:e=462,baseTokenSymbol:i,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: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};
|
|
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: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 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 b,m=new x(s.B),g=[],p=[];let u=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=m.multipliedBy(t/100).multipliedBy(h.multipliedBy(f).multipliedBy(4));0===t&&(e=m.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellBase(e,s);if(i.isNaN()||!i.gt(0))g.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=i.div(e);g.push({giveAmount:e,getAmount:i,price:t})}}for(let t=0;t<=250;t++){let e=m.multipliedBy(t/100).multipliedBy(h.multipliedBy(4));0===t&&(e=m.multipliedBy(1e-11));const i=null==d?void 0:d.QuerySellQuote(e,s);if(i.isNaN()||!i.gt(0))p.push({giveAmount:e,getAmount:new x(0),price:new x(0)});else{const t=e.dividedBy(i);p.push({giveAmount:e,getAmount:i,price:t})}}if(g.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<g.length;t++){const e=g[t],{giveAmount:i,getAmount:n,price:r}=e,o=g[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&&A.push({area:n,price:r,middlePrice:r.plus(e.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),A.push({area:n,price:r,middlePrice:r.plus(e.div(2)),rectangleHeight:a}),u=x.max(a,u)}}const y=[];for(let t=1;t<p.length;t++){const e=p[t],{giveAmount:i,getAmount:n,price:r}=e,o=p[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=g.length>0?g[g.length-1]:p[0],P=p.length>0?p[0]:g[0],v=p.length>0?p[p.length-1]:g[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=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 m=i<r;if(m){const t=v({areaPoints:M,targetPrice:a,isLeft:m});s=t.targetAreaStatPoint,d=t.targetAreaStatPoints}else{const t=v({areaPoints:W,targetPrice:a,isLeft:m});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:m?C:F,gridAreaHeight:J,value:s.rectangleHeight}),g=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==g||g.position({x:r,y:a-5-6}),null==c||c.fill(R.tooltipColor||(m?"#00FAD9":"#FF5072")),null==c||c.text(m?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)})),g&&h&&(g.width()/2>i?(h.pointerDirection("left"),h.pointerHeight(15),h.pointerWidth(8),g.offsetX(-11),g.offsetY(-11)):g.width()/2+i>t?(h.pointerDirection("right"),h.pointerHeight(15),h.pointerWidth(8),g.offsetX(11),g.offsetY(-11)):(h.pointerDirection("down"),h.pointerHeight(8),h.pointerWidth(15),g.offsetX(0),g.offsetY(0))),null==p||p.points([r,J,r,a]),null==p||p.stroke(m?"#55f6db":"#ff4f73");let b=m?"rgb(86, 246, 218)":"#FF5072",A=m?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";R.leftLine&&R.rightLine&&(b=m?R.leftLine:R.rightLine,A=m?`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(i)),L&&(L.fill(R.tooltipColor||(m?"#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:m?C:F,gridAreaHeight:J,value:n});y.push(o,l+1)}const v=y.slice(),[j,k]=v;m?(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(m?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=[],m=[];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);m.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))),m.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:m}){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,m=S({target:t}),g=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:m}),p=P({maxHeight:o,gridAreaHeight:d,value:a});e.push(g,p),p<i&&(i=p)}const l=e.slice(),[g,p]=l,u=l[l.length-1],c=l[l.length-2];return l.push(c,u),l.push(c,d),l.push(g,d),l.push(g,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:i},fillLinearGradientColorStops:m.leftBg}),h.jsx(a,{points:e,stroke:m.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,m=S({target:e}),g=H({minXLN10:n,maxXLN10:r,width:s,targetLN10:m}),p=P({maxHeight:l,gridAreaHeight:d,value:a});t.push(g,p),p<i&&(i=p)}const o=t.slice(),[g]=o;return o.unshift(g,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:m.rightBg}),h.jsx(a,{points:t,stroke:m.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:A,onMouseMove:D,onMouseOver:D,onMouseEnter:D,onMouseOut:()=>{const{current:t}=O;t&&t.hide()},children:[h.jsxs(m,{children:[h.jsx(g,{x:0,y:0,width:t,height:J,stroke:R.grid,strokeWidth:1}),z,G,E,Y,Q]}),h.jsxs(m,{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:e=462,baseTokenSymbol:i,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: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
|
-
"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-h-U1v1Cd.cjs"),n=require("react-konva"),o=require("./index-C__sVv0Y.cjs"),s=require("bignumber.js"),l=require("@dodoex/api");require("@lingui/core"),require("react-dom"),require("@lingui/react"),require("@dodoex/components"),require("@reown/appkit-utils"),require("@solana/web3.js"),require("@reown/appkit/networks"),require("@ethersproject/bignumber"),require("@tanstack/react-query"),require("zustand"),require("@web3-react/core"),require("@dodoex/dodo-contract-request"),require("@reown/appkit/react"),require("@web3-react/eip1193"),require("@web3-react/walletconnect-v2"),require("@web3-react/metamask"),require("@web3-react/types"),require("axios"),require("@ethersproject/contracts"),require("identicon.js"),require("bitcoinjs-lib"),require("@bitcoinerlab/secp256k1"),require("dayjs"),require("react-transition-group"),require("@dodoex/contract-request"),require("recharts"),require("react-window"),require("jsbi"),require("tiny-invariant"),require("@ethersproject/units"),require("@uniswap/sdk-core"),require("@uniswap/v2-sdk"),require("react-infinite-scroller"),require("d3"),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,q=A.price,R=new s(Math.log10(q.toNumber()));let v=y.gt(0)?new s(Math.log10(y.toNumber())):new s(-Math.log10(P.toNumber())),S=P.gt(0)?new s(Math.log10(P.toNumber())):new s(-Math.log10(y.toNumber()));const H=s.max(R.minus(v).abs(),S.minus(R).abs());return v=R.minus(H),S=R.plus(H),{leftStatAreaPoints:j,rightStatAreaPoints:b,maxLeftHeight:h.multipliedBy(1.2),maxRightHeight:x.multipliedBy(1.2),minXLN10:v,maxXLN10:S,middlePriceLN10:R}}),[e])}({params:u}),P=a-30.13,q=i.useRef(null),R=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),v=t=>{var i;const{current:n}=q,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"),q=n.findOne("#priceTextLabel"),v=null==q?void 0:q.findOne("#priceTextLabel-text"),S=n.findOne("#area");null==m||m.position({x:s,y:l-5-6}),null==w||w.fill(R.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)";R.leftLine&&R.rightLine&&(H=x?R.leftLine:R.rightLine,E=x?`rgba(${r.colorRgb(R.leftLine)}, 0.4)`:`rgba(${r.colorRgb(R.rightLine)}, 0.4)`),L&&(L.x(s),L.y(l),L.fill(H),L.stroke(E)),q&&(q.x(s),q.y(P+8.08+1),q.offsetX(q.width()/2),q.x()-q.width()/2<0?q.x(q.width()/2):q.x()+q.width()/2>e?q.x(e-q.width()/2):q.x(i)),v&&(v.fill(R.tooltipColor||(x?"#00FAD9":"#FF5072")),v.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)),S&&(S.points(X),S.fill(x?R.leftLine||"#2c5b56":R.rightLine||"#7b3a48")),n.show()}}}},S=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:R.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:R.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:R.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:R});return o.jsxRuntimeExports.jsxs(n.Stage,{width:e,height:a,onMouseMove:v,onMouseOver:v,onMouseEnter:v,onMouseOut:()=>{const{current:e}=q;e&&e.hide()},children:[o.jsxRuntimeExports.jsxs(n.Layer,{children:[o.jsxRuntimeExports.jsx(n.Rect,{x:0,y:0,width:e,height:P,stroke:R.grid,strokeWidth:1}),S,H,k,X,E]}),o.jsxRuntimeExports.jsxs(n.Layer,{ref:q,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:R.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:R.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:b,maxRightHeight:j,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 b=[];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&&b.push({area:r,price:n,middlePrice:n.plus(t.div(1.1)),rectangleHeight:a.plus(a.multipliedBy(.03))}),b.push({area:r,price:n,middlePrice:n.plus(t.div(2)),rectangleHeight:a}),h=s.max(a,h)}}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],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&&j.push({area:r,price:n,middlePrice:n.minus(t.div(1.1)),rectangleHeight:d.plus(d.multipliedBy(.03))}),j.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,q=A.price,R=new s(Math.log10(q.toNumber()));let v=y.gt(0)?new s(Math.log10(y.toNumber())):new s(-Math.log10(P.toNumber())),S=P.gt(0)?new s(Math.log10(P.toNumber())):new s(-Math.log10(y.toNumber()));const H=s.max(R.minus(v).abs(),S.minus(R).abs());return v=R.minus(H),S=R.plus(H),{leftStatAreaPoints:b,rightStatAreaPoints:j,maxLeftHeight:h.multipliedBy(1.2),maxRightHeight:x.multipliedBy(1.2),minXLN10:v,maxXLN10:S,middlePriceLN10:R}}),[e])}({params:u}),P=a-30.13,q=i.useRef(null),R=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),v=t=>{var i;const{current:n}=q,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?b:j,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"),q=n.findOne("#priceTextLabel"),v=null==q?void 0:q.findOne("#priceTextLabel-text"),S=n.findOne("#area");null==m||m.position({x:s,y:l-5-6}),null==w||w.fill(R.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)";R.leftLine&&R.rightLine&&(H=x?R.leftLine:R.rightLine,E=x?`rgba(${r.colorRgb(R.leftLine)}, 0.4)`:`rgba(${r.colorRgb(R.rightLine)}, 0.4)`),L&&(L.x(s),L.y(l),L.fill(H),L.stroke(E)),q&&(q.x(s),q.y(P+8.08+1),q.offsetX(q.width()/2),q.x()-q.width()/2<0?q.x(q.width()/2):q.x()+q.width()/2>e?q.x(e-q.width()/2):q.x(i)),v&&(v.fill(R.tooltipColor||(x?"#00FAD9":"#FF5072")),v.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?b:j,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)),S&&(S.points(X),S.fill(x?R.leftLine||"#2c5b56":R.rightLine||"#7b3a48")),n.show()}}}},S=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:R.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:R.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:R.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:b,maxRightHeight:j,gridAreaWidth:e,gridAreaHeight:P,colorMap:R});return o.jsxRuntimeExports.jsxs(n.Stage,{width:e,height:a,onMouseMove:v,onMouseOver:v,onMouseEnter:v,onMouseOut:()=>{const{current:e}=q;e&&e.hide()},children:[o.jsxRuntimeExports.jsxs(n.Layer,{children:[o.jsxRuntimeExports.jsx(n.Rect,{x:0,y:0,width:e,height:P,stroke:R.grid,strokeWidth:1}),S,H,k,X,E]}),o.jsxRuntimeExports.jsxs(n.Layer,{ref:q,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:R.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:R.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"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 w,f as j,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 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 w,f as j,u as z,g as L,h as k,l as B,i as C,j as S,k as N}from"./helper-nBm2Iobe.js";import{f as O,j as X,a as T,b as A}from"./index-CK9l9sYe.js";import{solveQuadraticFunctionForTarget as q,PMMModel as W}from"@dodoex/api";import"@lingui/core";import"react-dom";import"@lingui/react";import"@dodoex/components";import"@reown/appkit-utils";import"@solana/web3.js";import"@reown/appkit/networks";import"@ethersproject/bignumber";import"@tanstack/react-query";import"zustand";import"@web3-react/core";import"@dodoex/dodo-contract-request";import"@reown/appkit/react";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"axios";import"@ethersproject/contracts";import"identicon.js";import"bitcoinjs-lib";import"@bitcoinerlab/secp256k1";import"dayjs";import"react-transition-group";import"@dodoex/contract-request";import"recharts";import"react-window";import"jsbi";import"tiny-invariant";import"@ethersproject/units";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";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(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;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-C__sVv0Y.cjs");require("react-dom"),require("@lingui/react"),require("@lingui/core"),require("@dodoex/api"),require("@dodoex/components"),require("react"),require("@reown/appkit-utils"),require("bignumber.js"),require("lodash"),require("@solana/web3.js"),require("@reown/appkit/networks"),require("@ethersproject/bignumber"),require("@tanstack/react-query"),require("zustand"),require("@web3-react/core"),require("@dodoex/dodo-contract-request"),require("@reown/appkit/react"),require("@web3-react/eip1193"),require("@web3-react/walletconnect-v2"),require("@web3-react/metamask"),require("@web3-react/types"),require("axios"),require("@ethersproject/contracts"),require("identicon.js"),require("bitcoinjs-lib"),require("@bitcoinerlab/secp256k1"),require("dayjs"),require("react-transition-group"),require("@dodoex/contract-request"),require("recharts"),require("react-window"),require("jsbi"),require("tiny-invariant"),require("@ethersproject/units"),require("@uniswap/sdk-core"),require("@uniswap/v2-sdk"),require("react-infinite-scroller"),require("d3"),require("rmc-date-picker"),exports.AMMV2Create=e.AMMV2Create,exports.AMMV3PositionManage=e.AMMV3PositionManage,exports.AMMV3PositionsView=e.AMMV3PositionsView,exports.AddLiquidityV3=e.AddLiquidityV3,exports.EmptyList=e.EmptyList,exports.FailedList=e.FailedList,exports.InitSwapWidget=e.InitSwapWidget,exports.Message=e.Message,Object.defineProperty(exports,"MetadataFlag",{enumerable:!0,get:function(){return e.MetadataFlag}}),exports.MiningCreate=e.MiningCreate,exports.MiningDetail=e.MiningDetail,exports.MiningList=e.MiningList,Object.defineProperty(exports,"PageType",{enumerable:!0,get:function(){return e.PageType}}),exports.Pool=e.Pool,exports.PoolCreate=e.PoolCreate,exports.PoolDetail=e.PoolDetail,exports.PoolList=e.PoolList,exports.PoolModify=e.PoolModify,exports.PoolOperate=e.PoolOperate,exports.PoolOperateDialog=e.PoolOperateDialog,exports.PoolWidget=e.PoolWidget,exports.Swap=e.Swap,exports.SwapOrderHistory=e.SwapOrderHistory,exports.SwapWidget=e.SwapWidget,exports.TokenCard=e.TokenCard,exports.TokenLogo=e.TokenLogo,exports.UnstyleWidget=e.UnstyleWidget,exports.WIDGET_CLASS_NAME=e.WIDGET_CLASS_NAME,exports.WIDGET_MODULE_CLASS_NAME=e.WIDGET_MODULE_CLASS_NAME,exports.Widget=e.Widget,exports.chainListMap=e.chainListMap,exports.defaultTokenList=e.tokenList,exports.formatPercentageNumber=e.formatPercentageNumber,exports.formatReadableNumber=e.formatReadableNumber,exports.formatShortNumber=e.formatShortNumber,exports.formatTokenAmountNumber=e.formatTokenAmountNumber,exports.getEtherscanPage=e.getEtherscanPage,exports.rpcServerMap=e.rpcServerMap,exports.scanUrlDomainMap=e.scanUrlDomainMap,exports.useMessageState=e.useMessageState,exports.usePoolBalanceInfo=e.usePoolBalanceInfo,exports.useRouterStore=e.useRouterStore,exports.useTradeSwapOrderList=e.useTradeSwapOrderList;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as AMMV2Create,B as AMMV3PositionManage,C as AMMV3PositionsView,z as AddLiquidityV3,E as EmptyList,F as FailedList,I as InitSwapWidget,M as Message,k as MetadataFlag,v as MiningCreate,w as MiningDetail,x as MiningList,m as PageType,y as Pool,G as PoolCreate,H as PoolDetail,J as PoolList,K as PoolModify,L as PoolOperate,N as PoolOperateDialog,P as PoolWidget,c as Swap,d as SwapOrderHistory,S as SwapWidget,T as TokenCard,e as TokenLogo,U as UnstyleWidget,g as WIDGET_CLASS_NAME,h as WIDGET_MODULE_CLASS_NAME,W as Widget,i as chainListMap,t as defaultTokenList,a as formatPercentageNumber,p as formatReadableNumber,f as formatShortNumber,q as formatTokenAmountNumber,o as getEtherscanPage,r as rpcServerMap,s as scanUrlDomainMap,l as useMessageState,D as usePoolBalanceInfo,n as useRouterStore,u as useTradeSwapOrderList}from"./index-
|
|
1
|
+
export{A as AMMV2Create,B as AMMV3PositionManage,C as AMMV3PositionsView,z as AddLiquidityV3,E as EmptyList,F as FailedList,I as InitSwapWidget,M as Message,k as MetadataFlag,v as MiningCreate,w as MiningDetail,x as MiningList,m as PageType,y as Pool,G as PoolCreate,H as PoolDetail,J as PoolList,K as PoolModify,L as PoolOperate,N as PoolOperateDialog,P as PoolWidget,c as Swap,d as SwapOrderHistory,S as SwapWidget,T as TokenCard,e as TokenLogo,U as UnstyleWidget,g as WIDGET_CLASS_NAME,h as WIDGET_MODULE_CLASS_NAME,W as Widget,i as chainListMap,t as defaultTokenList,a as formatPercentageNumber,p as formatReadableNumber,f as formatShortNumber,q as formatTokenAmountNumber,o as getEtherscanPage,r as rpcServerMap,s as scanUrlDomainMap,l as useMessageState,D as usePoolBalanceInfo,n as useRouterStore,u as useTradeSwapOrderList}from"./index-CK9l9sYe.js";import"react-dom";import"@lingui/react";import"@lingui/core";import"@dodoex/api";import"@dodoex/components";import"react";import"@reown/appkit-utils";import"bignumber.js";import"lodash";import"@solana/web3.js";import"@reown/appkit/networks";import"@ethersproject/bignumber";import"@tanstack/react-query";import"zustand";import"@web3-react/core";import"@dodoex/dodo-contract-request";import"@reown/appkit/react";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"axios";import"@ethersproject/contracts";import"identicon.js";import"bitcoinjs-lib";import"@bitcoinerlab/secp256k1";import"dayjs";import"react-transition-group";import"@dodoex/contract-request";import"recharts";import"react-window";import"jsbi";import"tiny-invariant";import"@ethersproject/units";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin';
|
|
2
|
+
export declare function getMempoolUTXO(address: string): Promise<any>;
|
|
3
|
+
export declare function getMempoolTxDetail(txHash: string): Promise<any>;
|
|
4
|
+
export declare function getSignetMempoolUTXO(address: string): Promise<any>;
|
|
5
|
+
export declare function getSignetMempoolTxDetail(txHash: string): Promise<any>;
|
|
6
|
+
export declare function transferSignet({ fromAddress, toAddress, amount, calldata, publicKey, btcWallet, }: {
|
|
7
|
+
fromAddress: string;
|
|
8
|
+
toAddress: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
calldata: string;
|
|
11
|
+
publicKey: string;
|
|
12
|
+
btcWallet: BitcoinConnector;
|
|
13
|
+
}): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodoex/widgets",
|
|
3
|
-
"version": "3.0.2-zetachain.
|
|
3
|
+
"version": "3.0.2-zetachain.25",
|
|
4
4
|
"description": "DODO Widgets",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/runtime": "^7.17.0",
|
|
61
|
+
"@bitcoinerlab/secp256k1": "1.2.0",
|
|
61
62
|
"@dodoex/api": "3.0.3-zetachain.9",
|
|
62
63
|
"@dodoex/components": "3.0.3-zetachain.5",
|
|
63
64
|
"@dodoex/contract-request": "^1.3.0",
|
|
@@ -104,10 +105,10 @@
|
|
|
104
105
|
"peerDependencies": {
|
|
105
106
|
"@babel/runtime": ">=7.17.0",
|
|
106
107
|
"@reown/appkit": "^1.7.5",
|
|
107
|
-
"@reown/appkit-utils": "^1.7.5",
|
|
108
108
|
"@reown/appkit-adapter-solana": "^1.7.5",
|
|
109
|
-
"@
|
|
109
|
+
"@reown/appkit-utils": "^1.7.5",
|
|
110
110
|
"@solana/spl-token": "^0.4.13",
|
|
111
|
+
"@solana/web3.js": "1.98.2",
|
|
111
112
|
"bitcoinjs-lib": "6.1.7",
|
|
112
113
|
"react": "^18.0.0",
|
|
113
114
|
"react-dom": "^18.0.0"
|