@dodoex/widgets 3.14.1-react.10 → 3.14.1-react.11
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-CShlN-Na.js → helper-BHqtcxRL.js} +1 -1
- package/dist/{helper-C0hvFYzE.cjs → helper-Dx3OgznW.cjs} +1 -1
- package/dist/{index-CDlkk2Qn.cjs → index-3pznkkK5.cjs} +2 -2
- package/dist/{index-CPj5WDJ_.cjs → index-BEMHbFp4.cjs} +1 -1
- package/dist/{index-Dm9u7v6e.cjs → index-BjLBuGjJ.cjs} +1 -1
- package/dist/{index-BckgU9HL.js → index-DfT1-gjA.js} +1 -1
- package/dist/{index-CG8JD2hZ.js → index-epf35_6N.js} +1 -1
- package/dist/{index-ClfL8fzr.js → index-g8H0IkfO.js} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-
|
|
1
|
+
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-g8H0IkfO.js";function o(t,i){switch(t){case"depth-chart.tips.buy":return e._({id:"Es4ccw",message:"Users pay {0} {1} and receive {2} {3}\nPrice {4} ({5}%)",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol,4:i.priceText,5:i.slippageText}});case"depth-chart.tips.mid-price":return e._({id:"cnbRVW",message:"Initial Price {0} {1} = {2} {3}",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol}});case"depth-chart.tips.sell":return e._({id:"Es4ccw",message:"Users pay {0} {1} and receive {2} {3}\nPrice {4} ({5}%)",values:{0:i.oppositeAmountText,1:i.quoteTokenSymbol,2:i.amountText,3:i.baseTokenSymbol,4:i.priceText,5:i.slippageText}});case"pool.chart.buy-amount":return e._({id:"NjQ1e3",message:"Users sell {0} amount: ",values:{0:i.symbol}});case"pool.chart.price-impact":return e._({id:"I0LXan",message:"Price Impact: {0}",values:{0:i.amount}});case"pool.chart.sell-amount":return e._({id:"WJ94b8",message:"Users buy {0} amount: ",values:{0:i.symbol}});case"pool.create.disabled-token-amount":return e._({id:"5QDjef",message:"The token amount is calculated by initial price."});case"pool.create.set-pool.emulator.title":return e._({id:"FQfStS",message:"Emulator"});case"pool.create.set-pool.emulator.title.question":return e._({id:"9D2g7k",message:"The liquidity of DODO is continuous, which is different from the discrete liquidity of UniV3. The ticks shown in the illustration are for demonstration purposes only."});case"pool.chart.liquidity-chart-tip":return e._({id:"GhrVog",message:"The area of the chart indicates the buy/sell volume of {0} that can be carried by the market when the current price changes to the hover price. ",values:{0:i.baseTokenSymbol}});case"pool.chart.liquidity-chart-buy":return e._({id:"TvH4Ym",message:"Bought {0} {1}, price in the pool decreased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});case"pool.chart.liquidity-chart-sell":return e._({id:"0O1wzf",message:"Traders sold {0} {1}, price in the pool increased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});default:throw new Error(`Unknown key ${t}`)}}const l=12,n=18;function s(e){let t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){let e="#";for(let i=1;i<4;i+=1)e+=t.slice(i,i+1).concat(t.slice(i,i+1));t=e}const e=[];for(let i=1;i<7;i+=2)e.push(parseInt(`0x${t.slice(i,i+2)}`));return e.join(",")}return t}function r({val:e,model:i}){let o=e;if(e.isNaN())return{side:"no-one",vert:new t(0),base:new t(0),quote:new t(0)};i.Q0.eq(0)&&e.lt(i.i)&&(o=i.i),i.B0.eq(0)&&e.gt(i.i)&&(o=i.i);const l=i.getPriceDepth(o),n=l.baseAmount,s=l.quoteAmount,{isBuy:r}=l;return{side:r?"ask":"bid",vert:r?n:s,base:n,quote:s}}function a({midPrice:e,q:i,q0:o,pmmModel:l}){let n=t.maximum(i,o,l.B.multipliedBy(e));return n.isNaN()&&(n=new t(10)),n.eq(0)&&(n=new t(1)),{buyBaseVert:n.multipliedBy(1.2),sellBaseVert:n.div(e).multipliedBy(1.2)}}function u(e,i=1){return new t(i).div(e/2)}function m({tooltip:e,x:o,chartWidth:l,chartHeight:n,buyBaseVert:a,sellBaseVert:m,pmmModel:p,midPrice:c,baseTokenSymbol:d,quoteTokenSymbol:h,t:b,baseMinAndZoomMultiples:f,isHover:g,color:y,leftColor:T,rightColor:x}){const{zoomMultiples:w,baseMin:v}=f,k=u(l,w),M=a.div(n),B=m.div(n),q=2*w,N=v.multipliedBy(10**k.multipliedBy(o).toNumber());let S=new t(Math.log(c.div(v).toNumber())/Math.log(10));S=t.minimum(q,S),S=t.maximum(0,S);const A=S.div(k),P=r({val:N,model:p});if(P.vert.isNaN())return;const _=N.lt(c);let z=n-P.vert.div(M).toNumber();_||(z=n-P.vert.div(B).toNumber());const O=i(N),X=i(P.vert),$=N.minus(c).abs().div(c).multipliedBy(100).toFixed(2),D=A.toNumber(),L=e.findOne("#toolTipVertLine"),V=e.findOne("#toolTipHoriLine"),j=e.findOne("#joinCircle"),H=e.findOne("#toolTip"),W=e.findOne("#priceTextLabel"),U=e.findOne("#slippageTextLabel");if(!H)return;H.x(o),H.y(z-5-6);const I=H.getText(),Y=H.getTag();let C="ask"===P.side?i(P.quote):i(P.base);const E=p.k.lte(0);E&&(C=X);const F=i(c),Q={amountText:X,baseTokenSymbol:d,oppositeAmountText:C,quoteTokenSymbol:h,priceText:E?F:O,slippageText:`${_?"-":"+"}${$}`};if(A.minus(4).lte(o)&&A.plus(2).gte(o)&&g)I.text(b("depth-chart.tips.mid-price",{amountText:1,baseTokenSymbol:d,oppositeAmountText:F,quoteTokenSymbol:h})),H.x(D),H.y(n/2),null==L||L.hide(),null==V||V.hide(),null==j||j.hide(),null==W||W.hide(),null==U||U.hide();else{I.text(_?b("depth-chart.tips.buy",{amountText:C,baseTokenSymbol:d,oppositeAmountText:X,quoteTokenSymbol:h,priceText:E?F:O,slippageText:`${_?"-":"+"}${$}`}):b("depth-chart.tips.sell",Q));const e=y||(_?"#55f6db":"#ff4f73"),t=_?T||"#55f6db":x||"#ff4f73";I.fill(e),H.width()/2>o?(Y.pointerDirection("left"),Y.pointerHeight(15),Y.pointerWidth(8),H.offsetX(-11),H.offsetY(-11)):H.width()/2+o>l?(Y.pointerDirection("right"),Y.pointerHeight(15),Y.pointerWidth(8),H.offsetX(11),H.offsetY(-11)):(Y.pointerDirection("down"),Y.pointerHeight(8),Y.pointerWidth(15),H.offsetX(0),H.offsetY(0)),null==L||L.points([o,n,o,z]),null==L||L.stroke(t),null==V||V.points(_?[o,z,D,z]:[D,z,o,z]),null==V||V.stroke(t),null==j||j.x(o),null==j||j.y(z),null==j||j.fill(_?T||"rgb(86, 246, 218)":x||"#FF5072"),null==j||j.stroke(_?T?`rgba(${s(T)}, 0.4)`:"rgba(86, 246, 218, 0.3)":x?`rgba(${s(x)}, 0.4)`:"rgba(255, 80, 114, 0.3)"),W&&(W.x(o),W.y(n),W.offsetX(W.width()/2),W.x()-W.width()/2<0?W.x(W.width()/2):W.x()+W.width()/2>l?W.x(l-W.width()/2):W.x(o));const i=null==W?void 0:W.findOne("#priceTextLabel-text");i&&(i.fill(e),i.text(O)),U&&(U.x(_?o+(D-o)/2:o-(o-D)/2),U.y(z),U.offsetY(U.height()/2),U.offsetX(U.width()/2));const r=null==U?void 0:U.findOne("#slippageTextLabel-text");r&&(r.fill(e),r.text(`${_?"-":"+"}${$}%`)),null==L||L.show(),null==V||V.show(),null==j||j.show(),null==W||W.show(),null==U||U.show()}e.show()}function p({dragDistance:e,prevBaseMin:i,chartWidth:o,zoomMultiples:l}){const n=u(o,l);return e>0?i.multipliedBy(1-n.multipliedBy(e).toNumber()):i.multipliedBy(10**n.multipliedBy(new t(e).abs()).plus(0).toNumber())}const c=1;function d({prevZoomMultiples:e,zoomIn:t}){return!t&&e<=.1?e:t?e+.1:e-.1}function h({type:e,targetPrice:i,midPrice:o,width:l}){if("sell"===e){return{zoomMultiples:new t(Math.log10(i.div(o).toNumber())).minus(0).div(3/4).abs(),targetX:l/2*(3/4)+l/2}}const n=new t(Math.log10(i.div(o).toNumber()));return{zoomMultiples:new t(0).minus(n).div(3/4).abs(),targetX:l/2*(1/4)}}function b({currentBaseMinAndZoomMultiples:e,targetPrice:i,midPrice:o,width:l}){const{baseMin:n,zoomMultiples:s}=e,r=new t(Math.log10(n.div(o).toNumber())),a=r.plus(2*s),u=new t(o.multipliedBy(10**a.toNumber()));if(i.gte(n)&&i.lte(u)){return{isSkip:!0,targetX:new t(Math.log10(i.div(o).toNumber())).minus(r).div(2*s).multipliedBy(l).toNumber(),baseMin:new t(0),zoomMultiples:1}}const m=new t(o.multipliedBy(.1)),p=new t(o.multipliedBy(10));if(i.gte(m)&&i.lte(p)){return{isSkip:!1,targetX:new t(Math.log10(i.div(o).toNumber())).minus(-1).div(2).multipliedBy(l).toNumber(),baseMin:m,zoomMultiples:1}}return{isSkip:!1,targetX:-1,baseMin:new t(0),zoomMultiples:1}}function f({midPrice:e,zoomMultiples:t}){return e.multipliedBy(10**-t)}export{a,p as b,u as c,d,r as e,f,n as g,o as h,c as i,b as j,h as k,l,s as m,m as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@lingui/core"),t=require("bignumber.js"),i=require("./index-
|
|
1
|
+
"use strict";var e=require("@lingui/core"),t=require("bignumber.js"),i=require("./index-3pznkkK5.cjs");function o(e){let t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){let e="#";for(let i=1;i<4;i+=1)e+=t.slice(i,i+1).concat(t.slice(i,i+1));t=e}const e=[];for(let i=1;i<7;i+=2)e.push(parseInt(`0x${t.slice(i,i+2)}`));return e.join(",")}return t}function r({val:e,model:i}){let o=e;if(e.isNaN())return{side:"no-one",vert:new t(0),base:new t(0),quote:new t(0)};i.Q0.eq(0)&&e.lt(i.i)&&(o=i.i),i.B0.eq(0)&&e.gt(i.i)&&(o=i.i);const r=i.getPriceDepth(o),n=r.baseAmount,l=r.quoteAmount,{isBuy:s}=r;return{side:s?"ask":"bid",vert:s?n:l,base:n,quote:l}}function n(e,i=1){return new t(i).div(e/2)}exports.baseZoomMultiples=1,exports.beforePriceImpactEffect=function({currentBaseMinAndZoomMultiples:e,targetPrice:i,midPrice:o,width:r}){const{baseMin:n,zoomMultiples:l}=e,s=new t(Math.log10(n.div(o).toNumber())),u=s.plus(2*l),a=new t(o.multipliedBy(10**u.toNumber()));if(i.gte(n)&&i.lte(a)){return{isSkip:!0,targetX:new t(Math.log10(i.div(o).toNumber())).minus(s).div(2*l).multipliedBy(r).toNumber(),baseMin:new t(0),zoomMultiples:1}}const m=new t(o.multipliedBy(.1)),p=new t(o.multipliedBy(10));if(i.gte(m)&&i.lte(p)){return{isSkip:!1,targetX:new t(Math.log10(i.div(o).toNumber())).minus(-1).div(2).multipliedBy(r).toNumber(),baseMin:m,zoomMultiples:1}}return{isSkip:!1,targetX:-1,baseMin:new t(0),zoomMultiples:1}},exports.chartOffsetYBCToolTip=18,exports.chartT=function(t,i){switch(t){case"depth-chart.tips.buy":return e.i18n._({id:"Es4ccw",message:"Users pay {0} {1} and receive {2} {3}\nPrice {4} ({5}%)",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol,4:i.priceText,5:i.slippageText}});case"depth-chart.tips.mid-price":return e.i18n._({id:"cnbRVW",message:"Initial Price {0} {1} = {2} {3}",values:{0:i.amountText,1:i.baseTokenSymbol,2:i.oppositeAmountText,3:i.quoteTokenSymbol}});case"depth-chart.tips.sell":return e.i18n._({id:"Es4ccw",message:"Users pay {0} {1} and receive {2} {3}\nPrice {4} ({5}%)",values:{0:i.oppositeAmountText,1:i.quoteTokenSymbol,2:i.amountText,3:i.baseTokenSymbol,4:i.priceText,5:i.slippageText}});case"pool.chart.buy-amount":return e.i18n._({id:"NjQ1e3",message:"Users sell {0} amount: ",values:{0:i.symbol}});case"pool.chart.price-impact":return e.i18n._({id:"I0LXan",message:"Price Impact: {0}",values:{0:i.amount}});case"pool.chart.sell-amount":return e.i18n._({id:"WJ94b8",message:"Users buy {0} amount: ",values:{0:i.symbol}});case"pool.create.disabled-token-amount":return e.i18n._({id:"5QDjef",message:"The token amount is calculated by initial price."});case"pool.create.set-pool.emulator.title":return e.i18n._({id:"FQfStS",message:"Emulator"});case"pool.create.set-pool.emulator.title.question":return e.i18n._({id:"9D2g7k",message:"The liquidity of DODO is continuous, which is different from the discrete liquidity of UniV3. The ticks shown in the illustration are for demonstration purposes only."});case"pool.chart.liquidity-chart-tip":return e.i18n._({id:"GhrVog",message:"The area of the chart indicates the buy/sell volume of {0} that can be carried by the market when the current price changes to the hover price. ",values:{0:i.baseTokenSymbol}});case"pool.chart.liquidity-chart-buy":return e.i18n._({id:"TvH4Ym",message:"Bought {0} {1}, price in the pool decreased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});case"pool.chart.liquidity-chart-sell":return e.i18n._({id:"0O1wzf",message:"Traders sold {0} {1}, price in the pool increased to {2}",values:{0:i.amount,1:i.symbol,2:i.price}});default:throw new Error(`Unknown key ${t}`)}},exports.colorRgb=o,exports.computeBaseAfterZoom=function({midPrice:e,zoomMultiples:t}){return e.multipliedBy(10**-t)},exports.computeBaseMinByDistance=function({dragDistance:e,prevBaseMin:i,chartWidth:o,zoomMultiples:r}){const l=n(o,r);return e>0?i.multipliedBy(1-l.multipliedBy(e).toNumber()):i.multipliedBy(10**l.multipliedBy(new t(e).abs()).plus(0).toNumber())},exports.computeBaseVert=function({midPrice:e,q:i,q0:o,pmmModel:r}){let n=t.maximum(i,o,r.B.multipliedBy(e));return n.isNaN()&&(n=new t(10)),n.eq(0)&&(n=new t(1)),{buyBaseVert:n.multipliedBy(1.2),sellBaseVert:n.div(e).multipliedBy(1.2)}},exports.computeTargetXByTargetPrice=function({type:e,targetPrice:i,midPrice:o,width:r}){if("sell"===e){return{zoomMultiples:new t(Math.log10(i.div(o).toNumber())).minus(0).div(3/4).abs(),targetX:r/2*(3/4)+r/2}}const n=new t(Math.log10(i.div(o).toNumber()));return{zoomMultiples:new t(0).minus(n).div(3/4).abs(),targetX:r/2*(1/4)}},exports.computeXPortion=n,exports.computeZoomMultiplesWhenZoom=function({prevZoomMultiples:e,zoomIn:t}){return!t&&e<=.1?e:t?e+.1:e-.1},exports.evalPoint=r,exports.labelPadding=12,exports.updateTooltip=function({tooltip:e,x:l,chartWidth:s,chartHeight:u,buyBaseVert:a,sellBaseVert:m,pmmModel:p,midPrice:c,baseTokenSymbol:d,quoteTokenSymbol:h,t:b,baseMinAndZoomMultiples:f,isHover:g,color:y,leftColor:x,rightColor:T}){const{zoomMultiples:v,baseMin:w}=f,B=n(s,v),M=a.div(u),k=m.div(u),N=2*v,q=w.multipliedBy(10**B.multipliedBy(l).toNumber());let S=new t(Math.log(c.div(w).toNumber())/Math.log(10));S=t.minimum(N,S),S=t.maximum(0,S);const P=S.div(B),A=r({val:q,model:p});if(A.vert.isNaN())return;const X=q.lt(c);let O=u-A.vert.div(M).toNumber();X||(O=u-A.vert.div(k).toNumber());const _=i.formatShortNumber(q),z=i.formatShortNumber(A.vert),$=q.minus(c).abs().div(c).multipliedBy(100).toFixed(2),D=P.toNumber(),V=e.findOne("#toolTipVertLine"),L=e.findOne("#toolTipHoriLine"),W=e.findOne("#joinCircle"),H=e.findOne("#toolTip"),Z=e.findOne("#priceTextLabel"),j=e.findOne("#slippageTextLabel");if(!H)return;H.x(l),H.y(O-5-6);const I=H.getText(),U=H.getTag();let Y="ask"===A.side?i.formatShortNumber(A.quote):i.formatShortNumber(A.base);const C=p.k.lte(0);C&&(Y=z);const E=i.formatShortNumber(c),F={amountText:z,baseTokenSymbol:d,oppositeAmountText:Y,quoteTokenSymbol:h,priceText:C?E:_,slippageText:`${X?"-":"+"}${$}`};if(P.minus(4).lte(l)&&P.plus(2).gte(l)&&g)I.text(b("depth-chart.tips.mid-price",{amountText:1,baseTokenSymbol:d,oppositeAmountText:E,quoteTokenSymbol:h})),H.x(D),H.y(u/2),null==V||V.hide(),null==L||L.hide(),null==W||W.hide(),null==Z||Z.hide(),null==j||j.hide();else{I.text(X?b("depth-chart.tips.buy",{amountText:Y,baseTokenSymbol:d,oppositeAmountText:z,quoteTokenSymbol:h,priceText:C?E:_,slippageText:`${X?"-":"+"}${$}`}):b("depth-chart.tips.sell",F));const e=y||(X?"#55f6db":"#ff4f73"),t=X?x||"#55f6db":T||"#ff4f73";I.fill(e),H.width()/2>l?(U.pointerDirection("left"),U.pointerHeight(15),U.pointerWidth(8),H.offsetX(-11),H.offsetY(-11)):H.width()/2+l>s?(U.pointerDirection("right"),U.pointerHeight(15),U.pointerWidth(8),H.offsetX(11),H.offsetY(-11)):(U.pointerDirection("down"),U.pointerHeight(8),U.pointerWidth(15),H.offsetX(0),H.offsetY(0)),null==V||V.points([l,u,l,O]),null==V||V.stroke(t),null==L||L.points(X?[l,O,D,O]:[D,O,l,O]),null==L||L.stroke(t),null==W||W.x(l),null==W||W.y(O),null==W||W.fill(X?x||"rgb(86, 246, 218)":T||"#FF5072"),null==W||W.stroke(X?x?`rgba(${o(x)}, 0.4)`:"rgba(86, 246, 218, 0.3)":T?`rgba(${o(T)}, 0.4)`:"rgba(255, 80, 114, 0.3)"),Z&&(Z.x(l),Z.y(u),Z.offsetX(Z.width()/2),Z.x()-Z.width()/2<0?Z.x(Z.width()/2):Z.x()+Z.width()/2>s?Z.x(s-Z.width()/2):Z.x(l));const i=null==Z?void 0:Z.findOne("#priceTextLabel-text");i&&(i.fill(e),i.text(_)),j&&(j.x(X?l+(D-l)/2:l-(l-D)/2),j.y(O),j.offsetY(j.height()/2),j.offsetX(j.width()/2));const r=null==j?void 0:j.findOne("#slippageTextLabel-text");r&&(r.fill(e),r.text(`${X?"-":"+"}${$}%`)),null==V||V.show(),null==L||L.show(),null==W||W.show(),null==Z||Z.show(),null==j||j.show()}e.show()};
|