@rango-dev/widget-embedded 0.19.0 → 0.19.1-next.1
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 +0 -4
- package/dist/QueueManager.d.ts +5 -2
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +0 -2
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +1 -6
- 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 +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.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/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -3
- 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 +1 -4
- 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/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 +4 -0
- package/dist/components/NoResult/NoResult.d.ts.map +1 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
- package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
- package/dist/components/NoResult/index.d.ts +2 -0
- package/dist/components/NoResult/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts +4 -0
- package/dist/components/Quote/Quote.d.ts.map +1 -0
- package/dist/components/Quote/Quote.styles.d.ts +2217 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
- package/dist/components/Quote/Quote.types.d.ts +21 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.d.ts +11 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts +315 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
- package/dist/components/Quote/index.d.ts +3 -0
- package/dist/components/Quote/index.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +633 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +6 -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/HighValueLossWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
- package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +23 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
- 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 +1 -6
- 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 +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +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/constants/warnings.d.ts +2 -2
- package/dist/constants/warnings.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 +4 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +788 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +20 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/index.d.ts +2 -0
- package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
- 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/index.d.ts +2 -0
- package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +19 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
- package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
- package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
- package/dist/hooks/useFetchQuote.d.ts.map +1 -0
- 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 +5 -7
- 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 +4 -2
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
- 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 +21 -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 +1 -6
- 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 +1 -2
- 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 +1 -6
- 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 +1 -8
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +47 -0
- package/dist/store/AppStore.d.ts.map +1 -0
- package/dist/store/app.d.ts +41 -22
- 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 +89 -0
- package/dist/store/quote.d.ts.map +1 -0
- package/dist/store/slices/config.d.ts +3 -2
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +5 -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 +14 -9
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +41 -8
- 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/quote.d.ts +82 -0
- package/dist/types/quote.d.ts.map +1 -0
- 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/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/quote.d.ts +32 -0
- package/dist/utils/quote.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +6 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +35 -24
- 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 +9 -10
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/QueueManager.tsx +18 -17
- package/src/components/AppRouter.tsx +8 -32
- package/src/components/AppRoutes.tsx +57 -69
- 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 +26 -17
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +29 -10
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +43 -47
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
- package/src/components/ConfirmWalletsModal/WalletList.tsx +9 -8
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- 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/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +23 -16
- package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
- package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +12 -17
- package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
- package/src/components/NoResult/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +5 -3
- package/src/components/Quote/Quote.styles.ts +250 -0
- package/src/components/Quote/Quote.tsx +414 -0
- package/src/components/Quote/Quote.types.ts +15 -0
- package/src/components/Quote/QuoteSummary.styles.ts +16 -0
- package/src/components/Quote/QuoteSummary.tsx +46 -0
- package/src/components/Quote/index.ts +2 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +5 -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/HighValueLossWarningModal.tsx +107 -0
- package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +4 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +74 -0
- package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +8 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +25 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
- package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
- 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 +41 -56
- 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/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.helpers.ts +2 -2
- package/src/components/TokenList/TokenList.styles.ts +74 -38
- package/src/components/TokenList/TokenList.tsx +35 -26
- package/src/components/TokenList/TokenList.types.ts +4 -10
- package/src/components/TokenList/index.ts +0 -1
- package/src/components/UpdateUrl.tsx +35 -30
- package/src/components/WidgetEvents.tsx +4 -2
- package/src/constants/errors.ts +17 -15
- package/src/constants/index.ts +1 -0
- package/src/constants/messages.ts +1 -1
- package/src/constants/navigationRoutes.ts +7 -8
- package/src/constants/searchParams.ts +1 -0
- package/src/constants/warnings.ts +7 -7
- 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 +31 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +99 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +20 -0
- package/src/containers/QuoteInfo/index.ts +1 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +48 -34
- 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/index.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +172 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +137 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
- package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
- 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 +141 -48
- package/src/hooks/useSyncStoresWithConfig.ts +40 -24
- package/src/hooks/useTheme.ts +4 -5
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +50 -5
- package/src/pages/ConfirmSwapPage.tsx +117 -266
- package/src/pages/HistoryPage.tsx +2 -7
- package/src/pages/Home.tsx +88 -303
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +24 -37
- package/src/pages/SelectBlockchainPage.tsx +31 -24
- package/src/pages/SelectSwapItemsPage.tsx +18 -31
- package/src/pages/SettingsPage.tsx +32 -27
- package/src/pages/SwapDetailsPage.tsx +6 -7
- package/src/pages/ThemePage.tsx +2 -7
- package/src/pages/WalletsPage.tsx +9 -19
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +41 -0
- package/src/store/app.ts +44 -6
- package/src/store/{bestRoute.ts → quote.ts} +71 -64
- package/src/store/slices/config.ts +26 -15
- package/src/store/slices/data.ts +74 -35
- package/src/store/slices/settings.ts +168 -0
- package/src/store/wallets.ts +68 -37
- package/src/types/config.ts +53 -8
- package/src/types/index.ts +1 -1
- package/src/types/quote.ts +107 -0
- 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/numbers.ts +1 -1
- package/src/utils/providers.ts +8 -5
- package/src/utils/queue.ts +2 -2
- package/src/utils/quote.ts +338 -0
- package/src/utils/settings.ts +17 -10
- package/src/utils/swap.ts +154 -120
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +156 -161
- package/dist/Wallets.d.ts +0 -17
- 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/NoRoutes/NoRoutes.d.ts +0 -4
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
- package/dist/components/NoRoutes/index.d.ts +0 -2
- package/dist/components/NoRoutes/index.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/RouteErrors/index.d.ts +0 -2
- package/dist/components/RouteErrors/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
- package/dist/store/bestRoute.d.ts +0 -77
- package/dist/store/bestRoute.d.ts.map +0 -1
- package/dist/store/meta.d.ts +0 -23
- package/dist/store/meta.d.ts.map +0 -1
- package/dist/store/settings.d.ts +0 -81
- package/dist/store/settings.d.ts.map +0 -1
- package/dist/types/routing.d.ts +0 -65
- package/dist/types/routing.d.ts.map +0 -1
- package/dist/utils/routing.d.ts +0 -28
- package/dist/utils/routing.d.ts.map +0 -1
- package/src/Widget.tsx +0 -119
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -41
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
- package/src/components/NoRoutes/index.ts +0 -1
- package/src/components/RouteErrors/RouteErrors.tsx +0 -79
- package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
- package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
- package/src/components/RouteErrors/index.ts +0 -1
- package/src/hooks/useConfirmSwap.ts +0 -303
- package/src/store/meta.ts +0 -39
- package/src/store/settings.ts +0 -158
- package/src/types/routing.ts +0 -77
- package/src/utils/routing.ts +0 -321
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';
|
|
@@ -55,8 +61,11 @@ export function mapWalletTypesToWalletInfo(
|
|
|
55
61
|
return list
|
|
56
62
|
.filter((wallet) => !EXCLUDED_WALLETS.includes(wallet as WalletTypes))
|
|
57
63
|
.filter((wallet) => {
|
|
58
|
-
const { supportedChains,
|
|
59
|
-
|
|
64
|
+
const { supportedChains, isContractWallet } = getWalletInfo(wallet);
|
|
65
|
+
const { installed, network } = getState(wallet);
|
|
66
|
+
const filterContractWallets =
|
|
67
|
+
isContractWallet && (!installed || (!!chain && network !== chain));
|
|
68
|
+
if (filterContractWallets) {
|
|
60
69
|
return false;
|
|
61
70
|
}
|
|
62
71
|
if (chain) {
|
|
@@ -97,7 +106,8 @@ export function prepareAccountsForWalletStore(
|
|
|
97
106
|
wallet: WalletType,
|
|
98
107
|
accounts: string[],
|
|
99
108
|
evmBasedChains: string[],
|
|
100
|
-
supportedChainNames: Network[] | null
|
|
109
|
+
supportedChainNames: Network[] | null,
|
|
110
|
+
isContractWallet: boolean
|
|
101
111
|
): Wallet[] {
|
|
102
112
|
const result: Wallet[] = [];
|
|
103
113
|
|
|
@@ -151,21 +161,29 @@ export function prepareAccountsForWalletStore(
|
|
|
151
161
|
|
|
152
162
|
// If it's an evm network, we will add the address to all the evm chains.
|
|
153
163
|
if (isEvmBasedChain || isUnknownAndEvmBased) {
|
|
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) => {
|
|
164
|
+
if (isContractWallet) {
|
|
163
165
|
/*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
+
* for contract wallets like Safe wallet, we should add only account for the
|
|
167
|
+
* current connected blockchain not all of the supported blockchains
|
|
166
168
|
*/
|
|
167
169
|
addAccount(network, address.toLowerCase());
|
|
168
|
-
}
|
|
170
|
+
} else {
|
|
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
|
+
}
|
|
169
187
|
} else {
|
|
170
188
|
addAccount(network, address);
|
|
171
189
|
}
|
|
@@ -174,10 +192,10 @@ export function prepareAccountsForWalletStore(
|
|
|
174
192
|
return result;
|
|
175
193
|
}
|
|
176
194
|
|
|
177
|
-
export function getRequiredChains(
|
|
195
|
+
export function getRequiredChains(quote: BestRouteResponse | null) {
|
|
178
196
|
const wallets: string[] = [];
|
|
179
197
|
|
|
180
|
-
|
|
198
|
+
quote?.result?.swaps.forEach((swap) => {
|
|
181
199
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
182
200
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
183
201
|
if (!wallets.includes(currentStepFromBlockchain)) {
|
|
@@ -206,43 +224,6 @@ export function getRequiredChains(route: BestRouteResponse | null) {
|
|
|
206
224
|
|
|
207
225
|
type Blockchain = { name: string; accounts: ConnectedWallet[] };
|
|
208
226
|
|
|
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
|
-
|
|
246
227
|
export function isAccountAndWalletMatched(
|
|
247
228
|
account: Wallet,
|
|
248
229
|
connectedWallet: ConnectedWallet
|
|
@@ -336,30 +317,6 @@ function numberWithThousandSeparator(number: string | number): string {
|
|
|
336
317
|
return parts.join('.');
|
|
337
318
|
}
|
|
338
319
|
|
|
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
|
-
|
|
363
320
|
export const getUsdPrice = (
|
|
364
321
|
blockchain: string,
|
|
365
322
|
symbol: string,
|
|
@@ -403,98 +360,87 @@ export const getKeplrCompatibleConnectedWallets = (
|
|
|
403
360
|
);
|
|
404
361
|
};
|
|
405
362
|
|
|
406
|
-
export function
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
-
}
|
|
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;
|
|
435
379
|
|
|
436
|
-
|
|
437
|
-
...otherProps,
|
|
438
|
-
...(tokenAmount !== '0' && {
|
|
439
|
-
balance: { amount: tokenAmount, usdValue: tokenUsdValue },
|
|
440
|
-
}),
|
|
441
|
-
};
|
|
442
|
-
});
|
|
380
|
+
return formattedBalance;
|
|
443
381
|
}
|
|
444
382
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
455
|
-
return (
|
|
456
|
-
parseFloat(tokenB.balance.usdValue) -
|
|
457
|
-
parseFloat(tokenA.balance.usdValue)
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
if (!tokenA.balance?.usdValue && tokenB.balance?.usdValue) {
|
|
462
|
-
return 1;
|
|
463
|
-
}
|
|
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
|
+
}
|
|
464
392
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
393
|
+
if (!token1Balance?.usdValue && token2Balance?.usdValue) {
|
|
394
|
+
return 1;
|
|
395
|
+
}
|
|
468
396
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
parseFloat(tokenA.balance?.amount || '0')
|
|
473
|
-
);
|
|
474
|
-
}
|
|
397
|
+
if (token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
398
|
+
return -1;
|
|
399
|
+
}
|
|
475
400
|
|
|
476
|
-
|
|
477
|
-
|
|
401
|
+
if (!token1Balance?.usdValue && !token2Balance?.usdValue) {
|
|
402
|
+
return (
|
|
403
|
+
parseFloat(token2Balance?.amount || '0') -
|
|
404
|
+
parseFloat(token1Balance?.amount || '0')
|
|
405
|
+
);
|
|
406
|
+
}
|
|
478
407
|
|
|
479
|
-
return
|
|
408
|
+
return 0;
|
|
480
409
|
}
|
|
481
410
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
if (
|
|
491
|
-
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;
|
|
492
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
|
+
});
|
|
493
442
|
|
|
494
|
-
|
|
495
|
-
(token) => token.blockchain === chain?.name
|
|
496
|
-
);
|
|
497
|
-
return sortTokens(getTokensWithBalance(filteredTokens, connectedWallets));
|
|
443
|
+
return tokens;
|
|
498
444
|
}
|
|
499
445
|
|
|
500
446
|
export function tokensAreEqual(
|
|
@@ -556,3 +502,52 @@ export function getAddress({
|
|
|
556
502
|
connectedWallet.chain === chain
|
|
557
503
|
)?.address;
|
|
558
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,17 +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
|
-
}>): React.JSX.Element;
|
|
16
|
-
export {};
|
|
17
|
-
//# 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,KAAgC,MAAM,OAAO,CAAC;AAUrD,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;AAEH,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;CAC9B,CAAC,qBA+EH"}
|
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(props: PropsWithChildren<WidgetProps>): 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,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBAoDzD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBAsB3D"}
|
|
@@ -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":"NoRoutes.d.ts","sourceRoot":"","sources":["../../../src/components/NoRoutes/NoRoutes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAUlD,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,qBA6DxC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Info } from './NoRoutes.types';
|
|
2
|
-
export declare function makeInfo(diagnosisMessage: string | null, disabledLiquiditySources: string[], hasError: boolean, toggleAllLiquiditySources: (shouldReset: boolean) => void, refetchBestRoute: () => void): Info;
|
|
3
|
-
//# sourceMappingURL=NoRoutes.helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoRoutes.helper.d.ts","sourceRoot":"","sources":["../../../src/components/NoRoutes/NoRoutes.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAM7C,wBAAgB,QAAQ,CACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAC/B,wBAAwB,EAAE,MAAM,EAAE,EAClC,QAAQ,EAAE,OAAO,EACjB,yBAAyB,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,EACzD,gBAAgB,EAAE,MAAM,IAAI,GAC3B,IAAI,CAuCN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NoRoutes.types.d.ts","sourceRoot":"","sources":["../../../src/components/NoRoutes/NoRoutes.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;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/NoRoutes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrors.d.ts","sourceRoot":"","sources":["../../../src/components/RouteErrors/RouteErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,qBAgE3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrors.styles.d.ts","sourceRoot":"","sources":["../../../src/components/RouteErrors/RouteErrors.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAGjB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAMf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAMf,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAIjB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type BigNumber from 'bignumber.js';
|
|
2
|
-
export interface PropTypes {
|
|
3
|
-
openModal: boolean;
|
|
4
|
-
onToggle: (open: boolean) => void;
|
|
5
|
-
totalFeeInUsd: BigNumber | null;
|
|
6
|
-
outputUsdValue: BigNumber | null;
|
|
7
|
-
inputUsdValue: BigNumber | null;
|
|
8
|
-
percentageChange: BigNumber | null;
|
|
9
|
-
highValueLoss: boolean;
|
|
10
|
-
priceImpactCanNotBeComputed: boolean;
|
|
11
|
-
loading: boolean;
|
|
12
|
-
extraSpace: boolean;
|
|
13
|
-
}
|
|
14
|
-
type ModalPropTypesKeys = keyof Omit<PropTypes, 'priceImpactCanNotBeComputed' | 'openModal' | 'extraSpace' | 'loading'>;
|
|
15
|
-
export type ModalPropTypes = Pick<PropTypes, ModalPropTypesKeys> & {
|
|
16
|
-
open: boolean;
|
|
17
|
-
};
|
|
18
|
-
export interface ModalContentData {
|
|
19
|
-
title: string;
|
|
20
|
-
value: string;
|
|
21
|
-
valueColor?: string;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=RouteErrors.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrors.types.d.ts","sourceRoot":"","sources":["../../../src/components/RouteErrors/RouteErrors.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,SAAS,GAAG,IAAI,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC;IACvB,2BAA2B,EAAE,OAAO,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,kBAAkB,GAAG,MAAM,IAAI,CAClC,SAAS,EACT,6BAA6B,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CACvE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,GAAG;IACjE,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrorsModal.d.ts","sourceRoot":"","sources":["../../../src/components/RouteErrors/RouteErrorsModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAW1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,qBAkGrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteErrorsModalItem.d.ts","sourceRoot":"","sources":["../../../src/components/RouteErrors/RouteErrorsModalItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,qBAgB3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RouteErrors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useConfirmSwap.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfirmSwap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EAEnB,MAAM,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAwCzE,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC3D,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAoHF,wBAAgB,cAAc,IAAI,WAAW,CA4H5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchBestRoute.d.ts","sourceRoot":"","sources":["../../src/hooks/useFetchBestRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAMrE,UAAU,iBAAiB;IACzB,KAAK,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrE,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,iBAAiB,IAAI,iBAAiB,CAyBrD"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { TokenWithBalance } from '../components/TokenList';
|
|
2
|
-
import type { Wallet } from '../types';
|
|
3
|
-
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset/dist/shared';
|
|
4
|
-
import type { BestRouteResponse, BlockchainMeta, Token } from 'rango-sdk';
|
|
5
|
-
import BigNumber from 'bignumber.js';
|
|
6
|
-
export interface RouteState {
|
|
7
|
-
fromBlockchain: BlockchainMeta | null;
|
|
8
|
-
toBlockchain: BlockchainMeta | null;
|
|
9
|
-
inputAmount: string;
|
|
10
|
-
inputUsdValue: BigNumber | null;
|
|
11
|
-
outputAmount: BigNumber | null;
|
|
12
|
-
outputUsdValue: BigNumber | null;
|
|
13
|
-
fromToken: TokenWithBalance | null;
|
|
14
|
-
toToken: TokenWithBalance | null;
|
|
15
|
-
routeWalletsConfirmed: boolean;
|
|
16
|
-
selectedWallets: Wallet[];
|
|
17
|
-
resetRoute: () => void;
|
|
18
|
-
resetToBlockchain: () => void;
|
|
19
|
-
resetFromBlockchain: () => void;
|
|
20
|
-
setFromBlockchain: (chain: BlockchainMeta | null) => void;
|
|
21
|
-
setToBlockchain: (chian: BlockchainMeta | null) => void;
|
|
22
|
-
setFromToken: (token: Token | null) => void;
|
|
23
|
-
setToToken: (token: Token | null) => void;
|
|
24
|
-
setInputAmount: (amount: string) => void;
|
|
25
|
-
bestRoute: BestRouteResponse | null;
|
|
26
|
-
setRoute: (bestRoute: BestRouteResponse | null) => void;
|
|
27
|
-
retry: (pendingSwap: PendingSwap) => void;
|
|
28
|
-
switchFromAndTo: () => void;
|
|
29
|
-
setRouteWalletConfirmed: (flag: boolean) => void;
|
|
30
|
-
setSelectedWallets: (wallets: Wallet[]) => void;
|
|
31
|
-
customDestination: string;
|
|
32
|
-
setCustomDestination: (address: string) => void;
|
|
33
|
-
resetRouteWallets: () => void;
|
|
34
|
-
}
|
|
35
|
-
export declare const useBestRouteStore: {
|
|
36
|
-
(): RouteState;
|
|
37
|
-
<U>(selector: (state: RouteState) => U, equals?: ((a: U, b: U) => boolean) | undefined): U;
|
|
38
|
-
} & Omit<import("zustand").StoreApi<RouteState>, "subscribe"> & {
|
|
39
|
-
subscribe: {
|
|
40
|
-
(listener: (selectedState: RouteState, previousSelectedState: RouteState) => void): () => void;
|
|
41
|
-
<U_1>(selector: (state: RouteState) => U_1, listener: (selectedState: U_1, previousSelectedState: U_1) => void, options?: {
|
|
42
|
-
equalityFn?: ((a: U_1, b: U_1) => boolean) | undefined;
|
|
43
|
-
fireImmediately?: boolean | undefined;
|
|
44
|
-
} | undefined): () => void;
|
|
45
|
-
};
|
|
46
|
-
} & {
|
|
47
|
-
use: {
|
|
48
|
-
fromBlockchain: () => BlockchainMeta | null;
|
|
49
|
-
toBlockchain: () => BlockchainMeta | null;
|
|
50
|
-
inputAmount: () => string;
|
|
51
|
-
inputUsdValue: () => BigNumber | null;
|
|
52
|
-
outputAmount: () => BigNumber | null;
|
|
53
|
-
outputUsdValue: () => BigNumber | null;
|
|
54
|
-
fromToken: () => TokenWithBalance | null;
|
|
55
|
-
toToken: () => TokenWithBalance | null;
|
|
56
|
-
routeWalletsConfirmed: () => boolean;
|
|
57
|
-
selectedWallets: () => Wallet[];
|
|
58
|
-
resetRoute: () => () => void;
|
|
59
|
-
resetToBlockchain: () => () => void;
|
|
60
|
-
resetFromBlockchain: () => () => void;
|
|
61
|
-
setFromBlockchain: () => (chain: BlockchainMeta | null) => void;
|
|
62
|
-
setToBlockchain: () => (chian: BlockchainMeta | null) => void;
|
|
63
|
-
setFromToken: () => (token: Token | null) => void;
|
|
64
|
-
setToToken: () => (token: Token | null) => void;
|
|
65
|
-
setInputAmount: () => (amount: string) => void;
|
|
66
|
-
bestRoute: () => BestRouteResponse | null;
|
|
67
|
-
setRoute: () => (bestRoute: BestRouteResponse | null) => void;
|
|
68
|
-
retry: () => (pendingSwap: PendingSwap) => void;
|
|
69
|
-
switchFromAndTo: () => () => void;
|
|
70
|
-
setRouteWalletConfirmed: () => (flag: boolean) => void;
|
|
71
|
-
setSelectedWallets: () => (wallets: Wallet[]) => void;
|
|
72
|
-
customDestination: () => string;
|
|
73
|
-
setCustomDestination: () => (address: string) => void;
|
|
74
|
-
resetRouteWallets: () => () => void;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=bestRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bestRoute.d.ts","sourceRoot":"","sources":["../../src/store/bestRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE1E,OAAO,SAAS,MAAM,cAAc,CAAC;AAoBrC,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,YAAY,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,eAAe,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAExD,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,KAAK,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,uBAAuB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAChD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;gCApBV,IAAI;uCACG,IAAI;yCACF,IAAI;yCACJ,cAAc,GAAG,IAAI,KAAK,IAAI;uCAChC,cAAc,GAAG,IAAI,KAAK,IAAI;oCAEjC,KAAK,GAAG,IAAI,KAAK,IAAI;kCACvB,KAAK,GAAG,IAAI,KAAK,IAAI;uCAChB,MAAM,KAAK,IAAI;;oCAElB,iBAAiB,GAAG,IAAI,KAAK,IAAI;mCAClC,WAAW,KAAK,IAAI;qCAClB,IAAI;8CACK,OAAO,KAAK,IAAI;4CAClB,MAAM,EAAE,KAAK,IAAI;;8CAEf,MAAM,KAAK,IAAI;uCACtB,IAAI;;CA4L9B,CAAC"}
|