@dodoex/widgets 3.0.2-zetachain.10 → 3.0.2-zetachain.12

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.
@@ -0,0 +1,561 @@
1
+ 'use strict';
2
+
3
+ var core = require('@lingui/core');
4
+ var BigNumber = require('bignumber.js');
5
+ var index = require('./index-De8Sa6Av.cjs');
6
+
7
+ // \{\{([A-Za-z]+)\}\} to ${params.$1}
8
+ function chartT(key, params) {
9
+ switch (key) {
10
+ case 'depth-chart.tips.buy':
11
+ return core.i18n._(
12
+ /*i18n*/
13
+ {
14
+ id: "q+Q952",
15
+ message: "Users pay {0} {1} and receive {2} {3}\\nPrice {4} ({5}%)",
16
+ values: {
17
+ 0: params.amountText,
18
+ 1: params.baseTokenSymbol,
19
+ 2: params.oppositeAmountText,
20
+ 3: params.quoteTokenSymbol,
21
+ 4: params.priceText,
22
+ 5: params.slippageText
23
+ }
24
+ });
25
+ case 'depth-chart.tips.mid-price':
26
+ return core.i18n._(
27
+ /*i18n*/
28
+ {
29
+ id: "cnbRVW",
30
+ message: "Initial Price {0} {1} = {2} {3}",
31
+ values: {
32
+ 0: params.amountText,
33
+ 1: params.baseTokenSymbol,
34
+ 2: params.oppositeAmountText,
35
+ 3: params.quoteTokenSymbol
36
+ }
37
+ });
38
+ case 'depth-chart.tips.sell':
39
+ return core.i18n._(
40
+ /*i18n*/
41
+ {
42
+ id: "q+Q952",
43
+ message: "Users pay {0} {1} and receive {2} {3}\\nPrice {4} ({5}%)",
44
+ values: {
45
+ 0: params.oppositeAmountText,
46
+ 1: params.quoteTokenSymbol,
47
+ 2: params.amountText,
48
+ 3: params.baseTokenSymbol,
49
+ 4: params.priceText,
50
+ 5: params.slippageText
51
+ }
52
+ });
53
+ case 'pool.chart.buy-amount':
54
+ return core.i18n._(
55
+ /*i18n*/
56
+ {
57
+ id: "TaScUS",
58
+ message: "Users sell {0} amount:",
59
+ values: {
60
+ 0: params.symbol
61
+ }
62
+ });
63
+ case 'pool.chart.price-impact':
64
+ return core.i18n._(
65
+ /*i18n*/
66
+ {
67
+ id: "I0LXan",
68
+ message: "Price Impact: {0}",
69
+ values: {
70
+ 0: params.amount
71
+ }
72
+ });
73
+ case 'pool.chart.sell-amount':
74
+ return core.i18n._(
75
+ /*i18n*/
76
+ {
77
+ id: "F2vX4t",
78
+ message: "Users buy {0} amount:",
79
+ values: {
80
+ 0: params.symbol
81
+ }
82
+ });
83
+ case 'pool.create.disabled-token-amount':
84
+ return core.i18n._(
85
+ /*i18n*/
86
+ {
87
+ id: "5QDjef",
88
+ message: "The token amount is calculated by initial price."
89
+ });
90
+ case 'pool.create.set-pool.emulator.title':
91
+ return core.i18n._(
92
+ /*i18n*/
93
+ {
94
+ id: "FQfStS",
95
+ message: "Emulator"
96
+ });
97
+ case 'pool.create.set-pool.emulator.title.question':
98
+ return core.i18n._(
99
+ /*i18n*/
100
+ {
101
+ id: "9D2g7k",
102
+ 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."
103
+ });
104
+ // liquidity-chart
105
+ case 'pool.chart.liquidity-chart-tip':
106
+ return core.i18n._(
107
+ /*i18n*/
108
+ {
109
+ id: "YvXHDU",
110
+ 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.",
111
+ values: {
112
+ 0: params.baseTokenSymbol
113
+ }
114
+ });
115
+ case 'pool.chart.liquidity-chart-buy':
116
+ return core.i18n._(
117
+ /*i18n*/
118
+ {
119
+ id: "TvH4Ym",
120
+ message: "Bought {0} {1}, price in the pool decreased to {2}",
121
+ values: {
122
+ 0: params.amount,
123
+ 1: params.symbol,
124
+ 2: params.price
125
+ }
126
+ });
127
+ case 'pool.chart.liquidity-chart-sell':
128
+ return core.i18n._(
129
+ /*i18n*/
130
+ {
131
+ id: "0O1wzf",
132
+ message: "Traders sold \u202A{0}\u202C {1}, price in the pool increased to {2}",
133
+ values: {
134
+ 0: params.amount,
135
+ 1: params.symbol,
136
+ 2: params.price
137
+ }
138
+ });
139
+ default:
140
+ throw new Error(`Unknown key ${key}`);
141
+ }
142
+ }
143
+
144
+ const labelPadding = 12;
145
+ // The distance between toolTip and the top of the column
146
+ const toolTipMarginBottom = 6;
147
+ // Since toolTip exceeds part of the drawing area, additional padding is required
148
+ const chartOffsetYBCToolTip = labelPadding + toolTipMarginBottom;
149
+
150
+ function colorRgb(str) {
151
+ let sColor = str.toLowerCase();
152
+ // Regular expression for hexadecimal color values
153
+ const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
154
+ // If it is a hexadecimal color
155
+ if (sColor && reg.test(sColor)) {
156
+ if (sColor.length === 4) {
157
+ let sColorNew = '#';
158
+ for (let i = 1; i < 4; i += 1) {
159
+ sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
160
+ }
161
+ sColor = sColorNew;
162
+ }
163
+ // Handle six-bit color values
164
+ const sColorChange = [];
165
+ for (let i = 1; i < 7; i += 2) {
166
+ sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
167
+ }
168
+ return sColorChange.join(',');
169
+ }
170
+ return sColor;
171
+ }
172
+ function evalPoint({
173
+ val,
174
+ model
175
+ }) {
176
+ let v = val;
177
+ if (val.isNaN()) {
178
+ return {
179
+ side: 'no-one',
180
+ vert: new BigNumber(0),
181
+ base: new BigNumber(0),
182
+ quote: new BigNumber(0)
183
+ };
184
+ }
185
+ // If Q0=0, the minimum value of the abscissa must be greater than or equal to i. If the abscissa input is less than i, the vertical axis value when the abscissa is i is returned.
186
+ // If B0=0, the maximum value of the abscissa must be less than or equal to i. If the abscissa input is greater than i, the vertical axis value when the abscissa is i is returned.
187
+ if (model.Q0.eq(0) && val.lt(model.i)) {
188
+ v = model.i;
189
+ }
190
+ if (model.B0.eq(0) && val.gt(model.i)) {
191
+ v = model.i;
192
+ }
193
+ const resp = model.getPriceDepth(v);
194
+ const base = resp.baseAmount;
195
+ const quote = resp.quoteAmount;
196
+ const {
197
+ isBuy
198
+ } = resp;
199
+ return {
200
+ side: isBuy ? 'ask' : 'bid',
201
+ // vert: isBuy ? base.multipliedBy(midPrice) : quote,
202
+ vert: isBuy ? base : quote,
203
+ base,
204
+ quote
205
+ };
206
+ }
207
+ /**
208
+ * Returns two vertical coordinates, buyBaseVert on the left and sellBaseVert on the right.
209
+ * @param param0
210
+ */
211
+ function computeBaseVert({
212
+ midPrice,
213
+ q,
214
+ q0,
215
+ pmmModel
216
+ }) {
217
+ let baseVert = BigNumber.maximum(q, q0, pmmModel.B.multipliedBy(midPrice));
218
+ // Special handling to avoid exceptions
219
+ if (baseVert.isNaN()) {
220
+ baseVert = new BigNumber(10);
221
+ }
222
+ if (baseVert.eq(0)) {
223
+ baseVert = new BigNumber(1);
224
+ }
225
+ return {
226
+ buyBaseVert: baseVert.multipliedBy(1.2),
227
+ sellBaseVert: baseVert.div(midPrice).multipliedBy(1.2)
228
+ };
229
+ }
230
+ /**
231
+ * // 1000/800 The price represented by one pixel
232
+ // Maximum value on the right side of the middle price = middle price * 10 = middle price * 10^1
233
+ // Calculate the x-axis coordinate (price): middle price*10^(xPortion*x)+middle price; x is the number of equal parts that divide the right half into 50 parts
234
+ * @param chartWidth icon width
235
+ * @param zoomMultiples magnification factors
236
+ * @returns
237
+ */
238
+ function computeXPortion(chartWidth, zoomMultiples = 1) {
239
+ return new BigNumber(zoomMultiples).div(chartWidth / 2);
240
+ }
241
+ function updateTooltip({
242
+ tooltip,
243
+ x,
244
+ chartWidth,
245
+ chartHeight,
246
+ buyBaseVert,
247
+ sellBaseVert,
248
+ pmmModel,
249
+ midPrice,
250
+ baseTokenSymbol,
251
+ quoteTokenSymbol,
252
+ t,
253
+ baseMinAndZoomMultiples,
254
+ isHover,
255
+ color,
256
+ leftColor,
257
+ rightColor
258
+ }) {
259
+ const {
260
+ zoomMultiples,
261
+ baseMin
262
+ } = baseMinAndZoomMultiples;
263
+ const xPortion = computeXPortion(chartWidth, zoomMultiples);
264
+ const buyYPortion = buyBaseVert.div(chartHeight);
265
+ const sellYPortion = sellBaseVert.div(chartHeight);
266
+ const multiplesNum = zoomMultiples * 2;
267
+ const price = baseMin.multipliedBy(10 ** xPortion.multipliedBy(x).toNumber());
268
+ let midPriceN = new BigNumber(Math.log(midPrice.div(baseMin).toNumber()) / Math.log(10));
269
+ midPriceN = BigNumber.minimum(multiplesNum, midPriceN);
270
+ midPriceN = BigNumber.maximum(0, midPriceN);
271
+ const xMidPrice = midPriceN.div(xPortion);
272
+ const result = evalPoint({
273
+ val: price,
274
+ model: pmmModel,
275
+ midPrice
276
+ });
277
+ if (result.vert.isNaN()) {
278
+ return;
279
+ }
280
+ const isQuote = price.lt(midPrice);
281
+ let yy = chartHeight - result.vert.div(buyYPortion).toNumber();
282
+ if (!isQuote) {
283
+ yy = chartHeight - result.vert.div(sellYPortion).toNumber();
284
+ }
285
+ const priceText = index.formatShortNumber(price);
286
+ const amountText = index.formatShortNumber(result.vert);
287
+ const slippageText = price.minus(midPrice).abs().div(midPrice).multipliedBy(100).toFixed(2);
288
+ const xMidPriceText = xMidPrice.toNumber();
289
+ const toolTipVertLine = tooltip.findOne('#toolTipVertLine');
290
+ const toolTipHoriLine = tooltip.findOne('#toolTipHoriLine');
291
+ const joinCircle = tooltip.findOne('#joinCircle');
292
+ const tooltipLabel = tooltip.findOne('#toolTip');
293
+ const priceTextLabel = tooltip.findOne('#priceTextLabel');
294
+ const slippageTextLabel = tooltip.findOne('#slippageTextLabel');
295
+ if (!tooltipLabel) {
296
+ return;
297
+ }
298
+ tooltipLabel.x(x);
299
+ // yy + radius of intersection circle + border of intersection circle
300
+ tooltipLabel.y(yy - 5 - 6);
301
+ const toolTipText = tooltipLabel.getText();
302
+ const toolTipTag = tooltipLabel.getTag();
303
+ let oppositeAmountText = result.side === 'ask' ? index.formatShortNumber(result.quote) : index.formatShortNumber(result.base);
304
+ const isZeroK = pmmModel.k.lte(0);
305
+ if (isZeroK) {
306
+ oppositeAmountText = amountText;
307
+ }
308
+ const midPriceText = index.formatShortNumber(midPrice);
309
+ const tipTextParams = {
310
+ amountText,
311
+ baseTokenSymbol,
312
+ oppositeAmountText,
313
+ quoteTokenSymbol,
314
+ priceText: isZeroK ? midPriceText : priceText,
315
+ slippageText: `${isQuote ? '-' : '+'}${slippageText}`
316
+ };
317
+ if (xMidPrice.minus(4).lte(x) && xMidPrice.plus(2).gte(x) && isHover) {
318
+ // midPrice hover
319
+ toolTipText.text(t('depth-chart.tips.mid-price', {
320
+ amountText: 1,
321
+ baseTokenSymbol,
322
+ oppositeAmountText: midPriceText,
323
+ quoteTokenSymbol
324
+ }));
325
+ tooltipLabel.x(xMidPriceText);
326
+ tooltipLabel.y(chartHeight / 2);
327
+ toolTipVertLine === null || toolTipVertLine === void 0 ? void 0 : toolTipVertLine.hide();
328
+ toolTipHoriLine === null || toolTipHoriLine === void 0 ? void 0 : toolTipHoriLine.hide();
329
+ joinCircle === null || joinCircle === void 0 ? void 0 : joinCircle.hide();
330
+ priceTextLabel === null || priceTextLabel === void 0 ? void 0 : priceTextLabel.hide();
331
+ slippageTextLabel === null || slippageTextLabel === void 0 ? void 0 : slippageTextLabel.hide();
332
+ } else {
333
+ toolTipText.text(isQuote ? t('depth-chart.tips.buy', {
334
+ amountText: oppositeAmountText,
335
+ baseTokenSymbol,
336
+ oppositeAmountText: amountText,
337
+ quoteTokenSymbol,
338
+ priceText: isZeroK ? midPriceText : priceText,
339
+ slippageText: `${isQuote ? '-' : '+'}${slippageText}`
340
+ }) : t('depth-chart.tips.sell', tipTextParams));
341
+ const textColor = color || (isQuote ? '#55f6db' : '#ff4f73');
342
+ const lineColor = isQuote ? leftColor || '#55f6db' : rightColor || '#ff4f73';
343
+ toolTipText.fill(textColor);
344
+ if (tooltipLabel.width() / 2 > x) {
345
+ toolTipTag.pointerDirection('left');
346
+ toolTipTag.pointerHeight(15);
347
+ toolTipTag.pointerWidth(8);
348
+ tooltipLabel.offsetX(-(5 + 6));
349
+ tooltipLabel.offsetY(-(5 + 6));
350
+ } else if (tooltipLabel.width() / 2 + x > chartWidth) {
351
+ toolTipTag.pointerDirection('right');
352
+ toolTipTag.pointerHeight(15);
353
+ toolTipTag.pointerWidth(8);
354
+ tooltipLabel.offsetX(5 + 6);
355
+ tooltipLabel.offsetY(-(5 + 6));
356
+ } else {
357
+ // @ts-ignore
358
+ toolTipTag.pointerDirection('down');
359
+ toolTipTag.pointerHeight(8);
360
+ toolTipTag.pointerWidth(15);
361
+ tooltipLabel.offsetX(0);
362
+ tooltipLabel.offsetY(0);
363
+ }
364
+ toolTipVertLine === null || toolTipVertLine === void 0 ? void 0 : toolTipVertLine.points([x, chartHeight, x, yy]);
365
+ toolTipVertLine === null || toolTipVertLine === void 0 ? void 0 : toolTipVertLine.stroke(lineColor);
366
+ toolTipHoriLine === null || toolTipHoriLine === void 0 ? void 0 : toolTipHoriLine.points(isQuote ? [x, yy, xMidPriceText, yy] : [xMidPriceText, yy, x, yy]);
367
+ toolTipHoriLine === null || toolTipHoriLine === void 0 ? void 0 : toolTipHoriLine.stroke(lineColor);
368
+ joinCircle === null || joinCircle === void 0 ? void 0 : joinCircle.x(x);
369
+ joinCircle === null || joinCircle === void 0 ? void 0 : joinCircle.y(yy);
370
+ joinCircle === null || joinCircle === void 0 ? void 0 : joinCircle.fill(isQuote ? leftColor || 'rgb(86, 246, 218)' : rightColor || '#FF5072');
371
+ joinCircle === null || joinCircle === void 0 ? void 0 : joinCircle.stroke(
372
+ // eslint-disable-next-line no-nested-ternary
373
+ isQuote ? leftColor ? `rgba(${colorRgb(leftColor)}, 0.4)` : 'rgba(86, 246, 218, 0.3)' : rightColor ? `rgba(${colorRgb(rightColor)}, 0.4)` : 'rgba(255, 80, 114, 0.3)');
374
+ if (priceTextLabel) {
375
+ priceTextLabel.x(x);
376
+ priceTextLabel.y(chartHeight);
377
+ priceTextLabel.offsetX(priceTextLabel.width() / 2);
378
+ if (priceTextLabel.x() - priceTextLabel.width() / 2 < 0) {
379
+ priceTextLabel.x(priceTextLabel.width() / 2);
380
+ } else if (priceTextLabel.x() + priceTextLabel.width() / 2 > chartWidth) {
381
+ priceTextLabel.x(chartWidth - priceTextLabel.width() / 2);
382
+ } else {
383
+ priceTextLabel.x(x);
384
+ }
385
+ }
386
+ const priceTextLabelText = priceTextLabel === null || priceTextLabel === void 0 ? void 0 : priceTextLabel.findOne('#priceTextLabel-text');
387
+ if (priceTextLabelText) {
388
+ priceTextLabelText.fill(textColor);
389
+ priceTextLabelText.text(priceText);
390
+ }
391
+ if (slippageTextLabel) {
392
+ slippageTextLabel.x(isQuote ? x + (xMidPriceText - x) / 2 : x - (x - xMidPriceText) / 2);
393
+ slippageTextLabel.y(yy);
394
+ slippageTextLabel.offsetY(slippageTextLabel.height() / 2);
395
+ slippageTextLabel.offsetX(slippageTextLabel.width() / 2);
396
+ }
397
+ const slippageTextLabelText = slippageTextLabel === null || slippageTextLabel === void 0 ? void 0 : slippageTextLabel.findOne('#slippageTextLabel-text');
398
+ if (slippageTextLabelText) {
399
+ slippageTextLabelText.fill(textColor);
400
+ slippageTextLabelText.text(`${isQuote ? '-' : '+'}${slippageText}%`);
401
+ }
402
+ toolTipVertLine === null || toolTipVertLine === void 0 ? void 0 : toolTipVertLine.show();
403
+ toolTipHoriLine === null || toolTipHoriLine === void 0 ? void 0 : toolTipHoriLine.show();
404
+ joinCircle === null || joinCircle === void 0 ? void 0 : joinCircle.show();
405
+ priceTextLabel === null || priceTextLabel === void 0 ? void 0 : priceTextLabel.show();
406
+ slippageTextLabel === null || slippageTextLabel === void 0 ? void 0 : slippageTextLabel.show();
407
+ }
408
+ tooltip.show();
409
+ }
410
+ /**
411
+ * Calculate the minimum value on the left by pulling distance or button click
412
+ */
413
+ function computeBaseMinByDistance({
414
+ dragDistance,
415
+ prevBaseMin,
416
+ chartWidth,
417
+ zoomMultiples
418
+ }) {
419
+ const xPortion = computeXPortion(chartWidth, zoomMultiples);
420
+ if (dragDistance > 0) {
421
+ return prevBaseMin.multipliedBy(10 ** 0 - xPortion.multipliedBy(dragDistance).toNumber());
422
+ }
423
+ return prevBaseMin.multipliedBy(10 ** xPortion.multipliedBy(new BigNumber(dragDistance).abs()).plus(0).toNumber());
424
+ }
425
+ const baseZoomMultiples = 1;
426
+ function computeZoomMultiplesWhenZoom({
427
+ prevZoomMultiples,
428
+ zoomIn
429
+ }) {
430
+ if (!zoomIn) {
431
+ if (prevZoomMultiples <= baseZoomMultiples * 0.1) {
432
+ return prevZoomMultiples;
433
+ }
434
+ // The reduction ratio cannot exceed 0.001
435
+ // if (prevZoomMultiples <= baseZoomMultiples * 0.1) {
436
+ // if (prevZoomMultiples <= baseZoomMultiples * 0.01) {
437
+ // if (prevZoomMultiples === baseZoomMultiples * 0.001) {
438
+ // return prevZoomMultiples;
439
+ // }
440
+ // return prevZoomMultiples - baseZoomMultiples * 0.001;
441
+ // }
442
+ // return prevZoomMultiples - baseZoomMultiples * 0.01;
443
+ // }
444
+ }
445
+ return zoomIn ? prevZoomMultiples + baseZoomMultiples * 0.1 : prevZoomMultiples - baseZoomMultiples * 0.1;
446
+ }
447
+ /**
448
+ * Given a price target corresponding to the abscissa, calculate the abscissa of the point
449
+ * The buying impact point is at the left 1/4 position
450
+ * The selling impact point is 3/4 on the right
451
+ *
452
+ * Returns a coordinate point, baseMin and zoomMultiples
453
+ *
454
+ * Take the initial state as the starting point, that is, midPrice * 10 ^ -1 as the starting point of the horizontal axis, and it is a left-right symmetrical state, that is, the logarithm of the horizontal axis is from -1 -> 0 -> 1
455
+ *
456
+ * type === 'sell'
457
+ * targetPrice = midPrice * 10 ^ n
458
+ * n = Math.log10(targetPrice / midPrice)
459
+ * n = maxN * (3 / 4)
460
+ *
461
+ * If the new price is within the existing range, the zoom factor will not be adjusted (the price impact will not change the shape of the graph after graph scaling or translation)
462
+ * If it is not within the current interval, check whether it is midPrice * 10 ^-1 and midPrice * 10^1. If you still do not adjust the zoom factor, hit the specified point directly, otherwise you need to adjust the zoom factor (avoid inputting extremely small values) The value cannot be scaled to the specified range, resulting in stuck)
463
+ */
464
+ function computeTargetXByTargetPrice({
465
+ type,
466
+ targetPrice,
467
+ midPrice,
468
+ width
469
+ }) {
470
+ if (type === 'sell') {
471
+ const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));
472
+ const maxN = n.minus(0).div(3 / 4).abs();
473
+ const zoomMultiples = maxN;
474
+ return {
475
+ zoomMultiples,
476
+ targetX: width / 2 * (3 / 4) + width / 2
477
+ };
478
+ }
479
+ const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));
480
+ const maxN = new BigNumber(0).minus(n).div(3 / 4).abs();
481
+ const zoomMultiples = maxN;
482
+ return {
483
+ zoomMultiples,
484
+ targetX: width / 2 * (1 / 4)
485
+ };
486
+ }
487
+ /**
488
+ * If the new price is within the existing range, the zoom factor will not be adjusted (the price impact will not change the shape of the graph after graph scaling or translation)
489
+ * If it is not within the current interval, check whether it is midPrice * 10 ^-1 and midPrice * 10^1. If it is within the range, adjust the zoom factor to 1, and then impact to the specified point, otherwise you need to adjust the zoom factor ( Avoid entering extremely small values ​​that may result in inability to scale to the specified range and cause stucks)
490
+ *
491
+ * Returns an abscissa and a flag indicating whether to skip
492
+ */
493
+ function beforePriceImpactEffect({
494
+ currentBaseMinAndZoomMultiples,
495
+ targetPrice,
496
+ midPrice,
497
+ width
498
+ }) {
499
+ const {
500
+ baseMin,
501
+ zoomMultiples
502
+ } = currentBaseMinAndZoomMultiples;
503
+ const minN = new BigNumber(Math.log10(baseMin.div(midPrice).toNumber()));
504
+ const maxN = minN.plus(zoomMultiples * 2);
505
+ // price maximum
506
+ const baseMax = new BigNumber(midPrice.multipliedBy(10 ** maxN.toNumber()));
507
+ if (targetPrice.gte(baseMin) && targetPrice.lte(baseMax)) {
508
+ const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));
509
+ const targetX = n.minus(minN).div(zoomMultiples * 2).multipliedBy(width).toNumber();
510
+ return {
511
+ isSkip: true,
512
+ targetX,
513
+ baseMin: new BigNumber(0),
514
+ zoomMultiples: baseZoomMultiples
515
+ };
516
+ }
517
+ // 是否在 midPrice 范围内
518
+ const defaultBaseMin = new BigNumber(midPrice.multipliedBy(10 ** -baseZoomMultiples));
519
+ const defaultBaseMax = new BigNumber(midPrice.multipliedBy(10 ** baseZoomMultiples));
520
+ if (targetPrice.gte(defaultBaseMin) && targetPrice.lte(defaultBaseMax)) {
521
+ const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));
522
+ const targetX = n.minus(-baseZoomMultiples).div(baseZoomMultiples * 2).multipliedBy(width).toNumber();
523
+ return {
524
+ isSkip: false,
525
+ targetX,
526
+ baseMin: defaultBaseMin,
527
+ zoomMultiples: baseZoomMultiples
528
+ };
529
+ }
530
+ return {
531
+ isSkip: false,
532
+ targetX: -1,
533
+ baseMin: new BigNumber(0),
534
+ zoomMultiples: baseZoomMultiples
535
+ };
536
+ }
537
+ /**
538
+ * Recalculate baseMin after the zoom factor changes
539
+ */
540
+ function computeBaseAfterZoom({
541
+ midPrice,
542
+ zoomMultiples
543
+ }) {
544
+ return midPrice.multipliedBy(10 ** -zoomMultiples);
545
+ }
546
+
547
+ exports.baseZoomMultiples = baseZoomMultiples;
548
+ exports.beforePriceImpactEffect = beforePriceImpactEffect;
549
+ exports.chartOffsetYBCToolTip = chartOffsetYBCToolTip;
550
+ exports.chartT = chartT;
551
+ exports.colorRgb = colorRgb;
552
+ exports.computeBaseAfterZoom = computeBaseAfterZoom;
553
+ exports.computeBaseMinByDistance = computeBaseMinByDistance;
554
+ exports.computeBaseVert = computeBaseVert;
555
+ exports.computeTargetXByTargetPrice = computeTargetXByTargetPrice;
556
+ exports.computeXPortion = computeXPortion;
557
+ exports.computeZoomMultiplesWhenZoom = computeZoomMultiplesWhenZoom;
558
+ exports.evalPoint = evalPoint;
559
+ exports.labelPadding = labelPadding;
560
+ exports.updateTooltip = updateTooltip;
561
+ //# sourceMappingURL=helper-BnoyRpeK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-BnoyRpeK.cjs","sources":["../src/components/chart/i18n.ts","../src/components/chart/utils.ts","../src/components/chart/depth-chart/helper.ts"],"sourcesContent":["import { t } from '@lingui/macro';\n\n// \\{\\{([A-Za-z]+)\\}\\} to ${params.$1}\nexport function chartT(key: string, params: any) {\n switch (key) {\n case 'depth-chart.tips.buy':\n return t`Users pay ${params.amountText} ${params.baseTokenSymbol} and receive ${params.oppositeAmountText} ${params.quoteTokenSymbol}\\nPrice ${params.priceText} (${params.slippageText}%)`;\n case 'depth-chart.tips.mid-price':\n return t`Initial Price ${params.amountText} ${params.baseTokenSymbol} = ${params.oppositeAmountText} ${params.quoteTokenSymbol}`;\n case 'depth-chart.tips.sell':\n return t`Users pay ${params.oppositeAmountText} ${params.quoteTokenSymbol} and receive ${params.amountText} ${params.baseTokenSymbol}\\nPrice ${params.priceText} (${params.slippageText}%)`;\n case 'pool.chart.buy-amount':\n return t`Users sell ${params.symbol} amount: `;\n case 'pool.chart.price-impact':\n return t`Price Impact: ${params.amount}`;\n case 'pool.chart.sell-amount':\n return t`Users buy ${params.symbol} amount: `;\n case 'pool.create.disabled-token-amount':\n return t`The token amount is calculated by initial price.`;\n case 'pool.create.set-pool.emulator.title':\n return t`Emulator`;\n case 'pool.create.set-pool.emulator.title.question':\n return t`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.`;\n\n // liquidity-chart\n case 'pool.chart.liquidity-chart-tip':\n return t`The area of the chart indicates the buy/sell volume of ${params.baseTokenSymbol} that can be carried by the market when the current price changes to the hover price. `;\n case 'pool.chart.liquidity-chart-buy':\n return t`Bought ${params.amount} ${params.symbol}, price in the pool decreased to ${params.price}`;\n case 'pool.chart.liquidity-chart-sell':\n return t`Traders sold ‪${params.amount}‬ ${params.symbol}, price in the pool increased to ${params.price}`;\n default:\n throw new Error(`Unknown key ${key}`);\n }\n}\n","export const labelPadding = 12;\n// The distance between toolTip and the top of the column\nexport const toolTipMarginBottom = 6;\n\n// Since toolTip exceeds part of the drawing area, additional padding is required\nexport const chartOffsetYBCToolTip = labelPadding + toolTipMarginBottom;\n","import BigNumber from 'bignumber.js';\r\nimport Konva from 'konva';\r\nimport { formatShortNumber } from '../../../utils/formatter';\r\nimport { PMMModel } from '@dodoex/api';\r\n\r\nexport function colorRgb(str: string) {\r\n let sColor = str.toLowerCase();\r\n // Regular expression for hexadecimal color values\r\n const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;\r\n // If it is a hexadecimal color\r\n if (sColor && reg.test(sColor)) {\r\n if (sColor.length === 4) {\r\n let sColorNew = '#';\r\n for (let i = 1; i < 4; i += 1) {\r\n sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));\r\n }\r\n sColor = sColorNew;\r\n }\r\n // Handle six-bit color values\r\n const sColorChange = [];\r\n for (let i = 1; i < 7; i += 2) {\r\n sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));\r\n }\r\n return sColorChange.join(',');\r\n }\r\n return sColor;\r\n}\r\n\r\nexport type EvaluatedPoint = {\r\n side: 'bid' | 'ask' | 'no-one';\r\n vert: BigNumber;\r\n base: BigNumber;\r\n quote: BigNumber;\r\n};\r\n\r\nexport type BaseMinAndZoomMultiples = {\r\n baseMin: BigNumber;\r\n zoomMultiples: number;\r\n /** Price impact point active display hover */\r\n targetMarginPriceX: number;\r\n};\r\n\r\nexport function evalPoint({\r\n val,\r\n model,\r\n}: // midPrice,\r\n{\r\n val: BigNumber;\r\n model: PMMModel;\r\n midPrice: BigNumber;\r\n}): EvaluatedPoint {\r\n let v = val;\r\n if (val.isNaN()) {\r\n return {\r\n side: 'no-one',\r\n vert: new BigNumber(0),\r\n base: new BigNumber(0),\r\n quote: new BigNumber(0),\r\n };\r\n }\r\n // If Q0=0, the minimum value of the abscissa must be greater than or equal to i. If the abscissa input is less than i, the vertical axis value when the abscissa is i is returned.\r\n // If B0=0, the maximum value of the abscissa must be less than or equal to i. If the abscissa input is greater than i, the vertical axis value when the abscissa is i is returned.\r\n if (model.Q0.eq(0) && val.lt(model.i)) {\r\n v = model.i;\r\n }\r\n if (model.B0.eq(0) && val.gt(model.i)) {\r\n v = model.i;\r\n }\r\n\r\n const resp = model.getPriceDepth(v);\r\n const base = resp.baseAmount;\r\n const quote = resp.quoteAmount;\r\n const { isBuy } = resp;\r\n\r\n return {\r\n side: isBuy ? 'ask' : 'bid',\r\n // vert: isBuy ? base.multipliedBy(midPrice) : quote,\r\n vert: isBuy ? base : quote,\r\n base,\r\n quote,\r\n };\r\n}\r\n\r\n/**\r\n * Returns two vertical coordinates, buyBaseVert on the left and sellBaseVert on the right.\r\n * @param param0\r\n */\r\nexport function computeBaseVert({\r\n midPrice,\r\n q,\r\n q0,\r\n pmmModel,\r\n}: {\r\n midPrice: BigNumber;\r\n q: number;\r\n q0: number;\r\n pmmModel: PMMModel;\r\n}) {\r\n let baseVert = BigNumber.maximum(q, q0, pmmModel.B.multipliedBy(midPrice));\r\n // Special handling to avoid exceptions\r\n if (baseVert.isNaN()) {\r\n baseVert = new BigNumber(10);\r\n }\r\n if (baseVert.eq(0)) {\r\n baseVert = new BigNumber(1);\r\n }\r\n return {\r\n buyBaseVert: baseVert.multipliedBy(1.2),\r\n sellBaseVert: baseVert.div(midPrice).multipliedBy(1.2),\r\n };\r\n}\r\n\r\n/**\r\n * // 1000/800 The price represented by one pixel\r\n // Maximum value on the right side of the middle price = middle price * 10 = middle price * 10^1\r\n // Calculate the x-axis coordinate (price): middle price*10^(xPortion*x)+middle price; x is the number of equal parts that divide the right half into 50 parts\r\n * @param chartWidth icon width\r\n * @param zoomMultiples magnification factors\r\n * @returns\r\n */\r\nexport function computeXPortion(chartWidth: number, zoomMultiples = 1) {\r\n return new BigNumber(zoomMultiples).div(chartWidth / 2);\r\n}\r\n\r\nexport function updateTooltip({\r\n tooltip,\r\n x,\r\n chartWidth,\r\n chartHeight,\r\n buyBaseVert,\r\n sellBaseVert,\r\n pmmModel,\r\n midPrice,\r\n baseTokenSymbol,\r\n quoteTokenSymbol,\r\n t,\r\n baseMinAndZoomMultiples,\r\n isHover,\r\n color,\r\n leftColor,\r\n rightColor,\r\n}: {\r\n x: number;\r\n tooltip: Konva.Layer;\r\n chartWidth: number;\r\n chartHeight: number;\r\n buyBaseVert: BigNumber;\r\n sellBaseVert: BigNumber;\r\n pmmModel: PMMModel;\r\n midPrice: BigNumber;\r\n baseTokenSymbol: string;\r\n quoteTokenSymbol: string;\r\n t: any;\r\n baseMinAndZoomMultiples: BaseMinAndZoomMultiples;\r\n // The middle price is only displayed when hovering\r\n isHover?: boolean;\r\n // text color\r\n color?: string;\r\n // main color of base\r\n leftColor?: string;\r\n // main color of quote\r\n rightColor?: string;\r\n}) {\r\n const { zoomMultiples, baseMin } = baseMinAndZoomMultiples;\r\n const xPortion = computeXPortion(chartWidth, zoomMultiples);\r\n const buyYPortion = buyBaseVert.div(chartHeight);\r\n const sellYPortion = sellBaseVert.div(chartHeight);\r\n\r\n const multiplesNum = zoomMultiples * 2;\r\n\r\n const price = baseMin.multipliedBy(10 ** xPortion.multipliedBy(x).toNumber());\r\n let midPriceN = new BigNumber(\r\n Math.log(midPrice.div(baseMin).toNumber()) / Math.log(10),\r\n );\r\n midPriceN = BigNumber.minimum(multiplesNum, midPriceN);\r\n midPriceN = BigNumber.maximum(0, midPriceN);\r\n const xMidPrice = midPriceN.div(xPortion);\r\n const result = evalPoint({ val: price, model: pmmModel, midPrice });\r\n if (result.vert.isNaN()) {\r\n return;\r\n }\r\n\r\n const isQuote = price.lt(midPrice);\r\n\r\n let yy = chartHeight - result.vert.div(buyYPortion).toNumber();\r\n if (!isQuote) {\r\n yy = chartHeight - result.vert.div(sellYPortion).toNumber();\r\n }\r\n\r\n const priceText = formatShortNumber(price);\r\n const amountText = formatShortNumber(result.vert);\r\n const slippageText = price\r\n .minus(midPrice)\r\n .abs()\r\n .div(midPrice)\r\n .multipliedBy(100)\r\n .toFixed(2);\r\n const xMidPriceText = xMidPrice.toNumber();\r\n\r\n const toolTipVertLine = tooltip.findOne<Konva.Line>('#toolTipVertLine');\r\n const toolTipHoriLine = tooltip.findOne<Konva.Line>('#toolTipHoriLine');\r\n const joinCircle = tooltip.findOne<Konva.Line>('#joinCircle');\r\n const tooltipLabel = tooltip.findOne<Konva.Label>('#toolTip');\r\n const priceTextLabel = tooltip.findOne<Konva.Label>('#priceTextLabel');\r\n const slippageTextLabel = tooltip.findOne<Konva.Label>('#slippageTextLabel');\r\n\r\n if (!tooltipLabel) {\r\n return;\r\n }\r\n\r\n tooltipLabel.x(x);\r\n // yy + radius of intersection circle + border of intersection circle\r\n tooltipLabel.y(yy - 5 - 6);\r\n const toolTipText = tooltipLabel.getText();\r\n const toolTipTag = tooltipLabel.getTag();\r\n let oppositeAmountText =\r\n result.side === 'ask'\r\n ? formatShortNumber(result.quote)\r\n : formatShortNumber(result.base);\r\n const isZeroK = pmmModel.k.lte(0);\r\n if (isZeroK) {\r\n oppositeAmountText = amountText;\r\n }\r\n const midPriceText = formatShortNumber(midPrice);\r\n const tipTextParams = {\r\n amountText,\r\n baseTokenSymbol,\r\n oppositeAmountText,\r\n quoteTokenSymbol,\r\n priceText: isZeroK ? midPriceText : priceText,\r\n slippageText: `${isQuote ? '-' : '+'}${slippageText}`,\r\n };\r\n if (xMidPrice.minus(4).lte(x) && xMidPrice.plus(2).gte(x) && isHover) {\r\n // midPrice hover\r\n toolTipText.text(\r\n t('depth-chart.tips.mid-price', {\r\n amountText: 1,\r\n baseTokenSymbol,\r\n oppositeAmountText: midPriceText,\r\n quoteTokenSymbol,\r\n }),\r\n );\r\n tooltipLabel.x(xMidPriceText);\r\n tooltipLabel.y(chartHeight / 2);\r\n\r\n toolTipVertLine?.hide();\r\n toolTipHoriLine?.hide();\r\n joinCircle?.hide();\r\n priceTextLabel?.hide();\r\n slippageTextLabel?.hide();\r\n } else {\r\n toolTipText.text(\r\n isQuote\r\n ? t('depth-chart.tips.buy', {\r\n amountText: oppositeAmountText,\r\n baseTokenSymbol,\r\n oppositeAmountText: amountText,\r\n quoteTokenSymbol,\r\n priceText: isZeroK ? midPriceText : priceText,\r\n slippageText: `${isQuote ? '-' : '+'}${slippageText}`,\r\n })\r\n : t('depth-chart.tips.sell', tipTextParams),\r\n );\r\n const textColor = color || (isQuote ? '#55f6db' : '#ff4f73');\r\n const lineColor = isQuote\r\n ? leftColor || '#55f6db'\r\n : rightColor || '#ff4f73';\r\n toolTipText.fill(textColor);\r\n\r\n if (tooltipLabel.width() / 2 > x) {\r\n toolTipTag.pointerDirection('left');\r\n toolTipTag.pointerHeight(15);\r\n toolTipTag.pointerWidth(8);\r\n tooltipLabel.offsetX(-(5 + 6));\r\n tooltipLabel.offsetY(-(5 + 6));\r\n } else if (tooltipLabel.width() / 2 + x > chartWidth) {\r\n toolTipTag.pointerDirection('right');\r\n toolTipTag.pointerHeight(15);\r\n toolTipTag.pointerWidth(8);\r\n tooltipLabel.offsetX(5 + 6);\r\n tooltipLabel.offsetY(-(5 + 6));\r\n } else {\r\n // @ts-ignore\r\n toolTipTag.pointerDirection('down');\r\n toolTipTag.pointerHeight(8);\r\n toolTipTag.pointerWidth(15);\r\n tooltipLabel.offsetX(0);\r\n tooltipLabel.offsetY(0);\r\n }\r\n\r\n toolTipVertLine?.points([x, chartHeight, x, yy]);\r\n toolTipVertLine?.stroke(lineColor);\r\n\r\n toolTipHoriLine?.points(\r\n isQuote ? [x, yy, xMidPriceText, yy] : [xMidPriceText, yy, x, yy],\r\n );\r\n toolTipHoriLine?.stroke(lineColor);\r\n\r\n joinCircle?.x(x);\r\n joinCircle?.y(yy);\r\n joinCircle?.fill(\r\n isQuote ? leftColor || 'rgb(86, 246, 218)' : rightColor || '#FF5072',\r\n );\r\n joinCircle?.stroke(\r\n // eslint-disable-next-line no-nested-ternary\r\n isQuote\r\n ? leftColor\r\n ? `rgba(${colorRgb(leftColor)}, 0.4)`\r\n : 'rgba(86, 246, 218, 0.3)'\r\n : rightColor\r\n ? `rgba(${colorRgb(rightColor)}, 0.4)`\r\n : 'rgba(255, 80, 114, 0.3)',\r\n );\r\n\r\n if (priceTextLabel) {\r\n priceTextLabel.x(x);\r\n priceTextLabel.y(chartHeight);\r\n priceTextLabel.offsetX(priceTextLabel.width() / 2);\r\n if (priceTextLabel.x() - priceTextLabel.width() / 2 < 0) {\r\n priceTextLabel.x(priceTextLabel.width() / 2);\r\n } else if (priceTextLabel.x() + priceTextLabel.width() / 2 > chartWidth) {\r\n priceTextLabel.x(chartWidth - priceTextLabel.width() / 2);\r\n } else {\r\n priceTextLabel.x(x);\r\n }\r\n }\r\n\r\n const priceTextLabelText = priceTextLabel?.findOne<Konva.Text>(\r\n '#priceTextLabel-text',\r\n );\r\n if (priceTextLabelText) {\r\n priceTextLabelText.fill(textColor);\r\n priceTextLabelText.text(priceText);\r\n }\r\n\r\n if (slippageTextLabel) {\r\n slippageTextLabel.x(\r\n isQuote ? x + (xMidPriceText - x) / 2 : x - (x - xMidPriceText) / 2,\r\n );\r\n slippageTextLabel.y(yy);\r\n slippageTextLabel.offsetY(slippageTextLabel.height() / 2);\r\n slippageTextLabel.offsetX(slippageTextLabel.width() / 2);\r\n }\r\n const slippageTextLabelText = slippageTextLabel?.findOne<Konva.Text>(\r\n '#slippageTextLabel-text',\r\n );\r\n if (slippageTextLabelText) {\r\n slippageTextLabelText.fill(textColor);\r\n slippageTextLabelText.text(`${isQuote ? '-' : '+'}${slippageText}%`);\r\n }\r\n\r\n toolTipVertLine?.show();\r\n toolTipHoriLine?.show();\r\n joinCircle?.show();\r\n priceTextLabel?.show();\r\n slippageTextLabel?.show();\r\n }\r\n\r\n tooltip.show();\r\n}\r\n\r\n/**\r\n * Calculate the minimum value on the left by pulling distance or button click\r\n */\r\nexport function computeBaseMinByDistance({\r\n dragDistance,\r\n prevBaseMin,\r\n chartWidth,\r\n zoomMultiples,\r\n}: {\r\n dragDistance: number;\r\n prevBaseMin: BigNumber;\r\n chartWidth: number;\r\n zoomMultiples: number;\r\n}) {\r\n const xPortion = computeXPortion(chartWidth, zoomMultiples);\r\n if (dragDistance > 0) {\r\n return prevBaseMin.multipliedBy(\r\n 10 ** 0 - xPortion.multipliedBy(dragDistance).toNumber(),\r\n );\r\n }\r\n return prevBaseMin.multipliedBy(\r\n 10 **\r\n xPortion\r\n .multipliedBy(new BigNumber(dragDistance).abs())\r\n .plus(0)\r\n .toNumber(),\r\n );\r\n}\r\n\r\nexport const baseZoomMultiples = 1;\r\nexport function computeZoomMultiplesWhenZoom({\r\n prevZoomMultiples,\r\n zoomIn,\r\n}: {\r\n prevZoomMultiples: number;\r\n zoomIn: boolean;\r\n}) {\r\n if (!zoomIn) {\r\n if (prevZoomMultiples <= baseZoomMultiples * 0.1) {\r\n return prevZoomMultiples;\r\n }\r\n // The reduction ratio cannot exceed 0.001\r\n // if (prevZoomMultiples <= baseZoomMultiples * 0.1) {\r\n // if (prevZoomMultiples <= baseZoomMultiples * 0.01) {\r\n // if (prevZoomMultiples === baseZoomMultiples * 0.001) {\r\n // return prevZoomMultiples;\r\n // }\r\n // return prevZoomMultiples - baseZoomMultiples * 0.001;\r\n // }\r\n // return prevZoomMultiples - baseZoomMultiples * 0.01;\r\n // }\r\n }\r\n return zoomIn\r\n ? prevZoomMultiples + baseZoomMultiples * 0.1\r\n : prevZoomMultiples - baseZoomMultiples * 0.1;\r\n}\r\n\r\n/**\r\n * Given a price target corresponding to the abscissa, calculate the abscissa of the point\r\n * The buying impact point is at the left 1/4 position\r\n * The selling impact point is 3/4 on the right\r\n *\r\n * Returns a coordinate point, baseMin and zoomMultiples\r\n *\r\n * Take the initial state as the starting point, that is, midPrice * 10 ^ -1 as the starting point of the horizontal axis, and it is a left-right symmetrical state, that is, the logarithm of the horizontal axis is from -1 -> 0 -> 1\r\n *\r\n * type === 'sell'\r\n * targetPrice = midPrice * 10 ^ n\r\n * n = Math.log10(targetPrice / midPrice)\r\n * n = maxN * (3 / 4)\r\n *\r\n * If the new price is within the existing range, the zoom factor will not be adjusted (the price impact will not change the shape of the graph after graph scaling or translation)\r\n * If it is not within the current interval, check whether it is midPrice * 10 ^-1 and midPrice * 10^1. If you still do not adjust the zoom factor, hit the specified point directly, otherwise you need to adjust the zoom factor (avoid inputting extremely small values) The value cannot be scaled to the specified range, resulting in stuck)\r\n */\r\nexport function computeTargetXByTargetPrice({\r\n type,\r\n targetPrice,\r\n midPrice,\r\n width,\r\n}: {\r\n type: 'buy' | 'sell';\r\n targetPrice: BigNumber;\r\n midPrice: BigNumber;\r\n width: number;\r\n}) {\r\n if (type === 'sell') {\r\n const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));\r\n const maxN = n\r\n .minus(0)\r\n .div(3 / 4)\r\n .abs();\r\n const zoomMultiples = maxN;\r\n\r\n return {\r\n zoomMultiples,\r\n targetX: (width / 2) * (3 / 4) + width / 2,\r\n };\r\n }\r\n\r\n const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));\r\n const maxN = new BigNumber(0)\r\n .minus(n)\r\n .div(3 / 4)\r\n .abs();\r\n const zoomMultiples = maxN;\r\n\r\n return {\r\n zoomMultiples,\r\n targetX: (width / 2) * (1 / 4),\r\n };\r\n}\r\n\r\n/**\r\n * If the new price is within the existing range, the zoom factor will not be adjusted (the price impact will not change the shape of the graph after graph scaling or translation)\r\n * If it is not within the current interval, check whether it is midPrice * 10 ^-1 and midPrice * 10^1. If it is within the range, adjust the zoom factor to 1, and then impact to the specified point, otherwise you need to adjust the zoom factor ( Avoid entering extremely small values ​​that may result in inability to scale to the specified range and cause stucks)\r\n *\r\n * Returns an abscissa and a flag indicating whether to skip\r\n */\r\nexport function beforePriceImpactEffect({\r\n currentBaseMinAndZoomMultiples,\r\n targetPrice,\r\n midPrice,\r\n width,\r\n}: {\r\n currentBaseMinAndZoomMultiples: BaseMinAndZoomMultiples;\r\n targetPrice: BigNumber;\r\n midPrice: BigNumber;\r\n width: number;\r\n}) {\r\n const { baseMin, zoomMultiples } = currentBaseMinAndZoomMultiples;\r\n const minN = new BigNumber(Math.log10(baseMin.div(midPrice).toNumber()));\r\n const maxN = minN.plus(zoomMultiples * 2);\r\n // price maximum\r\n const baseMax = new BigNumber(midPrice.multipliedBy(10 ** maxN.toNumber()));\r\n\r\n if (targetPrice.gte(baseMin) && targetPrice.lte(baseMax)) {\r\n const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));\r\n const targetX = n\r\n .minus(minN)\r\n .div(zoomMultiples * 2)\r\n .multipliedBy(width)\r\n .toNumber();\r\n return {\r\n isSkip: true,\r\n targetX,\r\n baseMin: new BigNumber(0),\r\n zoomMultiples: baseZoomMultiples,\r\n };\r\n }\r\n\r\n // 是否在 midPrice 范围内\r\n const defaultBaseMin = new BigNumber(\r\n midPrice.multipliedBy(10 ** -baseZoomMultiples),\r\n );\r\n const defaultBaseMax = new BigNumber(\r\n midPrice.multipliedBy(10 ** baseZoomMultiples),\r\n );\r\n if (targetPrice.gte(defaultBaseMin) && targetPrice.lte(defaultBaseMax)) {\r\n const n = new BigNumber(Math.log10(targetPrice.div(midPrice).toNumber()));\r\n const targetX = n\r\n .minus(-baseZoomMultiples)\r\n .div(baseZoomMultiples * 2)\r\n .multipliedBy(width)\r\n .toNumber();\r\n return {\r\n isSkip: false,\r\n targetX,\r\n baseMin: defaultBaseMin,\r\n zoomMultiples: baseZoomMultiples,\r\n };\r\n }\r\n\r\n return {\r\n isSkip: false,\r\n targetX: -1,\r\n baseMin: new BigNumber(0),\r\n zoomMultiples: baseZoomMultiples,\r\n };\r\n}\r\n\r\n/**\r\n * Recalculate baseMin after the zoom factor changes\r\n */\r\nexport function computeBaseAfterZoom({\r\n midPrice,\r\n zoomMultiples,\r\n}: {\r\n midPrice: BigNumber;\r\n zoomMultiples: number;\r\n}) {\r\n return midPrice.multipliedBy(10 ** -zoomMultiples);\r\n}\r\n"],"names":["chartT","key","params","i18n","_","id","message","values","0","amountText","1","baseTokenSymbol","2","oppositeAmountText","3","quoteTokenSymbol","4","priceText","5","slippageText","symbol","amount","price","Error","labelPadding","toolTipMarginBottom","chartOffsetYBCToolTip","colorRgb","str","sColor","toLowerCase","reg","test","length","sColorNew","i","slice","concat","sColorChange","push","parseInt","join","evalPoint","val","model","v","isNaN","side","vert","BigNumber","base","quote","Q0","eq","lt","B0","gt","resp","getPriceDepth","baseAmount","quoteAmount","isBuy","computeBaseVert","midPrice","q","q0","pmmModel","baseVert","maximum","B","multipliedBy","buyBaseVert","sellBaseVert","div","computeXPortion","chartWidth","zoomMultiples","updateTooltip","tooltip","x","chartHeight","t","baseMinAndZoomMultiples","isHover","color","leftColor","rightColor","baseMin","xPortion","buyYPortion","sellYPortion","multiplesNum","toNumber","midPriceN","Math","log","minimum","xMidPrice","result","isQuote","yy","formatShortNumber","minus","abs","toFixed","xMidPriceText","toolTipVertLine","findOne","toolTipHoriLine","joinCircle","tooltipLabel","priceTextLabel","slippageTextLabel","y","toolTipText","getText","toolTipTag","getTag","isZeroK","k","lte","midPriceText","tipTextParams","plus","gte","text","hide","textColor","lineColor","fill","width","pointerDirection","pointerHeight","pointerWidth","offsetX","offsetY","points","stroke","priceTextLabelText","height","slippageTextLabelText","show","computeBaseMinByDistance","dragDistance","prevBaseMin","baseZoomMultiples","computeZoomMultiplesWhenZoom","prevZoomMultiples","zoomIn","computeTargetXByTargetPrice","type","targetPrice","n","log10","maxN","targetX","beforePriceImpactEffect","currentBaseMinAndZoomMultiples","minN","baseMax","isSkip","defaultBaseMin","defaultBaseMax","computeBaseAfterZoom"],"mappings":";;;;;;AAEA;AACgB,SAAAA,MAAMA,CAACC,GAAW,EAAEC,MAAW,EAAA;AAC7C,EAAA,QAAQD,GAAG;AACT,IAAA,KAAK,sBAAsB;MACzB,OAAAE,SAAA,CAAAC,CAAA;AAAA;AAAO,MAAA;QAAAC,EAAA,EAAA,QAAA;QAAAC,OAAA,EAAA,0DAAA;QAAAC,MAAA,EAAA;UAAAC,CAAA,EAAcN,MAAM,CAACO,UAAU;UAAAC,CAAA,EAAIR,M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