@dodoex/wallet-web3-react 0.0.1-beta.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.
Files changed (78) hide show
  1. package/babel.config.js +9 -0
  2. package/dist/index.js +72 -0
  3. package/dist/types/ClientProvider.d.ts +2 -0
  4. package/dist/types/LangProvider.d.ts +11 -0
  5. package/dist/types/WalletConnect/AccountPage.d.ts +11 -0
  6. package/dist/types/WalletConnect/ActivityList.d.ts +20 -0
  7. package/dist/types/WalletConnect/ConnectAlchemy/index.d.ts +6 -0
  8. package/dist/types/WalletConnect/ConnectAlchemy/useConnectAlchemy.d.ts +12 -0
  9. package/dist/types/WalletConnect/ConnectLedger/ErrorDialog.d.ts +4 -0
  10. package/dist/types/WalletConnect/ConnectLedger/LoadingDialog.d.ts +3 -0
  11. package/dist/types/WalletConnect/ConnectLedger/LockedDialog.d.ts +4 -0
  12. package/dist/types/WalletConnect/ConnectLedger/ProtocolDialog.d.ts +6 -0
  13. package/dist/types/WalletConnect/ConnectLedger/SelectAddressDialog.d.ts +8 -0
  14. package/dist/types/WalletConnect/ConnectLedger/SelectPathDialog.d.ts +5 -0
  15. package/dist/types/WalletConnect/ConnectLedger/helper.d.ts +2 -0
  16. package/dist/types/WalletConnect/ConnectLedger/index.d.ts +6 -0
  17. package/dist/types/WalletConnect/ConnectPage.d.ts +9 -0
  18. package/dist/types/WalletConnect/HasBalanceTokenList.d.ts +4 -0
  19. package/dist/types/WalletConnect/ReceiveTokenPage.d.ts +4 -0
  20. package/dist/types/WalletConnect/SendTokenPage.d.ts +5 -0
  21. package/dist/types/WalletConnect/WalletDialog.d.ts +6 -0
  22. package/dist/types/WalletConnectProvider.d.ts +72 -0
  23. package/dist/types/components/AddressWithLinkAndCopy.d.ts +28 -0
  24. package/dist/types/components/Dialog.d.ts +15 -0
  25. package/dist/types/components/TokenLogo.d.ts +26 -0
  26. package/dist/types/components/WalletTag.d.ts +7 -0
  27. package/dist/types/constants/localstorage.d.ts +6 -0
  28. package/dist/types/hooks/useConnectWalet.d.ts +30 -0
  29. package/dist/types/hooks/useFetchFiatPrice.d.ts +3 -0
  30. package/dist/types/hooks/useFetchTokensBalance.d.ts +14 -0
  31. package/dist/types/hooks/useHasBalanceTokenList.d.ts +21 -0
  32. package/dist/types/hooks/useTransactionList.d.ts +272 -0
  33. package/dist/types/index.d.ts +4 -0
  34. package/dist/types/utils/formatter.d.ts +20 -0
  35. package/dist/types/utils/time.d.ts +3 -0
  36. package/dist/types/utils/utils.d.ts +2 -0
  37. package/lingui.config.ts +13 -0
  38. package/locales/en.po +251 -0
  39. package/locales/en.ts +1 -0
  40. package/locales/zh.po +249 -0
  41. package/locales/zh.ts +1 -0
  42. package/package.json +68 -0
  43. package/rollup.config.mjs +64 -0
  44. package/src/ClientProvider.tsx +15 -0
  45. package/src/LangProvider.tsx +32 -0
  46. package/src/WalletConnect/AccountPage.tsx +535 -0
  47. package/src/WalletConnect/ActivityList.tsx +597 -0
  48. package/src/WalletConnect/ConnectAlchemy/index.tsx +246 -0
  49. package/src/WalletConnect/ConnectAlchemy/useConnectAlchemy.ts +101 -0
  50. package/src/WalletConnect/ConnectLedger/ErrorDialog.tsx +61 -0
  51. package/src/WalletConnect/ConnectLedger/LoadingDialog.tsx +106 -0
  52. package/src/WalletConnect/ConnectLedger/LockedDialog.tsx +54 -0
  53. package/src/WalletConnect/ConnectLedger/ProtocolDialog.tsx +61 -0
  54. package/src/WalletConnect/ConnectLedger/SelectAddressDialog.tsx +326 -0
  55. package/src/WalletConnect/ConnectLedger/SelectPathDialog.tsx +68 -0
  56. package/src/WalletConnect/ConnectLedger/helper.ts +14 -0
  57. package/src/WalletConnect/ConnectLedger/index.tsx +89 -0
  58. package/src/WalletConnect/ConnectPage.tsx +459 -0
  59. package/src/WalletConnect/HasBalanceTokenList.tsx +201 -0
  60. package/src/WalletConnect/ReceiveTokenPage.tsx +143 -0
  61. package/src/WalletConnect/SendTokenPage.tsx +249 -0
  62. package/src/WalletConnect/WalletDialog.tsx +72 -0
  63. package/src/WalletConnectProvider.tsx +54 -0
  64. package/src/components/AddressWithLinkAndCopy.tsx +200 -0
  65. package/src/components/Dialog.tsx +155 -0
  66. package/src/components/TokenLogo.tsx +165 -0
  67. package/src/components/WalletTag.tsx +113 -0
  68. package/src/constants/localstorage.ts +22 -0
  69. package/src/hooks/useConnectWalet.ts +144 -0
  70. package/src/hooks/useFetchFiatPrice.ts +51 -0
  71. package/src/hooks/useFetchTokensBalance.ts +52 -0
  72. package/src/hooks/useHasBalanceTokenList.ts +157 -0
  73. package/src/hooks/useTransactionList.ts +87 -0
  74. package/src/index.tsx +4 -0
  75. package/src/utils/formatter.ts +102 -0
  76. package/src/utils/time.ts +21 -0
  77. package/src/utils/utils.ts +8 -0
  78. package/tsconfig.json +22 -0
