@rango-dev/widget-embedded 0.17.1-next.3 → 0.17.1-next.31
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/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/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +370 -56
- 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 +0 -2
- 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.types.d.ts +2 -2
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.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/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 +633 -3
- 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/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/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.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 +942 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +3 -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.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 +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 +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 +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 +23 -16
- package/dist/store/quote.d.ts.map +1 -1
- 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 +3 -0
- 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 +38 -5
- 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 +6 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +16 -7
- 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 -9
- 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.tsx +4 -4
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +12 -6
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +20 -21
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +0 -2
- package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
- package/src/components/Layout/Layout.tsx +20 -7
- package/src/components/Layout/Layout.types.ts +2 -2
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +14 -7
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +63 -60
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +17 -8
- package/src/components/NoResult/NoResult.helpers.ts +12 -12
- package/src/components/NoResult/NoResult.tsx +6 -6
- package/src/components/NotificationContent/NotificationContent.tsx +5 -3
- package/src/components/Quote/Quote.styles.ts +42 -12
- package/src/components/Quote/Quote.tsx +106 -37
- package/src/components/Quote/Quote.types.ts +0 -1
- package/src/components/Quote/QuoteSkeleton.tsx +1 -1
- package/src/components/Quote/QuoteSummary.styles.ts +9 -8
- package/src/components/Quote/QuoteSummary.tsx +2 -2
- 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.tsx +3 -5
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +5 -7
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +37 -33
- package/src/components/SwapDetails/SwapDetails.tsx +33 -45
- 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.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 +58 -37
- package/src/components/TokenList/TokenList.tsx +28 -23
- package/src/components/TokenList/TokenList.types.ts +3 -10
- package/src/components/TokenList/index.ts +0 -1
- package/src/components/UpdateUrl.tsx +23 -18
- package/src/components/WidgetEvents.tsx +4 -2
- 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 +44 -43
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -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/useConfirmSwap.helpers.ts +15 -11
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +25 -24
- 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 +89 -30
- package/src/hooks/useSyncStoresWithConfig.ts +38 -22
- package/src/hooks/useTheme.ts +4 -5
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +53 -5
- package/src/pages/ConfirmSwapPage.tsx +61 -41
- package/src/pages/HistoryPage.tsx +2 -7
- package/src/pages/Home.tsx +58 -88
- package/src/pages/LanguagePage.tsx +0 -5
- package/src/pages/LiquiditySourcePage.tsx +24 -37
- package/src/pages/SelectBlockchainPage.tsx +28 -21
- package/src/pages/SelectSwapItemsPage.tsx +10 -27
- package/src/pages/SettingsPage.tsx +28 -24
- package/src/pages/SwapDetailsPage.tsx +6 -7
- package/src/pages/ThemePage.tsx +2 -7
- package/src/pages/WalletsPage.tsx +4 -15
- package/src/services/httpService.ts +1 -1
- package/src/store/AppStore.tsx +41 -0
- package/src/store/app.ts +44 -6
- package/src/store/quote.ts +29 -26
- package/src/store/slices/config.ts +25 -15
- package/src/store/slices/data.ts +64 -29
- package/src/store/slices/settings.ts +168 -0
- package/src/store/wallets.ts +68 -37
- package/src/types/config.ts +50 -5
- 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 +17 -10
- package/src/utils/swap.ts +59 -55
- package/src/utils/time.ts +1 -1
- package/src/utils/wallets.ts +107 -149
- 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/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/src/Widget.tsx +0 -119
- package/src/store/meta.ts +0 -39
- package/src/store/settings.ts +0 -158
package/src/utils/meta.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
|
|
1
|
+
import type { Asset, BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
|
|
2
2
|
|
|
3
3
|
import { tokensAreEqual } from './wallets';
|
|
4
4
|
|
|
@@ -17,6 +17,13 @@ export function getBlockchainShortNameFor(
|
|
|
17
17
|
?.shortName;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
export function getSwapperDisplayName(
|
|
21
|
+
swapperId: string,
|
|
22
|
+
swappers: SwapperMeta[]
|
|
23
|
+
) {
|
|
24
|
+
return swappers.find((swapper) => swapper.id === swapperId)?.swapperGroup;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
export function findToken(t: Asset, tokens: Token[]) {
|
|
21
28
|
return tokens.find((token) => tokensAreEqual(token, t)) ?? null;
|
|
22
29
|
}
|
package/src/utils/providers.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../types';
|
|
2
|
+
import type { ProviderInterface } from '@rango-dev/wallets-react';
|
|
3
|
+
|
|
1
4
|
import { allProviders } from '@rango-dev/provider-all';
|
|
2
|
-
import { ProviderInterface } from '@rango-dev/wallets-react';
|
|
3
|
-
import { WidgetConfig } from '../types';
|
|
4
5
|
|
|
5
6
|
export interface ProvidersOptions {
|
|
6
7
|
walletConnectProjectId?: WidgetConfig['walletConnectProjectId'];
|
|
@@ -26,9 +27,11 @@ export function matchAndGenerateProviders(
|
|
|
26
27
|
const selectedProviders: ProviderInterface[] = [];
|
|
27
28
|
|
|
28
29
|
providers.forEach((requestedProvider) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/*
|
|
31
|
+
* There are two types of provider we get, the first one is only passing the wallet name
|
|
32
|
+
* then we will match the wallet name with our providers (@rango-dev/provider-*).
|
|
33
|
+
* The second way is passing a custom provider which implemented ProviderInterface.
|
|
34
|
+
*/
|
|
32
35
|
if (typeof requestedProvider === 'string') {
|
|
33
36
|
const result: ProviderInterface | undefined = all.find((provider) => {
|
|
34
37
|
return provider.config.type === requestedProvider;
|
package/src/utils/queue.ts
CHANGED
package/src/utils/quote.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
2
|
import type { QuoteError, QuoteWarning, Wallet } from '../types';
|
|
3
|
-
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
4
3
|
import type { PriceImpactWarningLevel } from '@rango-dev/ui';
|
|
5
4
|
import type {
|
|
6
5
|
SimulationAssetAndAmount,
|
|
@@ -12,6 +11,7 @@ import type {
|
|
|
12
11
|
BlockchainMeta,
|
|
13
12
|
Token,
|
|
14
13
|
} from 'rango-sdk';
|
|
14
|
+
import type { PendingSwap } from 'rango-types';
|
|
15
15
|
|
|
16
16
|
import { getLastSuccessfulStep } from '@rango-dev/queue-manager-rango-preset';
|
|
17
17
|
import BigNumber from 'bignumber.js';
|
|
@@ -238,11 +238,12 @@ export function generateQuoteWarnings(
|
|
|
238
238
|
const outputUsdValue = getUsdValue(toToken, quote.result?.outputAmount ?? '');
|
|
239
239
|
|
|
240
240
|
if (quote.result && inputUsdValue && outputUsdValue) {
|
|
241
|
-
const priceImpact =
|
|
241
|
+
const priceImpact = getPriceImpact(
|
|
242
242
|
inputUsdValue.toString(),
|
|
243
243
|
outputUsdValue.toString()
|
|
244
244
|
);
|
|
245
|
-
const highValueLoss =
|
|
245
|
+
const highValueLoss =
|
|
246
|
+
!!priceImpact && hasHighValueLoss(inputUsdValue, priceImpact);
|
|
246
247
|
|
|
247
248
|
if (highValueLoss) {
|
|
248
249
|
const totalFee = getTotalFeeInUsd(quote.result.swaps, tokens);
|
|
@@ -320,13 +321,12 @@ export function generateQuoteErrors(
|
|
|
320
321
|
export function getPriceImpact(
|
|
321
322
|
inputUsdValue: BigNumber | string | null,
|
|
322
323
|
outputUsdValue: BigNumber | string | null
|
|
323
|
-
) {
|
|
324
|
+
): number | null {
|
|
324
325
|
const outputUsdValueIsInvalid =
|
|
325
326
|
typeof outputUsdValue === 'string'
|
|
326
327
|
? parseFloat(outputUsdValue) <= 0
|
|
327
328
|
: !outputUsdValue?.gt(0);
|
|
328
|
-
|
|
329
|
-
const priceImpact =
|
|
329
|
+
const percentageChange =
|
|
330
330
|
!inputUsdValue || !outputUsdValue || outputUsdValueIsInvalid
|
|
331
331
|
? null
|
|
332
332
|
: getPercentageChange(
|
|
@@ -334,5 +334,5 @@ export function getPriceImpact(
|
|
|
334
334
|
outputUsdValue.toString()
|
|
335
335
|
);
|
|
336
336
|
|
|
337
|
-
return
|
|
337
|
+
return percentageChange && percentageChange < 0 ? percentageChange : null;
|
|
338
338
|
}
|
package/src/utils/settings.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Features } from '../types';
|
|
2
|
+
import type { SwapperMeta } from 'rango-sdk';
|
|
3
3
|
|
|
4
4
|
import { removeDuplicateFrom } from './common';
|
|
5
5
|
|
|
@@ -14,11 +14,10 @@ export type UniqueSwappersGroupType = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export function getUniqueSwappersGroups(
|
|
17
|
-
|
|
17
|
+
swappers: SwapperMeta[],
|
|
18
|
+
disabledLiquiditySources: string[]
|
|
18
19
|
): UniqueSwappersGroupType[] {
|
|
19
|
-
const
|
|
20
|
-
const disabledLiquiditySources =
|
|
21
|
-
useSettingsStore.use.disabledLiquiditySources();
|
|
20
|
+
const supportedSwappers = swappers.map((swapper) => swapper.swapperGroup);
|
|
22
21
|
|
|
23
22
|
const uniqueSupportedSwappersGroups: Array<UniqueSwappersGroupType> = [];
|
|
24
23
|
|
|
@@ -57,16 +56,24 @@ export function getUniqueSwappersGroups(
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
export function sortLiquiditySourcesByGroupTitle(
|
|
60
|
-
a:
|
|
61
|
-
b:
|
|
59
|
+
a: SwapperMeta,
|
|
60
|
+
b: SwapperMeta
|
|
62
61
|
) {
|
|
63
|
-
if (a.
|
|
62
|
+
if (a.swapperGroup < b.swapperGroup) {
|
|
64
63
|
return -1;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
if (a.
|
|
66
|
+
if (a.swapperGroup > b.swapperGroup) {
|
|
68
67
|
return 1;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
return 0;
|
|
72
71
|
}
|
|
72
|
+
|
|
73
|
+
export function isFeatureHidden(feature: keyof Features, features?: Features) {
|
|
74
|
+
return features?.[feature] === 'hidden';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function isFeatureEnabled(feature: keyof Features, features?: Features) {
|
|
78
|
+
return features?.[feature] === 'enabled';
|
|
79
|
+
}
|
package/src/utils/swap.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import type {
|
|
3
|
-
import type { ConnectedWallet } from '../store/wallets';
|
|
2
|
+
import type { FetchStatus } from '../store/slices/data';
|
|
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,12 +33,11 @@ import {
|
|
|
35
33
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
36
34
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
37
35
|
} from '../constants/routing';
|
|
38
|
-
import { useMetaStore } from '../store/meta';
|
|
39
|
-
import { ButtonState } from '../types';
|
|
40
36
|
|
|
41
37
|
import { removeDuplicateFrom } from './common';
|
|
38
|
+
import { getBlockchainShortNameFor } from './meta';
|
|
42
39
|
import { numberToString } from './numbers';
|
|
43
|
-
import { getRequiredBalanceOfWallet } from './quote';
|
|
40
|
+
import { getPriceImpact, getRequiredBalanceOfWallet } from './quote';
|
|
44
41
|
import { getRequiredChains } from './wallets';
|
|
45
42
|
|
|
46
43
|
export function getOutputRatio(
|
|
@@ -180,63 +177,70 @@ export function getLimitErrorMessage(quote: BestRouteResponse): {
|
|
|
180
177
|
return { swap, fromAmountRangeError, recommendation };
|
|
181
178
|
}
|
|
182
179
|
|
|
183
|
-
export function getSwapButtonState(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
needsToWarnEthOnPath: boolean
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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') {
|
|
195
201
|
return {
|
|
196
202
|
title: swapButtonTitles().connectWallet,
|
|
197
|
-
|
|
203
|
+
action: 'connect-wallet',
|
|
198
204
|
disabled: true,
|
|
199
205
|
};
|
|
200
206
|
}
|
|
201
|
-
if (
|
|
207
|
+
if (!anyWalletConnected) {
|
|
202
208
|
return {
|
|
203
209
|
title: swapButtonTitles().connectWallet,
|
|
204
|
-
|
|
210
|
+
action: 'connect-wallet',
|
|
205
211
|
disabled: false,
|
|
206
212
|
};
|
|
207
213
|
}
|
|
208
214
|
if (
|
|
209
|
-
|
|
215
|
+
fetchingQuote ||
|
|
210
216
|
!quote ||
|
|
211
217
|
!quote.result ||
|
|
212
|
-
|
|
218
|
+
error ||
|
|
213
219
|
!inputAmount ||
|
|
214
220
|
inputAmount === '0'
|
|
215
221
|
) {
|
|
216
222
|
return {
|
|
217
223
|
title: swapButtonTitles().swap,
|
|
224
|
+
action: 'confirm-swap',
|
|
218
225
|
disabled: true,
|
|
219
|
-
state: ButtonState.SWAP,
|
|
220
226
|
};
|
|
221
|
-
} else if (
|
|
227
|
+
} else if (warning) {
|
|
222
228
|
return {
|
|
223
229
|
title: swapButtonTitles().swapAnyway,
|
|
230
|
+
action: 'confirm-warning',
|
|
224
231
|
disabled: false,
|
|
225
|
-
hasWarning: true,
|
|
226
|
-
state: ButtonState.NEEDTOCONFIRM,
|
|
227
232
|
};
|
|
228
233
|
} else if (needsToWarnEthOnPath) {
|
|
229
234
|
return {
|
|
230
235
|
title: swapButtonTitles().ethWarning,
|
|
236
|
+
action: 'confirm-warning',
|
|
231
237
|
disabled: false,
|
|
232
|
-
hasWarning: true,
|
|
233
|
-
state: ButtonState.WARNING,
|
|
234
238
|
};
|
|
235
239
|
}
|
|
236
240
|
return {
|
|
237
241
|
title: swapButtonTitles().swap,
|
|
242
|
+
action: 'confirm-swap',
|
|
238
243
|
disabled: false,
|
|
239
|
-
state: ButtonState.SWAP,
|
|
240
244
|
};
|
|
241
245
|
}
|
|
242
246
|
|
|
@@ -360,7 +364,7 @@ export function checkSlippageWarnings(
|
|
|
360
364
|
quote.result?.swaps.forEach((swap, index) => {
|
|
361
365
|
if (
|
|
362
366
|
swap.recommendedSlippage?.slippage &&
|
|
363
|
-
|
|
367
|
+
parseFloat(swap.recommendedSlippage.slippage) > userSlippage
|
|
364
368
|
) {
|
|
365
369
|
recommendedSlippages.set(index, swap.recommendedSlippage.slippage);
|
|
366
370
|
}
|
|
@@ -441,6 +445,8 @@ export function createQuoteRequestBody(params: {
|
|
|
441
445
|
inputAmount: string;
|
|
442
446
|
wallets?: Wallet[];
|
|
443
447
|
selectedWallets?: Wallet[];
|
|
448
|
+
liquiditySources?: string[];
|
|
449
|
+
excludeLiquiditySources?: boolean;
|
|
444
450
|
disabledLiquiditySources: string[];
|
|
445
451
|
slippage: number;
|
|
446
452
|
affiliateRef: string | null;
|
|
@@ -456,6 +462,8 @@ export function createQuoteRequestBody(params: {
|
|
|
456
462
|
wallets,
|
|
457
463
|
selectedWallets,
|
|
458
464
|
disabledLiquiditySources,
|
|
465
|
+
liquiditySources,
|
|
466
|
+
excludeLiquiditySources,
|
|
459
467
|
slippage,
|
|
460
468
|
affiliateRef,
|
|
461
469
|
affiliatePercent,
|
|
@@ -531,13 +539,18 @@ export function createQuoteRequestBody(params: {
|
|
|
531
539
|
selectedWallets: selectedWalletsMap ?? {},
|
|
532
540
|
slippage: slippage.toString(),
|
|
533
541
|
...(destination && { destination: destination }),
|
|
534
|
-
...(
|
|
535
|
-
swapperGroups: disabledLiquiditySources,
|
|
542
|
+
...(excludeLiquiditySources && {
|
|
543
|
+
swapperGroups: disabledLiquiditySources.concat(liquiditySources ?? []),
|
|
536
544
|
swappersGroupsExclude: true,
|
|
537
545
|
}),
|
|
546
|
+
...(!excludeLiquiditySources && {
|
|
547
|
+
swapperGroups: liquiditySources?.filter(
|
|
548
|
+
(liquiditySource) => !disabledLiquiditySources.includes(liquiditySource)
|
|
549
|
+
),
|
|
550
|
+
swappersGroupsExclude: false,
|
|
551
|
+
}),
|
|
538
552
|
...(checkPrerequisites && { blockchains: filteredBlockchains }),
|
|
539
553
|
};
|
|
540
|
-
|
|
541
554
|
return requestBody;
|
|
542
555
|
}
|
|
543
556
|
|
|
@@ -582,10 +595,7 @@ export function isOutputAmountChangedALot(
|
|
|
582
595
|
if (!oldOutputAmount || !newOutputAmount) {
|
|
583
596
|
return false;
|
|
584
597
|
}
|
|
585
|
-
const percentageChange =
|
|
586
|
-
oldOutputAmount,
|
|
587
|
-
newOutputAmount
|
|
588
|
-
);
|
|
598
|
+
const percentageChange = getPriceImpact(oldOutputAmount, newOutputAmount);
|
|
589
599
|
if (!percentageChange) {
|
|
590
600
|
return true;
|
|
591
601
|
}
|
|
@@ -593,9 +603,10 @@ export function isOutputAmountChangedALot(
|
|
|
593
603
|
return percentageChange <= -1;
|
|
594
604
|
}
|
|
595
605
|
|
|
596
|
-
export function
|
|
606
|
+
export function generateBalanceWarnings(
|
|
597
607
|
quote: BestRouteResponse,
|
|
598
|
-
selectedWallets: Wallet[]
|
|
608
|
+
selectedWallets: Wallet[],
|
|
609
|
+
blockchains: BlockchainMeta[]
|
|
599
610
|
) {
|
|
600
611
|
const fee = quote.validationStatus;
|
|
601
612
|
const requiredWallets = getRequiredChains(quote);
|
|
@@ -640,7 +651,10 @@ export function getBalanceWarnings(
|
|
|
640
651
|
symbol,
|
|
641
652
|
reason,
|
|
642
653
|
currentAmount,
|
|
643
|
-
blockchain:
|
|
654
|
+
blockchain: getBlockchainShortNameFor(
|
|
655
|
+
asset.asset.blockchain,
|
|
656
|
+
blockchains
|
|
657
|
+
),
|
|
644
658
|
},
|
|
645
659
|
});
|
|
646
660
|
return warningMessage;
|
|
@@ -744,16 +758,6 @@ export function shouldRetrySwap(pendingSwap: PendingSwap) {
|
|
|
744
758
|
new Date().getTime() - parseInt(pendingSwap.finishTime) < 4 * 3600 * 1000
|
|
745
759
|
);
|
|
746
760
|
}
|
|
747
|
-
export function isValidCustomDestination(
|
|
748
|
-
blockchain: string,
|
|
749
|
-
address: string
|
|
750
|
-
): boolean {
|
|
751
|
-
const blockchains = useMetaStore.getState().meta.blockchains;
|
|
752
|
-
const regex =
|
|
753
|
-
blockchains.find((chain) => chain.name === blockchain)?.addressPatterns ||
|
|
754
|
-
[];
|
|
755
|
-
return regex.filter((r) => new RegExp(r).test(address)).length > 0;
|
|
756
|
-
}
|
|
757
761
|
|
|
758
762
|
export function confirmSwapDisabled(
|
|
759
763
|
fetching: boolean,
|
package/src/utils/time.ts
CHANGED