@rango-dev/widget-embedded 0.21.1-next.1 → 0.21.1-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  2. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  3. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  4. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -1
  5. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  6. package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts +4 -0
  7. package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -0
  8. package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts +2 -0
  9. package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts.map +1 -0
  10. package/dist/components/{SwapsGroup/SwapsGroup.styles.d.ts → HistoryGroupedList/HistoryGroupedList.styles.d.ts} +162 -1
  11. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -0
  12. package/dist/components/{SwapsGroup/SwapsGroup.types.d.ts → HistoryGroupedList/HistoryGroupedList.types.d.ts} +5 -4
  13. package/dist/components/HistoryGroupedList/HistoryGroupedList.types.d.ts.map +1 -0
  14. package/dist/components/HistoryGroupedList/index.d.ts +2 -0
  15. package/dist/components/HistoryGroupedList/index.d.ts.map +1 -0
  16. package/dist/components/Layout/Layout.d.ts.map +1 -1
  17. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  18. package/dist/components/Layout/Layout.types.d.ts +0 -1
  19. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  20. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  21. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  22. package/dist/components/Quote/Quote.d.ts.map +1 -1
  23. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
  24. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
  25. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
  26. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
  27. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  28. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  29. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
  30. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  31. package/dist/components/WalletModal/WalletModal.d.ts.map +1 -1
  32. package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -1
  33. package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts +5 -0
  34. package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts.map +1 -0
  35. package/dist/components/common/WatermarkedModal/index.d.ts +2 -0
  36. package/dist/components/common/WatermarkedModal/index.d.ts.map +1 -0
  37. package/dist/constants/index.d.ts +7 -1
  38. package/dist/constants/index.d.ts.map +1 -1
  39. package/dist/constants/searchParams.d.ts +2 -1
  40. package/dist/constants/searchParams.d.ts.map +1 -1
  41. package/dist/containers/App/App.d.ts.map +1 -1
  42. package/dist/hooks/useFetchApiConfig.d.ts +7 -0
  43. package/dist/hooks/useFetchApiConfig.d.ts.map +1 -0
  44. package/dist/hooks/useIframe/index.d.ts +2 -0
  45. package/dist/hooks/useIframe/index.d.ts.map +1 -0
  46. package/dist/hooks/useIframe/useIframe.d.ts +9 -0
  47. package/dist/hooks/useIframe/useIframe.d.ts.map +1 -0
  48. package/dist/hooks/useIframe/useIframe.helpers.d.ts +2 -0
  49. package/dist/hooks/useIframe/useIframe.helpers.d.ts.map +1 -0
  50. package/dist/hooks/useIframe/useIframe.types.d.ts +10 -0
  51. package/dist/hooks/useIframe/useIframe.types.d.ts.map +1 -0
  52. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
  53. package/dist/hooks/useWalletList.d.ts +0 -1
  54. package/dist/hooks/useWalletList.d.ts.map +1 -1
  55. package/dist/index.d.ts +2 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +2 -2
  58. package/dist/index.js.map +4 -4
  59. package/dist/pages/Home.d.ts.map +1 -1
  60. package/dist/pages/WalletsPage.d.ts.map +1 -1
  61. package/dist/store/slices/config.d.ts +8 -0
  62. package/dist/store/slices/config.d.ts.map +1 -1
  63. package/dist/store/ui.d.ts +5 -0
  64. package/dist/store/ui.d.ts.map +1 -1
  65. package/dist/types/config.d.ts +1 -0
  66. package/dist/types/config.d.ts.map +1 -1
  67. package/dist/types/notification.d.ts +4 -4
  68. package/dist/types/notification.d.ts.map +1 -1
  69. package/dist/utils/common.d.ts.map +1 -1
  70. package/dist/utils/date.d.ts +1 -1
  71. package/dist/utils/date.d.ts.map +1 -1
  72. package/dist/utils/wallets.d.ts +1 -2
  73. package/dist/utils/wallets.d.ts.map +1 -1
  74. package/package.json +2 -2
  75. package/readme.md +1 -0
  76. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +9 -7
  77. package/src/components/ConfirmWalletsModal/WalletList.tsx +29 -33
  78. package/src/components/CustomCollapsible/CustomCollapsible.tsx +1 -10
  79. package/src/components/HeaderButtons/HomeButtons.tsx +2 -1
  80. package/src/components/HistoryGroupedList/HistoryGroupedList.helpers.ts +17 -0
  81. package/src/components/{SwapsGroup/SwapsGroup.styles.ts → HistoryGroupedList/HistoryGroupedList.styles.ts} +9 -0
  82. package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +162 -0
  83. package/src/components/{SwapsGroup/SwapsGroup.types.ts → HistoryGroupedList/HistoryGroupedList.types.ts} +4 -3
  84. package/src/components/HistoryGroupedList/index.ts +1 -0
  85. package/src/components/Layout/Layout.styles.ts +12 -6
  86. package/src/components/Layout/Layout.tsx +47 -22
  87. package/src/components/Layout/Layout.types.ts +0 -1
  88. package/src/components/NotificationContent/NotificationContent.styles.ts +1 -0
  89. package/src/components/NotificationContent/NotificationContent.tsx +13 -22
  90. package/src/components/NotificationContent/NotificationNotFound.tsx +1 -1
  91. package/src/components/Quote/Quote.tsx +2 -12
  92. package/src/components/Quote/QuoteCostDetails.tsx +3 -3
  93. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +4 -3
  94. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +5 -3
  95. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +4 -4
  96. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +7 -5
  97. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +3 -29
  98. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +7 -5
  99. package/src/components/TokenList/TokenList.tsx +4 -24
  100. package/src/components/WalletModal/WalletModal.tsx +8 -5
  101. package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +9 -3
  102. package/src/components/common/WatermarkedModal/WatermarkedModal.tsx +18 -0
  103. package/src/components/common/WatermarkedModal/index.ts +1 -0
  104. package/src/constants/index.ts +7 -1
  105. package/src/constants/searchParams.ts +2 -0
  106. package/src/containers/App/App.tsx +3 -1
  107. package/src/hooks/useFetchApiConfig.ts +33 -0
  108. package/src/hooks/useIframe/index.ts +1 -0
  109. package/src/hooks/useIframe/useIframe.helpers.ts +3 -0
  110. package/src/hooks/useIframe/useIframe.ts +55 -0
  111. package/src/hooks/useIframe/useIframe.types.ts +13 -0
  112. package/src/hooks/useSwapInput.ts +2 -2
  113. package/src/hooks/useSyncStoresWithConfig.ts +3 -3
  114. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +11 -1
  115. package/src/hooks/useWalletList.ts +4 -20
  116. package/src/index.ts +2 -0
  117. package/src/pages/HistoryPage.tsx +6 -6
  118. package/src/pages/Home.tsx +2 -3
  119. package/src/pages/WalletsPage.tsx +18 -24
  120. package/src/store/notification.ts +4 -4
  121. package/src/store/slices/config.ts +29 -1
  122. package/src/store/slices/data.ts +2 -2
  123. package/src/store/ui.ts +8 -0
  124. package/src/types/config.ts +1 -0
  125. package/src/types/notification.ts +4 -4
  126. package/src/utils/common.ts +2 -2
  127. package/src/utils/configs.ts +3 -3
  128. package/src/utils/date.ts +9 -2
  129. package/src/utils/meta.ts +2 -2
  130. package/src/utils/wallets.ts +1 -5
  131. package/dist/components/SwapsGroup/SwapsGroup.d.ts +0 -4
  132. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +0 -1
  133. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +0 -1
  134. package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +0 -1
  135. package/dist/components/SwapsGroup/index.d.ts +0 -2
  136. package/dist/components/SwapsGroup/index.d.ts.map +0 -1
  137. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -141
  138. package/src/components/SwapsGroup/index.ts +0 -1