@@ -0,0 +1,597 @@
1
+ import { Box, EmptyDataIcon, RotatingIcon, Skeleton } from '@dodoex/components';
2
+ import {
3
+ ArrowRight,
4
+ DoneFilled as PassedIcon,
5
+ ErrorFilled as RejectedIcon,
6
+ InvalidFilled as InvalidIcon,
7
+ ArrowBack,
8
+ } from '@dodoex/icons';
9
+ import { useWalletStore } from '@dodoex/wallet-web3';
10
+ import { t, Trans } from '@lingui/macro';
11
+ import { debounce } from 'lodash';
12
+ import React from 'react';
13
+ import InfiniteScroll from 'react-infinite-scroller';
14
+ import {
15
+ NoticeTransactionList,
16
+ StateText,
17
+ useTransactionList,
18
+ } from '../hooks/useTransactionList';
19
+ import { formatReadableTimeAgo } from '../utils/time';
20
+ import { increaseArray } from '../utils/utils';
21
+ import { useWalletConnectContext } from '../WalletConnectProvider';
22
+
23
+ export default function ActivityList({
24
+ getScrollParent,
25
+ fetchTransactionQuery,
26
+ }: {
27
+ getScrollParent: () => HTMLDivElement | null;
28
+ fetchTransactionQuery: ReturnType<typeof useTransactionList>;
29
+ }) {
30
+ const { account } = useWalletStore();
31
+
32
+ return (
33
+ <InfiniteScroll
34
+ useWindow={false}
35
+ hasMore={fetchTransactionQuery.hasNextPage}
36
+ threshold={300}
37
+ getScrollParent={getScrollParent}
38
+ loadMore={debounce(() => {
39
+ if (
40
+ fetchTransactionQuery.hasNextPage &&
41
+ !fetchTransactionQuery.isFetchingNextPage
42
+ ) {
43
+ fetchTransactionQuery.fetchNextPage();
44
+ }
45
+ }, 500)}
46
+ >
47
+ <TransactionList
48
+ account={account}
49
+ isLoading={fetchTransactionQuery.isLoading}
50
+ isFetchingNextPage={fetchTransactionQuery.isFetchingNextPage}
51
+ list={fetchTransactionQuery.list}
52
+ />
53
+ </InfiniteScroll>
54
+ );
55
+ }
56
+
57
+ export function TransactionList({
58
+ account,
59
+ isLoading,
60
+ isFetchingNextPage,
61
+ list,
62
+ }: {
63
+ account: string | undefined;
64
+ isLoading?: boolean;
65
+ isFetchingNextPage?: boolean;
66
+ list: NoticeTransactionList;
67
+ }) {
68
+ const { getChain } = useWalletConnectContext();
69
+ return (
70
+ <>
71
+ {isLoading && (
72
+ <>
73
+ {increaseArray(3).map((i) => (
74
+ <Box
75
+ key={i}
76
+ sx={{
77
+ position: 'relative',
78
+ display: 'flex',
79
+ width: '100%',
80
+ pl: 24,
81
+ pr: 48,
82
+ py: 20,
83
+ }}
84
+ >
85
+ <Box
86
+ sx={{
87
+ position: 'absolute',
88
+ bottom: 0,
89
+ right: 24,
90
+ left: 80,
91
+ height: '1px',
92
+ backgroundColor: 'border.default',
93
+ }}
94
+ />
95
+ <Skeleton width={40} height={40} />
96
+ <Box
97
+ sx={{
98
+ ml: 8,
99
+ flex: 1,
100
+ }}
101
+ >
102
+ <Skeleton width="100%" height={22} />
103
+ <Skeleton
104
+ width={128}
105
+ height={16}
106
+ sx={{
107
+ mt: 4,
108
+ }}
109
+ />
110
+ </Box>
111
+ </Box>
112
+ ))}
113
+ </>
114
+ )}
115
+ {!isLoading && !list.length && (
116
+ <Box
117
+ sx={{
118
+ display: 'flex',
119
+ alignItems: 'center',
120
+ justifyContent: 'space-between',
121
+ flexDirection: 'column',
122
+ mt: 56,
123
+ gap: 12,
124
+ typography: 'body2',
125
+ color: 'text.secondary',
126
+ }}
127
+ >
128
+ <EmptyDataIcon />
129
+ <Trans>This is empty</Trans>
130
+ </Box>
131
+ )}
132
+ {!isLoading &&
133
+ list?.map((item) => {
134
+ if (!item?.key || !item.chainId) return null;
135
+ const tx = item.extend?.tx;
136
+ const status = item.extend?.status;
137
+ let url = '';
138
+ if (tx) {
139
+ const scanUrl = getChain(item.chainId)?.scanUrl ?? '';
140
+ if (status === StateText.Warning && account) {
141
+ url = scanUrl + `/address/${account}`;
142
+ } else {
143
+ url = scanUrl + `/tx/${tx}`;
144
+ }
145
+ }
146
+ return (
147
+ <Box
148
+ key={item.id}
149
+ onClick={() => {
150
+ if (!url) return;
151
+ window.open(url);
152
+ }}
153
+ sx={{
154
+ position: 'relative',
155
+ display: 'flex',
156
+ pl: 20,
157
+ py: 16,
158
+ ...(url
159
+ ? {
160
+ cursor: 'pointer',
161
+ '&:hover': {
162
+ backgroundColor: 'hover.default',
163
+ },
164
+ '&:not(:hover) > svg:last-child': {
165
+ visibility: 'hidden',
166
+ },
167
+ }
168
+ : {}),
169
+ }}
170
+ >
171
+ <Box
172
+ sx={{
173
+ position: 'relative',
174
+ display: 'flex',
175
+ alignItems: 'center',
176
+ justifyContent: 'space-between',
177
+ width: 40,
178
+ height: 40,
179
+ borderRadius: '50%',
180
+ backgroundColor: 'background.paperContrast',
181
+ }}
182
+ >
183
+ <SubmissionTypeIcon brief={item.key} chainId={item.chainId} />
184
+ <Box
185
+ sx={{
186
+ position: 'absolute',
187
+ bottom: -1,
188
+ right: -1,
189
+ display: 'flex',
190
+ width: 16,
191
+ height: 16,
192
+ color: 'primary.contrastText',
193
+ backgroundColor: 'background.paperContrast',
194
+ borderWidth: 1,
195
+ borderStyle: 'solid',
196
+ borderColor: 'border.default',
197
+ borderRadius: '50%',
198
+ }}
199
+ >
200
+ <SubmissionStatusIcon status={status} />
201
+ </Box>
202
+ </Box>
203
+ <Box
204
+ sx={{
205
+ ml: 12,
206
+ flex: 1,
207
+ }}
208
+ >
209
+ <Box
210
+ sx={{
211
+ display: 'flex',
212
+ alignItems: 'center',
213
+ fontWeight: 600,
214
+ }}
215
+ >
216
+ {getTitleText(item.key, status)}
217
+ </Box>
218
+ <Box
219
+ sx={{
220
+ mt: 12,
221
+ typography: 'h6',
222
+ color: 'text.secondary',
223
+ }}
224
+ >
225
+ {formatReadableTimeAgo({
226
+ time: Number(item.createTime),
227
+ })}
228
+ </Box>
229
+ </Box>
230
+ {url ? (
231
+ <Box
232
+ component={ArrowRight}
233
+ sx={{
234
+ mr: 24,
235
+ width: 18,
236
+ height: 18,
237
+ alignSelf: 'center',
238
+ }}
239
+ />
240
+ ) : (
241
+ <Box />
242
+ )}
243
+ </Box>
244
+ );
245
+ })}
246
+ {isFetchingNextPage ? (
247
+ <Box
248
+ sx={{
249
+ display: 'flex',
250
+ alignItems: 'center',
251
+ justifyContent: 'center',
252
+ gap: 4,
253
+ mt: 16,
254
+ color: 'text.secondary',
255
+ typography: 'body2',
256
+ }}
257
+ >
258
+ <RotatingIcon
259
+ sx={{
260
+ width: 20,
261
+ color: 'primary.main',
262
+ }}
263
+ />
264
+ <Trans>Loading more</Trans>
265
+ </Box>
266
+ ) : (
267
+ ''
268
+ )}
269
+ </>
270
+ );
271
+ }
272
+
273
+ export function SubmissionStatusIcon({ status }: { status: string }) {
274
+ switch (status) {
275
+ case StateText.Success:
276
+ return (
277
+ <Box
278
+ component={PassedIcon}
279
+ sx={{
280
+ width: '100%',
281
+ height: '100%',
282
+ }}
283
+ />
284
+ );
285
+ case StateText.Failed:
286
+ return (
287
+ <Box
288
+ component={RejectedIcon}
289
+ sx={{
290
+ width: '100%',
291
+ height: '100%',
292
+ }}
293
+ />
294
+ );
295
+ case StateText.Warning:
296
+ return (
297
+ <Box
298
+ component={InvalidIcon}
299
+ sx={{
300
+ width: '100%',
301
+ height: '100%',
302
+ }}
303
+ />
304
+ );
305
+ case StateText.Running:
306
+ return (
307
+ <Box
308
+ sx={{
309
+ display: 'flex',
310
+ alignItems: 'center',
311
+ justifyContent: 'center',
312
+ backgroundColor: 'primary.main',
313
+ borderRadius: '50%',
314
+ width: '100%',
315
+ height: '100%',
316
+ }}
317
+ >
318
+ <Box
319
+ component="svg"
320
+ width={24}
321
+ height={24}
322
+ viewBox="0 0 24 24"
323
+ fill="none"
324
+ xmlns="http://www.w3.org/2000/svg"
325
+ sx={{
326
+ width: '92%',
327
+ height: '92%',
328
+ color: 'primary.contrastText',
329
+ }}
330
+ >
331
+ <path
332
+ d="M6 13C6 11.35 6.67 9.85 7.76 8.76L6.34 7.34C4.9 8.79 4 10.79 4 13C4 17.08 7.05 20.44 11 20.93V18.91C8.17 18.43 6 15.97 6 13ZM20 13C20 8.58 16.42 5 12 5C11.94 5 11.88 5.01 11.82 5.01L12.91 3.92L11.5 2.5L8 6L11.5 9.5L12.91 8.09L11.83 7.01C11.89 7.01 11.95 7 12 7C15.31 7 18 9.69 18 13C18 15.97 15.83 18.43 13 18.91V20.93C16.95 20.44 20 17.08 20 13Z"
333
+ fill="currentColor"
334
+ />
335
+ </Box>
336
+ </Box>
337
+ );
338
+
339
+ default:
340
+ break;
341
+ }
342
+ return null;
343
+ }
344
+
345
+ export function getTitleText(brief: string, status: string) {
346
+ const prefix = getSubmitTitleByBrief(brief);
347
+ const statusLangMap: { [key: string]: string } = {
348
+ [StateText.Success]: t`Succeeded`,
349
+ [StateText.Failed]: t`Failed`,
350
+ [StateText.Running]: t`Pending`,
351
+ [StateText.Warning]: t`Reset`,
352
+ };
353
+ const suffix = statusLangMap[status];
354
+ return suffix ? `${prefix} ${suffix}` : prefix;
355
+ }
356
+
357
+ export function getSubmitTitleByBrief(brief: string) {
358
+ const prefixTypeTextMap: {
359
+ [key: string]: string;
360
+ } = {
361
+ 'common.approve.resetBrief': t`Reset`,
362
+ 'common.approve.brief': t`Approve`,
363
+ };
364
+ const matchPrefixKey = Object.keys(prefixTypeTextMap).find(
365
+ (prefixKey) => brief.indexOf(prefixKey) === 0,
366
+ );
367
+ if (matchPrefixKey) {
368
+ return prefixTypeTextMap[matchPrefixKey];
369
+ }
370
+ switch (brief) {
371
+ case 'tradingCard.submissionBrief':
372
+ case 'limit.main.title':
373
+ case 'exchange.tabs.RFQ':
374
+ case 'bridge.order.execute-bridge':
375
+ return t`Swap`;
376
+ case 'bridge.order.execute-bridge':
377
+ return t`Transfer`;
378
+ case 'liquidity.operate.title':
379
+ case 'pool.amm-v2.add-liquidity.title':
380
+ case 'pool.amm-v3.add-liquidity.title':
381
+ return t`Add Liquidity`;
382
+ case 'liquidity.operate.remove.title':
383
+ case 'pool.amm-v2.remove-liquidity.title':
384
+ case 'pool.amm-v3.remove-liquidity.title':
385
+ return t`Remove Liquidity`;
386
+ case 'pool.my-pools.create-a-pool':
387
+ case 'pool.amm-v2.create.title':
388
+ case 'pool.amm-v3.create.title':
389
+ return t`Pool Creation`;
390
+ case 'mining.stake':
391
+ return t`Stake`;
392
+ case 'mining.submit.remove-title':
393
+ return t`End mining\n`;
394
+ case 'mining.deposit.receive-reward':
395
+ case 'pool.amm-v3.receive-reward.title':
396
+ return t`Claim Rewards`;
397
+ case 'nav.create-mining':
398
+ return t`Create Liquidity Mining`;
399
+
400
+ case 'wallet.account.card.operate.send':
401
+ return t`Send`;
402
+
403
+ default:
404
+ return null;
405
+ }
406
+ }
407
+
408
+ type IconMap = {
409
+ [key: string]: React.ReactElement;
410
+ };
411
+ export function SubmissionTypeIcon({
412
+ brief,
413
+ chainId,
414
+ }: {
415
+ brief: string;
416
+ chainId: number;
417
+ }) {
418
+ const { getChain } = useWalletConnectContext();
419
+ const prefixTypeIconMap: IconMap = {
420
+ 'common.approve.resetBrief': (
421
+ <svg
422
+ width="24"
423
+ height="24"
424
+ viewBox="0 0 24 24"
425
+ fill="none"
426
+ xmlns="http://www.w3.org/2000/svg"
427
+ >
428
+ <path
429
+ d="M6 13C6 11.35 6.67 9.85 7.76 8.76L6.34 7.34C4.9 8.79 4 10.79 4 13C4 17.08 7.05 20.44 11 20.93V18.91C8.17 18.43 6 15.97 6 13ZM20 13C20 8.58 16.42 5 12 5C11.94 5 11.88 5.01 11.82 5.01L12.91 3.92L11.5 2.5L8 6L11.5 9.5L12.91 8.09L11.83 7.01C11.89 7.01 11.95 7 12 7C15.31 7 18 9.69 18 13C18 15.97 15.83 18.43 13 18.91V20.93C16.95 20.44 20 17.08 20 13Z"
430
+ fill="currentColor"
431
+ />
432
+ </svg>
433
+ ),
434
+ 'common.approve.brief': (
435
+ <svg
436
+ width="24"
437
+ height="24"
438
+ viewBox="0 0 24 24"
439
+ fill="none"
440
+ xmlns="http://www.w3.org/2000/svg"
441
+ >
442
+ <path
443
+ fill-rule="evenodd"
444
+ clip-rule="evenodd"
445
+ d="M18 8H17V6C17 3.24 14.76 1 12 1C9.24 1 7 3.24 7 6V8H6C4.9 8 4 8.9 4 10V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V10C20 8.9 19.1 8 18 8ZM9 6C9 4.34 10.34 3 12 3C13.66 3 15 4.34 15 6V8H9V6ZM14 14C14 14.7364 13.5967 15.3831 13 15.7303V18H11V15.7303C10.4033 15.3831 10 14.7364 10 14C10 12.9 10.9 12 12 12C13.1 12 14 12.9 14 14Z"
446
+ fill="currentColor"
447
+ />
448
+ </svg>
449
+ ),
450
+ };
451
+ const matchPrefixKey = Object.keys(prefixTypeIconMap).find(
452
+ (prefixKey) => brief.indexOf(prefixKey) === 0,
453
+ );
454
+ if (matchPrefixKey) {
455
+ return (
456
+ <Box
457
+ sx={{
458
+ width: 24,
459
+ height: 24,
460
+ color: 'text.secondary',
461
+ }}
462
+ >
463
+ {prefixTypeIconMap[matchPrefixKey]}
464
+ </Box>
465
+ );
466
+ }
467
+
468
+ if (brief === 'wallet.account.card.operate.send') {
469
+ return <ArrowBack className="w-6 h-6 rotate-90" />;
470
+ }
471
+
472
+ const swapTypes = [
473
+ 'tradingCard.submissionBrief',
474
+ 'limit.main.title',
475
+ 'exchange.tabs.RFQ',
476
+ 'bridge.order.execute-bridge',
477
+ ];
478
+ if (swapTypes.includes(brief)) {
479
+ const chainLogo = getChain(chainId)?.logo;
480
+ if (!chainLogo) return null;
481
+ return (
482
+ <Box
483
+ sx={{
484
+ width: 24,
485
+ height: 24,
486
+ color: 'text.secondary',
487
+ }}
488
+ >
489
+ {chainLogo}
490
+ </Box>
491
+ );
492
+ }
493
+
494
+ const PoolIcon = (
495
+ <svg
496
+ width="24"
497
+ height="24"
498
+ viewBox="0 0 24 24"
499
+ fill="none"
500
+ xmlns="http://www.w3.org/2000/svg"
501
+ >
502
+ <path
503
+ className="active-color"
504
+ fillRule="evenodd"
505
+ clipRule="evenodd"
506
+ d="M7 3.77979C7.47668 3.77979 7.8871 4.11624 7.98058 4.58367C8.22292 5.79538 8.95318 6.97446 9.92213 7.76492C11.2407 8.84061 12 10.2058 12 11.7298C12 14.4891 9.76515 16.7798 7 16.7798C4.23484 16.7798 2 14.4891 2 11.7298C2 10.2237 2.74214 8.83345 4.0853 7.75892C5.05247 6.98519 5.77579 5.80184 6.01942 4.58367C6.1129 4.11624 6.52332 3.77979 7 3.77979Z"
507
+ fill="currentColor"
508
+ />
509
+ <path
510
+ fillRule="evenodd"
511
+ clipRule="evenodd"
512
+ d="M14 1.5C14.4794 1.5 14.8913 1.84022 14.982 2.31097C15.4329 4.65329 16.7694 6.47608 18.6541 8.07351C20.8277 9.91584 22 12.1786 22 14.6364C22 19.2681 18.3582 22.5 14 22.5C11.1133 22.5 8.5408 21.082 7.13281 18.7785C10.9673 18.7065 14 15.5225 14 11.7298C14 9.47755 12.8621 7.58357 11.1898 6.21802C12.0968 5.07887 12.732 3.79698 13.018 2.31097C13.1086 1.84022 13.5206 1.5 14 1.5Z"
513
+ fill="currentColor"
514
+ />
515
+ </svg>
516
+ );
517
+
518
+ const MiningIcon = (
519
+ <svg
520
+ width="24"
521
+ height="24"
522
+ viewBox="0 0 24 24"
523
+ fill="none"
524
+ xmlns="http://www.w3.org/2000/svg"
525
+ >
526
+ <g clipPath="url(#clip0_331_763)">
527
+ <path
528
+ d="M9.69961 7.1L9.39961 8H14.6996L13.0996 3.3L12.6996 2H11.3996L9.69961 7.1Z"
529
+ fill="currentColor"
530
+ />
531
+ <path
532
+ d="M9.39961 10L12.0996 18.2L14.6996 10H9.39961Z"
533
+ fill="currentColor"
534
+ />
535
+ <path
536
+ d="M16.7996 8H22.4996C22.4996 7.9 22.3996 7.9 22.3996 7.8L18.0996 2.6C17.9996 2.5 17.8996 2.3 17.6996 2.2C17.5996 2.1 17.3996 2 17.1996 2C16.9996 2 16.8996 2 16.6996 2H14.7996L16.7996 8Z"
537
+ fill="currentColor"
538
+ />
539
+ <path
540
+ d="M16.7996 10L13.1996 21.1C13.2996 21 13.3996 20.9 13.3996 20.9L22.3996 10.2C22.3996 10.1 22.4996 10.1 22.4996 10H16.7996Z"
541
+ fill="currentColor"
542
+ />
543
+ <path
544
+ className="active-color"
545
+ d="M7.29961 8L9.09961 2.7L9.29961 2H7.39961C7.29961 2 7.09961 2 6.89961 2.1C6.69961 2.1 6.59961 2.2 6.39961 2.3C6.29961 2.4 6.19961 2.5 6.09961 2.6L1.69961 7.9L1.59961 8H7.29961Z"
546
+ fill="currentColor"
547
+ />
548
+ <path
549
+ className="active-color"
550
+ d="M7.29961 10H1.59961C1.59961 10.1 1.69961 10.1 1.69961 10.2L10.6996 21C10.7996 21.1 10.7996 21.2 10.8996 21.3L7.29961 10Z"
551
+ fill="currentColor"
552
+ />
553
+ </g>
554
+ <defs>
555
+ <clipPath id="clip0_331_763">
556
+ <rect
557
+ width="20.9"
558
+ height="19.2"
559
+ fill="white"
560
+ transform="translate(1.59961 2)"
561
+ />
562
+ </clipPath>
563
+ </defs>
564
+ </svg>
565
+ );
566
+
567
+ const typeIconMap: IconMap = {
568
+ 'pool.my-pools.create-a-pool': PoolIcon,
569
+ 'pool.detail.modify-dpp-parameters': PoolIcon,
570
+ 'liquidity.operate.remove.title': PoolIcon,
571
+ 'liquidity.operate.title': PoolIcon,
572
+ 'pool.amm-v2.create.title': PoolIcon,
573
+ 'pool.amm-v2.remove-liquidity.title': PoolIcon,
574
+ 'pool.amm-v2.add-liquidity.title': PoolIcon,
575
+ 'pool.amm-v3.create.title': PoolIcon,
576
+ 'pool.amm-v3.add-liquidity.title': PoolIcon,
577
+ 'pool.amm-v3.remove-liquidity.title': PoolIcon,
578
+ 'pool.amm-v3.receive-reward.title': PoolIcon,
579
+ 'nav.create-mining': MiningIcon,
580
+ 'mining.deposit.receive-reward': MiningIcon,
581
+ 'mining.stake': MiningIcon,
582
+ 'mining.submit.remove-title': MiningIcon,
583
+ };
584
+ const Icon = typeIconMap[brief];
585
+ if (!Icon) return null;
586
+ return (
587
+ <Box
588
+ sx={{
589
+ width: 24,
590
+ height: 24,
591
+ color: 'text.secondary',
592
+ }}
593
+ >
594
+ {Icon}
595
+ </Box>
596
+ );
597
+ }