@dodoex/widgets 3.13.0 → 3.14.1-react.1

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.
Files changed (48) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +70 -70
  3. package/dist/{34acf2e58b457195.svg → 28442382d977858a.svg} +9 -9
  4. package/dist/{219f8611c6c9e6e2.svg → 8de9a184d4ef0a11.svg} +6 -6
  5. package/dist/{44df077bd19df476.svg → b3f16b2626f03378.svg} +10 -10
  6. package/dist/{5c5d298f247819e1.svg → ed726d76d93d4899.svg} +10 -10
  7. package/dist/helper-CQ8Clocj.js +1 -0
  8. package/dist/{helper-BBc2ohzp.cjs → helper-Dzp_C5O7.cjs} +1 -1
  9. package/dist/index-BV7yhAFZ.cjs +78 -0
  10. package/dist/index-CM1znFdK.cjs +12 -0
  11. package/dist/index-CWlMhnOc.js +40 -0
  12. package/dist/index-CdnUu5l1.js +12 -0
  13. package/dist/index-Ci_MIjDG.js +78 -0
  14. package/dist/index-rXrwk4Lb.cjs +40 -0
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/types/components/chart/components/BaseButton.d.ts +1 -1
  18. package/dist/types/components/chart/components/Input.d.ts +1 -1
  19. package/dist/types/components/chart/depth-chart/index.styled.d.ts +11 -6
  20. package/dist/types/components/chart/depth-chart-v2/index.styled.d.ts +8 -3
  21. package/dist/types/components/chart/liquidity-chart/index.styled.d.ts +2 -2
  22. package/dist/types/hooks/Submission/spec.d.ts +0 -1
  23. package/dist/types/hooks/Swap/useForecastSlippageList.d.ts +49 -5
  24. package/dist/types/hooks/Swap/useSwapSlippage.d.ts +49 -5
  25. package/dist/types/hooks/Swap/useTradeSwapOrderList.d.ts +76 -5
  26. package/dist/types/hooks/Token/useTokenListFetchBalance.d.ts +2 -2
  27. package/dist/types/hooks/contract/useFetchETHBalance.d.ts +4 -4
  28. package/dist/types/utils/formatter.d.ts +0 -1
  29. package/dist/types/widgets/MiningWidget/MiningCreate/hooks/useRewardsStatus.d.ts +1 -1
  30. package/dist/types/widgets/MiningWidget/MiningList/hooks/useStatusAndStartBlockNumber.d.ts +3 -3
  31. package/dist/types/widgets/MiningWidget/hooks/useStatusAndStartBlockNumber.d.ts +3 -3
  32. package/dist/types/widgets/PoolWidget/PoolCreate/components/DepthAndLiquidityChart.d.ts +0 -1
  33. package/dist/types/widgets/PoolWidget/PoolCreate/hooks/useCreatePmm.d.ts +1 -1
  34. package/dist/types/widgets/PoolWidget/PoolDetail/hooks/useLiquidityProviders.d.ts +44 -5
  35. package/dist/types/widgets/PoolWidget/PoolDetail/hooks/usePoolDashboard.d.ts +79 -5
  36. package/dist/types/widgets/PoolWidget/PoolDetail/hooks/usePoolDayData.d.ts +49 -5
  37. package/dist/types/widgets/PoolWidget/PoolDetail/hooks/usePoolSwapList.d.ts +65 -5
  38. package/dist/types/widgets/PoolWidget/hooks/usePoolBalanceInfo.d.ts +0 -1
  39. package/dist/types/widgets/PoolWidget/hooks/usePoolDetail.d.ts +93 -5
  40. package/dist/types/widgets/PoolWidget/hooks/useUniV2CreatePairs.d.ts +3 -3
  41. package/package.json +162 -162
  42. package/dist/helper-FLUhm18E.js +0 -1
  43. package/dist/index-C6Oqw6zm.js +0 -78
  44. package/dist/index-CAQP8oNY.cjs +0 -12
  45. package/dist/index-CKZqMWBf.js +0 -40
  46. package/dist/index-CnenhEse.js +0 -12
  47. package/dist/index-DL-6149F.cjs +0 -40
  48. package/dist/index-vajkxsgg.cjs +0 -78