package/src/store/ui.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Watermark } from '../hooks/useFetchApiConfig';
1
2
  import type { TabManagerInterface } from '../libs/tabManager';
2
3
 
3
4
  import { create } from 'zustand';
@@ -10,11 +11,13 @@ interface UiState {
10
11
  isActiveTab: boolean;
11
12
  tabManagerInitiated: boolean;
12
13
  showActivateTabModal: boolean;
14
+ watermark: Watermark;
13
15
  activateCurrentTab: (
14
16
  setCurrentTabAsActive: () => void,
15
17
  hasRunningSwaps: boolean
16
18
  ) => void;
17
19
  setShowActivateTabModal: (flag: boolean) => void;
20
+ setWatermark: (watermark: Watermark) => void;
18
21
  }
19
22
 
20
23
  export const useUiStore = createSelectors(
@@ -22,6 +25,8 @@ export const useUiStore = createSelectors(
22
25
  isActiveTab: false,
23
26
  tabManagerInitiated: false,
24
27
  showActivateTabModal: false,
28
+ watermark: 'NONE',
29
+ fetchingApiConfig: false,
25
30
  activateCurrentTab: (setCurrentTabAsActive, hasRunningSwaps) => {
26
31
  const { showActivateTabModal } = get();
27
32
 
@@ -34,6 +39,9 @@ export const useUiStore = createSelectors(
34
39
  setShowActivateTabModal: (flag) => {
35
40
  set({ showActivateTabModal: flag });
36
41
  },
42
+ setWatermark: (watermark) => {
43
+ set({ watermark });
44
+ },
37
45
  }))
38
46
  );
