@dodoex/widgets 3.0.2-zetachain.11 → 3.0.2-zetachain.13
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-DCJJEnV3.cjs → helper-C8kpd-XZ.cjs} +1 -1
- package/dist/{helper-Bh6_7gAw.js → helper-CFkq89e3.js} +1 -1
- package/dist/index-0y2KfYCc.cjs +12 -0
- package/dist/index-CKOyGvxj.cjs +31 -0
- package/dist/{index-CzpL7rfy.js → index-COM8blAY.js} +4 -4
- package/dist/index-CtEwdTyC.js +31 -0
- package/dist/{index-DVLnDJLQ.cjs → index-DIfLo1db.cjs} +4 -4
- package/dist/index-DKrRx7nR.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/hooks/ConnectWallet/useWalletInfo.d.ts +3 -1
- package/package.json +8 -18
- package/dist/index-Bg8rd10E.js +0 -12
- package/dist/index-CEN1BcL7.cjs +0 -263
- package/dist/index-CGy_7PS2.cjs +0 -12
- package/dist/index-DjAOs16s.js +0 -263
package/dist/index-CGy_7PS2.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("@emotion/styled"),t=require("lodash"),i=require("react"),r=require("./helper-DCJJEnV3.cjs"),n=require("react-konva"),o=require("./index-CEN1BcL7.cjs"),s=require("bignumber.js"),l=require("@dodoex/api");require("@lingui/core"),require("@lingui/react"),require("@dodoex/components"),require("@web3-react/core"),require("axios"),require("@ethersproject/bignumber"),require("zustand"),require("@dodoex/dodo-contract-request"),require("@tanstack/react-query"),require("@reown/appkit-utils"),require("@reown/appkit-common"),require("os"),require("events"),require("fs"),require("util"),require("path"),require("worker_threads"),require("module"),require("url"),require("buffer"),require("assert"),require("stream"),require("http"),require("punycode"),require("https"),require("zlib"),require("@web3-react/eip1193"),require("@web3-react/walletconnect-v2"),require("@web3-react/metamask"),require("@web3-react/types"),require("@ethersproject/contracts"),require("identicon.js"),require("react-dom"),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
|
-
height: 100%;
|
|
3
|
-
position: relative;
|
|
4
|
-
`,u=e.div`
|
|
5
|
-
text-align: center;
|
|
6
|
-
margin-top: 17.1px;
|
|
7
|
-
margin-bottom: 88.41px;
|
|
8
|
-
color: #606066;
|
|
9
|
-
font-size: 12px;
|
|
10
|
-
line-height: 17px;
|
|
11
|
-
font-weight: 400;
|
|
12
|
-
`,d=36;function m({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 g({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:b,maxRightHeight:j,leftStatAreaPoints:w,rightStatAreaPoints:q,minXLN10:A,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)}),m=new l.PMMHelper,g=new s(d.B),p=[],c=[];let h=new s(0),x=new s(0);const f=m.GetMidPrice(d),L=i.gt(0)?t.div(i):new s(1);for(let e=0;e<=250;e++){let t=g.multipliedBy(e/100).multipliedBy(f.multipliedBy(L).multipliedBy(4));0===e&&(t=g.multipliedBy(1e-11));const i=null==m?void 0:m.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=g.multipliedBy(e/100).multipliedBy(f.multipliedBy(4));0===e&&(t=g.multipliedBy(1e-11));const i=null==m?void 0:m.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 b=[];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&&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<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&&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=p.length>0?p[p.length-1]:c[0],q=c.length>0?c[0]:p[0],A=c.length>0?c[c.length-1]:p[0],y=w.price,N=A.price,P=q.price,v=new s(Math.log10(P.toNumber()));let R=y.gt(0)?new s(Math.log10(y.toNumber())):new s(-Math.log10(N.toNumber())),S=N.gt(0)?new s(Math.log10(N.toNumber())):new s(-Math.log10(y.toNumber()));const H=s.max(v.minus(R).abs(),S.minus(v).abs());return R=v.minus(H),S=v.plus(H),{leftStatAreaPoints:b,rightStatAreaPoints:j,maxLeftHeight:h.multipliedBy(1.2),maxRightHeight:x.multipliedBy(1.2),minXLN10:R,maxXLN10:S,middlePriceLN10:v}}),[e])}({params:u}),N=a-30.13,P=i.useRef(null),v=t.merge({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,x,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,x,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0,textColor:"#606066"},L),R=t=>{var i;const{current:n}=P,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:A,maxXLN10:y});let a=null,u=[];const x=i<s;if(x){const e=g({areaPoints:w,targetPrice:l,isLeft:x});a=e.targetAreaStatPoint,u=e.targetAreaStatPoints}else{const e=g({areaPoints:q,targetPrice:l,isLeft:x});a=e.targetAreaStatPoint,u=e.targetAreaStatPoints}if(a){const t=h({target:a.middlePrice}),s=c({minXLN10:A,maxXLN10:y,width:e,targetLN10:t}),l=m({maxHeight:x?b:j,gridAreaHeight:N,value:a.rectangleHeight}),g=n.findOne("#tooltip"),p=n.findOne("#toolTipVertLine"),L=n.findOne("#joinCircle"),w=n.findOne("#tooltip-Text"),q=n.findOne("#tooltip-tag"),P=n.findOne("#priceTextLabel"),R=null==P?void 0:P.findOne("#priceTextLabel-text"),S=n.findOne("#area");null==g||g.position({x:s,y:l-5-6}),null==w||w.fill(v.tooltipColor||(x?"#00FAD9":"#FF5072")),null==w||w.text(x?r.chartT("pool.chart.liquidity-chart-buy",{amount:o.formatShortNumber(a.area),symbol:d,price:o.formatShortNumber(a.price)}):r.chartT("pool.chart.liquidity-chart-sell",{amount:o.formatShortNumber(a.area),symbol:f,price:o.formatShortNumber(a.price)})),g&&q&&(g.width()/2>i?(q.pointerDirection("left"),q.pointerHeight(15),q.pointerWidth(8),g.offsetX(-11),g.offsetY(-11)):g.width()/2+i>e?(q.pointerDirection("right"),q.pointerHeight(15),q.pointerWidth(8),g.offsetX(11),g.offsetY(-11)):(q.pointerDirection("down"),q.pointerHeight(8),q.pointerWidth(15),g.offsetX(0),g.offsetY(0))),null==p||p.points([s,N,s,l]),null==p||p.stroke(x?"#55f6db":"#ff4f73");let H=x?"rgb(86, 246, 218)":"#FF5072",E=x?"rgba(86, 246, 218, 0.3)":"rgba(255, 80, 114, 0.3)";v.leftLine&&v.rightLine&&(H=x?v.leftLine:v.rightLine,E=x?`rgba(${r.colorRgb(v.leftLine)}, 0.4)`:`rgba(${r.colorRgb(v.rightLine)}, 0.4)`),L&&(L.x(s),L.y(l),L.fill(H),L.stroke(E)),P&&(P.x(s),P.y(N+8.08+1),P.offsetX(P.width()/2),P.x()-P.width()/2<0?P.x(P.width()/2):P.x()+P.width()/2>e?P.x(e-P.width()/2):P.x(i)),R&&(R.fill(v.tooltipColor||(x?"#00FAD9":"#FF5072")),R.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:A,maxXLN10:y,width:e,targetLN10:n}),s=m({maxHeight:x?b:j,gridAreaHeight:N,value:r});k.push(o,s+1)}const X=k.slice(),[M,B]=X;x?(X.push(s,l),X.push(s,N),X.push(M,N),X.push(M,B)):(X.unshift(M,N),X.unshift(s,N),X.unshift(s,l)),S&&(S.points(X),S.fill(x?v.leftLine||"#2c5b56":v.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:N,gridAreaWidth:e,horizontalLineCount:9,verticalLineCount:7,color:v.grid}),H=function({minXLN10:e,maxXLN10:t,labelCount:r,gridAreaHeight:s,gridAreaWidth:l,color:a="#606066"}){return i.useMemo((()=>{const i=l/(r+1),u=[],d=[];for(let n=0;n<r;n++){const r=i/2+i*n;u.push({x:r,y:s+10.08+1,text:o.formatShortNumber(p({x:i*(n+1),width:l,minXLN10:e,maxXLN10:t}))});const a=i*(n+1);d.push([a,s+1,a,s+4+1])}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[u.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Text,{x:e.x,y:e.y,text:e.text,fontSize:14,fontFamily:"Manrope",fill:a,width:i,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t))),d.map(((e,t)=>o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:a,strokeWidth:1,lineCap:"butt",lineJoin:"miter",tension:1,listening:!1},t)))]})}),[e,t,s,l,r])}({gridAreaHeight:N,gridAreaWidth:e,labelCount:7,minXLN10:A,maxXLN10:y,color:v.textColor}),E=function({gridAreaHeight:e,gridAreaWidth:t,color:r="#606066"}){return i.useMemo((()=>{const i=t/2;return o.jsxRuntimeExports.jsx(n.Line,{points:[i,0,i,e-1],stroke:r,strokeWidth:1,lineCap:"round",lineJoin:"round",tension:1,listening:!1})}),[e,t,r])}({gridAreaHeight:N,gridAreaWidth:e,color:v.midPriceLine}),{leftLine:k,rightLine:X}=function({leftStatAreaPoints:e,rightStatAreaPoints:t,minXLN10:r,maxXLN10:s,maxLeftHeight:l,maxRightHeight:a,gridAreaWidth:u,gridAreaHeight:d,colorMap:g}){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}),g=c({minXLN10:r,maxXLN10:s,width:u,targetLN10:a}),p=m({maxHeight:l,gridAreaHeight:d,value:o});t.push(g,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:g.leftBg}),o.jsxRuntimeExports.jsx(n.Line,{points:t,stroke:g.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}),g=c({minXLN10:r,maxXLN10:s,width:u,targetLN10:l}),p=m({maxHeight:a,gridAreaHeight:d,value:o});e.push(g,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:g.rightBg}),o.jsxRuntimeExports.jsx(n.Line,{points:e,stroke:g.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]})}),[t,u,r,s,d,a])}}({leftStatAreaPoints:w,rightStatAreaPoints:q,minXLN10:A,maxXLN10:y,maxLeftHeight:b,maxRightHeight:j,gridAreaWidth:e,gridAreaHeight:N,colorMap:v});return o.jsxRuntimeExports.jsxs(n.Stage,{width:e,height:a,onMouseMove:R,onMouseOver:R,onMouseEnter:R,onMouseOut:()=>{const{current:e}=P;e&&e.hide()},children:[o.jsxRuntimeExports.jsxs(n.Layer,{children:[o.jsxRuntimeExports.jsx(n.Rect,{x:0,y:0,width:e,height:N,stroke:v.grid,strokeWidth:1}),S,H,k,X,E]}),o.jsxRuntimeExports.jsxs(n.Layer,{ref:P,visible:!1,children:[o.jsxRuntimeExports.jsx(n.Line,{points:[],closed:!0,listening:!1,lineCap:"round",lineJoin:"round",id:"area"}),o.jsxRuntimeExports.jsx(n.Line,{points:[],strokeWidth:1,stroke:"#ff4f73",lineJoin:"round",lineCap:"round",dash:[4,6],id:"toolTipVertLine"}),o.jsxRuntimeExports.jsx(n.Circle,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),o.jsxRuntimeExports.jsxs(n.Label,{listening:!1,x:0,y:0,id:"priceTextLabel",children:[o.jsxRuntimeExports.jsx(n.Tag,{fill:v.tooltipBg,id:"priceTextLabel-tag"}),o.jsxRuntimeExports.jsx(n.Text,{text:"-",fontSize:14,fontFamily:"Manrope",padding:2,fill:"#FF5072",id:"priceTextLabel-text"})]}),o.jsxRuntimeExports.jsxs(n.Label,{listening:!1,id:"tooltip",children:[o.jsxRuntimeExports.jsx(n.Tag,{fill:v.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"tooltip-tag"}),o.jsxRuntimeExports.jsx(n.Text,{text:"",fontFamily:"Manrope",fontSize:12,lineHeight:17/12,padding:r.labelPadding,fill:"#FF5072",id:"tooltip-Text"})]})]})]})}exports.default=({width:e=834,height:t=462,baseTokenSymbol:i,quoteTokenSymbol:n,pmmModel:s,pmmParams:l,midPrice:d,notShowTipText:m,colorMap:g})=>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:g}),m?"":o.jsxRuntimeExports.jsxs(u,{children:["* ",r.chartT("pool.chart.liquidity-chart-tip",{baseTokenSymbol:i})]})]});
|