@dodoex/widgets 3.10.8 → 3.12.0
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/LICENSE +674 -674
- package/README.md +70 -70
- package/dist/{8de9a184d4ef0a11.svg → 219f8611c6c9e6e2.svg} +6 -6
- package/dist/{28442382d977858a.svg → 34acf2e58b457195.svg} +9 -9
- package/dist/{b3f16b2626f03378.svg → 44df077bd19df476.svg} +10 -10
- package/dist/{ed726d76d93d4899.svg → 5c5d298f247819e1.svg} +10 -10
- package/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/helper-C32NHXpc.cjs +1 -0
- package/dist/helper-DcpJ4_iF.js +1 -0
- package/dist/index-B-ViYUmB.cjs +31 -0
- package/dist/index-BKrygMTU.js +31 -0
- package/dist/{index-CgCnDcEU.js → index-C10pRixa.js} +1 -1
- package/dist/{index-BmRsd4jU.cjs → index-CvzT5JzZ.cjs} +1 -1
- package/dist/{index-DatBQMKy.cjs → index-DCQY-MHu.cjs} +1 -1
- package/dist/{index-Bw8dCrEi.js → index-DIwG8F44.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/package.json +162 -155
- package/dist/helper-DmAlQX_I.js +0 -1
- package/dist/helper-Dq2MmKrX.cjs +0 -1
- package/dist/index-CpWx5DlC.cjs +0 -31
- package/dist/index-DGmyjOlm.js +0 -31
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-BKrygMTU.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 P=S.div(k),A=r({val:N,model:p,midPrice:c});if(A.vert.isNaN())return;const _=N.lt(c);let z=n-A.vert.div(M).toNumber();_||(z=n-A.vert.div(B).toNumber());const O=i(N),X=i(A.vert),$=N.minus(c).abs().div(c).multipliedBy(100).toFixed(2),D=P.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"===A.side?i(A.quote):i(A.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(P.minus(4).lte(o)&&P.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,o as g,n as h,c as i,b as j,h as k,l,s as m,m as u};
|