@rango-dev/widget-embedded 0.12.1-next.8 → 0.13.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.
- package/CHANGELOG.md +55 -0
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +5 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts +14 -4
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +6 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +94 -17
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +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/ConfirmWalletsModal/WalletList.styles.d.ts +18 -3
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +25 -284
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
- package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts +18 -3
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +6 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
- package/dist/components/{SelectableCategoryList/SelectableCategoryList.styles.d.ts → LoadingSwapDetails/LoadingSwapDetails.styles.d.ts} +21 -6
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
- package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -1
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts +18 -3
- package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +24 -4
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts +24 -4
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +3 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +6 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +23 -151
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/SettingsContainer/index.d.ts +1 -1
- package/dist/components/SettingsContainer/index.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +24 -4
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +2 -9
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +35 -153
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +6 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +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/SwapDetailsModal/SwapDetailsModal.styles.d.ts +6 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +24 -4
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +207 -9
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +6 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +24 -4
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +2 -2
- package/dist/constants/routing.d.ts +12 -2
- package/dist/constants/routing.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList.d.ts +18 -0
- package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +3 -6
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders.d.ts +3 -3
- package/dist/hooks/useWalletProviders.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts +1 -2
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts +1 -5
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/httpService.d.ts +0 -1
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/store/app.d.ts +26 -0
- package/dist/store/app.d.ts.map +1 -0
- package/dist/store/bestRoute.d.ts +4 -8
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +0 -2
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -0
- package/dist/store/slices/data.d.ts +26 -0
- package/dist/store/slices/data.d.ts.map +1 -0
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +5 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +3 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +6 -3
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +1 -1
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +2 -2
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +8 -8
- package/readme.md +2 -0
- package/src/Widget.tsx +22 -3
- package/src/components/AppRouter.tsx +38 -7
- package/src/components/AppRoutes.tsx +4 -28
- package/src/components/BlockchainList/BlockchainList.helpers.ts +1 -1
- package/src/components/BlockchainList/BlockchainList.styles.ts +6 -5
- package/src/components/BlockchainList/BlockchainList.tsx +6 -9
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +29 -42
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +33 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +48 -7
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +59 -16
- package/src/components/ConfirmWalletsModal/WalletList.tsx +66 -22
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +2 -2
- package/src/components/HeaderButtons/HeaderButtons.types.ts +1 -0
- package/src/components/HeaderButtons/HomeButtons.tsx +18 -5
- package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +1 -2
- package/src/components/HeaderButtons/WalletButton.tsx +4 -1
- package/src/components/Layout/Layout.styles.ts +5 -3
- package/src/components/Layout/Layout.tsx +5 -20
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/LoadingSwapDetails/index.ts +1 -0
- package/src/components/NoRoutes/NoRoutes.helper.ts +4 -2
- package/src/components/NotificationContent/NotificationContent.tsx +3 -7
- package/src/components/RouteErrors/RouteErrors.styles.ts +2 -1
- package/src/components/RouteErrors/RouteErrors.tsx +37 -26
- package/src/components/RouteErrors/RouteErrors.types.ts +3 -1
- package/src/components/RouteErrors/RouteErrorsModal.tsx +42 -14
- package/src/components/SettingsContainer/SettingsContainer.style.ts +2 -7
- package/src/components/SettingsContainer/index.ts +0 -1
- package/src/components/Slippage/Slippage.tsx +6 -2
- package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +52 -16
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +19 -33
- package/src/components/SwapDetails/SwapDetails.styles.ts +10 -14
- package/src/components/SwapDetails/SwapDetails.tsx +143 -101
- package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +5 -4
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +6 -7
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +3 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +3 -2
- package/src/components/SwitchFromAndTo.tsx +1 -35
- package/src/components/TokenList/TokenList.helpers.ts +6 -8
- package/src/components/TokenList/TokenList.styles.ts +7 -1
- package/src/components/TokenList/TokenList.tsx +29 -23
- package/src/components/TokenList/TokenList.types.ts +1 -1
- package/src/components/UpdateUrl.tsx +7 -1
- package/src/components/WidgetEvents.tsx +9 -3
- package/src/constants/errors.ts +2 -2
- package/src/constants/routing.ts +17 -2
- package/src/constants.ts +1 -0
- package/src/globalStyles.ts +1 -4
- package/src/hooks/useFetchBestRoute.ts +2 -2
- package/src/hooks/useNavigateBack.ts +10 -0
- package/src/hooks/usePrepareBlockchainList.ts +125 -0
- package/src/hooks/useSwapInput.ts +17 -3
- package/src/hooks/useSyncStoresWithConfig.ts +102 -0
- package/src/hooks/useTheme.ts +37 -75
- package/src/hooks/useWalletProviders.ts +7 -7
- package/src/pages/ConfirmSwapPage.tsx +65 -36
- package/src/pages/HistoryPage.tsx +2 -2
- package/src/pages/Home.tsx +114 -50
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +22 -18
- package/src/pages/SelectBlockchainPage.tsx +19 -20
- package/src/pages/SelectSwapItemsPage.tsx +66 -88
- package/src/pages/SettingsPage.tsx +42 -15
- package/src/pages/SwapDetailsPage.tsx +9 -2
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +11 -5
- package/src/services/httpService.ts +4 -5
- package/src/store/app.ts +15 -0
- package/src/store/bestRoute.ts +45 -71
- package/src/store/meta.ts +11 -29
- package/src/store/slices/config.ts +26 -0
- package/src/store/slices/data.ts +203 -0
- package/src/store/wallets.ts +0 -27
- package/src/types/config.ts +3 -0
- package/src/utils/common.ts +3 -0
- package/src/utils/configs.ts +8 -2
- package/src/utils/meta.ts +7 -0
- package/src/utils/numbers.ts +3 -2
- package/src/utils/routing.ts +76 -14
- package/src/utils/settings.ts +15 -0
- package/src/utils/swap.ts +82 -26
- package/src/utils/time.ts +69 -36
- package/src/utils/wallets.ts +49 -29
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +0 -5
- package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +0 -151
- package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +0 -6
- package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +0 -1
- package/dist/components/BlockchainsChip/index.d.ts +0 -2
- package/dist/components/BlockchainsChip/index.d.ts.map +0 -1
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +0 -3
- package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +0 -4
- package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +0 -4
- package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +0 -12
- package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +0 -1
- package/dist/components/SelectableCategoryList/index.d.ts +0 -2
- package/dist/components/SelectableCategoryList/index.d.ts.map +0 -1
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +0 -30
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +0 -15
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +0 -4
- package/src/components/BlockchainsChip/index.ts +0 -1
- package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +0 -20
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +0 -20
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +0 -21
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +0 -79
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +0 -12
- package/src/components/SelectableCategoryList/index.ts +0 -1
package/src/utils/time.ts
CHANGED
|
@@ -1,46 +1,79 @@
|
|
|
1
|
-
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
|
|
5
|
+
const MILLISECOND_PER_SECOND = 1000;
|
|
6
|
+
const SECONDS_PER_YEAR = 31536000;
|
|
7
|
+
const SECONDS_PER_MONTH = 2592000;
|
|
8
|
+
const SECONDS_PER_DAY = 86400;
|
|
9
|
+
const SECONDS_PER_HOUR = 3600;
|
|
10
|
+
const SECONDS_PER_MINUTE = 60;
|
|
11
|
+
|
|
12
|
+
export function timeSince(millisecond: number): string {
|
|
13
|
+
const seconds = Math.floor(
|
|
14
|
+
(Date.now() - millisecond) / MILLISECOND_PER_SECOND
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const intervals = [
|
|
18
|
+
{
|
|
19
|
+
turningPoint: SECONDS_PER_YEAR,
|
|
20
|
+
label: i18n.t('year'),
|
|
21
|
+
pluralLabel: i18n.t('years'),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
turningPoint: SECONDS_PER_MONTH,
|
|
25
|
+
label: i18n.t('month'),
|
|
26
|
+
pluralLabel: i18n.t('months'),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
turningPoint: SECONDS_PER_DAY,
|
|
30
|
+
label: i18n.t('day'),
|
|
31
|
+
pluralLabel: i18n.t('days'),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
turningPoint: SECONDS_PER_HOUR,
|
|
35
|
+
label: i18n.t('hour'),
|
|
36
|
+
pluralLabel: i18n.t('hours'),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
turningPoint: SECONDS_PER_MINUTE,
|
|
40
|
+
label: i18n.t('minute'),
|
|
41
|
+
pluralLabel: i18n.t('minutes'),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const sortedIntervals = intervals.sort(
|
|
46
|
+
(a, b) => b.turningPoint - a.turningPoint
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
for (const interval of sortedIntervals) {
|
|
50
|
+
const { turningPoint, label, pluralLabel } = interval;
|
|
51
|
+
const intervalCount = Math.floor(seconds / turningPoint);
|
|
52
|
+
if (intervalCount > 1) {
|
|
53
|
+
return `${intervalCount} ${pluralLabel}`;
|
|
54
|
+
}
|
|
55
|
+
if (intervalCount === 1) {
|
|
56
|
+
return `${intervalCount} ${label}`;
|
|
32
57
|
}
|
|
33
58
|
}
|
|
34
59
|
|
|
35
|
-
if (
|
|
36
|
-
|
|
60
|
+
if (seconds > 1) {
|
|
61
|
+
return `${seconds} ${i18n.t('seconds')}`;
|
|
37
62
|
}
|
|
38
63
|
|
|
39
|
-
return
|
|
64
|
+
return `${seconds} ${i18n.t('second')}`;
|
|
40
65
|
}
|
|
41
66
|
|
|
42
67
|
export function getSwapDate(pendingSwap: PendingSwap) {
|
|
43
68
|
return pendingSwap.finishTime
|
|
44
|
-
?
|
|
45
|
-
|
|
69
|
+
? i18n.t({
|
|
70
|
+
id: 'timeAgo',
|
|
71
|
+
message: '{time} ago',
|
|
72
|
+
values: { time: timeSince(parseInt(pendingSwap.finishTime)) },
|
|
73
|
+
})
|
|
74
|
+
: i18n.t({
|
|
75
|
+
id: 'timeAgo',
|
|
76
|
+
message: '{time} ago',
|
|
77
|
+
values: { time: timeSince(parseInt(pendingSwap.creationTime)) },
|
|
78
|
+
});
|
|
46
79
|
}
|
package/src/utils/wallets.ts
CHANGED
|
@@ -135,19 +135,19 @@ export function prepareAccountsForWalletStore(
|
|
|
135
135
|
/*
|
|
136
136
|
* In some cases we can handle unknown network by checking its address
|
|
137
137
|
* pattern and act on it.
|
|
138
|
-
* Example: showing our evm compatible
|
|
138
|
+
* Example: showing our evm compatible network when the unknown network is evm.
|
|
139
139
|
* Otherwise, we stop executing this function.
|
|
140
140
|
*/
|
|
141
|
-
const
|
|
141
|
+
const isUnknownAndEvmBased =
|
|
142
142
|
network === Networks.Unknown && isEvmAddress(address);
|
|
143
|
-
if (isUnknown && !
|
|
143
|
+
if (isUnknown && !isUnknownAndEvmBased) {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
const isEvmBasedChain = evmBasedChains.includes(network);
|
|
148
148
|
|
|
149
149
|
// If it's an evm network, we will add the address to all the evm chains.
|
|
150
|
-
if (isEvmBasedChain ||
|
|
150
|
+
if (isEvmBasedChain || isUnknownAndEvmBased) {
|
|
151
151
|
/*
|
|
152
152
|
* all evm chains are not supported in wallets, so we are adding
|
|
153
153
|
* only to those that are supported by wallet.
|
|
@@ -158,7 +158,7 @@ export function prepareAccountsForWalletStore(
|
|
|
158
158
|
|
|
159
159
|
evmChainsSupportedByWallet.forEach((network) => {
|
|
160
160
|
/*
|
|
161
|
-
* EVM addresses are not case
|
|
161
|
+
* EVM addresses are not case sensitive.
|
|
162
162
|
* Some wallets like Binance-chain return some letters in uppercase which produces bugs in our wallet state.
|
|
163
163
|
*/
|
|
164
164
|
addAccount(network, address.toLowerCase());
|
|
@@ -311,7 +311,7 @@ export function resetConnectedWalletState(
|
|
|
311
311
|
|
|
312
312
|
export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
313
313
|
const uniqueAccountAddresses = new Set<string | null>();
|
|
314
|
-
const
|
|
314
|
+
const uniqueBalance: ConnectedWallet[] = connectedWallet?.reduce(
|
|
315
315
|
(acc: ConnectedWallet[], current: ConnectedWallet) => {
|
|
316
316
|
return acc.findIndex(
|
|
317
317
|
(i) => i.address === current.address && i.chain === current.chain
|
|
@@ -323,7 +323,7 @@ export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
|
323
323
|
[]
|
|
324
324
|
);
|
|
325
325
|
|
|
326
|
-
const modifiedWalletBlockchains =
|
|
326
|
+
const modifiedWalletBlockchains = uniqueBalance?.map((chain) => {
|
|
327
327
|
const modifiedWalletBlockchain: Blockchain = {
|
|
328
328
|
name: chain.chain,
|
|
329
329
|
accounts: [],
|
|
@@ -348,10 +348,10 @@ export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
|
348
348
|
?.reduce((a, b) => a.plus(b), ZERO) || ZERO
|
|
349
349
|
).toString();
|
|
350
350
|
|
|
351
|
-
return
|
|
351
|
+
return numberWithThousandSeparator(total);
|
|
352
352
|
};
|
|
353
353
|
|
|
354
|
-
function
|
|
354
|
+
function numberWithThousandSeparator(number: string | number): string {
|
|
355
355
|
const parts = number.toString().split('.');
|
|
356
356
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
357
357
|
return parts.join('.');
|
|
@@ -428,7 +428,6 @@ export function getTokensWithBalance(
|
|
|
428
428
|
tokens: TokenWithBalance[],
|
|
429
429
|
connectedWallets: ConnectedWallet[]
|
|
430
430
|
): TokenWithBalance[] {
|
|
431
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
432
431
|
return tokens.map(({ balance, ...otherProps }) => {
|
|
433
432
|
const tokenAmount = numberToString(
|
|
434
433
|
new BigNumber(
|
|
@@ -464,17 +463,55 @@ export function getTokensWithBalance(
|
|
|
464
463
|
});
|
|
465
464
|
}
|
|
466
465
|
|
|
466
|
+
export function getTokensBalanceFromWalletAndSort(
|
|
467
|
+
tokens: TokenWithBalance[],
|
|
468
|
+
connectedWallets: ConnectedWallet[]
|
|
469
|
+
) {
|
|
470
|
+
const list =
|
|
471
|
+
connectedWallets.length > 0
|
|
472
|
+
? getTokensWithBalance(tokens, connectedWallets)
|
|
473
|
+
: tokens;
|
|
474
|
+
list.sort((tokenA, tokenB) => {
|
|
475
|
+
if (tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
476
|
+
return (
|
|
477
|
+
parseFloat(tokenB.balance.usdValue) -
|
|
478
|
+
parseFloat(tokenA.balance.usdValue)
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (!tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
483
|
+
return 1;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (tokenA.balance?.usdValue && !tokenB.balance?.usdValue) {
|
|
487
|
+
return -1;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (!tokenA.balance?.usdValue && !tokenB.balance?.usdValue) {
|
|
491
|
+
return (
|
|
492
|
+
parseFloat(tokenB.balance?.amount || '0') -
|
|
493
|
+
parseFloat(tokenA.balance?.amount || '0')
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return 0;
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
return list;
|
|
501
|
+
}
|
|
502
|
+
|
|
467
503
|
export function getSortedTokens(
|
|
468
504
|
chain: BlockchainMeta | null,
|
|
469
505
|
tokens: Token[],
|
|
470
506
|
connectedWallets: ConnectedWallet[],
|
|
471
507
|
otherChainTokens: TokenWithBalance[]
|
|
472
508
|
): TokenWithBalance[] {
|
|
473
|
-
const
|
|
509
|
+
const fromChainEqualsToToBlockchain =
|
|
474
510
|
chain?.name === otherChainTokens[0]?.name;
|
|
475
|
-
if (
|
|
511
|
+
if (fromChainEqualsToToBlockchain) {
|
|
476
512
|
return otherChainTokens;
|
|
477
513
|
}
|
|
514
|
+
|
|
478
515
|
const filteredTokens = tokens.filter(
|
|
479
516
|
(token) => token.blockchain === chain?.name
|
|
480
517
|
);
|
|
@@ -492,23 +529,6 @@ export function tokensAreEqual(
|
|
|
492
529
|
);
|
|
493
530
|
}
|
|
494
531
|
|
|
495
|
-
export function getDefaultToken(
|
|
496
|
-
sortedTokens: TokenWithBalance[],
|
|
497
|
-
otherToken: TokenWithBalance | null
|
|
498
|
-
): TokenWithBalance {
|
|
499
|
-
let selectedToken: TokenWithBalance;
|
|
500
|
-
const firstToken = sortedTokens[0];
|
|
501
|
-
const secondToken = sortedTokens[1];
|
|
502
|
-
if (sortedTokens.length === 1) {
|
|
503
|
-
selectedToken = firstToken;
|
|
504
|
-
} else if (tokensAreEqual(firstToken, otherToken)) {
|
|
505
|
-
selectedToken = secondToken;
|
|
506
|
-
} else {
|
|
507
|
-
selectedToken = firstToken;
|
|
508
|
-
}
|
|
509
|
-
return selectedToken;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
532
|
export function sortWalletsBasedOnConnectionState(
|
|
513
533
|
wallets: ModalWalletInfo[]
|
|
514
534
|
): ModalWalletInfo[] {
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './BlockchainsChip.types';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
export declare function BlockchainsChip(props: PropsWithChildren<PropTypes>): React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=BlockchainsChip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockchainsChip.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsChip/BlockchainsChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,qBAOlE"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
export declare const Chip: import("@stitches/react/types/styled-component").StyledComponent<"button", {
|
|
2
|
-
selected?: boolean | "true" | "false" | undefined;
|
|
3
|
-
}, {
|
|
4
|
-
sm: string;
|
|
5
|
-
md: string;
|
|
6
|
-
lg: string;
|
|
7
|
-
}, import("@stitches/react/types/css-util").CSS<{
|
|
8
|
-
sm: string;
|
|
9
|
-
md: string;
|
|
10
|
-
lg: string;
|
|
11
|
-
}, {
|
|
12
|
-
colors: {
|
|
13
|
-
primary500: string;
|
|
14
|
-
primary600: string;
|
|
15
|
-
secondary100: string;
|
|
16
|
-
secondary200: string;
|
|
17
|
-
secondary300: string;
|
|
18
|
-
secondary400: string;
|
|
19
|
-
secondary500: string;
|
|
20
|
-
secondary600: string;
|
|
21
|
-
secondary700: string;
|
|
22
|
-
secondary800: string;
|
|
23
|
-
secondary900: string;
|
|
24
|
-
neutral100: string;
|
|
25
|
-
neutral200: string;
|
|
26
|
-
neutral300: string;
|
|
27
|
-
neutral400: string;
|
|
28
|
-
neutral500: string;
|
|
29
|
-
neutral600: string;
|
|
30
|
-
neutral700: string;
|
|
31
|
-
neutral800: string;
|
|
32
|
-
neutral900: string;
|
|
33
|
-
error100: string;
|
|
34
|
-
error300: string;
|
|
35
|
-
error500: string;
|
|
36
|
-
error600: string;
|
|
37
|
-
error700: string;
|
|
38
|
-
warning100: string;
|
|
39
|
-
warning300: string;
|
|
40
|
-
warning500: string;
|
|
41
|
-
warning600: string;
|
|
42
|
-
warning700: string;
|
|
43
|
-
info100: string;
|
|
44
|
-
info300: string;
|
|
45
|
-
info500: string;
|
|
46
|
-
info600: string;
|
|
47
|
-
info700: string;
|
|
48
|
-
success100: string;
|
|
49
|
-
success300: string;
|
|
50
|
-
success500: string;
|
|
51
|
-
success600: string;
|
|
52
|
-
success700: string;
|
|
53
|
-
background: string;
|
|
54
|
-
foreground: string;
|
|
55
|
-
};
|
|
56
|
-
space: {
|
|
57
|
-
0: string;
|
|
58
|
-
5: string;
|
|
59
|
-
10: string;
|
|
60
|
-
15: string;
|
|
61
|
-
20: string;
|
|
62
|
-
25: string;
|
|
63
|
-
30: string;
|
|
64
|
-
40: string;
|
|
65
|
-
46: string;
|
|
66
|
-
50: string;
|
|
67
|
-
60: string;
|
|
68
|
-
70: string;
|
|
69
|
-
80: string;
|
|
70
|
-
90: string;
|
|
71
|
-
100: string;
|
|
72
|
-
2: string;
|
|
73
|
-
4: string;
|
|
74
|
-
6: string;
|
|
75
|
-
8: string;
|
|
76
|
-
12: string;
|
|
77
|
-
16: string;
|
|
78
|
-
24: string;
|
|
79
|
-
28: string;
|
|
80
|
-
32: string;
|
|
81
|
-
};
|
|
82
|
-
radii: {
|
|
83
|
-
xs: string;
|
|
84
|
-
sm: string;
|
|
85
|
-
xm: string;
|
|
86
|
-
md: string;
|
|
87
|
-
xl: string;
|
|
88
|
-
lg: string;
|
|
89
|
-
};
|
|
90
|
-
fontSizes: {
|
|
91
|
-
10: string;
|
|
92
|
-
12: string;
|
|
93
|
-
14: string;
|
|
94
|
-
16: string;
|
|
95
|
-
18: string;
|
|
96
|
-
20: string;
|
|
97
|
-
22: string;
|
|
98
|
-
24: string;
|
|
99
|
-
28: string;
|
|
100
|
-
32: string;
|
|
101
|
-
36: string;
|
|
102
|
-
40: string;
|
|
103
|
-
48: string;
|
|
104
|
-
};
|
|
105
|
-
fonts: {};
|
|
106
|
-
fontWeights: {
|
|
107
|
-
regular: number;
|
|
108
|
-
medium: number;
|
|
109
|
-
semiBold: number;
|
|
110
|
-
bold: number;
|
|
111
|
-
};
|
|
112
|
-
lineHeights: {
|
|
113
|
-
12: string;
|
|
114
|
-
16: string;
|
|
115
|
-
20: string;
|
|
116
|
-
24: string;
|
|
117
|
-
26: string;
|
|
118
|
-
28: string;
|
|
119
|
-
30: string;
|
|
120
|
-
36: string;
|
|
121
|
-
40: string;
|
|
122
|
-
44: string;
|
|
123
|
-
52: string;
|
|
124
|
-
64: string;
|
|
125
|
-
};
|
|
126
|
-
letterSpacings: {};
|
|
127
|
-
sizes: {
|
|
128
|
-
4: string;
|
|
129
|
-
6: string;
|
|
130
|
-
8: string;
|
|
131
|
-
12: string;
|
|
132
|
-
16: string;
|
|
133
|
-
18: string;
|
|
134
|
-
20: string;
|
|
135
|
-
24: string;
|
|
136
|
-
28: string;
|
|
137
|
-
32: string;
|
|
138
|
-
36: string;
|
|
139
|
-
40: string;
|
|
140
|
-
45: string;
|
|
141
|
-
48: string;
|
|
142
|
-
};
|
|
143
|
-
borderWidths: {};
|
|
144
|
-
borderStyles: {};
|
|
145
|
-
shadows: {
|
|
146
|
-
s: string;
|
|
147
|
-
};
|
|
148
|
-
zIndices: {};
|
|
149
|
-
transitions: {};
|
|
150
|
-
}, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
|
|
151
|
-
//# sourceMappingURL=BlockchainsChip.styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockchainsChip.styles.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsChip/BlockchainsChip.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA2Bf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockchainsChip.types.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsChip/BlockchainsChip.types.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CACtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsChip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockchainSection.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsSection/BlockchainSection.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,eAAO,MAAM,eAAe,gBAAiB,cAAc,EAAE,qBAiB5D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableCategoryList.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCategoryList/SelectableCategoryList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAIhE,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,qBA4DtD"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type BlockchainMeta } from 'rango-sdk';
|
|
2
|
-
import { BlockchainCategories } from './SelectableCategoryList.types';
|
|
3
|
-
export declare const generateBlockchainsLogo: (list: BlockchainMeta[], type: Exclude<BlockchainCategories, 'ALL'>) => BlockchainMeta[];
|
|
4
|
-
//# sourceMappingURL=SelectableCategoryList.helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableCategoryList.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAStE,eAAO,MAAM,uBAAuB,SAC5B,cAAc,EAAE,QAChB,QAAQ,oBAAoB,EAAE,KAAK,CAAC,qBAIoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableCategoryList.styles.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCategoryList/SelectableCategoryList.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAIpB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAMvB,CAAC;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAKrB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PropTypes {
|
|
2
|
-
setCategory: (type: string) => void;
|
|
3
|
-
category: string;
|
|
4
|
-
}
|
|
5
|
-
export declare enum BlockchainCategories {
|
|
6
|
-
ALL = "ALL",
|
|
7
|
-
EVM = "EVM",
|
|
8
|
-
COSMOS = "COSMOS",
|
|
9
|
-
UTXO = "UTXO",
|
|
10
|
-
OTHER = "OTHER"
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=SelectableCategoryList.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableCategoryList.types.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCategoryList/SelectableCategoryList.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,oBAAoB;IAC9B,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCategoryList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
2
|
-
|
|
3
|
-
export const Chip = styled('button', {
|
|
4
|
-
padding: '$10',
|
|
5
|
-
borderRadius: '$sm',
|
|
6
|
-
backgroundColor: '$neutral100',
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexDirection: 'column',
|
|
9
|
-
justifyContent: 'center',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
cursor: 'pointer',
|
|
12
|
-
border: 0,
|
|
13
|
-
'.image-container': {
|
|
14
|
-
borderRadius: '$xm',
|
|
15
|
-
overflow: 'hidden',
|
|
16
|
-
},
|
|
17
|
-
'&:hover': {
|
|
18
|
-
backgroundColor: '$neutral400',
|
|
19
|
-
},
|
|
20
|
-
'&:focus-visible': {
|
|
21
|
-
outline: 0,
|
|
22
|
-
backgroundColor: '$neutral500',
|
|
23
|
-
},
|
|
24
|
-
variants: {
|
|
25
|
-
selected: {
|
|
26
|
-
true: { outline: '1px solid $secondary500' },
|
|
27
|
-
false: { outline: 0 },
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './BlockchainsChip.types';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { Chip } from './BlockchainsChip.styles';
|
|
7
|
-
|
|
8
|
-
export function BlockchainsChip(props: PropsWithChildren<PropTypes>) {
|
|
9
|
-
const { children, selected, onClick } = props;
|
|
10
|
-
return (
|
|
11
|
-
<Chip selected={selected} onClick={onClick}>
|
|
12
|
-
{children}
|
|
13
|
-
</Chip>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BlockchainsChip } from './BlockchainsChip';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { BlockchainMeta } from 'rango-sdk';
|
|
2
|
-
|
|
3
|
-
export const sortBlockchains = (blockchains: BlockchainMeta[]) => {
|
|
4
|
-
const importantBlockchains: BlockchainMeta[] = [];
|
|
5
|
-
const otherBlockchains: BlockchainMeta[] = [];
|
|
6
|
-
|
|
7
|
-
for (const blockchain of blockchains) {
|
|
8
|
-
if (
|
|
9
|
-
blockchain.name === 'ETH' ||
|
|
10
|
-
blockchain.name === 'COSMOS' ||
|
|
11
|
-
blockchain.name === 'OSMOSIS'
|
|
12
|
-
) {
|
|
13
|
-
importantBlockchains.push(blockchain);
|
|
14
|
-
} else {
|
|
15
|
-
otherBlockchains.push(blockchain);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return importantBlockchains.concat(otherBlockchains);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type BlockchainMeta } from 'rango-sdk';
|
|
2
|
-
|
|
3
|
-
import { filterByType } from '../BlockchainList/BlockchainList.helpers';
|
|
4
|
-
|
|
5
|
-
import { BlockchainCategories } from './SelectableCategoryList.types';
|
|
6
|
-
|
|
7
|
-
const blockchainslogo = {
|
|
8
|
-
[BlockchainCategories.EVM]: ['ETH', 'BSC', 'POLYGON'],
|
|
9
|
-
[BlockchainCategories.COSMOS]: ['COSMOS', 'OSMOSIS', 'JUNO'],
|
|
10
|
-
[BlockchainCategories.UTXO]: ['BTC', 'LTC', 'BCH'],
|
|
11
|
-
[BlockchainCategories.OTHER]: ['STARKNET', 'TRON', 'SOLANA'],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const generateBlockchainsLogo = (
|
|
15
|
-
list: BlockchainMeta[],
|
|
16
|
-
type: Exclude<BlockchainCategories, 'ALL'>
|
|
17
|
-
) =>
|
|
18
|
-
list
|
|
19
|
-
.filter((item) => filterByType(item, type))
|
|
20
|
-
.filter((item) => blockchainslogo[type].includes(item.name));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
2
|
-
|
|
3
|
-
export const Container = styled('div', {
|
|
4
|
-
display: 'grid',
|
|
5
|
-
gap: '$10',
|
|
6
|
-
gridTemplateColumns: 'auto 1fr 1fr 1fr 1fr',
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const ImageContent = styled('div', {
|
|
10
|
-
display: 'flex',
|
|
11
|
-
position: 'relative',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
justifyContent: 'center',
|
|
14
|
-
paddingTop: '$10',
|
|
15
|
-
});
|
|
16
|
-
export const FirstImage = styled('img', {
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
top: -2,
|
|
19
|
-
width: 15,
|
|
20
|
-
height: 15,
|
|
21
|
-
});
|