@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/utils/swap.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
2
|
import type { FetchStatus } from '../store/slices/data';
|
|
3
|
-
import type { ConnectedWallet } from '../store/wallets';
|
|
4
3
|
import type {
|
|
5
4
|
ConvertedToken,
|
|
5
|
+
QuoteError,
|
|
6
|
+
QuoteWarning,
|
|
6
7
|
RecommendedSlippages,
|
|
7
8
|
SwapButtonState,
|
|
8
9
|
Wallet,
|
|
9
10
|
} from '../types';
|
|
10
|
-
import type {
|
|
11
|
-
PendingSwap,
|
|
12
|
-
PendingSwapStep,
|
|
13
|
-
} from '@rango-dev/queue-manager-rango-preset';
|
|
14
11
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
15
12
|
import type {
|
|
16
13
|
BestRouteRequest,
|
|
@@ -20,10 +17,11 @@ import type {
|
|
|
20
17
|
SwapResult,
|
|
21
18
|
Token,
|
|
22
19
|
} from 'rango-sdk';
|
|
20
|
+
import type { PendingSwap, PendingSwapStep } from 'rango-types';
|
|
23
21
|
|
|
24
22
|
import { i18n } from '@lingui/core';
|
|
25
|
-
import { PendingSwapNetworkStatus } from '@rango-dev/queue-manager-rango-preset';
|
|
26
23
|
import BigNumber from 'bignumber.js';
|
|
24
|
+
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
27
25
|
|
|
28
26
|
import { isValidAddress } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
|
|
29
27
|
import { errorMessages } from '../constants/errors';
|
|
@@ -35,11 +33,11 @@ import {
|
|
|
35
33
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
36
34
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
37
35
|
} from '../constants/routing';
|
|
38
|
-
import { ButtonState } from '../types';
|
|
39
36
|
|
|
40
37
|
import { removeDuplicateFrom } from './common';
|
|
38
|
+
import { getBlockchainShortNameFor } from './meta';
|
|
41
39
|
import { numberToString } from './numbers';
|
|
42
|
-
import { getRequiredBalanceOfWallet } from './quote';
|
|
40
|
+
import { getPriceImpact, getRequiredBalanceOfWallet } from './quote';
|
|
43
41
|
import { getRequiredChains } from './wallets';
|
|
44
42
|
|
|
45
43
|
export function getOutputRatio(
|
|
@@ -179,63 +177,70 @@ export function getLimitErrorMessage(quote: BestRouteResponse): {
|
|
|
179
177
|
return { swap, fromAmountRangeError, recommendation };
|
|
180
178
|
}
|
|
181
179
|
|
|
182
|
-
export function getSwapButtonState(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
needsToWarnEthOnPath: boolean
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
180
|
+
export function getSwapButtonState(params: {
|
|
181
|
+
fetchMetaStatus: FetchStatus;
|
|
182
|
+
anyWalletConnected: boolean;
|
|
183
|
+
fetchingQuote: boolean;
|
|
184
|
+
inputAmount: string;
|
|
185
|
+
quote: BestRouteResponse | null;
|
|
186
|
+
warning: QuoteWarning | null;
|
|
187
|
+
error: QuoteError | null;
|
|
188
|
+
needsToWarnEthOnPath: boolean;
|
|
189
|
+
}): SwapButtonState {
|
|
190
|
+
const {
|
|
191
|
+
fetchMetaStatus,
|
|
192
|
+
anyWalletConnected,
|
|
193
|
+
fetchingQuote,
|
|
194
|
+
inputAmount,
|
|
195
|
+
quote,
|
|
196
|
+
warning,
|
|
197
|
+
error,
|
|
198
|
+
needsToWarnEthOnPath,
|
|
199
|
+
} = params;
|
|
200
|
+
if (fetchMetaStatus !== 'success') {
|
|
194
201
|
return {
|
|
195
202
|
title: swapButtonTitles().connectWallet,
|
|
196
|
-
|
|
203
|
+
action: 'connect-wallet',
|
|
197
204
|
disabled: true,
|
|
198
205
|
};
|
|
199
206
|
}
|
|
200
|
-
if (
|
|
207
|
+
if (!anyWalletConnected) {
|
|
201
208
|
return {
|
|
202
209
|
title: swapButtonTitles().connectWallet,
|
|
203
|
-
|
|
210
|
+
action: 'connect-wallet',
|
|
204
211
|
disabled: false,
|
|
205
212
|
};
|
|
206
213
|
}
|
|
207
214
|
if (
|
|
208
|
-
|
|
215
|
+
fetchingQuote ||
|
|
209
216
|
!quote ||
|
|
210
217
|
!quote.result ||
|
|
211
|
-
|
|
218
|
+
error ||
|
|
212
219
|
!inputAmount ||
|
|
213
220
|
inputAmount === '0'
|
|
214
221
|
) {
|
|
215
222
|
return {
|
|
216
223
|
title: swapButtonTitles().swap,
|
|
224
|
+
action: 'confirm-swap',
|
|
217
225
|
disabled: true,
|
|
218
|
-
state: ButtonState.SWAP,
|
|
219
226
|
};
|
|
220
|
-
} else if (
|
|
227
|
+
} else if (warning) {
|
|
221
228
|
return {
|
|
222
229
|
title: swapButtonTitles().swapAnyway,
|
|
230
|
+
action: 'confirm-warning',
|
|
223
231
|
disabled: false,
|
|
224
|
-
hasWarning: true,
|
|
225
|
-
state: ButtonState.NEEDTOCONFIRM,
|
|
226
232
|
};
|
|
227
233
|
} else if (needsToWarnEthOnPath) {
|
|
228
234
|
return {
|
|
229
235
|
title: swapButtonTitles().ethWarning,
|
|
236
|
+
action: 'confirm-warning',
|
|
230
237
|
disabled: false,
|
|
231
|
-
hasWarning: true,
|
|
232
|
-
state: ButtonState.WARNING,
|
|
233
238
|
};
|
|
234
239
|
}
|
|
235
240
|
return {
|
|
236
241
|
title: swapButtonTitles().swap,
|
|
242
|
+
action: 'confirm-swap',
|
|
237
243
|
disabled: false,
|
|
238
|
-
state: ButtonState.SWAP,
|
|
239
244
|
};
|
|
240
245
|
}
|
|
241
246
|
|
|
@@ -359,7 +364,7 @@ export function checkSlippageWarnings(
|
|
|
359
364
|
quote.result?.swaps.forEach((swap, index) => {
|
|
360
365
|
if (
|
|
361
366
|
swap.recommendedSlippage?.slippage &&
|
|
362
|
-
|
|
367
|
+
parseFloat(swap.recommendedSlippage.slippage) > userSlippage
|
|
363
368
|
) {
|
|
364
369
|
recommendedSlippages.set(index, swap.recommendedSlippage.slippage);
|
|
365
370
|
}
|
|
@@ -590,10 +595,7 @@ export function isOutputAmountChangedALot(
|
|
|
590
595
|
if (!oldOutputAmount || !newOutputAmount) {
|
|
591
596
|
return false;
|
|
592
597
|
}
|
|
593
|
-
const percentageChange =
|
|
594
|
-
oldOutputAmount,
|
|
595
|
-
newOutputAmount
|
|
596
|
-
);
|
|
598
|
+
const percentageChange = getPriceImpact(oldOutputAmount, newOutputAmount);
|
|
597
599
|
if (!percentageChange) {
|
|
598
600
|
return true;
|
|
599
601
|
}
|
|
@@ -601,9 +603,10 @@ export function isOutputAmountChangedALot(
|
|
|
601
603
|
return percentageChange <= -1;
|
|
602
604
|
}
|
|
603
605
|
|
|
604
|
-
export function
|
|
606
|
+
export function generateBalanceWarnings(
|
|
605
607
|
quote: BestRouteResponse,
|
|
606
|
-
selectedWallets: Wallet[]
|
|
608
|
+
selectedWallets: Wallet[],
|
|
609
|
+
blockchains: BlockchainMeta[]
|
|
607
610
|
) {
|
|
608
611
|
const fee = quote.validationStatus;
|
|
609
612
|
const requiredWallets = getRequiredChains(quote);
|
|
@@ -648,7 +651,10 @@ export function getBalanceWarnings(
|
|
|
648
651
|
symbol,
|
|
649
652
|
reason,
|
|
650
653
|
currentAmount,
|
|
651
|
-
blockchain:
|
|
654
|
+
blockchain: getBlockchainShortNameFor(
|
|
655
|
+
asset.asset.blockchain,
|
|
656
|
+
blockchains
|
|
657
|
+
),
|
|
652
658
|
},
|
|
653
659
|
});
|
|
654
660
|
return warningMessage;
|
package/src/utils/time.ts
CHANGED
package/src/utils/wallets.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TokenWithBalance } from '../components/TokenList';
|
|
2
1
|
import type { ConnectedWallet, TokenBalance } from '../store/wallets';
|
|
3
|
-
import type { Wallet } from '../types';
|
|
2
|
+
import type { Balance, TokenHash, TokensBalance, Wallet } from '../types';
|
|
4
3
|
import type { WalletInfo as ModalWalletInfo } from '@rango-dev/ui';
|
|
5
4
|
import type {
|
|
5
|
+
Asset,
|
|
6
6
|
Network,
|
|
7
7
|
WalletInfo,
|
|
8
8
|
WalletState,
|
|
@@ -29,6 +29,12 @@ 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';
|
|
32
38
|
import { EXCLUDED_WALLETS } from '../constants/wallets';
|
|
33
39
|
|
|
34
40
|
import { numberToString } from './numbers';
|
|
@@ -218,43 +224,6 @@ export function getRequiredChains(quote: BestRouteResponse | null) {
|
|
|
218
224
|
|
|
219
225
|
type Blockchain = { name: string; accounts: ConnectedWallet[] };
|
|
220
226
|
|
|
221
|
-
export function getBalanceFromWallet(
|
|
222
|
-
connectedWallets: ConnectedWallet[],
|
|
223
|
-
chain: string,
|
|
224
|
-
symbol: string,
|
|
225
|
-
address: string | null
|
|
226
|
-
): TokenBalance | null {
|
|
227
|
-
if (connectedWallets.length === 0) {
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const selectedChainWallets = connectedWallets.filter(
|
|
232
|
-
(wallet) => wallet.chain === chain
|
|
233
|
-
);
|
|
234
|
-
if (selectedChainWallets.length === 0) {
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return (
|
|
239
|
-
selectedChainWallets
|
|
240
|
-
.map(
|
|
241
|
-
(wallet) =>
|
|
242
|
-
wallet.balances?.find(
|
|
243
|
-
(balance) =>
|
|
244
|
-
(address !== null && balance.address === address) ||
|
|
245
|
-
(address === null &&
|
|
246
|
-
balance.address === address &&
|
|
247
|
-
balance.symbol === symbol)
|
|
248
|
-
) || null
|
|
249
|
-
)
|
|
250
|
-
.filter((balance) => balance !== null)
|
|
251
|
-
.sort(
|
|
252
|
-
(a, b) => parseFloat(b?.amount || '0') - parseFloat(a?.amount || '1')
|
|
253
|
-
)
|
|
254
|
-
.find(() => true) || null
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
227
|
export function isAccountAndWalletMatched(
|
|
259
228
|
account: Wallet,
|
|
260
229
|
connectedWallet: ConnectedWallet
|
|
@@ -348,30 +317,6 @@ function numberWithThousandSeparator(number: string | number): string {
|
|
|
348
317
|
return parts.join('.');
|
|
349
318
|
}
|
|
350
319
|
|
|
351
|
-
export const sortTokens = (tokens: TokenWithBalance[]): TokenWithBalance[] => {
|
|
352
|
-
const walletConnected = !!tokens.some((token) => token.balance);
|
|
353
|
-
if (!walletConnected) {
|
|
354
|
-
return tokens
|
|
355
|
-
.filter((token) => !token.address)
|
|
356
|
-
.concat(
|
|
357
|
-
tokens.filter((token) => token.address && !token.isSecondaryCoin),
|
|
358
|
-
tokens.filter((token) => token.isSecondaryCoin)
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return tokens
|
|
363
|
-
.filter((token) => !!token.balance)
|
|
364
|
-
.sort(
|
|
365
|
-
(tokenA, tokenB) =>
|
|
366
|
-
parseFloat(tokenB.balance?.usdValue || '0') -
|
|
367
|
-
parseFloat(tokenA.balance?.usdValue || '0')
|
|
368
|
-
)
|
|
369
|
-
.concat(
|
|
370
|
-
tokens.filter((token) => !token.balance && !token.isSecondaryCoin),
|
|
371
|
-
tokens.filter((token) => !token.balance && token.isSecondaryCoin)
|
|
372
|
-
);
|
|
373
|
-
};
|
|
374
|
-
|
|
375
320
|
export const getUsdPrice = (
|
|
376
321
|
blockchain: string,
|
|
377
322
|
symbol: string,
|
|
@@ -415,98 +360,87 @@ export const getKeplrCompatibleConnectedWallets = (
|
|
|
415
360
|
);
|
|
416
361
|
};
|
|
417
362
|
|
|
418
|
-
export function
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
let tokenUsdValue = '';
|
|
435
|
-
if (otherProps.usdPrice) {
|
|
436
|
-
tokenUsdValue = numberToString(
|
|
437
|
-
new BigNumber(
|
|
438
|
-
getBalanceFromWallet(
|
|
439
|
-
connectedWallets,
|
|
440
|
-
otherProps.blockchain,
|
|
441
|
-
otherProps.symbol,
|
|
442
|
-
otherProps.address
|
|
443
|
-
)?.amount || ZERO
|
|
444
|
-
).multipliedBy(otherProps.usdPrice)
|
|
445
|
-
);
|
|
446
|
-
}
|
|
363
|
+
export function formatBalance(balance: Balance | null): Balance | null {
|
|
364
|
+
const formattedBalance: Balance | null = balance
|
|
365
|
+
? {
|
|
366
|
+
...balance,
|
|
367
|
+
amount: numberToString(
|
|
368
|
+
balance.amount,
|
|
369
|
+
BALANCE_MIN_DECIMALS,
|
|
370
|
+
BALANCE_MAX_DECIMALS
|
|
371
|
+
),
|
|
372
|
+
usdValue: numberToString(
|
|
373
|
+
balance.usdValue,
|
|
374
|
+
USD_VALUE_MIN_DECIMALS,
|
|
375
|
+
USD_VALUE_MAX_DECIMALS
|
|
376
|
+
),
|
|
377
|
+
}
|
|
378
|
+
: null;
|
|
447
379
|
|
|
448
|
-
|
|
449
|
-
...otherProps,
|
|
450
|
-
...(tokenAmount !== '0' && {
|
|
451
|
-
balance: { amount: tokenAmount, usdValue: tokenUsdValue },
|
|
452
|
-
}),
|
|
453
|
-
};
|
|
454
|
-
});
|
|
380
|
+
return formattedBalance;
|
|
455
381
|
}
|
|
456
382
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
if (tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
467
|
-
return (
|
|
468
|
-
parseFloat(tokenB.balance.usdValue) -
|
|
469
|
-
parseFloat(tokenA.balance.usdValue)
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (!tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
474
|
-
return 1;
|
|
475
|
-
}
|
|
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)
|
|
390
|
+
);
|
|
391
|
+
}
|
|
476
392
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
393
|
+
if (!token1Balance?.usdValue && token2Balance?.usdValue) {
|
|
394
|
+
return 1;
|
|
395
|
+
}
|
|
480
396
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
parseFloat(tokenA.balance?.amount || '0')
|
|
485
|
-
);
|
|
486
|
-
}
|
|
397
|
+
if (token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
398
|
+
return -1;
|
|
399
|
+
}
|
|
487
400
|
|
|
488
|
-
|
|
489
|
-
|
|
401
|
+
if (!token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
402
|
+
return (
|
|
403
|
+
parseFloat(token2Balance?.amount || '0') -
|
|
404
|
+
parseFloat(token1Balance?.amount || '0')
|
|
405
|
+
);
|
|
406
|
+
}
|
|
490
407
|
|
|
491
|
-
return
|
|
408
|
+
return 0;
|
|
492
409
|
}
|
|
493
410
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
if (
|
|
503
|
-
return
|
|
411
|
+
function sortTokensByPinnedToken(
|
|
412
|
+
token1: Token,
|
|
413
|
+
token2: Token,
|
|
414
|
+
isTokenPinned: (token: Token) => boolean
|
|
415
|
+
): number {
|
|
416
|
+
const isToken1Pinned = isTokenPinned(token1);
|
|
417
|
+
const isToken2Pinned = isTokenPinned(token2);
|
|
418
|
+
|
|
419
|
+
if (isToken1Pinned === isToken2Pinned) {
|
|
420
|
+
return 0;
|
|
504
421
|
}
|
|
422
|
+
if (isToken1Pinned) {
|
|
423
|
+
return -1;
|
|
424
|
+
}
|
|
425
|
+
return 1;
|
|
426
|
+
}
|
|
427
|
+
export function sortTokens(
|
|
428
|
+
tokens: Token[],
|
|
429
|
+
getBalanceFor: (token: Token) => Balance | null,
|
|
430
|
+
isTokenPinned: (token: Token) => boolean
|
|
431
|
+
) {
|
|
432
|
+
tokens.sort((token1, token2) => {
|
|
433
|
+
const token1Balance = getBalanceFor(token1);
|
|
434
|
+
const token2Balance = getBalanceFor(token2);
|
|
435
|
+
// Check pinned tokens
|
|
436
|
+
const isTokenPin = sortTokensByPinnedToken(token1, token2, isTokenPinned);
|
|
437
|
+
|
|
438
|
+
return isTokenPin !== 0
|
|
439
|
+
? isTokenPin
|
|
440
|
+
: sortTokensByBalance(token1Balance, token2Balance);
|
|
441
|
+
});
|
|
505
442
|
|
|
506
|
-
|
|
507
|
-
(token) => token.blockchain === chain?.name
|
|
508
|
-
);
|
|
509
|
-
return sortTokens(getTokensWithBalance(filteredTokens, connectedWallets));
|
|
443
|
+
return tokens;
|
|
510
444
|
}
|
|
511
445
|
|
|
512
446
|
export function tokensAreEqual(
|
|
@@ -568,3 +502,52 @@ export function getAddress({
|
|
|
568
502
|
connectedWallet.chain === chain
|
|
569
503
|
)?.address;
|
|
570
504
|
}
|
|
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
|
+
);
|
package/dist/Wallets.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { WidgetConfig } from './types';
|
|
2
|
-
import type { ProvidersOptions } from './utils/providers';
|
|
3
|
-
import type { EventHandler } from '@rango-dev/wallets-react';
|
|
4
|
-
import type { PropsWithChildren } from 'react';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
type OnConnectHandler = (key: string) => void;
|
|
7
|
-
interface WidgetContextInterface {
|
|
8
|
-
onConnectWallet(handler: OnConnectHandler): void;
|
|
9
|
-
}
|
|
10
|
-
export declare const WidgetContext: React.Context<WidgetContextInterface>;
|
|
11
|
-
export declare function WidgetWallets(props: PropsWithChildren<{
|
|
12
|
-
providers: WidgetConfig['wallets'];
|
|
13
|
-
options?: ProvidersOptions;
|
|
14
|
-
onUpdateState?: EventHandler;
|
|
15
|
-
config: WidgetConfig;
|
|
16
|
-
}>): React.JSX.Element;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=Wallets.d.ts.map
|
package/dist/Wallets.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Wallets.d.ts","sourceRoot":"","sources":["../src/Wallets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,OAAO,KAA2C,MAAM,OAAO,CAAC;AAUhE,KAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAC9C,UAAU,sBAAsB;IAC9B,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClD;AAED,eAAO,MAAM,aAAa,uCAIxB,CAAC;AA4FH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,iBAAiB,CAAC;IACvB,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC,qBAQH"}
|
package/dist/Widget.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { WidgetConfig } from './types';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
export type WidgetProps = {
|
|
5
|
-
config?: WidgetConfig;
|
|
6
|
-
};
|
|
7
|
-
export declare function Main(): React.JSX.Element;
|
|
8
|
-
export declare function Widget(props: PropsWithChildren<WidgetProps>): React.JSX.Element;
|
|
9
|
-
//# sourceMappingURL=Widget.d.ts.map
|
package/dist/Widget.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../src/Widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAiCxE,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,wBAAgB,IAAI,sBA+CnB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBAc3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSwapDetailStep.d.ts","sourceRoot":"","sources":["../../../src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,sBAAsB,qBAiClE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSwapDetails.types.d.ts","sourceRoot":"","sources":["../../../src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteSkeleton.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/QuoteSkeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAmC1B,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,qBAqE7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteSkeleton.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/QuoteSkeleton.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA4FpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAaxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteSkeleton.types.d.ts","sourceRoot":"","sources":["../../../src/components/Quote/QuoteSkeleton.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,cAAc,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC"}
|
package/dist/store/settings.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { SwapperMeta } from 'rango-sdk';
|
|
2
|
-
import { type Language } from '@rango-dev/ui';
|
|
3
|
-
export type ThemeMode = 'auto' | 'dark' | 'light';
|
|
4
|
-
export interface SettingsState {
|
|
5
|
-
/** Keeping a history of blockchains that user has selected (in Swap process) */
|
|
6
|
-
preferredBlockchains: string[];
|
|
7
|
-
slippage: number;
|
|
8
|
-
customSlippage: number | null;
|
|
9
|
-
infiniteApprove: boolean;
|
|
10
|
-
disabledLiquiditySources: string[];
|
|
11
|
-
theme: ThemeMode;
|
|
12
|
-
language: Language;
|
|
13
|
-
affiliateRef: string | null;
|
|
14
|
-
affiliatePercent: number | null;
|
|
15
|
-
affiliateWallets: {
|
|
16
|
-
[key: string]: string;
|
|
17
|
-
} | null;
|
|
18
|
-
setSlippage: (slippage: number) => void;
|
|
19
|
-
setCustomSlippage: (customSlippage: number | null) => void;
|
|
20
|
-
toggleInfiniteApprove: () => void;
|
|
21
|
-
toggleLiquiditySource: (name: string) => void;
|
|
22
|
-
setTheme: (theme: ThemeMode) => void;
|
|
23
|
-
setLanguage: (language: Language) => void;
|
|
24
|
-
toggleAllLiquiditySources: (swappers: SwapperMeta[], shouldReset?: boolean) => void;
|
|
25
|
-
setAffiliateRef: (affiliateRef: string | null) => void;
|
|
26
|
-
setAffiliatePercent: (affiliatePercent: number | null) => void;
|
|
27
|
-
setAffiliateWallets: (affiliateWallets: {
|
|
28
|
-
[key: string]: string;
|
|
29
|
-
} | null) => void;
|
|
30
|
-
addPreferredBlockchain: (blockchain: string) => void;
|
|
31
|
-
}
|
|
32
|
-
export declare const useSettingsStore: {
|
|
33
|
-
(): SettingsState;
|
|
34
|
-
<U>(selector: (state: SettingsState) => U, equals?: ((a: U, b: U) => boolean) | undefined): U;
|
|
35
|
-
} & Omit<Omit<import("zustand").StoreApi<SettingsState>, "persist"> & {
|
|
36
|
-
persist: {
|
|
37
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SettingsState, SettingsState>>) => void;
|
|
38
|
-
clearStorage: () => void;
|
|
39
|
-
rehydrate: () => void | Promise<void>;
|
|
40
|
-
hasHydrated: () => boolean;
|
|
41
|
-
onHydrate: (fn: (state: SettingsState) => void) => () => void;
|
|
42
|
-
onFinishHydration: (fn: (state: SettingsState) => void) => () => void;
|
|
43
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SettingsState, SettingsState>>;
|
|
44
|
-
};
|
|
45
|
-
}, "subscribe"> & {
|
|
46
|
-
subscribe: {
|
|
47
|
-
(listener: (selectedState: SettingsState, previousSelectedState: SettingsState) => void): () => void;
|
|
48
|
-
<U_1>(selector: (state: SettingsState) => U_1, listener: (selectedState: U_1, previousSelectedState: U_1) => void, options?: {
|
|
49
|
-
equalityFn?: ((a: U_1, b: U_1) => boolean) | undefined;
|
|
50
|
-
fireImmediately?: boolean | undefined;
|
|
51
|
-
} | undefined): () => void;
|
|
52
|
-
};
|
|
53
|
-
} & {
|
|
54
|
-
use: {
|
|
55
|
-
preferredBlockchains: () => string[];
|
|
56
|
-
slippage: () => number;
|
|
57
|
-
customSlippage: () => number | null;
|
|
58
|
-
infiniteApprove: () => boolean;
|
|
59
|
-
disabledLiquiditySources: () => string[];
|
|
60
|
-
theme: () => ThemeMode;
|
|
61
|
-
language: () => "en" | "es" | "ja" | "fr";
|
|
62
|
-
affiliateRef: () => string | null;
|
|
63
|
-
affiliatePercent: () => number | null;
|
|
64
|
-
affiliateWallets: () => {
|
|
65
|
-
[key: string]: string;
|
|
66
|
-
} | null;
|
|
67
|
-
setSlippage: () => (slippage: number) => void;
|
|
68
|
-
setCustomSlippage: () => (customSlippage: number | null) => void;
|
|
69
|
-
toggleInfiniteApprove: () => () => void;
|
|
70
|
-
toggleLiquiditySource: () => (name: string) => void;
|
|
71
|
-
setTheme: () => (theme: ThemeMode) => void;
|
|
72
|
-
setLanguage: () => (language: Language) => void;
|
|
73
|
-
toggleAllLiquiditySources: () => (swappers: SwapperMeta[], shouldReset?: boolean) => void;
|
|
74
|
-
setAffiliateRef: () => (affiliateRef: string | null) => void;
|
|
75
|
-
setAffiliatePercent: () => (affiliatePercent: number | null) => void;
|
|
76
|
-
setAffiliateWallets: () => (affiliateWallets: {
|
|
77
|
-
[key: string]: string;
|
|
78
|
-
} | null) => void;
|
|
79
|
-
addPreferredBlockchain: () => (blockchain: string) => void;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/store/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAW9C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAEnD,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC1C,yBAAyB,EAAE,CACzB,QAAQ,EAAE,WAAW,EAAE,EACvB,WAAW,CAAC,EAAE,OAAO,KAClB,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,mBAAmB,EAAE,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/D,mBAAmB,EAAE,CACnB,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,KAC/C,IAAI,CAAC;IACV,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAlBH,MAAM,KAAK,IAAI;kDACH,MAAM,GAAG,IAAI,KAAK,IAAI;2CAC7B,IAAI;4CACH,MAAM,KAAK,IAAI;gCAC3B,SAAS,KAAK,IAAI;sCACZ,QAAQ,KAAK,IAAI;oDAE7B,WAAW,EAAE,gBACT,OAAO,KAClB,IAAI;8CACuB,MAAM,GAAG,IAAI,KAAK,IAAI;sDACd,MAAM,GAAG,IAAI,KAAK,IAAI;;;qBAGzD,IAAI;mDAC4B,MAAM,KAAK,IAAI;;CAqHrD,CAAC"}
|