@rango-dev/widget-embedded 0.18.0 → 0.19.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 +1 -113
- package/dist/QueueManager.d.ts +2 -5
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/Wallets.d.ts +17 -0
- package/dist/Wallets.d.ts.map +1 -0
- package/dist/Widget.d.ts +9 -0
- package/dist/Widget.d.ts.map +1 -0
- package/dist/components/AppRouter.d.ts +2 -0
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +6 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +62 -691
- 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/ConfirmWalletsModal.types.d.ts +3 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +4 -1
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- 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 +2 -2
- package/dist/components/Layout/Layout.types.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.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +0 -1727
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
- package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
- package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
- package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/index.d.ts +2 -0
- package/dist/components/NoRoutes/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +0 -158
- 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 +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +0 -628
- package/dist/components/SwapDetails/SwapDetails.styles.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.helpers.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -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 +0 -157
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
- package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +1 -1100
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +9 -4
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/TokenList/index.d.ts +1 -0
- package/dist/components/TokenList/index.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/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +4 -4
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +1 -1
- package/dist/constants/navigationRoutes.d.ts +2 -1
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +1 -2
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/warnings.d.ts +2 -2
- package/dist/constants/warnings.d.ts.map +1 -1
- package/dist/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/useLanguage.d.ts +1 -1
- package/dist/hooks/useLanguage.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts +3 -1
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +7 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +0 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +1 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts +2 -4
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +8 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -1
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts +2 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +6 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +8 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/app.d.ts +22 -41
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +77 -0
- package/dist/store/bestRoute.d.ts.map +1 -0
- package/dist/store/meta.d.ts +23 -0
- package/dist/store/meta.d.ts.map +1 -0
- package/dist/store/notification.d.ts +3 -4
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/settings.d.ts +81 -0
- package/dist/store/settings.d.ts.map +1 -0
- package/dist/store/slices/config.d.ts +2 -3
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -5
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/ui.d.ts +1 -2
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +9 -14
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -41
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/routing.d.ts +65 -0
- package/dist/types/routing.d.ts.map +1 -0
- package/dist/types/swap.d.ts +14 -4
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +1 -15
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +0 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -2
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -2
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/queue.d.ts +2 -2
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +28 -0
- package/dist/utils/routing.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +2 -6
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +24 -35
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +10 -9
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +10 -12
- package/src/QueueManager.tsx +17 -18
- package/src/{containers/Wallets/Wallets.tsx → Wallets.tsx} +34 -48
- package/src/Widget.tsx +119 -0
- package/src/components/AppRouter.tsx +32 -8
- package/src/components/AppRoutes.tsx +69 -57
- package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +17 -26
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +10 -29
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +47 -43
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
- package/src/components/ConfirmWalletsModal/WalletList.tsx +8 -9
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
- package/src/components/HeaderButtons/HomeButtons.tsx +18 -28
- package/src/components/Layout/Layout.styles.ts +0 -2
- package/src/components/Layout/Layout.tsx +7 -20
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +61 -65
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +34 -28
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
- package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +16 -23
- package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
- package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +17 -12
- package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +3 -5
- package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +1 -8
- package/src/components/RouteErrors/RouteErrors.tsx +79 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
- package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +4 -4
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/Slippage/Slippage.styles.ts +5 -15
- package/src/components/Slippage/Slippage.tsx +10 -11
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +8 -5
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +33 -36
- package/src/components/SwapDetails/SwapDetails.tsx +56 -41
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +3 -4
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +8 -14
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
- package/src/components/SwapsGroup/SwapsGroup.styles.ts +1 -10
- package/src/components/SwapsGroup/SwapsGroup.tsx +5 -3
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +38 -74
- package/src/components/TokenList/TokenList.tsx +26 -35
- package/src/components/TokenList/TokenList.types.ts +10 -4
- package/src/components/TokenList/index.ts +1 -0
- package/src/components/UpdateUrl.tsx +30 -35
- package/src/components/WidgetEvents.tsx +2 -4
- package/src/constants/errors.ts +15 -17
- package/src/constants/index.ts +0 -1
- package/src/constants/messages.ts +1 -1
- package/src/constants/navigationRoutes.ts +8 -7
- package/src/constants/searchParams.ts +0 -1
- package/src/constants/warnings.ts +7 -7
- package/src/hooks/useConfirmSwap.ts +303 -0
- package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
- package/src/hooks/useLanguage.ts +5 -4
- package/src/hooks/useNavigateBack.ts +52 -3
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +7 -37
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +0 -60
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +3 -78
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +6 -15
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +1 -6
- package/src/hooks/useSwapInput.ts +48 -141
- package/src/hooks/useSyncStoresWithConfig.ts +24 -40
- package/src/hooks/useTheme.ts +5 -4
- package/src/hooks/useWalletList.ts +5 -3
- package/src/index.ts +5 -53
- package/src/pages/ConfirmSwapPage.tsx +266 -117
- package/src/pages/HistoryPage.tsx +7 -2
- package/src/pages/Home.tsx +303 -88
- package/src/pages/LanguagePage.tsx +5 -0
- package/src/pages/LiquiditySourcePage.tsx +37 -24
- package/src/pages/SelectBlockchainPage.tsx +24 -31
- package/src/pages/SelectSwapItemsPage.tsx +31 -18
- package/src/pages/SettingsPage.tsx +27 -32
- package/src/pages/SwapDetailsPage.tsx +7 -6
- package/src/pages/ThemePage.tsx +7 -2
- package/src/pages/WalletsPage.tsx +19 -9
- package/src/services/httpService.ts +1 -1
- package/src/store/app.ts +6 -44
- package/src/store/{quote.ts → bestRoute.ts} +64 -71
- package/src/store/meta.ts +39 -0
- package/src/store/settings.ts +158 -0
- package/src/store/slices/config.ts +15 -26
- package/src/store/slices/data.ts +35 -74
- package/src/store/wallets.ts +37 -68
- package/src/types/config.ts +8 -53
- package/src/types/index.ts +1 -1
- package/src/types/routing.ts +77 -0
- package/src/types/swap.ts +13 -4
- package/src/types/wallets.ts +1 -18
- package/src/utils/colors.ts +1 -2
- package/src/utils/configs.ts +1 -2
- package/src/utils/date.ts +1 -1
- package/src/utils/meta.ts +1 -8
- package/src/utils/numbers.ts +1 -1
- package/src/utils/providers.ts +5 -8
- package/src/utils/queue.ts +2 -2
- package/src/utils/routing.ts +321 -0
- package/src/utils/settings.ts +10 -17
- package/src/utils/swap.ts +120 -154
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +161 -156
- package/dist/components/NoResult/NoResult.d.ts +0 -4
- package/dist/components/NoResult/NoResult.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
- package/dist/components/NoResult/index.d.ts +0 -2
- package/dist/components/NoResult/index.d.ts.map +0 -1
- package/dist/components/Quote/Quote.d.ts +0 -4
- package/dist/components/Quote/Quote.d.ts.map +0 -1
- package/dist/components/Quote/Quote.styles.d.ts +0 -2217
- package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -21
- package/dist/components/Quote/Quote.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.d.ts +0 -11
- package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -315
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
- package/dist/components/Quote/index.d.ts +0 -3
- package/dist/components/Quote/index.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +0 -633
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +0 -6
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +0 -1571
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +0 -6
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +0 -4
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +0 -786
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +0 -4
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +0 -1
- package/dist/components/QuoteSkeleton/index.d.ts +0 -4
- package/dist/components/QuoteSkeleton/index.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -23
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
- package/dist/containers/App/App.d.ts +0 -3
- package/dist/containers/App/App.d.ts.map +0 -1
- package/dist/containers/App/App.styles.d.ts +0 -158
- package/dist/containers/App/App.styles.d.ts.map +0 -1
- package/dist/containers/App/index.d.ts +0 -2
- package/dist/containers/App/index.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -788
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -20
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/index.d.ts +0 -2
- package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
- package/dist/containers/Wallets/Wallets.d.ts +0 -6
- package/dist/containers/Wallets/Wallets.d.ts.map +0 -1
- package/dist/containers/Wallets/Wallets.types.d.ts +0 -11
- package/dist/containers/Wallets/Wallets.types.d.ts.map +0 -1
- package/dist/containers/Wallets/index.d.ts +0 -2
- package/dist/containers/Wallets/index.d.ts.map +0 -1
- package/dist/containers/Widget/Widget.d.ts +0 -5
- package/dist/containers/Widget/Widget.d.ts.map +0 -1
- package/dist/containers/Widget/Widget.types.d.ts +0 -5
- package/dist/containers/Widget/Widget.types.d.ts.map +0 -1
- package/dist/containers/Widget/index.d.ts +0 -3
- package/dist/containers/Widget/index.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts +0 -6
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +0 -20
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +0 -21
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +0 -1
- package/dist/containers/WidgetInfo/index.d.ts +0 -2
- package/dist/containers/WidgetInfo/index.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts +0 -5
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +0 -7
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +0 -1
- package/dist/containers/WidgetProvider/index.d.ts +0 -2
- package/dist/containers/WidgetProvider/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
- package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -19
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
- package/dist/hooks/useFetchQuote.d.ts.map +0 -1
- package/dist/hooks/useForceAutoConnect.d.ts +0 -2
- package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
- package/dist/store/AppStore.d.ts +0 -47
- package/dist/store/AppStore.d.ts.map +0 -1
- package/dist/store/quote.d.ts +0 -89
- package/dist/store/quote.d.ts.map +0 -1
- package/dist/store/slices/settings.d.ts +0 -39
- package/dist/store/slices/settings.d.ts.map +0 -1
- package/dist/types/quote.d.ts +0 -82
- package/dist/types/quote.d.ts.map +0 -1
- package/dist/utils/quote.d.ts +0 -32
- package/dist/utils/quote.d.ts.map +0 -1
- package/src/components/NoResult/index.ts +0 -1
- package/src/components/Quote/Quote.styles.ts +0 -249
- package/src/components/Quote/Quote.tsx +0 -414
- package/src/components/Quote/Quote.types.ts +0 -15
- package/src/components/Quote/QuoteSummary.styles.ts +0 -16
- package/src/components/Quote/QuoteSummary.tsx +0 -46
- package/src/components/Quote/index.ts +0 -2
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +0 -42
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +0 -30
- package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +0 -5
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +0 -57
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +0 -76
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +0 -6
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +0 -33
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +0 -44
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +0 -1
- package/src/components/QuoteSkeleton/index.ts +0 -3
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -74
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -25
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
- package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
- package/src/containers/App/App.styles.ts +0 -18
- package/src/containers/App/App.tsx +0 -52
- package/src/containers/App/index.ts +0 -1
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -31
- package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -99
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -20
- package/src/containers/QuoteInfo/index.ts +0 -1
- package/src/containers/Wallets/Wallets.types.ts +0 -12
- package/src/containers/Wallets/index.ts +0 -1
- package/src/containers/Widget/Widget.tsx +0 -19
- package/src/containers/Widget/Widget.types.ts +0 -5
- package/src/containers/Widget/index.ts +0 -2
- package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +0 -64
- package/src/containers/WidgetInfo/WidgetInfo.tsx +0 -62
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +0 -21
- package/src/containers/WidgetInfo/index.ts +0 -1
- package/src/containers/WidgetProvider/WidgetProvider.tsx +0 -28
- package/src/containers/WidgetProvider/WidgetProvider.types.ts +0 -7
- package/src/containers/WidgetProvider/index.ts +0 -1
- package/src/hooks/useConfirmSwap/index.ts +0 -1
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -172
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -137
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
- package/src/hooks/useForceAutoConnect.ts +0 -27
- package/src/store/AppStore.tsx +0 -41
- package/src/store/slices/settings.ts +0 -168
- package/src/types/quote.ts +0 -107
- package/src/utils/quote.ts +0 -338
package/src/utils/wallets.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { TokenWithBalance } from '../components/TokenList';
|
|
1
2
|
import type { ConnectedWallet, TokenBalance } from '../store/wallets';
|
|
2
|
-
import type {
|
|
3
|
+
import type { Wallet } from '../types';
|
|
3
4
|
import type { WalletInfo as ModalWalletInfo } from '@rango-dev/ui';
|
|
4
5
|
import type {
|
|
5
|
-
Asset,
|
|
6
6
|
Network,
|
|
7
7
|
WalletInfo,
|
|
8
8
|
WalletState,
|
|
@@ -29,12 +29,6 @@ import BigNumber from 'bignumber.js';
|
|
|
29
29
|
import { isCosmosBlockchain } from 'rango-types';
|
|
30
30
|
|
|
31
31
|
import { ZERO } from '../constants/numbers';
|
|
32
|
-
import {
|
|
33
|
-
BALANCE_MAX_DECIMALS,
|
|
34
|
-
BALANCE_MIN_DECIMALS,
|
|
35
|
-
USD_VALUE_MAX_DECIMALS,
|
|
36
|
-
USD_VALUE_MIN_DECIMALS,
|
|
37
|
-
} from '../constants/routing';
|
|
38
32
|
import { EXCLUDED_WALLETS } from '../constants/wallets';
|
|
39
33
|
|
|
40
34
|
import { numberToString } from './numbers';
|
|
@@ -61,11 +55,8 @@ export function mapWalletTypesToWalletInfo(
|
|
|
61
55
|
return list
|
|
62
56
|
.filter((wallet) => !EXCLUDED_WALLETS.includes(wallet as WalletTypes))
|
|
63
57
|
.filter((wallet) => {
|
|
64
|
-
const { supportedChains,
|
|
65
|
-
|
|
66
|
-
const filterContractWallets =
|
|
67
|
-
isContractWallet && (!installed || (!!chain && network !== chain));
|
|
68
|
-
if (filterContractWallets) {
|
|
58
|
+
const { supportedChains, hideWhenNotInstalled } = getWalletInfo(wallet);
|
|
59
|
+
if (hideWhenNotInstalled && !getState(wallet).installed) {
|
|
69
60
|
return false;
|
|
70
61
|
}
|
|
71
62
|
if (chain) {
|
|
@@ -106,8 +97,7 @@ export function prepareAccountsForWalletStore(
|
|
|
106
97
|
wallet: WalletType,
|
|
107
98
|
accounts: string[],
|
|
108
99
|
evmBasedChains: string[],
|
|
109
|
-
supportedChainNames: Network[] | null
|
|
110
|
-
isContractWallet: boolean
|
|
100
|
+
supportedChainNames: Network[] | null
|
|
111
101
|
): Wallet[] {
|
|
112
102
|
const result: Wallet[] = [];
|
|
113
103
|
|
|
@@ -161,29 +151,21 @@ export function prepareAccountsForWalletStore(
|
|
|
161
151
|
|
|
162
152
|
// If it's an evm network, we will add the address to all the evm chains.
|
|
163
153
|
if (isEvmBasedChain || isUnknownAndEvmBased) {
|
|
164
|
-
|
|
154
|
+
/*
|
|
155
|
+
* all evm chains are not supported in wallets, so we are adding
|
|
156
|
+
* only to those that are supported by wallet.
|
|
157
|
+
*/
|
|
158
|
+
const evmChainsSupportedByWallet = supportedBlockchains.filter((chain) =>
|
|
159
|
+
evmBasedChains.includes(chain)
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
evmChainsSupportedByWallet.forEach((network) => {
|
|
165
163
|
/*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
164
|
+
* EVM addresses are not case sensitive.
|
|
165
|
+
* Some wallets like Binance-chain return some letters in uppercase which produces bugs in our wallet state.
|
|
168
166
|
*/
|
|
169
167
|
addAccount(network, address.toLowerCase());
|
|
170
|
-
}
|
|
171
|
-
/*
|
|
172
|
-
* all evm chains are not supported in wallets, so we are adding
|
|
173
|
-
* only to those that are supported by wallet.
|
|
174
|
-
*/
|
|
175
|
-
const evmChainsSupportedByWallet = supportedBlockchains.filter(
|
|
176
|
-
(chain) => evmBasedChains.includes(chain)
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
evmChainsSupportedByWallet.forEach((network) => {
|
|
180
|
-
/*
|
|
181
|
-
* EVM addresses are not case sensitive.
|
|
182
|
-
* Some wallets like Binance-chain return some letters in uppercase which produces bugs in our wallet state.
|
|
183
|
-
*/
|
|
184
|
-
addAccount(network, address.toLowerCase());
|
|
185
|
-
});
|
|
186
|
-
}
|
|
168
|
+
});
|
|
187
169
|
} else {
|
|
188
170
|
addAccount(network, address);
|
|
189
171
|
}
|
|
@@ -192,10 +174,10 @@ export function prepareAccountsForWalletStore(
|
|
|
192
174
|
return result;
|
|
193
175
|
}
|
|
194
176
|
|
|
195
|
-
export function getRequiredChains(
|
|
177
|
+
export function getRequiredChains(route: BestRouteResponse | null) {
|
|
196
178
|
const wallets: string[] = [];
|
|
197
179
|
|
|
198
|
-
|
|
180
|
+
route?.result?.swaps.forEach((swap) => {
|
|
199
181
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
200
182
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
201
183
|
if (!wallets.includes(currentStepFromBlockchain)) {
|
|
@@ -224,6 +206,43 @@ export function getRequiredChains(quote: BestRouteResponse | null) {
|
|
|
224
206
|
|
|
225
207
|
type Blockchain = { name: string; accounts: ConnectedWallet[] };
|
|
226
208
|
|
|
209
|
+
export function getBalanceFromWallet(
|
|
210
|
+
connectedWallets: ConnectedWallet[],
|
|
211
|
+
chain: string,
|
|
212
|
+
symbol: string,
|
|
213
|
+
address: string | null
|
|
214
|
+
): TokenBalance | null {
|
|
215
|
+
if (connectedWallets.length === 0) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const selectedChainWallets = connectedWallets.filter(
|
|
220
|
+
(wallet) => wallet.chain === chain
|
|
221
|
+
);
|
|
222
|
+
if (selectedChainWallets.length === 0) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
selectedChainWallets
|
|
228
|
+
.map(
|
|
229
|
+
(wallet) =>
|
|
230
|
+
wallet.balances?.find(
|
|
231
|
+
(balance) =>
|
|
232
|
+
(address !== null && balance.address === address) ||
|
|
233
|
+
(address === null &&
|
|
234
|
+
balance.address === address &&
|
|
235
|
+
balance.symbol === symbol)
|
|
236
|
+
) || null
|
|
237
|
+
)
|
|
238
|
+
.filter((balance) => balance !== null)
|
|
239
|
+
.sort(
|
|
240
|
+
(a, b) => parseFloat(b?.amount || '0') - parseFloat(a?.amount || '1')
|
|
241
|
+
)
|
|
242
|
+
.find(() => true) || null
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
227
246
|
export function isAccountAndWalletMatched(
|
|
228
247
|
account: Wallet,
|
|
229
248
|
connectedWallet: ConnectedWallet
|
|
@@ -317,6 +336,30 @@ function numberWithThousandSeparator(number: string | number): string {
|
|
|
317
336
|
return parts.join('.');
|
|
318
337
|
}
|
|
319
338
|
|
|
339
|
+
export const sortTokens = (tokens: TokenWithBalance[]): TokenWithBalance[] => {
|
|
340
|
+
const walletConnected = !!tokens.some((token) => token.balance);
|
|
341
|
+
if (!walletConnected) {
|
|
342
|
+
return tokens
|
|
343
|
+
.filter((token) => !token.address)
|
|
344
|
+
.concat(
|
|
345
|
+
tokens.filter((token) => token.address && !token.isSecondaryCoin),
|
|
346
|
+
tokens.filter((token) => token.isSecondaryCoin)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return tokens
|
|
351
|
+
.filter((token) => !!token.balance)
|
|
352
|
+
.sort(
|
|
353
|
+
(tokenA, tokenB) =>
|
|
354
|
+
parseFloat(tokenB.balance?.usdValue || '0') -
|
|
355
|
+
parseFloat(tokenA.balance?.usdValue || '0')
|
|
356
|
+
)
|
|
357
|
+
.concat(
|
|
358
|
+
tokens.filter((token) => !token.balance && !token.isSecondaryCoin),
|
|
359
|
+
tokens.filter((token) => !token.balance && token.isSecondaryCoin)
|
|
360
|
+
);
|
|
361
|
+
};
|
|
362
|
+
|
|
320
363
|
export const getUsdPrice = (
|
|
321
364
|
blockchain: string,
|
|
322
365
|
symbol: string,
|
|
@@ -360,87 +403,98 @@ export const getKeplrCompatibleConnectedWallets = (
|
|
|
360
403
|
);
|
|
361
404
|
};
|
|
362
405
|
|
|
363
|
-
export function
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
: null;
|
|
379
|
-
|
|
380
|
-
return formattedBalance;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function sortTokensByBalance(
|
|
384
|
-
token1Balance: Balance | null,
|
|
385
|
-
token2Balance: Balance | null
|
|
386
|
-
): number {
|
|
387
|
-
if (token1Balance?.usdValue && token2Balance?.usdValue) {
|
|
388
|
-
return (
|
|
389
|
-
parseFloat(token2Balance.usdValue) - parseFloat(token1Balance.usdValue)
|
|
406
|
+
export function getTokensWithBalance(
|
|
407
|
+
tokens: TokenWithBalance[],
|
|
408
|
+
connectedWallets: ConnectedWallet[]
|
|
409
|
+
): TokenWithBalance[] {
|
|
410
|
+
return tokens.map(({ balance, ...otherProps }) => {
|
|
411
|
+
const tokenAmount = numberToString(
|
|
412
|
+
new BigNumber(
|
|
413
|
+
getBalanceFromWallet(
|
|
414
|
+
connectedWallets,
|
|
415
|
+
otherProps.blockchain,
|
|
416
|
+
otherProps.symbol,
|
|
417
|
+
otherProps.address
|
|
418
|
+
)?.amount || ZERO
|
|
419
|
+
)
|
|
390
420
|
);
|
|
391
|
-
}
|
|
392
421
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
422
|
+
let tokenUsdValue = '';
|
|
423
|
+
if (otherProps.usdPrice) {
|
|
424
|
+
tokenUsdValue = numberToString(
|
|
425
|
+
new BigNumber(
|
|
426
|
+
getBalanceFromWallet(
|
|
427
|
+
connectedWallets,
|
|
428
|
+
otherProps.blockchain,
|
|
429
|
+
otherProps.symbol,
|
|
430
|
+
otherProps.address
|
|
431
|
+
)?.amount || ZERO
|
|
432
|
+
).multipliedBy(otherProps.usdPrice)
|
|
433
|
+
);
|
|
434
|
+
}
|
|
396
435
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
436
|
+
return {
|
|
437
|
+
...otherProps,
|
|
438
|
+
...(tokenAmount !== '0' && {
|
|
439
|
+
balance: { amount: tokenAmount, usdValue: tokenUsdValue },
|
|
440
|
+
}),
|
|
441
|
+
};
|
|
442
|
+
});
|
|
443
|
+
}
|
|
400
444
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
445
|
+
export function getTokensBalanceFromWalletAndSort(
|
|
446
|
+
tokens: TokenWithBalance[],
|
|
447
|
+
connectedWallets: ConnectedWallet[]
|
|
448
|
+
) {
|
|
449
|
+
const list =
|
|
450
|
+
connectedWallets.length > 0
|
|
451
|
+
? getTokensWithBalance(tokens, connectedWallets)
|
|
452
|
+
: tokens;
|
|
453
|
+
list.sort((tokenA, tokenB) => {
|
|
454
|
+
if (tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
455
|
+
return (
|
|
456
|
+
parseFloat(tokenB.balance.usdValue) -
|
|
457
|
+
parseFloat(tokenA.balance.usdValue)
|
|
458
|
+
);
|
|
459
|
+
}
|
|
407
460
|
|
|
408
|
-
|
|
409
|
-
|
|
461
|
+
if (!tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
462
|
+
return 1;
|
|
463
|
+
}
|
|
410
464
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
)
|
|
416
|
-
|
|
417
|
-
|
|
465
|
+
if (tokenA.balance?.usdValue && !tokenB.balance?.usdValue) {
|
|
466
|
+
return -1;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (!tokenA.balance?.usdValue && !tokenB.balance?.usdValue) {
|
|
470
|
+
return (
|
|
471
|
+
parseFloat(tokenB.balance?.amount || '0') -
|
|
472
|
+
parseFloat(tokenA.balance?.amount || '0')
|
|
473
|
+
);
|
|
474
|
+
}
|
|
418
475
|
|
|
419
|
-
if (isToken1Pinned === isToken2Pinned) {
|
|
420
476
|
return 0;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
return 1;
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
return list;
|
|
426
480
|
}
|
|
427
|
-
|
|
481
|
+
|
|
482
|
+
export function getSortedTokens(
|
|
483
|
+
chain: BlockchainMeta | null,
|
|
428
484
|
tokens: Token[],
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return isTokenPin !== 0
|
|
439
|
-
? isTokenPin
|
|
440
|
-
: sortTokensByBalance(token1Balance, token2Balance);
|
|
441
|
-
});
|
|
485
|
+
connectedWallets: ConnectedWallet[],
|
|
486
|
+
otherChainTokens: TokenWithBalance[]
|
|
487
|
+
): TokenWithBalance[] {
|
|
488
|
+
const fromChainEqualsToToBlockchain =
|
|
489
|
+
chain?.name === otherChainTokens[0]?.name;
|
|
490
|
+
if (fromChainEqualsToToBlockchain) {
|
|
491
|
+
return otherChainTokens;
|
|
492
|
+
}
|
|
442
493
|
|
|
443
|
-
|
|
494
|
+
const filteredTokens = tokens.filter(
|
|
495
|
+
(token) => token.blockchain === chain?.name
|
|
496
|
+
);
|
|
497
|
+
return sortTokens(getTokensWithBalance(filteredTokens, connectedWallets));
|
|
444
498
|
}
|
|
445
499
|
|
|
446
500
|
export function tokensAreEqual(
|
|
@@ -502,52 +556,3 @@ export function getAddress({
|
|
|
502
556
|
connectedWallet.chain === chain
|
|
503
557
|
)?.address;
|
|
504
558
|
}
|
|
505
|
-
|
|
506
|
-
export function createTokenHash(token: Asset): TokenHash {
|
|
507
|
-
return `${token.blockchain}-${token.symbol}-${token.address ?? ''}`;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
export function makeTokensBalance(connectedWallets: ConnectedWallet[]) {
|
|
511
|
-
return connectedWallets
|
|
512
|
-
.flatMap((wallet) => wallet.balances)
|
|
513
|
-
.reduce((balances: TokensBalance, balance) => {
|
|
514
|
-
const currentBalance = {
|
|
515
|
-
amount: balance?.amount ?? '',
|
|
516
|
-
decimals: balance?.decimal ?? 0,
|
|
517
|
-
usdValue: balance?.usdPrice
|
|
518
|
-
? new BigNumber(balance?.usdPrice ?? ZERO)
|
|
519
|
-
.multipliedBy(balance?.amount)
|
|
520
|
-
.toString()
|
|
521
|
-
: '',
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
const tokenHash = balance
|
|
525
|
-
? createTokenHash({
|
|
526
|
-
symbol: balance.symbol,
|
|
527
|
-
blockchain: balance.chain,
|
|
528
|
-
address: balance.address,
|
|
529
|
-
})
|
|
530
|
-
: null;
|
|
531
|
-
|
|
532
|
-
const prevBalance = tokenHash ? balances[tokenHash] : null;
|
|
533
|
-
|
|
534
|
-
const shouldUpdateBalance =
|
|
535
|
-
tokenHash &&
|
|
536
|
-
(!prevBalance ||
|
|
537
|
-
(prevBalance && prevBalance.amount < currentBalance.amount));
|
|
538
|
-
|
|
539
|
-
if (shouldUpdateBalance) {
|
|
540
|
-
balances[tokenHash] = currentBalance;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
return balances;
|
|
544
|
-
}, {});
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
export const isFetchingBalance = (
|
|
548
|
-
connectedWallets: ConnectedWallet[],
|
|
549
|
-
blockchain: string
|
|
550
|
-
) =>
|
|
551
|
-
!!connectedWallets.find(
|
|
552
|
-
(wallet) => wallet.chain === blockchain && wallet.loading
|
|
553
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoResult.d.ts","sourceRoot":"","sources":["../../../src/components/NoResult/NoResult.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAUlD,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,qBAyDxC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Info } from './NoResult.types';
|
|
2
|
-
import { type NoResultError, type QuoteRequestFailed } from '../../types';
|
|
3
|
-
export declare function makeInfo(error: NoResultError | QuoteRequestFailed | null, disabledLiquiditySources: string[], toggleAllLiquiditySources: (shouldReset: boolean) => void, refetchQuote: () => void): Info;
|
|
4
|
-
//# sourceMappingURL=NoResult.helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoResult.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/NoResult/NoResult.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAErB,wBAAgB,QAAQ,CACtB,KAAK,EAAE,aAAa,GAAG,kBAAkB,GAAG,IAAI,EAChD,wBAAwB,EAAE,MAAM,EAAE,EAClC,yBAAyB,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,EACzD,YAAY,EAAE,MAAM,IAAI,GACvB,IAAI,CA0CN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoResult.types.d.ts","sourceRoot":"","sources":["../../../src/components/NoResult/NoResult.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,aAAa,GAAG,kBAAkB,GAAG,IAAI,CAAC;CAClD;AAED,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/NoResult/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Quote.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/Quote.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkBhD,OAAO,KAA4C,MAAM,OAAO,CAAC;AAgDjE,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,qBA2VtC"}
|