39
47
 
@@ -184,6 +184,7 @@ export type Features = Partial<
184
184
  export type WidgetConfig = {
185
185
  apiKey: string;
186
186
  apiUrl?: string;
187
+ title?: string;
187
188
  walletConnectProjectId?: string;
188
189
  affiliate?: WidgetAffiliate;
189
190
  amount?: number;
@@ -8,13 +8,13 @@ import {
8
8
  type NotificationRoute = {
9
9
  from: {
10
10
  blockchain: Step['fromBlockchain'];
11
- tokenSymbol: Step['fromSymbol'];
12
- tokenAddress: Step['fromSymbolAddress'];
11
+ symbol: Step['fromSymbol'];
12
+ address: Step['fromSymbolAddress'];
13
13
  };
14
14
  to: {
15
15
  blockchain: Step['toBlockchain'];
16
- tokenSymbol: Step['toSymbol'];
17
- tokenAddress: Step['toSymbolAddress'];
16
+ symbol: Step['toSymbol'];
17
+ address: Step['toSymbolAddress'];
18
18
  };
19
19
  };
20
20
 
@@ -1,4 +1,4 @@
1
- import { RANGO_SWAP_BOX_ID } from '../constants';
1
+ import { WIDGET_UI_ID } from '../constants';
2
2
 
3
3
  export function removeDuplicateFrom<T>(array: T[]): T[] {
4
4
  return Array.from(new Set(array));
@@ -33,4 +33,4 @@ export function containsText(text: string, searchText: string): boolean {
33
33
  }
34
34
 
35
35
  export const getContainer = () =>
36
- document.getElementById(RANGO_SWAP_BOX_ID) as HTMLElement;
36
+ document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) as HTMLElement;
@@ -3,7 +3,7 @@ import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
3
3
 
4
4
  import { RANGO_PUBLIC_API_KEY } from '../constants';
5
5
 
6
- import { tokensAreEqual } from './wallets';
6
+ import { areTokensEqual } from './wallets';
7
7
 
8
8
  export interface Configs {
9
9
  API_KEY: string;
@@ -57,10 +57,10 @@ export const isTokenExcludedInConfig = (
57
57
  let result = false;
58
58
  if (tokensConfig && token) {
59
59
  if (Array.isArray(tokensConfig)) {
60
- result = !tokensConfig.some((asset) => tokensAreEqual(asset, token));
60
+ result = !tokensConfig.some((asset) => areTokensEqual(asset, token));
61
61
  } else if (!Array.isArray(tokensConfig) && tokensConfig[token.blockchain]) {
62
62
  result = tokensConfig[token.blockchain].tokens.some((asset) =>
63
- tokensAreEqual(asset, token)
63
+ areTokensEqual(asset, token)
64
64
  );
65
65
  const isExcluded = tokensConfig[token.blockchain].isExcluded;
66
66
  return (!isExcluded && !result) || (isExcluded && result);
package/src/utils/date.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GroupBy } from '../components/SwapsGroup/SwapsGroup.types';
1
+ import type { GroupBy } from '../components/HistoryGroupedList/HistoryGroupedList.types';
2
2
  import type { PendingSwap } from 'rango-types';
3
3
 
4
4
  import { i18n } from '@lingui/core';
@@ -70,5 +70,12 @@ export const groupSwapsByDate: GroupBy = (swaps) => {
70
70
  }
71
71
  });
72
72
 
73
- return Array.from(output.values());
73
+ const groupedSwaps = Array.from(output.values()).filter(
74
+ (item) => item.swaps.length > 0
75
+ );
76
+ const items = groupedSwaps.flatMap((group) => group.swaps);
77
+ const groupCounts = groupedSwaps.map((group) => group.swaps.length);
78
+ const groups = groupedSwaps.map((group) => group.title);
79
+
80
+ return { swaps: items, groupCounts, groups };
74
81
  };
package/src/utils/meta.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Asset, BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
2
2
 
3
- import { tokensAreEqual } from './wallets';
3
+ import { areTokensEqual } from './wallets';
4
4
 
5
5
  export function getBlockchainDisplayNameFor(
6
6
  blockchainName: string,
@@ -25,7 +25,7 @@ export function getSwapperDisplayName(
25
25
  }
26
26
 
27
27
  export function findToken(t: Asset, tokens: Token[]) {
28
- return tokens.find((token) => tokensAreEqual(token, t)) ?? null;
28
+ return tokens.find((token) => areTokensEqual(token, t)) ?? null;
29
29
  }
30
30
 
31
31
  export function findBlockchain(name: string, blockchains: BlockchainMeta[]) {
@@ -443,7 +443,7 @@ export function sortTokens(
443
443
  return tokens;
444
444
  }
445
445
 
446
- export function tokensAreEqual(
446
+ export function areTokensEqual(
447
447
  tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null,
448
448
  tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null
449
449
  ) {
@@ -551,7 +551,3 @@ export const isFetchingBalance = (
551
551
  !!connectedWallets.find(
552
552
  (wallet) => wallet.chain === blockchain && wallet.loading
553
553
  );
554
-
555
- export function hashWalletsState(walletsInfo: ModalWalletInfo[]) {
556
- return walletsInfo.map((w) => w.state).join('-');
557
- }
@@ -1,4 +0,0 @@
1
- import type { PropTypes } from './SwapsGroup.types';
2
- import React from 'react';
3
- export declare function SwapsGroup(props: PropTypes): React.JSX.Element;
4
- //# sourceMappingURL=SwapsGroup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwapsGroup.d.ts","sourceRoot":"","sources":["../../../src/components/SwapsGroup/SwapsGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,qBA6H1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwapsGroup.styles.d.ts","sourceRoot":"","sources":["../../../src/components/SwapsGroup/SwapsGroup.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAAQ,CAAC;AAEjC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAWhB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAIf,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAInB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAK5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwapsGroup.types.d.ts","sourceRoot":"","sources":["../../../src/components/SwapsGroup/SwapsGroup.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,EAAE,CAAC;AAEJ,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -1,2 +0,0 @@
1
- export { SwapsGroup } from './SwapsGroup';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SwapsGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -1,141 +0,0 @@
1
- import type { PropTypes } from './SwapsGroup.types';
2
-
3
- import { i18n } from '@lingui/core';
4
- import { Divider, SwapListItem, Typography } from '@rango-dev/ui';
5
- import React from 'react';
6
-
7
- import {
8
- TOKEN_AMOUNT_MAX_DECIMALS,
9
- TOKEN_AMOUNT_MIN_DECIMALS,
10
- } from '../../constants/routing';
11
- import { getContainer } from '../../utils/common';
12
- import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
13
-
14
- import { Group, groupStyles, SwapList, Time } from './SwapsGroup.styles';
15
-
16
- export function SwapsGroup(props: PropTypes) {
17
- const { list, onSwapClick, groupBy, isLoading } = props;
18
- const groups = groupBy ? groupBy(list) : [{ title: 'History', swaps: list }];
19
-
20
- if (isLoading) {
21
- const swaps = [{}, {}];
22
-
23
- const loadingGroups = [
24
- {
25
- title: i18n.t('Today'),
26
- swaps,
27
- },
28
- {
29
- title: i18n.t('This month'),
30
- swaps,
31
- },
32
- ];
33
- return (
34
- <>
35
- {loadingGroups.map((group) => (
36
- <React.Fragment key={group.title}>
37
- <Group>
38
- <Time>
39
- <Typography
40
- variant="label"
41
- size="medium"
42
- className={groupStyles()}>
43
- {group.title}
44
- </Typography>
45
- </Time>
46
- <Divider size={4} />
47
- <SwapList>
48
- {group.swaps.map((_, index) => {
49
- const key = index + group.title;
50
- return (
51
- <React.Fragment key={key}>
52
- <SwapListItem isLoading={true} />
53
- </React.Fragment>
54
- );
55
- })}
56
- </SwapList>
57
- </Group>
58
- </React.Fragment>
59
- ))}
60
- </>
61
- );
62
- }
63
-
64
- return (
65
- <>
66
- {groups
67
- .filter((group) => group.swaps.length > 0)
68
- .map((group) => (
69
- <React.Fragment key={group.title}>
70
- <Group>
71
- <Time>
72
- <Typography
73
- variant="label"
74
- size="medium"
75
- className={groupStyles()}>
76
- {group.title}
77
- </Typography>
78
- </Time>
79
- <Divider size={4} />
80
- <SwapList>
81
- {group.swaps.map((swap) => {
82
- const firstStep = swap.steps[0];
83
-
84
- const lastStep = swap.steps[swap.steps.length - 1];
85
- return (
86
- <React.Fragment key={swap.requestId}>
87
- <SwapListItem
88
- requestId={swap.requestId}
89
- creationTime={swap.creationTime}
90
- status={swap.status}
91
- onClick={onSwapClick}
92
- tooltipContainer={getContainer()}
93
- onlyShowTime={group.title === i18n.t('Today')}
94
- swapTokenData={{
95
- from: {
96
- token: {
97
- image: firstStep.fromLogo,
98
- displayName: firstStep.fromSymbol,
99
- },
100
- blockchain: {
101
- image: firstStep.fromBlockchainLogo || '',
102
- },
103
- amount: numberToString(
104
- swap.inputAmount,
105
- TOKEN_AMOUNT_MIN_DECIMALS,
106
- TOKEN_AMOUNT_MAX_DECIMALS
107
- ),
108
- realAmount: formatTooltipNumbers(swap.inputAmount),
109
- },
110
- to: {
111
- token: {
112
- image: lastStep.toLogo,
113
- displayName: lastStep.toSymbol,
114
- },
115
- blockchain: {
116
- image: lastStep.toBlockchainLogo || '',
117
- },
118
- amount: numberToString(
119
- lastStep.outputAmount ||
120
- lastStep.expectedOutputAmountHumanReadable ||
121
- '',
122
- TOKEN_AMOUNT_MIN_DECIMALS,
123
- TOKEN_AMOUNT_MAX_DECIMALS
124
- ),
125
- realAmount: formatTooltipNumbers(
126
- lastStep.outputAmount ||
127
- lastStep.expectedOutputAmountHumanReadable
128
- ),
129
- },
130
- }}
131
- />
132
- </React.Fragment>
133
- );
134
- })}
135
- </SwapList>
136
- </Group>
137
- </React.Fragment>
138
- ))}
139
- </>
140
- );
141
- }
@@ -1 +0,0 @@
1
- export { SwapsGroup } from './SwapsGroup';