@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.
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts +4 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts +2 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts.map +1 -0
- package/dist/components/{SwapsGroup/SwapsGroup.styles.d.ts → HistoryGroupedList/HistoryGroupedList.styles.d.ts} +162 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -0
- package/dist/components/{SwapsGroup/SwapsGroup.types.d.ts → HistoryGroupedList/HistoryGroupedList.types.d.ts} +5 -4
- package/dist/components/HistoryGroupedList/HistoryGroupedList.types.d.ts.map +1 -0
- package/dist/components/HistoryGroupedList/index.d.ts +2 -0
- package/dist/components/HistoryGroupedList/index.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +0 -1
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -1
- package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -1
- package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts +5 -0
- package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts.map +1 -0
- package/dist/components/common/WatermarkedModal/index.d.ts +2 -0
- package/dist/components/common/WatermarkedModal/index.d.ts.map +1 -0
- package/dist/constants/index.d.ts +7 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +2 -1
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/containers/App/App.d.ts.map +1 -1
- package/dist/hooks/useFetchApiConfig.d.ts +7 -0
- package/dist/hooks/useFetchApiConfig.d.ts.map +1 -0
- package/dist/hooks/useIframe/index.d.ts +2 -0
- package/dist/hooks/useIframe/index.d.ts.map +1 -0
- package/dist/hooks/useIframe/useIframe.d.ts +9 -0
- package/dist/hooks/useIframe/useIframe.d.ts.map +1 -0
- package/dist/hooks/useIframe/useIframe.helpers.d.ts +2 -0
- package/dist/hooks/useIframe/useIframe.helpers.d.ts.map +1 -0
- package/dist/hooks/useIframe/useIframe.types.d.ts +10 -0
- package/dist/hooks/useIframe/useIframe.types.d.ts.map +1 -0
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +0 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/ui.d.ts +5 -0
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +4 -4
- package/dist/types/notification.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +9 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +29 -33
- package/src/components/CustomCollapsible/CustomCollapsible.tsx +1 -10
- package/src/components/HeaderButtons/HomeButtons.tsx +2 -1
- package/src/components/HistoryGroupedList/HistoryGroupedList.helpers.ts +17 -0
- package/src/components/{SwapsGroup/SwapsGroup.styles.ts → HistoryGroupedList/HistoryGroupedList.styles.ts} +9 -0
- package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +162 -0
- package/src/components/{SwapsGroup/SwapsGroup.types.ts → HistoryGroupedList/HistoryGroupedList.types.ts} +4 -3
- package/src/components/HistoryGroupedList/index.ts +1 -0
- package/src/components/Layout/Layout.styles.ts +12 -6
- package/src/components/Layout/Layout.tsx +47 -22
- package/src/components/Layout/Layout.types.ts +0 -1
- package/src/components/NotificationContent/NotificationContent.styles.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +13 -22
- package/src/components/NotificationContent/NotificationNotFound.tsx +1 -1
- package/src/components/Quote/Quote.tsx +2 -12
- package/src/components/Quote/QuoteCostDetails.tsx +3 -3
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +4 -3
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +5 -3
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +4 -4
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +7 -5
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +3 -29
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +7 -5
- package/src/components/TokenList/TokenList.tsx +4 -24
- package/src/components/WalletModal/WalletModal.tsx +8 -5
- package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +9 -3
- package/src/components/common/WatermarkedModal/WatermarkedModal.tsx +18 -0
- package/src/components/common/WatermarkedModal/index.ts +1 -0
- package/src/constants/index.ts +7 -1
- package/src/constants/searchParams.ts +2 -0
- package/src/containers/App/App.tsx +3 -1
- package/src/hooks/useFetchApiConfig.ts +33 -0
- package/src/hooks/useIframe/index.ts +1 -0
- package/src/hooks/useIframe/useIframe.helpers.ts +3 -0
- package/src/hooks/useIframe/useIframe.ts +55 -0
- package/src/hooks/useIframe/useIframe.types.ts +13 -0
- package/src/hooks/useSwapInput.ts +2 -2
- package/src/hooks/useSyncStoresWithConfig.ts +3 -3
- package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +11 -1
- package/src/hooks/useWalletList.ts +4 -20
- package/src/index.ts +2 -0
- package/src/pages/HistoryPage.tsx +6 -6
- package/src/pages/Home.tsx +2 -3
- package/src/pages/WalletsPage.tsx +18 -24
- package/src/store/notification.ts +4 -4
- package/src/store/slices/config.ts +29 -1
- package/src/store/slices/data.ts +2 -2
- package/src/store/ui.ts +8 -0
- package/src/types/config.ts +1 -0
- package/src/types/notification.ts +4 -4
- package/src/utils/common.ts +2 -2
- package/src/utils/configs.ts +3 -3
- package/src/utils/date.ts +9 -2
- package/src/utils/meta.ts +2 -2
- package/src/utils/wallets.ts +1 -5
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +0 -4
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +0 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +0 -1
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +0 -1
- package/dist/components/SwapsGroup/index.d.ts +0 -2
- package/dist/components/SwapsGroup/index.d.ts.map +0 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +0 -141
- 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
|
|
package/src/types/config.ts
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
type NotificationRoute = {
|
|
9
9
|
from: {
|
|
10
10
|
blockchain: Step['fromBlockchain'];
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
symbol: Step['fromSymbol'];
|
|
12
|
+
address: Step['fromSymbolAddress'];
|
|
13
13
|
};
|
|
14
14
|
to: {
|
|
15
15
|
blockchain: Step['toBlockchain'];
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
symbol: Step['toSymbol'];
|
|
17
|
+
address: Step['toSymbolAddress'];
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
|
package/src/utils/common.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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(
|
|
36
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) as HTMLElement;
|
package/src/utils/configs.ts
CHANGED
|
@@ -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 {
|
|
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) =>
|
|
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
|
-
|
|
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/
|
|
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
|
-
|
|
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 {
|
|
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) =>
|
|
28
|
+
return tokens.find((token) => areTokensEqual(token, t)) ?? null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function findBlockchain(name: string, blockchains: BlockchainMeta[]) {
|
package/src/utils/wallets.ts
CHANGED
|
@@ -443,7 +443,7 @@ export function sortTokens(
|
|
|
443
443
|
return tokens;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
export function
|
|
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 +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 +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';
|