@rango-dev/widget-embedded 0.17.1-next.8 → 0.18.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 +116 -0
- package/dist/QueueManager.d.ts +3 -1
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts.map +1 -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.styles.d.ts +690 -61
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.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/LoadingSwapDetails.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +1727 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +793 -5
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -1
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +157 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/Quote/index.d.ts +0 -1
- package/dist/components/Quote/index.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.styles.d.ts +314 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +1571 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +6 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +786 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/index.d.ts +4 -0
- package/dist/components/QuoteSkeleton/index.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +158 -0
- 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 +628 -0
- 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 +157 -0
- 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 +1100 -1
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +4 -9
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/components/TokenList/index.d.ts +0 -1
- package/dist/components/TokenList/index.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +1 -2
- package/dist/constants/navigationRoutes.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 +3 -0
- package/dist/containers/App/App.d.ts.map +1 -0
- package/dist/containers/App/App.styles.d.ts +158 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -0
- package/dist/containers/App/index.d.ts +2 -0
- package/dist/containers/App/index.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts +6 -0
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
- package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
- package/dist/containers/Wallets/index.d.ts +2 -0
- package/dist/containers/Wallets/index.d.ts.map +1 -0
- package/dist/containers/Widget/Widget.d.ts +5 -0
- package/dist/containers/Widget/Widget.d.ts.map +1 -0
- package/dist/containers/Widget/Widget.types.d.ts +5 -0
- package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
- package/dist/containers/Widget/index.d.ts +3 -0
- package/dist/containers/Widget/index.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +20 -0
- package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +21 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
- package/dist/containers/WidgetInfo/index.d.ts +2 -0
- package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
- package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
- package/dist/containers/WidgetProvider/index.d.ts +2 -0
- package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
- package/dist/hooks/useForceAutoConnect.d.ts +2 -0
- package/dist/hooks/useForceAutoConnect.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 +1 -3
- 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 +3 -5
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts.map +1 -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/index.d.ts +20 -8
- 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.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.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.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.map +1 -1
- package/dist/store/AppStore.d.ts +37 -1
- package/dist/store/AppStore.d.ts.map +1 -1
- package/dist/store/app.d.ts +39 -2
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/notification.d.ts +4 -3
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/quote.d.ts +9 -9
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -2
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts +39 -0
- package/dist/store/slices/settings.d.ts.map +1 -0
- package/dist/store/ui.d.ts +2 -1
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +9 -5
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +36 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/swap.d.ts +4 -14
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +15 -1
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/colors.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +1 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +2 -1
- package/dist/utils/meta.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/quote.d.ts +1 -1
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +4 -1
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +13 -5
- 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 +7 -8
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/QueueManager.tsx +4 -3
- package/src/components/AppRouter.tsx +5 -27
- package/src/components/AppRoutes.tsx +54 -33
- package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +19 -10
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +29 -10
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +15 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -3
- package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
- package/src/components/Layout/Layout.styles.ts +2 -0
- package/src/components/Layout/Layout.tsx +20 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +65 -61
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +28 -34
- package/src/components/NoResult/NoResult.helpers.ts +12 -12
- package/src/components/NoResult/NoResult.tsx +2 -5
- package/src/components/NotificationContent/NotificationContent.tsx +2 -1
- package/src/components/Quote/Quote.styles.ts +49 -12
- package/src/components/Quote/Quote.tsx +107 -38
- package/src/components/Quote/Quote.types.ts +0 -1
- package/src/components/Quote/QuoteSummary.styles.ts +9 -8
- package/src/components/Quote/QuoteSummary.tsx +2 -2
- package/src/components/Quote/index.ts +0 -1
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +57 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +76 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +6 -0
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +33 -0
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +44 -0
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +1 -0
- package/src/components/QuoteSkeleton/index.ts +3 -0
- package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -3
- package/src/components/Slippage/Slippage.styles.ts +15 -5
- package/src/components/Slippage/Slippage.tsx +11 -10
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +5 -8
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +36 -33
- package/src/components/SwapDetails/SwapDetails.tsx +28 -39
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +14 -8
- 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 +10 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +3 -5
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +74 -38
- package/src/components/TokenList/TokenList.tsx +30 -20
- package/src/components/TokenList/TokenList.types.ts +4 -10
- package/src/components/TokenList/index.ts +0 -1
- package/src/components/UpdateUrl.tsx +4 -5
- package/src/constants/errors.ts +9 -5
- package/src/constants/index.ts +1 -0
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/constants/searchParams.ts +1 -0
- package/src/containers/App/App.styles.ts +18 -0
- package/src/containers/App/App.tsx +52 -0
- package/src/containers/App/index.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
- package/src/containers/QuoteInfo/QuoteInfo.tsx +46 -44
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +25 -31
- package/src/containers/Wallets/Wallets.types.ts +12 -0
- package/src/containers/Wallets/index.ts +1 -0
- package/src/containers/Widget/Widget.tsx +19 -0
- package/src/containers/Widget/Widget.types.ts +5 -0
- package/src/containers/Widget/index.ts +2 -0
- package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +64 -0
- package/src/containers/WidgetInfo/WidgetInfo.tsx +62 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +21 -0
- package/src/containers/WidgetInfo/index.ts +1 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
- package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
- package/src/containers/WidgetProvider/index.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +21 -20
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
- package/src/hooks/useForceAutoConnect.ts +27 -0
- package/src/hooks/useLanguage.ts +4 -5
- package/src/hooks/useNavigateBack.ts +3 -52
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +15 -6
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
- package/src/hooks/useSwapInput.ts +86 -28
- package/src/hooks/useSyncStoresWithConfig.ts +18 -5
- package/src/hooks/useTheme.ts +4 -5
- package/src/index.ts +53 -5
- package/src/pages/ConfirmSwapPage.tsx +61 -33
- package/src/pages/HistoryPage.tsx +2 -7
- package/src/pages/Home.tsx +55 -81
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +3 -7
- package/src/pages/SelectBlockchainPage.tsx +26 -18
- package/src/pages/SelectSwapItemsPage.tsx +13 -26
- package/src/pages/SettingsPage.tsx +26 -17
- package/src/pages/SwapDetailsPage.tsx +3 -4
- package/src/pages/ThemePage.tsx +2 -7
- package/src/pages/WalletsPage.tsx +5 -8
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +7 -1
- package/src/store/app.ts +31 -5
- package/src/store/quote.ts +3 -4
- package/src/store/slices/config.ts +1 -0
- package/src/store/slices/data.ts +10 -6
- package/src/store/slices/settings.ts +168 -0
- package/src/store/wallets.ts +57 -29
- package/src/types/config.ts +48 -3
- package/src/types/swap.ts +4 -13
- package/src/types/wallets.ts +18 -1
- package/src/utils/colors.ts +2 -1
- package/src/utils/configs.ts +2 -1
- package/src/utils/date.ts +1 -1
- package/src/utils/meta.ts +8 -1
- package/src/utils/providers.ts +8 -5
- package/src/utils/queue.ts +2 -2
- package/src/utils/quote.ts +7 -7
- package/src/utils/settings.ts +11 -5
- package/src/utils/swap.ts +46 -40
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +127 -144
- package/dist/Wallets.d.ts +0 -18
- package/dist/Wallets.d.ts.map +0 -1
- package/dist/Widget.d.ts +0 -9
- package/dist/Widget.d.ts.map +0 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +0 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
- package/dist/store/settings.d.ts +0 -82
- package/dist/store/settings.d.ts.map +0 -1
- package/src/Widget.tsx +0 -106
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -41
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
- package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
- package/src/components/Quote/QuoteSkeleton.tsx +0 -108
- package/src/store/settings.ts +0 -161
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.d.ts +0 -0
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.d.ts +0 -0
- /package/src/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.ts +0 -0
package/src/Widget.tsx
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { WidgetConfig } from './types';
|
|
2
|
-
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
3
|
-
import type { PropsWithChildren } from 'react';
|
|
4
|
-
|
|
5
|
-
import { I18nManager, styled } from '@rango-dev/ui';
|
|
6
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { AppRouter } from './components/AppRouter';
|
|
9
|
-
import { AppRoutes } from './components/AppRoutes';
|
|
10
|
-
import { WidgetEvents } from './components/WidgetEvents';
|
|
11
|
-
import { globalFont } from './globalStyles';
|
|
12
|
-
import { useLanguage } from './hooks/useLanguage';
|
|
13
|
-
import { useTheme } from './hooks/useTheme';
|
|
14
|
-
import QueueManager from './QueueManager';
|
|
15
|
-
import { useAppStore } from './store/AppStore';
|
|
16
|
-
import { useNotificationStore } from './store/notification';
|
|
17
|
-
import { useSettingsStore } from './store/settings';
|
|
18
|
-
import { DEFAULT_CONFIG } from './store/slices/config';
|
|
19
|
-
import { initConfig } from './utils/configs';
|
|
20
|
-
import { WidgetContext, WidgetWallets } from './Wallets';
|
|
21
|
-
|
|
22
|
-
const MainContainer = styled('div', {
|
|
23
|
-
width: '100%',
|
|
24
|
-
display: 'flex',
|
|
25
|
-
justifyContent: 'center',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
fontFamily: '$widget',
|
|
28
|
-
boxSizing: 'border-box',
|
|
29
|
-
'& *, *::before, *::after': {
|
|
30
|
-
boxSizing: 'inherit',
|
|
31
|
-
listStyleType: 'none',
|
|
32
|
-
},
|
|
33
|
-
'& *:focus-visible': {
|
|
34
|
-
outlineColor: '$info500',
|
|
35
|
-
transition: 'none',
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export type WidgetProps = {
|
|
40
|
-
config?: WidgetConfig;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export function Main() {
|
|
44
|
-
globalFont();
|
|
45
|
-
|
|
46
|
-
const { fetch: fetchMeta, config } = useAppStore();
|
|
47
|
-
const { activeTheme } = useTheme(config?.theme || {});
|
|
48
|
-
const { activeLanguage, changeLanguage } = useLanguage();
|
|
49
|
-
const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
|
|
50
|
-
useState<string>('');
|
|
51
|
-
const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
|
|
52
|
-
const widgetContext = useContext(WidgetContext);
|
|
53
|
-
|
|
54
|
-
useMemo(() => {
|
|
55
|
-
if (config?.apiKey) {
|
|
56
|
-
initConfig({
|
|
57
|
-
API_KEY: config?.apiKey,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}, [config]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
void fetchMeta().catch();
|
|
63
|
-
void useSettingsStore.persist.rehydrate();
|
|
64
|
-
void useNotificationStore.persist.rehydrate();
|
|
65
|
-
widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
|
|
66
|
-
}, []);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (config?.language) {
|
|
69
|
-
changeLanguage(config.language);
|
|
70
|
-
}
|
|
71
|
-
}, [config?.language]);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<I18nManager language={activeLanguage}>
|
|
75
|
-
<MainContainer id="swap-container" className={activeTheme()}>
|
|
76
|
-
<QueueManager>
|
|
77
|
-
<WidgetEvents />
|
|
78
|
-
<AppRouter
|
|
79
|
-
lastConnectedWallet={lastConnectedWalletWithNetwork}
|
|
80
|
-
disconnectedWallet={disconnectedWallet}
|
|
81
|
-
clearDisconnectedWallet={() => {
|
|
82
|
-
setDisconnectedWallet(undefined);
|
|
83
|
-
}}>
|
|
84
|
-
<AppRoutes />
|
|
85
|
-
</AppRouter>
|
|
86
|
-
</QueueManager>
|
|
87
|
-
</MainContainer>
|
|
88
|
-
</I18nManager>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function Widget(props: PropsWithChildren<WidgetProps>) {
|
|
93
|
-
if (!props.config?.externalWallets) {
|
|
94
|
-
return (
|
|
95
|
-
<WidgetWallets
|
|
96
|
-
config={props.config ?? DEFAULT_CONFIG}
|
|
97
|
-
providers={props.config?.wallets}
|
|
98
|
-
options={{
|
|
99
|
-
walletConnectProjectId: props.config?.walletConnectProjectId,
|
|
100
|
-
}}>
|
|
101
|
-
<Main />
|
|
102
|
-
</WidgetWallets>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
return <Main />;
|
|
106
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { StepSkeletonPropsTypes } from './LoadingSwapDetails.types';
|
|
2
|
-
|
|
3
|
-
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { StepContainer } from './LoadingSwapDetails.styles';
|
|
7
|
-
|
|
8
|
-
export function LoadingSwapDetailStep(props: StepSkeletonPropsTypes) {
|
|
9
|
-
const { extraInfo } = props;
|
|
10
|
-
return (
|
|
11
|
-
<StepContainer>
|
|
12
|
-
<div className="step-title">
|
|
13
|
-
<Skeleton height={28} width={28} variant="circular" />
|
|
14
|
-
<Divider direction="horizontal" size={8} />
|
|
15
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
16
|
-
</div>
|
|
17
|
-
<div className="step-tokens">
|
|
18
|
-
<Divider direction="horizontal" size={20} />
|
|
19
|
-
<div className="step-token-info">
|
|
20
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
21
|
-
<Divider direction="horizontal" size={8} />
|
|
22
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
23
|
-
</div>
|
|
24
|
-
<div className="step-icon-container">
|
|
25
|
-
<NextIcon color="gray" size={16} />
|
|
26
|
-
</div>
|
|
27
|
-
<div className="step-token-info">
|
|
28
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
29
|
-
<Divider direction="horizontal" size={8} />
|
|
30
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
{extraInfo && (
|
|
34
|
-
<div className="extra-info">
|
|
35
|
-
<Divider direction="horizontal" size={20} />
|
|
36
|
-
<Skeleton height={22} width={297} variant="rectangular" />
|
|
37
|
-
</div>
|
|
38
|
-
)}
|
|
39
|
-
</StepContainer>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
|
-
|
|
3
|
-
export const Container = styled('div', {
|
|
4
|
-
$$color: '$colors$neutral100',
|
|
5
|
-
[`.${darkTheme} &`]: {
|
|
6
|
-
$$color: '$colors$neutral300',
|
|
7
|
-
},
|
|
8
|
-
backgroundColor: '$$color',
|
|
9
|
-
borderBottomLeftRadius: '$xm',
|
|
10
|
-
borderBottomRightRadius: '$xm',
|
|
11
|
-
padding: '$15 ',
|
|
12
|
-
'& .cost-and-tag': {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
height: '22px',
|
|
17
|
-
},
|
|
18
|
-
variants: {
|
|
19
|
-
rounded: {
|
|
20
|
-
true: {
|
|
21
|
-
borderRadius: '$xm',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
'& .cost': {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
},
|
|
28
|
-
'& .basic-summary': {
|
|
29
|
-
padding: '$15 $0 14px $0',
|
|
30
|
-
},
|
|
31
|
-
'& .output': {
|
|
32
|
-
padding: '$6 $0 $15 $0',
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
},
|
|
36
|
-
'& .output__token-info': {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
justifyContent: 'start',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
paddingBottom: '$5',
|
|
41
|
-
},
|
|
42
|
-
'& .quote-summary': {
|
|
43
|
-
display: 'flex',
|
|
44
|
-
justifyContent: 'space-between',
|
|
45
|
-
alignItems: 'end',
|
|
46
|
-
},
|
|
47
|
-
'& .quote-summary__separator': {
|
|
48
|
-
height: '$28',
|
|
49
|
-
marginLeft: '13px',
|
|
50
|
-
borderLeft: '1px solid $neutral700',
|
|
51
|
-
},
|
|
52
|
-
'& .token-amount': {
|
|
53
|
-
display: 'flex',
|
|
54
|
-
justifyContent: 'space-between',
|
|
55
|
-
},
|
|
56
|
-
'& .token-amount__label': {
|
|
57
|
-
display: 'flex',
|
|
58
|
-
flexDirection: 'column',
|
|
59
|
-
alignItems: 'start',
|
|
60
|
-
},
|
|
61
|
-
'& .chains': {
|
|
62
|
-
paddingTop: '$2',
|
|
63
|
-
},
|
|
64
|
-
'& .swap-preview': {
|
|
65
|
-
padding: '$15 $0 $15 $0',
|
|
66
|
-
},
|
|
67
|
-
'& .steps': {
|
|
68
|
-
paddingLeft: '$8',
|
|
69
|
-
},
|
|
70
|
-
'& .step__title': {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
},
|
|
74
|
-
'& .step__content': {
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'start',
|
|
77
|
-
},
|
|
78
|
-
'& .step__tokens': {
|
|
79
|
-
paddingTop: '$5',
|
|
80
|
-
paddingBottom: '$10',
|
|
81
|
-
display: 'flex',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
},
|
|
84
|
-
'& .step__token-info': {
|
|
85
|
-
display: 'flex',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
},
|
|
88
|
-
'& .step__icon-container': {
|
|
89
|
-
margin: '$0 $2',
|
|
90
|
-
padding: '$4',
|
|
91
|
-
display: 'flex',
|
|
92
|
-
justifyContent: 'center',
|
|
93
|
-
alignItems: 'center',
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
export const StepSeparator = styled('div', {
|
|
98
|
-
borderLeft: '1px dashed black',
|
|
99
|
-
minHeight: ' 64px',
|
|
100
|
-
margin: '0px 11.5px',
|
|
101
|
-
alignSelf: 'stretch',
|
|
102
|
-
variants: {
|
|
103
|
-
hideSeparator: {
|
|
104
|
-
true: {
|
|
105
|
-
minHeight: 'unset',
|
|
106
|
-
height: '0',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './QuoteSkeleton.types';
|
|
2
|
-
|
|
3
|
-
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { Container, StepSeparator } from './QuoteSkeleton.styles';
|
|
7
|
-
|
|
8
|
-
function StepSkeleton(props: { separator?: boolean }) {
|
|
9
|
-
const { separator = true } = props;
|
|
10
|
-
return (
|
|
11
|
-
<>
|
|
12
|
-
<div className="step__title">
|
|
13
|
-
<Skeleton height={22} width={22} variant="circular" />
|
|
14
|
-
<Divider direction="horizontal" size={8} />
|
|
15
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
16
|
-
</div>
|
|
17
|
-
<div className="step__content">
|
|
18
|
-
<StepSeparator hideSeparator={!separator} />
|
|
19
|
-
<div className="step__tokens">
|
|
20
|
-
<div className="step__token-info">
|
|
21
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
22
|
-
<Divider direction="horizontal" size={8} />
|
|
23
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
24
|
-
</div>
|
|
25
|
-
<div className="step__icon-container">
|
|
26
|
-
<NextIcon color="gray" size={16} />
|
|
27
|
-
</div>
|
|
28
|
-
<div className="step__token-info">
|
|
29
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
30
|
-
<Divider direction="horizontal" size={8} />
|
|
31
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function QuoteSkeleton(props: PropTypes) {
|
|
40
|
-
const { type, expanded, tag = false } = props;
|
|
41
|
-
const quoteSummary = (
|
|
42
|
-
<div className="quote-summary">
|
|
43
|
-
<div className="token-amount">
|
|
44
|
-
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
45
|
-
<Divider size={8} direction="horizontal" />
|
|
46
|
-
<div className="token-amount__label">
|
|
47
|
-
<Skeleton height={10} width={60} variant="rounded" />
|
|
48
|
-
<Divider size={4} />
|
|
49
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<Skeleton height={12} width={64} variant="rounded" />
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Container>
|
|
58
|
-
<div className="cost-and-tag">
|
|
59
|
-
<div className="cost">
|
|
60
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
61
|
-
<Divider size={4} direction="horizontal" />
|
|
62
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
63
|
-
<Divider size={4} direction="horizontal" />
|
|
64
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
65
|
-
</div>
|
|
66
|
-
{tag && <Skeleton height={22} width={100} variant="rounded" />}
|
|
67
|
-
</div>
|
|
68
|
-
{type === 'basic' && (
|
|
69
|
-
<div className="basic-summary">
|
|
70
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
{type === 'list-item' && (
|
|
74
|
-
<div className="output">
|
|
75
|
-
<div className="output__token-info">
|
|
76
|
-
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
77
|
-
<Divider direction="horizontal" size={4} />
|
|
78
|
-
<Skeleton height={15} width={150} variant="rounded" />
|
|
79
|
-
</div>
|
|
80
|
-
<Divider size={4} />
|
|
81
|
-
<Skeleton height={10} width={184} variant="rounded" />
|
|
82
|
-
</div>
|
|
83
|
-
)}
|
|
84
|
-
{type === 'swap-preview' && (
|
|
85
|
-
<>
|
|
86
|
-
<Divider size={4} />
|
|
87
|
-
<div className="swap-preview">
|
|
88
|
-
{quoteSummary}
|
|
89
|
-
<div className="quote-summary__separator" />
|
|
90
|
-
{quoteSummary}
|
|
91
|
-
</div>
|
|
92
|
-
</>
|
|
93
|
-
)}
|
|
94
|
-
<div className="chains">
|
|
95
|
-
<Skeleton height={15} width={321} variant="rounded" />
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{expanded && (
|
|
99
|
-
<div className="steps">
|
|
100
|
-
<Divider size={20} />
|
|
101
|
-
<StepSkeleton />
|
|
102
|
-
<StepSkeleton />
|
|
103
|
-
<StepSkeleton separator={false} />
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
</Container>
|
|
107
|
-
);
|
|
108
|
-
}
|
package/src/store/settings.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type { SwapperMeta } from 'rango-sdk';
|
|
2
|
-
|
|
3
|
-
import { type Language } from '@rango-dev/ui';
|
|
4
|
-
import { create } from 'zustand';
|
|
5
|
-
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
|
6
|
-
|
|
7
|
-
import { BLOCKCHAIN_LIST_SIZE } from '../constants/configs';
|
|
8
|
-
import { DEFAULT_LANGUAGE } from '../constants/languages';
|
|
9
|
-
import { DEFAULT_SLIPPAGE } from '../constants/swapSettings';
|
|
10
|
-
import { removeDuplicateFrom } from '../utils/common';
|
|
11
|
-
|
|
12
|
-
import createSelectors from './selectors';
|
|
13
|
-
|
|
14
|
-
export type ThemeMode = 'auto' | 'dark' | 'light';
|
|
15
|
-
|
|
16
|
-
export interface SettingsState {
|
|
17
|
-
/** Keeping a history of blockchains that user has selected (in Swap process) */
|
|
18
|
-
preferredBlockchains: string[];
|
|
19
|
-
slippage: number;
|
|
20
|
-
customSlippage: number | null;
|
|
21
|
-
infiniteApprove: boolean;
|
|
22
|
-
disabledLiquiditySources: string[];
|
|
23
|
-
theme: ThemeMode;
|
|
24
|
-
language: Language;
|
|
25
|
-
affiliateRef: string | null;
|
|
26
|
-
affiliatePercent: number | null;
|
|
27
|
-
affiliateWallets: { [key: string]: string } | null;
|
|
28
|
-
|
|
29
|
-
setSlippage: (slippage: number) => void;
|
|
30
|
-
setCustomSlippage: (customSlippage: number | null) => void;
|
|
31
|
-
toggleInfiniteApprove: () => void;
|
|
32
|
-
toggleLiquiditySource: (name: string) => void;
|
|
33
|
-
setTheme: (theme: ThemeMode) => void;
|
|
34
|
-
setLanguage: (language: Language) => void;
|
|
35
|
-
toggleAllLiquiditySources: (
|
|
36
|
-
swappers: SwapperMeta[],
|
|
37
|
-
shouldReset?: boolean
|
|
38
|
-
) => void;
|
|
39
|
-
setAffiliateRef: (affiliateRef: string | null) => void;
|
|
40
|
-
setAffiliatePercent: (affiliatePercent: number | null) => void;
|
|
41
|
-
setAffiliateWallets: (
|
|
42
|
-
affiliateWallets: { [key: string]: string } | null
|
|
43
|
-
) => void;
|
|
44
|
-
addPreferredBlockchain: (blockchain: string) => void;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const useSettingsStore = createSelectors(
|
|
48
|
-
create<SettingsState>()(
|
|
49
|
-
persist(
|
|
50
|
-
subscribeWithSelector((set, get) => ({
|
|
51
|
-
preferredBlockchains: [],
|
|
52
|
-
slippage: DEFAULT_SLIPPAGE,
|
|
53
|
-
customSlippage: null,
|
|
54
|
-
infiniteApprove: false,
|
|
55
|
-
affiliateRef: null,
|
|
56
|
-
affiliatePercent: null,
|
|
57
|
-
affiliateWallets: null,
|
|
58
|
-
disabledLiquiditySources: [],
|
|
59
|
-
theme: 'auto',
|
|
60
|
-
language: DEFAULT_LANGUAGE,
|
|
61
|
-
addPreferredBlockchain: (blockchain) => {
|
|
62
|
-
const currentPreferredBlockchains = get().preferredBlockchains;
|
|
63
|
-
|
|
64
|
-
const noNeedToDoAnything = currentPreferredBlockchains.find(
|
|
65
|
-
(preferredBlockchain, index) => {
|
|
66
|
-
const isSameBlockchain = preferredBlockchain === blockchain;
|
|
67
|
-
const isInVisibleList = index <= BLOCKCHAIN_LIST_SIZE - 1;
|
|
68
|
-
|
|
69
|
-
return isSameBlockchain && isInVisibleList;
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
if (noNeedToDoAnything) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const nextPreferredBlockchains: string[] =
|
|
78
|
-
currentPreferredBlockchains.filter((preferredBlockchain) => {
|
|
79
|
-
const isSameBlockchain = preferredBlockchain === blockchain;
|
|
80
|
-
|
|
81
|
-
return !isSameBlockchain;
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
set(() => ({
|
|
85
|
-
preferredBlockchains: [blockchain, ...nextPreferredBlockchains],
|
|
86
|
-
}));
|
|
87
|
-
},
|
|
88
|
-
setSlippage: (slippage) =>
|
|
89
|
-
set(() => ({
|
|
90
|
-
slippage: slippage,
|
|
91
|
-
})),
|
|
92
|
-
setCustomSlippage: (customSlippage) =>
|
|
93
|
-
set(() => ({
|
|
94
|
-
customSlippage: customSlippage,
|
|
95
|
-
})),
|
|
96
|
-
setAffiliateRef: (affiliateRef) =>
|
|
97
|
-
set(() => ({
|
|
98
|
-
affiliateRef,
|
|
99
|
-
})),
|
|
100
|
-
setAffiliatePercent: (affiliatePercent) =>
|
|
101
|
-
set(() => ({
|
|
102
|
-
affiliatePercent,
|
|
103
|
-
})),
|
|
104
|
-
|
|
105
|
-
setAffiliateWallets: (affiliateWallets) =>
|
|
106
|
-
set(() => ({
|
|
107
|
-
affiliateWallets,
|
|
108
|
-
})),
|
|
109
|
-
toggleAllLiquiditySources: (swappers, shouldReset) =>
|
|
110
|
-
set((state) => {
|
|
111
|
-
if (shouldReset) {
|
|
112
|
-
return { disabledLiquiditySources: [] };
|
|
113
|
-
}
|
|
114
|
-
const swappersGroup = removeDuplicateFrom(
|
|
115
|
-
swappers.map((swapper) => swapper.swapperGroup)
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
swappersGroup.length === state.disabledLiquiditySources.length
|
|
120
|
-
) {
|
|
121
|
-
return { disabledLiquiditySources: [] };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
disabledLiquiditySources: swappersGroup,
|
|
126
|
-
};
|
|
127
|
-
}),
|
|
128
|
-
toggleInfiniteApprove: () =>
|
|
129
|
-
set((state) => ({
|
|
130
|
-
infiniteApprove: !state.infiniteApprove,
|
|
131
|
-
})),
|
|
132
|
-
toggleLiquiditySource: (name) =>
|
|
133
|
-
set((state) => {
|
|
134
|
-
if (state.disabledLiquiditySources.includes(name)) {
|
|
135
|
-
return {
|
|
136
|
-
disabledLiquiditySources: state.disabledLiquiditySources.filter(
|
|
137
|
-
(liquiditySource) => liquiditySource != name
|
|
138
|
-
),
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
disabledLiquiditySources:
|
|
143
|
-
state.disabledLiquiditySources.concat(name),
|
|
144
|
-
};
|
|
145
|
-
}),
|
|
146
|
-
setTheme: (theme) =>
|
|
147
|
-
set(() => ({
|
|
148
|
-
theme,
|
|
149
|
-
})),
|
|
150
|
-
setLanguage: (language) =>
|
|
151
|
-
set(() => ({
|
|
152
|
-
language,
|
|
153
|
-
})),
|
|
154
|
-
})),
|
|
155
|
-
{
|
|
156
|
-
name: 'user-settings',
|
|
157
|
-
skipHydration: true,
|
|
158
|
-
}
|
|
159
|
-
)
|
|
160
|
-
)
|
|
161
|
-
);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|