@dodoex/widgets 3.0.2-zetachain.24 → 3.0.2-zetachain.26
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-BjElSybD.cjs} +1 -1
- package/dist/{helper-CqVYcunS.js → helper-D2gRfZE2.js} +1 -1
- package/dist/index-CW7dbGMb.cjs +40 -0
- package/dist/{index-B2e5jMRC.cjs → index-CbVGPuuN.cjs} +3 -3
- package/dist/{index-P0I7mT2T.cjs → index-Ct-aEpbu.cjs} +2 -2
- package/dist/{index-CNogQ3nw.js → index-D-KAe_lf.js} +1 -1
- package/dist/index-DeShJXSX.js +40 -0
- package/dist/{index-Bf7osrkq.js → index-YzpFVkAf.js} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/utils/btc.d.ts +13 -0
- package/dist/types/utils/solana.d.ts +4 -1
- package/package.json +4 -3
- package/dist/index-Cfn7WKzq.js +0 -40
- package/dist/index-h3O0jv8i.cjs +0 -40
|
@@ -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-D2gRfZE2.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-DeShJXSX.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};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-CW7dbGMb.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-DeShJXSX.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>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function constructSolanaRouteTransaction({ data }: {
|
|
3
3
|
data: string;
|
|
4
4
|
}): VersionedTransaction | Transaction;
|
|
5
|
+
export declare function constructSolanaBridgeRouteTransaction({ data, }: {
|
|
6
|
+
data: string;
|
|
7
|
+
}): Transaction;
|
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.26",
|
|
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"
|