@@ -63,6 +63,7 @@ export declare function usePoolDetail({ id, chainId, }: {
63
63
  isLoadingError: false;
64
64
  isRefetchError: true;
65
65
  isSuccess: false;
66
+ isPlaceholderData: false;
66
67
  status: "error";
67
68
  dataUpdatedAt: number;
68
69
  errorUpdatedAt: number;
@@ -74,11 +75,12 @@ export declare function usePoolDetail({ id, chainId, }: {
74
75
  isFetching: boolean;
75
76
  isInitialLoading: boolean;
76
77
  isPaused: boolean;
77
- isPlaceholderData: boolean;
78
78
  isRefetching: boolean;
79
79
  isStale: boolean;
80
+ isEnabled: boolean;
80
81
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery, Error>>;
81
82
  fetchStatus: import("@tanstack/react-query").FetchStatus;
83
+ promise: Promise<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery>;
82
84
  } | {
83
85
  poolDetail: {
84
86
  address: string;
@@ -139,6 +141,7 @@ export declare function usePoolDetail({ id, chainId, }: {
139
141
  isLoadingError: false;
140
142
  isRefetchError: false;
141
143
  isSuccess: true;
144
+ isPlaceholderData: false;
142
145
  status: "success";
143
146
  dataUpdatedAt: number;
144
147
  errorUpdatedAt: number;
@@ -150,11 +153,12 @@ export declare function usePoolDetail({ id, chainId, }: {
150
153
  isFetching: boolean;
151
154
  isInitialLoading: boolean;
152
155
  isPaused: boolean;
153
- isPlaceholderData: boolean;
154
156
  isRefetching: boolean;
155
157
  isStale: boolean;
158
+ isEnabled: boolean;
156
159
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery, Error>>;
157
160
  fetchStatus: import("@tanstack/react-query").FetchStatus;
161
+ promise: Promise<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery>;
158
162
  } | {
159
163
  poolDetail: {
160
164
  address: string;
@@ -215,6 +219,7 @@ export declare function usePoolDetail({ id, chainId, }: {
215
219
  isLoadingError: true;
216
220
  isRefetchError: false;
217
221
  isSuccess: false;
222
+ isPlaceholderData: false;
218
223
  status: "error";
219
224
  dataUpdatedAt: number;
220
225
  errorUpdatedAt: number;
@@ -226,11 +231,12 @@ export declare function usePoolDetail({ id, chainId, }: {
226
231
  isFetching: boolean;
227
232
  isInitialLoading: boolean;
228
233
  isPaused: boolean;
229
- isPlaceholderData: boolean;
230
234
  isRefetching: boolean;
231
235
  isStale: boolean;
236
+ isEnabled: boolean;
232
237
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery, Error>>;
233
238
  fetchStatus: import("@tanstack/react-query").FetchStatus;
239
+ promise: Promise<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery>;
234
240
  } | {
235
241
  poolDetail: {
236
242
  address: string;
@@ -291,6 +297,7 @@ export declare function usePoolDetail({ id, chainId, }: {
291
297
  isLoadingError: false;
292
298
  isRefetchError: false;
293
299
  isSuccess: false;
300
+ isPlaceholderData: false;
294
301
  status: "pending";
295
302
  dataUpdatedAt: number;
296
303
  errorUpdatedAt: number;
@@ -302,11 +309,12 @@ export declare function usePoolDetail({ id, chainId, }: {
302
309
  isFetching: boolean;
303
310
  isInitialLoading: boolean;
304
311
  isPaused: boolean;
305
- isPlaceholderData: boolean;
306
312
  isRefetching: boolean;
307
313
  isStale: boolean;
314
+ isEnabled: boolean;
308
315
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery, Error>>;
309
316
  fetchStatus: import("@tanstack/react-query").FetchStatus;
317
+ promise: Promise<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery>;
310
318
  } | {
311
319
  poolDetail: {
312
320
  address: string;
@@ -366,6 +374,7 @@ export declare function usePoolDetail({ id, chainId, }: {
366
374
  isLoadingError: false;
367
375
  isRefetchError: false;
368
376
  isSuccess: false;
377
+ isPlaceholderData: false;
369
378
  status: "pending";
370
379
  dataUpdatedAt: number;
371
380
  errorUpdatedAt: number;
@@ -378,9 +387,88 @@ export declare function usePoolDetail({ id, chainId, }: {
378
387
  isLoading: boolean;
379
388
  isInitialLoading: boolean;
380
389
  isPaused: boolean;
381
- isPlaceholderData: boolean;
382
390
  isRefetching: boolean;
383
391
  isStale: boolean;
392
+ isEnabled: boolean;
384
393
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery, Error>>;
385
394
  fetchStatus: import("@tanstack/react-query").FetchStatus;
395
+ promise: Promise<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery>;
396
+ } | {
397
+ poolDetail: {
398
+ address: string;
399
+ type: PoolType;
400
+ chainId: ChainId;
401
+ baseToken: TokenInfo;
402
+ quoteToken: TokenInfo;
403
+ miningAddress: string;
404
+ apy: {
405
+ miningBaseApy?: any | null;
406
+ miningQuoteApy?: any | null;
407
+ transactionBaseApy?: any | null;
408
+ transactionQuoteApy?: any | null;
409
+ metromMiningApy?: any | null;
410
+ } | null | undefined;
411
+ baseApy: string | undefined;
412
+ quoteApy: string | undefined;
413
+ isCpPool: boolean;
414
+ cpAddress: string | undefined;
415
+ cpLiquidator: string | undefined;
416
+ cpCreator: string | undefined;
417
+ cpCreatedAtTimestamp: string | undefined;
418
+ id: string;
419
+ creator: any;
420
+ owner?: any | null;
421
+ traderCount: any;
422
+ volumeBaseToken: any;
423
+ volumeQuoteToken: any;
424
+ volumeUSD: any;
425
+ feeBase: any;
426
+ feeQuote: any;
427
+ mtFeeRate: any;
428
+ lpFeeRate: any;
429
+ i?: any | null;
430
+ k?: any | null;
431
+ baseReserve: any;
432
+ quoteReserve: any;
433
+ createdAtTimestamp: any;
434
+ lastTradePrice: any;
435
+ baseLpToken?: {
436
+ id: string;
437
+ symbol: string;
438
+ name: string;
439
+ decimals: any;
440
+ } | null;
441
+ quoteLpToken?: {
442
+ id: string;
443
+ symbol: string;
444
+ name: string;
445
+ decimals: any;
446
+ } | null;
447
+ } | null;
448
+ data: import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery;
449
+ isError: false;
450
+ error: null;
451
+ isPending: false;
452
+ isLoading: false;
453
+ isLoadingError: false;
454
+ isRefetchError: false;
455
+ isSuccess: true;
456
+ isPlaceholderData: true;
457
+ status: "success";
458
+ dataUpdatedAt: number;
459
+ errorUpdatedAt: number;
460
+ failureCount: number;
461
+ failureReason: Error | null;
462
+ errorUpdateCount: number;
463
+ isFetched: boolean;
464
+ isFetchedAfterMount: boolean;
465
+ isFetching: boolean;
466
+ isInitialLoading: boolean;
467
+ isPaused: boolean;
468
+ isRefetching: boolean;
469
+ isStale: boolean;
470
+ isEnabled: boolean;
471
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery, Error>>;
472
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
473
+ promise: Promise<import("@dodoex/api/dist/types/gql/graphql").FetchPoolQuery>;
386
474
  };
@@ -9,10 +9,10 @@ export declare function useUniV2CreatePairs({ baseToken, quoteToken, baseAmount,
9
9
  pairAddress: string | undefined;
10
10
  pair: import("@uniswap/v2-sdk").Pair | null;
11
11
  isInvalidPair: boolean;
12
- price: import("bignumber.js").BigNumber | undefined;
13
- invertedPrice: import("bignumber.js").BigNumber | undefined;
12
+ price: BigNumber | undefined;
13
+ invertedPrice: BigNumber | undefined;
14
14
  priceLoading: boolean;
15
- liquidityMinted: import("bignumber.js").BigNumber | undefined;
15
+ liquidityMinted: BigNumber | undefined;
16
16
  shareOfPool: string;
17
17
  isExists: boolean;
18
18
  };
package/package.json CHANGED
@@ -1,162 +1,162 @@
1
- {
2
- "name": "@dodoex/widgets",
3
- "version": "3.13.0",
4
- "description": "DODO Widgets",
5
- "source": "src/index.tsx",
6
- "types": "dist/types/index.d.ts",
7
- "main": "dist/index.cjs",
8
- "module": "dist/index.js",
9
- "license": "GPL-3.0-or-later",
10
- "homepage": "https://github.com/DODOEX/widgets#readme",
11
- "repository": "https://github.com/DODOEX/widgets",
12
- "files": [
13
- "dist"
14
- ],
15
- "scripts": {
16
- "prepare": "yarn compile:i18n",
17
- "extract:i18n": "lingui extract --clean",
18
- "compile:i18n": "yarn extract:i18n && lingui compile",
19
- "sync:i18n": "export $(cat .env | xargs) && env lingui extract --overwrite && lingui compile",
20
- "watch": "yarn run rollup -c --watch",
21
- "build": "yarn compile:i18n && rollup --config",
22
- "prerelease": "yarn run build",
23
- "release": "semantic-release",
24
- "release:local": "np --any-branch --no-cleanup --no-tests",
25
- "release.npm-publish": "npm publish --access public",
26
- "release.npm-publish-beta": "npm publish --tag beta",
27
- "test": "jest src",
28
- "test:e2e": "jest e2e"
29
- },
30
- "author": "",
31
- "publishConfig": {
32
- "access": "public",
33
- "registry": "https://registry.npmjs.org"
34
- },
35
- "exports": {
36
- ".": {
37
- "types": "./dist/types/index.d.ts",
38
- "import": "./dist/index.js",
39
- "require": "./dist/index.cjs"
40
- }
41
- },
42
- "keywords": [
43
- "dodo",
44
- "widgets",
45
- "interfaces"
46
- ],
47
- "browserslist": {
48
- "production": [
49
- ">0.2%",
50
- "not dead",
51
- "not op_mini all"
52
- ],
53
- "development": [
54
- "last 1 chrome version",
55
- "last 1 firefox version",
56
- "last 1 safari version"
57
- ]
58
- },
59
- "dependencies": {
60
- "@babel/runtime": "^7.17.0",
61
- "@dodoex/api": "3.5.0",
62
- "@dodoex/components": "^3.2.0",
63
- "@dodoex/contract-request": "^1.3.0",
64
- "@dodoex/dodo-contract-request": "^1.32.0",
65
- "@dodoex/icons": "^2.1.0",
66
- "@emotion/react": "^11.10.0",
67
- "@emotion/styled": "^11.10.0",
68
- "@ethersproject/bignumber": "^5.6.2",
69
- "@ethersproject/contracts": "^5.7.0",
70
- "@lingui/core": "^5.7.0",
71
- "@lingui/macro": "^5.7.0",
72
- "@lingui/react": "^5.7.0",
73
- "@reduxjs/toolkit": "^1.6.1",
74
- "@semantic-release/changelog": "^6.0.1",
75
- "@semantic-release/git": "^10.0.1",
76
- "@tanstack/react-query": "^5.18.1",
77
- "@uniswap/sdk-core": "^5.9.0",
78
- "@uniswap/v2-sdk": "^4.6.2",
79
- "@web3-react/core": "8.2.0",
80
- "@web3-react/eip1193": "8.2.0",
81
- "@web3-react/metamask": "8.2.1",
82
- "@web3-react/types": "8.2.0",
83
- "@web3-react/walletconnect-v2": "8.3.6",
84
- "axios": "^0.27.2",
85
- "bignumber.js": "^9.0.2",
86
- "d3": "7.6.1",
87
- "dayjs": "^1.11.11",
88
- "identicon.js": "^2.3.3",
89
- "jsbi": "^3.1.4",
90
- "konva": "^9.3.15",
91
- "lodash": "^4.17.21",
92
- "make-plural": "^7.0.0",
93
- "moment": "^2.29.4",
94
- "react-datetime": "^3.3.0",
95
- "react-icons": "^5.0.1",
96
- "react-infinite-scroller": "^1.2.6",
97
- "react-konva": "^19.0.0",
98
- "react-transition-group": "^4.4.5",
99
- "react-window": "^1.8.11",
100
- "recharts": "^2.15.0",
101
- "rmc-date-picker": "^6.0.10",
102
- "tiny-invariant": "^1.1.0",
103
- "zustand": "^4.5.5"
104
- },
105
- "peerDependencies": {
106
- "@babel/runtime": ">=7.17.0",
107
- "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
108
- "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
109
- },
110
- "peerDependenciesMeta": {
111
- "react-infinite-scroller": {
112
- "optional": true
113
- }
114
- },
115
- "devDependencies": {
116
- "@babel/preset-env": "^7.16.11",
117
- "@babel/preset-react": "^7.18.6",
118
- "@babel/preset-typescript": "^7.16.7",
119
- "@lingui/cli": "^5.7.0",
120
- "@nomicfoundation/hardhat-network-helpers": "^1.0.6",
121
- "@nomiclabs/hardhat-ethers": "^2.1.1",
122
- "@rollup/plugin-babel": "^6.0.4",
123
- "@rollup/plugin-commonjs": "^26.0.1",
124
- "@rollup/plugin-json": "^6.1.0",
125
- "@rollup/plugin-multi-entry": "^6.0.1",
126
- "@rollup/plugin-replace": "^5.0.7",
127
- "@rollup/plugin-terser": "^0.4.4",
128
- "@rollup/plugin-typescript": "^12.1.1",
129
- "@rollup/plugin-url": "^8.0.2",
130
- "@svgr/rollup": "^6.2.1",
131
- "@testing-library/jest-dom": "^6.5.0",
132
- "@testing-library/react": "^16.0.1",
133
- "@testing-library/react-hooks": "^8.0.1",
134
- "@types/d3": "7.4.3",
135
- "@types/identicon.js": "^2.3.1",
136
- "@types/jest": "^29.0.3",
137
- "@types/lodash": "^4.14.184",
138
- "@types/react-infinite-scroller": "^1.2.5",
139
- "@types/react-transition-group": "^4.4.11",
140
- "@types/react-window": "^1.8.5",
141
- "babel-plugin-macros": "^3.1.0",
142
- "babel-runtime": "^6.26.0",
143
- "dotenv": "^16.0.2",
144
- "ethers": "^5.7.1",
145
- "gettext-parser": "^8.0.0",
146
- "hardhat": "^2.22.13",
147
- "identity-obj-proxy": "^3.0.0",
148
- "jest": "^29.0.3",
149
- "jest-environment-hardhat": "^1.1.9",
150
- "jest-environment-jsdom": "^29.0.3",
151
- "np": "^7.6.1",
152
- "rollup": "^4.18.0",
153
- "rollup-plugin-clear": "^2.0.7",
154
- "rollup-plugin-import-css": "^3.5.5",
155
- "svg-jest": "^1.0.1",
156
- "ts-jest": "^29.0.1",
157
- "typescript": "^5.6.3"
158
- },
159
- "optionalDependencies": {
160
- "pino-pretty": "^13.1.3"
161
- }
162
- }
1
+ {
2
+ "name": "@dodoex/widgets",
3
+ "version": "3.14.1-react.01",
4
+ "description": "DODO Widgets",
5
+ "source": "src/index.tsx",
6
+ "types": "dist/types/index.d.ts",
7
+ "main": "dist/index.cjs",
8
+ "module": "dist/index.js",
9
+ "license": "GPL-3.0-or-later",
10
+ "homepage": "https://github.com/DODOEX/widgets#readme",
11
+ "repository": "https://github.com/DODOEX/widgets",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "prepare": "yarn compile:i18n",
17
+ "extract:i18n": "lingui extract --clean",
18
+ "compile:i18n": "yarn extract:i18n && lingui compile",
19
+ "sync:i18n": "export $(cat .env | xargs) && env lingui extract --overwrite && lingui compile",
20
+ "watch": "yarn run rollup -c --watch",
21
+ "build": "yarn compile:i18n && rollup --config",
22
+ "prerelease": "yarn run build",
23
+ "release": "semantic-release",
24
+ "release:local": "np --any-branch --no-cleanup --no-tests",
25
+ "release.npm-publish": "npm publish --access public",
26
+ "release.npm-publish-beta": "npm publish --tag beta",
27
+ "test": "jest src",
28
+ "test:e2e": "jest e2e"
29
+ },
30
+ "author": "",
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/types/index.d.ts",
38
+ "import": "./dist/index.js",
39
+ "require": "./dist/index.cjs"
40
+ }
41
+ },
42
+ "keywords": [
43
+ "dodo",
44
+ "widgets",
45
+ "interfaces"
46
+ ],
47
+ "browserslist": {
48
+ "production": [
49
+ ">0.2%",
50
+ "not dead",
51
+ "not op_mini all"
52
+ ],
53
+ "development": [
54
+ "last 1 chrome version",
55
+ "last 1 firefox version",
56
+ "last 1 safari version"
57
+ ]
58
+ },
59
+ "dependencies": {
60
+ "@babel/runtime": "^7.17.0",
61
+ "@dodoex/api": "3.5.1-react.01",
62
+ "@dodoex/components": "^3.2.1-react.01",
63
+ "@dodoex/contract-request": "^1.3.0",
64
+ "@dodoex/dodo-contract-request": "^1.32.0",
65
+ "@dodoex/icons": "^2.1.0",
66
+ "@emotion/react": "^11.10.0",
67
+ "@emotion/styled": "^11.10.0",
68
+ "@ethersproject/bignumber": "^5.6.2",
69
+ "@ethersproject/contracts": "^5.7.0",
70
+ "@lingui/core": "^5.7.0",
71
+ "@lingui/macro": "^5.7.0",
72
+ "@lingui/react": "^5.7.0",
73
+ "@reduxjs/toolkit": "^1.6.1",
74
+ "@semantic-release/changelog": "^6.0.1",
75
+ "@semantic-release/git": "^10.0.1",
76
+ "@tanstack/react-query": "^5.18.1",
77
+ "@uniswap/sdk-core": "^5.9.0",
78
+ "@uniswap/v2-sdk": "^4.6.2",
79
+ "@web3-react/core": "8.2.0",
80
+ "@web3-react/eip1193": "8.2.0",
81
+ "@web3-react/metamask": "8.2.1",
82
+ "@web3-react/types": "8.2.0",
83
+ "@web3-react/walletconnect-v2": "8.3.6",
84
+ "axios": "^0.27.2",
85
+ "bignumber.js": "^9.0.2",
86
+ "d3": "7.6.1",
87
+ "dayjs": "^1.11.11",
88
+ "identicon.js": "^2.3.3",
89
+ "jsbi": "^3.1.4",
90
+ "konva": "^9.3.15",
91
+ "lodash": "^4.17.21",
92
+ "make-plural": "^7.0.0",
93
+ "moment": "^2.29.4",
94
+ "react-datetime": "^3.3.0",
95
+ "react-icons": "^5.0.1",
96
+ "react-infinite-scroller": "^1.2.6",
97
+ "react-konva": "^19.0.0",
98
+ "react-transition-group": "^4.4.5",
99
+ "react-window": "^1.8.11",
100
+ "recharts": "^2.15.0",
101
+ "rmc-date-picker": "^6.0.10",
102
+ "tiny-invariant": "^1.1.0",
103
+ "zustand": "^4.5.5"
104
+ },
105
+ "peerDependencies": {
106
+ "@babel/runtime": ">=7.17.0",
107
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
108
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
109
+ },
110
+ "peerDependenciesMeta": {
111
+ "react-infinite-scroller": {
112
+ "optional": true
113
+ }
114
+ },
115
+ "devDependencies": {
116
+ "@babel/preset-env": "^7.16.11",
117
+ "@babel/preset-react": "^7.18.6",
118
+ "@babel/preset-typescript": "^7.16.7",
119
+ "@lingui/cli": "^5.7.0",
120
+ "@nomicfoundation/hardhat-network-helpers": "^1.0.6",
121
+ "@nomiclabs/hardhat-ethers": "^2.1.1",
122
+ "@rollup/plugin-babel": "^6.0.4",
123
+ "@rollup/plugin-commonjs": "^26.0.1",
124
+ "@rollup/plugin-json": "^6.1.0",
125
+ "@rollup/plugin-multi-entry": "^6.0.1",
126
+ "@rollup/plugin-replace": "^5.0.7",
127
+ "@rollup/plugin-terser": "^0.4.4",
128
+ "@rollup/plugin-typescript": "^12.1.1",
129
+ "@rollup/plugin-url": "^8.0.2",
130
+ "@svgr/rollup": "^6.2.1",
131
+ "@testing-library/jest-dom": "^6.5.0",
132
+ "@testing-library/react": "^16.0.1",
133
+ "@testing-library/react-hooks": "^8.0.1",
134
+ "@types/d3": "7.4.3",
135
+ "@types/identicon.js": "^2.3.1",
136
+ "@types/jest": "^29.0.3",
137
+ "@types/lodash": "^4.14.184",
138
+ "@types/react-infinite-scroller": "^1.2.5",
139
+ "@types/react-transition-group": "^4.4.11",
140
+ "@types/react-window": "^1.8.5",
141
+ "babel-plugin-macros": "^3.1.0",
142
+ "babel-runtime": "^6.26.0",
143
+ "dotenv": "^16.0.2",
144
+ "ethers": "^5.7.1",
145
+ "gettext-parser": "^8.0.0",
146
+ "hardhat": "^2.22.13",
147
+ "identity-obj-proxy": "^3.0.0",
148
+ "jest": "^29.0.3",
149
+ "jest-environment-hardhat": "^1.1.9",
150
+ "jest-environment-jsdom": "^29.0.3",
151
+ "np": "^7.6.1",
152
+ "rollup": "^4.18.0",
153
+ "rollup-plugin-clear": "^2.0.7",
154
+ "rollup-plugin-import-css": "^3.5.5",
155
+ "svg-jest": "^1.0.1",
156
+ "ts-jest": "^29.0.1",
157
+ "typescript": "^5.6.3"
158
+ },
159
+ "optionalDependencies": {
160
+ "pino-pretty": "^13.1.3"
161
+ }
162
+ }
@@ -1 +0,0 @@
1
- import{i18n as e}from"@lingui/core";import t from"bignumber.js";import{f as i}from"./index-CKZqMWBf.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};
@@ -1,78 +0,0 @@
1
- import e from"bignumber.js";import{merge as t,throttle as i,debounce as o}from"lodash";import r,{useEffect as n,useMemo as l,useRef as s,useState as a}from"react";import d from"@emotion/styled";import{css as c}from"@emotion/react";import{Stage as u,Layer as p,Rect as m,Line as g,Text as h,Circle as b,Label as f,Tag as M}from"react-konva";import{c as x,e as v,a as y,b as P,d as j,f as w,u as z,g as L,h as k,l as B,i as C,j as S,k as N}from"./helper-FLUhm18E.js";import{f as O,j as X,a as T,b as A}from"./index-CKZqMWBf.js";import{solveQuadraticFunctionForTarget as q,PMMModel as W}from"@dodoex/api";import"@lingui/core";import"@dodoex/components";import"@dodoex/dodo-contract-request";import"@lingui/react";import"identicon.js";import"zustand";import"@web3-react/core";import"@web3-react/eip1193";import"@web3-react/walletconnect-v2";import"@web3-react/metamask";import"@web3-react/types";import"@tanstack/react-query";import"@ethersproject/bignumber";import"react-dom";import"react-window";import"dayjs";import"react-transition-group";import"@dodoex/contract-request";import"axios";import"recharts";import"jsbi";import"tiny-invariant";import"@uniswap/sdk-core";import"@uniswap/v2-sdk";import"react-infinite-scroller";import"d3";import"rmc-date-picker";var E={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},F=r.createContext&&r.createContext(E),H=["attr","size","title"];function Z(e,t){if(null==e)return{};var i,o,r=function(e,t){if(null==e)return{};var i,o,r={},n=Object.keys(e);for(o=0;o<n.length;o++)i=n[o],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)i=n[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},G.apply(this,arguments)}function D(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function J(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?D(Object(i),!0).forEach((function(t){V(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):D(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function V(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){return e&&e.map(((e,t)=>r.createElement(e.tag,J({key:t},e.attr),Y(e.child))))}function I(e){return t=>r.createElement(R,G({attr:J({},e.attr)},t),Y(e.child))}function R(e){var t=t=>{var i,{attr:o,size:n,title:l}=e,s=Z(e,H),a=n||t.size||"1em";return t.className&&(i=t.className),e.className&&(i=(i?i+" ":"")+e.className),r.createElement("svg",G({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,o,s,{className:i,style:J(J({color:e.color||t.color},t.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&r.createElement("title",null,l),e.children)};return void 0!==F?r.createElement(F.Consumer,null,(e=>t(e))):t(E)}function $(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M13.293 6.293 7.586 12l5.707 5.707 1.414-1.414L10.414 12l4.293-4.293z"},child:[]}]})(e)}function Q(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10.707 17.707 16.414 12l-5.707-5.707-1.414 1.414L13.586 12l-4.293 4.293z"},child:[]}]})(e)}function K(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5 11h14v2H5z"},child:[]}]})(e)}function U(e){return I({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z"},child:[]}]})(e)}const _=d.input`
2
- margin: 4px 10px 4px 6px;
3
- border-radius: 10px;
4
- border: 1px solid #373739;
5
- padding: 4px 9px;
6
- background-color: #1a1a1b;
7
- color: #ffffff;
8
- font-size: 14px;
9
- font-weight: 400;
10
- line-height: 20px;
11
- outline: none;
12
- width: 96px;
13
- &:focus {
14
- border-color: #fff;
15
-
16
- ${({error:e})=>e&&c`
17
- border-color: red;
18
- `}
19
- }
20
- `;const ee="rgba(38, 39, 41, 0.3)";function te({width:o,height:r,midPrice:a,pmmModel:d,params:c,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,colorMap:T,setBaseMinAndZoomMultiples:A}){const q=t({grid:"#2A2A2D",midPriceLine:"#313335",leftBg:[0,ee,1,"#31645d"],leftLine:"#55f6db",leftColor:"",rightBg:[0,ee,1,"#67303d"],rightLine:"#ff4f73",rightColor:"",tooltipBg:"#121212",tooltipColor:void 0},T),W=o,E=r-18,F=W/7,{buyBaseVert:H,sellBaseVert:Z}=y({midPrice:a,q:c.q,q0:c.q0,pmmModel:d}),G=H.div(E),D=Z.div(E),J=s(null),V=s(null),{current:Y}=J,I=s(0),R=s(),{horizontalGridLines:$,verticalGridLines:Q}=function({chartHeight:e,chartWidth:t,horizontalLineCount:i,verticalLineCount:o}){return l((()=>{const r=[],n=e/(i+1),l=[],s=t/o;for(let e=0;e<i;e++){const i=n*(e+1);r.push([0,i,t,i])}for(let t=0;t<o;t++){const i=s*t+s/2;l.push([i,0,i,e])}return{horizontalGridLines:r,verticalGridLines:l}}),[e,t,i,o])}({chartHeight:E,chartWidth:W,horizontalLineCount:9,verticalLineCount:7}),{horizontalLabelTickPoints:K,horizontalLabelTextPoints:U}=function({chartHeight:e,chartWidth:t,xAxisPoints:i,oneXPx:o,baseMinAndZoomMultiples:r}){return l((()=>{const n=x(t,r.zoomMultiples),l=[],s=[];for(let t=0;t<i;t++){l.push([t*o+o/2,e,t*o+o/2,e+4]);const i=n.multipliedBy(t).multipliedBy(o).plus(n.multipliedBy(o/2)).toNumber(),a=r.baseMin.multipliedBy(10**i),d=t*o,c=e+2+4,u=O(a);s.push({x:d,y:c,text:u})}return{horizontalLabelTickPoints:l,horizontalLabelTextPoints:s}}),[r.baseMin,r.zoomMultiples,e,t,o,i])}({chartHeight:E,chartWidth:W,xAxisPoints:7,oneXPx:F,baseMinAndZoomMultiples:N}),{quoteLinePoints:_,quoteLineAreaPoints:te,quoteLineAreaLinearGradientEndPointY:ie,baseLinePoints:oe,baseLineAreaPoints:re,baseLineAreaLinearGradientEndPointY:ne,midPriceLinePoints:le}=function({chartHeight:t,chartWidth:i,midPrice:o,xPoints:r,pmmModel:n,baseMinAndZoomMultiples:s,buyYPortion:a,sellYPortion:d}){return l((()=>{const l=[],c=[],u=[],{baseMin:p,zoomMultiples:m}=s,g=x(i,m),h=2*m,b=new e(h).div(r);let f=new e(Math.log(o.div(p).toNumber())/Math.log(10));f=e.minimum(h,f),f=e.maximum(0,f);for(let i=new e(0);i.lte(f);){const e=p.multipliedBy(10**i.toNumber()),r=v({val:e,model:n,midPrice:o});if(!r.vert.isNaN()){const e=i.div(g).toNumber(),o=t-r.vert.div(a).toNumber();l.push(e,o)}i=i.plus(b)}for(let e=f;e.lte(h);){const i=p.multipliedBy(10**e.toNumber()),r=v({val:i,model:n,midPrice:o});if(!r.vert.isNaN()){const i=e.div(g).toNumber(),o=t-r.vert.div(d).toNumber();c.push(i,o)}e=e.plus(b)}const M=f.div(g).toNumber(),[,y]=l,P=n.k.eq(0);P&&l.push(M,y||t),l.push(M,t),u.push(M,t,M,0);const j=v({val:p.multipliedBy(10**h),model:n,midPrice:o});let w=t;const z=new e(h).div(g).toNumber();return j.vert.isNaN()||(w=t-j.vert.div(d).toNumber()),P&&c.length>=2&&(c.unshift(M,w),c.unshift(M,t)),c.push(z,w),f.lte(0)&&c.unshift(0,t),{quoteLinePoints:l,quoteLineAreaPoints:[0,t,0,y,...l],quoteLineAreaLinearGradientEndPointY:y,baseLinePoints:c,baseLineAreaPoints:[...c,z,t],baseLineAreaLinearGradientEndPointY:w,midPriceLinePoints:u}}),[s,i,r,o,n,t,a,d])}({chartHeight:E,chartWidth:W,midPrice:a,xPoints:50,pmmModel:d,baseMinAndZoomMultiples:N,buyYPortion:G,sellYPortion:D}),se=e=>{var t;const i=e.target;if(i&&Y){const e=null===(t=i.getStage())||void 0===t?void 0:t.getPointerPosition();if(e){const{x:t}=e;if(t>W)return void Y.hide();z({x:t,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}}},ae=l((()=>i((e=>{const{target:t}=e,i=t.getStage();if(i){i.container().style.cursor="grabbing";const e=null==i?void 0:i.getPointerPosition();if(e){const t=e.x-I.current;I.current=e.x,R.current=e.x,A((e=>void 0===e.baseMin?e:{baseMin:P({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:W,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:0}))}}}),100)),[W,A]),de=l((()=>i((e=>{e.cancelBubble=!0,e.evt.preventDefault();const t=e.evt.deltaY<0;A((e=>{const i=j({zoomIn:t,prevZoomMultiples:e.zoomMultiples});return{baseMin:w({midPrice:a,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:e.targetMarginPriceX}}))}),100)),[a,A]);return n((()=>{N.targetMarginPriceX>0&&null!==Y?z({x:N.targetMarginPriceX,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine}):void 0!==R.current&&null!==Y&&z({x:R.current,tooltip:Y,buyBaseVert:H,sellBaseVert:Z,chartWidth:W,chartHeight:E,midPrice:a,pmmModel:d,baseTokenSymbol:C,quoteTokenSymbol:S,baseMinAndZoomMultiples:N,t:L,isHover:!0,color:q.tooltipColor,leftColor:q.leftLine,rightColor:q.rightLine})}),[N,C,H,E,W,q.leftLine,q.rightLine,q.tooltipColor,a,d,S,Z,Y]),X.jsxs(u,{ref:V,width:o,offsetY:-k,height:r+k,draggable:!0,dragBoundFunc:function(){return{x:this.absolutePosition().x,y:this.absolutePosition().y}},onMouseMove:se,onMouseOver:se,onMouseOut:()=>{Y&&Y.hide()},onDragStart:function(e){const{target:t}=e,i=t.getStage();if(i){const e=i.getPointerPosition();e&&(I.current=e.x)}},onDragMove:ae,onDragEnd:e=>{const{target:t}=e,i=t.getStage();i&&(i.container().style.cursor="pointer")},onWheel:de,children:[X.jsxs(p,{children:[X.jsx(m,{x:0,y:0,width:o,height:E,stroke:q.grid,strokeWidth:1}),$.map(((e,t)=>X.jsx(g,{points:e,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),Q.map(((e,t)=>X.jsx(g,{points:e,stroke:q.grid,strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),K.map(((e,t)=>X.jsx(g,{points:e,stroke:"#9d9d9d",strokeWidth:1,lineCap:"round",lineJoin:"round",listening:!1},t))),U.map(((e,t)=>X.jsx(h,{x:e.x,y:e.y,text:e.text,fontFamily:"Manrope",fontSize:12,fill:"#9d9d9d",width:F,padding:0,align:"center",verticalAlign:"bottom",listening:!1},t))),X.jsx(g,{points:te,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:0,y:E},fillLinearGradientEndPoint:{x:0,y:ie},fillLinearGradientColorStops:q.leftBg}),X.jsx(g,{points:_,stroke:q.leftLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.jsx(g,{points:re,closed:!0,listening:!1,lineCap:"round",lineJoin:"round",fillLinearGradientStartPoint:{x:W,y:E},fillLinearGradientEndPoint:{x:W,y:ne},fillLinearGradientColorStops:q.rightBg}),X.jsx(g,{points:oe,stroke:q.rightLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1}),X.jsx(g,{points:le,stroke:q.midPriceLine,strokeWidth:2,lineCap:"round",lineJoin:"round",listening:!1})]}),X.jsxs(p,{ref:J,visible:!1,listening:!1,children:[X.jsx(g,{points:[],stroke:"#ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipVertLine"}),X.jsx(g,{points:[],stroke:"ff4f73",strokeWidth:1,lineCap:"round",lineJoin:"round",dash:[4,6],id:"toolTipHoriLine"}),X.jsx(b,{x:0,y:0,radius:5,fill:"#FF5072",stroke:"rgba(255, 80, 114, 0.3)",strokeWidth:12,id:"joinCircle"}),X.jsxs(f,{x:0,y:0,id:"priceTextLabel",children:[X.jsx(M,{fill:q.tooltipBg,id:"priceTextLabel-tag"}),X.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"priceTextLabel-text"})]}),X.jsxs(f,{x:0,y:0,id:"slippageTextLabel",children:[X.jsx(M,{fill:q.tooltipBg,id:"slippageTextLabel-tag"}),X.jsx(h,{text:"",fontSize:12,fontFamily:"Manrope",padding:4,fill:"#FF5072",id:"slippageTextLabel-text"})]}),X.jsxs(f,{x:0,y:0,id:"toolTip",children:[X.jsx(M,{fill:q.tooltipBg,pointerDirection:"down",pointerWidth:15,pointerHeight:8,cornerRadius:8,lineJoin:"round",id:"toolTip-tag"}),X.jsx(h,{text:"-",fontSize:12,lineHeight:17/12,padding:B,fontFamily:"Manrope",fill:"#FFFFFF",id:"toolTip-text"})]})]})]})}const ie=d.button`
21
- margin: 0;
22
- border: none;
23
- padding: 0;
24
- background: none;
25
-
26
- &:focus {
27
- outline: none;
28
- }
29
- &:active {
30
- outline: none;
31
- }
32
- `,oe=d.div`
33
- height: 100%;
34
- `,re=d.div`
35
- display: flex;
36
- align-items: center;
37
- `,ne=d.div`
38
- border: 1px solid ${({borderColor:e})=>e||"#2a2a2d"};
39
- flex: 1 0 50%;
40
-
41
- display: flex;
42
- align-items: center;
43
- justify-content: center;
44
- font-size: 12px;
45
- font-weight: 400;
46
- line-height: 17px;
47
- color: #606066;
48
-
49
- & + & {
50
- border-left: none;
51
- }
52
- `,le=d.span`
53
- color: #85858d;
54
- `,se=d.div`
55
- margin-top: 20px;
56
- display: flex;
57
- justify-content: center;
58
- margin-bottom: 9px;
59
- `,ae=d(ie)`
60
- border-radius: 13px;
61
- background-color: #373739;
62
- width: 24px;
63
- height: 24px;
64
- font-size: 18px;
65
- color: #85858d;
66
- line-height: 0;
67
- & + & {
68
- margin-left: 10px;
69
- }
70
- &:first-child,
71
- &:last-child {
72
- font-size: 20px;
73
- }
74
-
75
- &:hover {
76
- color: #fff;
77
- }
78
- `;function de({params:t,target:i,isBuy:o=!0}){const r=new e(t.b),n=new e(t.q);let l=new e(t.b0);const s=new e(t.q0),a=new e(t.i),d=new e(t.k),{R:c}=t;1===c&&l.eq(r)&&(l=q(r,n.minus(s),new e(1).div(a),d));const u=o?r.plus(i):r.minus(i);if(u.lt(l)||r.eq(l)){let t=l.multipliedBy(l).div(u).div(u);return t=new e(1).minus(d).plus(d.multipliedBy(t)),a.multipliedBy(t)}const p=new W;p.RStatus=c,p.B=r,p.B0=l,p.Q=n,p.Q0=s,p.i=a,p.k=d,p.mtFeeRate=new e(0),p.lpFeeRate=new e(0);let m=new e(0);m=o?p.querySellBase(i):p.queryBuyBase(i);const g=o?n.minus(m):n.plus(m);let h=s.multipliedBy(s).div(g).div(g);return h=new e(1).minus(d).plus(d.multipliedBy(h)),a.div(h)}const ce=({chartId:t,width:i=834,height:r=460,baseTokenSymbol:s,quoteTokenSymbol:d,pmmModel:c,pmmParams:u,midPrice:p=new e(0),colorMap:m,notShowAmountInput:g})=>{(({id:e})=>{n((()=>{function t(e){e.preventDefault()}let i=!1;try{const e={get passive(){return i=!0,!1}};window.addEventListener("test",(()=>{}),e),window.removeEventListener("test",(()=>{}))}catch(e){i=!1}const o=document.getElementById(e),r=!!i&&{passive:!1};return null==o||o.addEventListener("wheel",t,r),()=>{null==o||o.removeEventListener("wheel",t)}}),[e])})({id:t});const[h,b]=a(""),[f,M]=a(""),[x,v]=a("-"),[y,z]=a("-"),[k,B]=a({baseMin:new e(0),zoomMultiples:C,targetMarginPriceX:0});n((()=>{void 0!==p&&B((e=>({baseMin:w({midPrice:p,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX})))}),[p]);const O=l((()=>o((({type:t,amount:o})=>{""===o&&p&&(B({baseMin:w({midPrice:p,zoomMultiples:C}),zoomMultiples:C,targetMarginPriceX:0}),"buy"===t?v("-"):z("-"));const r=new e(o);if(!r.lte(0)&&!r.isNaN()&&(null==u?void 0:u.b)&&!r.gte(u.b)&&p)if("buy"===t){const e=de({params:u,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:e,midPrice:p,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:p,width:i,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),v(`${T({input:e.minus(p).div(p)})}`)}else{const e=function({params:e,target:t}){return de({params:e,target:t,isBuy:!1})}({params:u,target:r});B((o=>{const r=S({currentBaseMinAndZoomMultiples:o,targetPrice:e,midPrice:p,width:i});if(r.isSkip)return{baseMin:o.baseMin,zoomMultiples:o.zoomMultiples,targetMarginPriceX:r.targetX};if(r.targetX>0)return{baseMin:r.baseMin,zoomMultiples:r.zoomMultiples,targetMarginPriceX:r.targetX};const n=N({midPrice:p,width:i,type:t,targetPrice:e}),l=n.zoomMultiples.dp(6).toNumber();return{baseMin:w({midPrice:p,zoomMultiples:l}),zoomMultiples:l,targetMarginPriceX:n.targetX}})),z(`+${T({input:e.minus(p).div(p)})}`)}}),300)),[u,p,i]);n((()=>{void 0!==h&&O({type:"buy",amount:h})}),[O,h]),n((()=>{void 0!==f&&O({type:"sell",amount:f})}),[O,f]);const q=e=>{let t=0;t=e?-.1*i:.1*i,B((e=>void 0===e.baseMin?e:{baseMin:P({dragDistance:t,prevBaseMin:e.baseMin,chartWidth:i,zoomMultiples:e.zoomMultiples}),zoomMultiples:e.zoomMultiples,targetMarginPriceX:e.targetMarginPriceX}))},W=e=>{B((t=>{const i=j({zoomIn:null!=e&&e,prevZoomMultiples:t.zoomMultiples});return{baseMin:w({midPrice:p,zoomMultiples:i}),zoomMultiples:i,targetMarginPriceX:t.targetMarginPriceX}}))},E=l((()=>{if(""===h)return!1;const t=new e(h);return!(!t.lte(0)&&!t.isNaN()&&(null==u?void 0:u.b)&&!t.gte(u.b))}),[h,u]),F=l((()=>{if(""===f)return!1;const t=new e(f);return!(!t.lte(0)&&!t.isNaN()&&(null==u?void 0:u.b)&&!t.gte(u.b))}),[f,u]);return X.jsxs(oe,{id:t,children:[g?"":X.jsxs(re,{children:[X.jsxs(ne,{borderColor:m&&m.grid,children:[L("pool.chart.buy-amount",{symbol:s}),X.jsx(_,{value:h,error:E,onChange:e=>{const t=A(e.target.value,2);null!==t&&b(t)}}),X.jsx(le,{children:L("pool.chart.price-impact",{amount:x})})]}),X.jsxs(ne,{borderColor:m&&m.grid,children:[L("pool.chart.sell-amount",{symbol:s}),X.jsx(_,{value:f,error:F,onChange:e=>{const t=A(e.target.value,2);null!==t&&M(t)}}),X.jsx(le,{children:L("pool.chart.price-impact",{amount:y})})]})]}),void 0!==u&&void 0!==p&&void 0!==c&&void 0!==k.baseMin&&void 0!==p&&X.jsx(te,{width:i,height:r,params:u,midPrice:p,pmmModel:c,baseTokenSymbol:s,quoteTokenSymbol:d,baseMinAndZoomMultiples:k,colorMap:m,setBaseMinAndZoomMultiples:B}),X.jsxs(se,{className:"operate-btn-wrapper",children:[X.jsx(ae,{onClick:()=>q(!0),children:X.jsx($,{})}),X.jsx(ae,{onClick:()=>W(!1),children:X.jsx(K,{})}),X.jsx(ae,{onClick:()=>W(!0),children:X.jsx(U,{})}),X.jsx(ae,{onClick:()=>q(!1),children:X.jsx(Q,{})})]})]})};export{ce as default};