@rango-dev/widget-embedded 0.17.1-next.1 → 0.17.1-next.10
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.helpers.d.ts +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +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/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 +1429 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
- package/dist/components/Quote/Quote.types.d.ts +22 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
- package/dist/components/Quote/QuoteSkeleton.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 +158 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
- package/dist/components/Quote/index.d.ts +4 -0
- package/dist/components/Quote/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 +22 -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/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.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/messages.d.ts +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 +472 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +17 -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.types.d.ts +5 -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 +16 -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/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
- 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/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +10 -4
- 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/Home.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/SettingsPage.d.ts +1 -6
- package/dist/pages/SettingsPage.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 +11 -0
- package/dist/store/AppStore.d.ts.map +1 -0
- package/dist/store/app.d.ts +5 -23
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
- package/dist/store/quote.d.ts.map +1 -0
- package/dist/store/settings.d.ts +3 -2
- package/dist/store/settings.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/wallets.d.ts +5 -4
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +5 -5
- 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/utils/numbers.d.ts +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
- package/dist/utils/quote.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +3 -2
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +25 -22
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/QueueManager.tsx +17 -17
- package/src/components/AppRouter.tsx +6 -5
- package/src/components/AppRoutes.tsx +6 -39
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +28 -40
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
- package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
- package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +16 -9
- package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
- package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
- 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 +3 -2
- package/src/components/Quote/Quote.styles.ts +212 -0
- package/src/components/Quote/Quote.tsx +345 -0
- package/src/components/Quote/Quote.types.ts +16 -0
- package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
- package/src/components/Quote/QuoteSkeleton.tsx +108 -0
- package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
- package/src/components/Quote/QuoteSummary.styles.ts +15 -0
- package/src/components/Quote/QuoteSummary.tsx +46 -0
- package/src/components/Quote/index.ts +3 -0
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
- package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +3 -3
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +67 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +24 -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/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +18 -22
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.tsx +5 -6
- package/src/components/UpdateUrl.tsx +36 -26
- package/src/components/WidgetEvents.tsx +4 -2
- package/src/constants/errors.ts +8 -10
- package/src/constants/messages.ts +1 -1
- 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 +65 -0
- package/src/containers/App/index.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +15 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +97 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +17 -0
- package/src/containers/QuoteInfo/index.ts +1 -0
- package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
- 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.tsx +36 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +5 -0
- package/src/containers/WidgetInfo/index.ts +1 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +19 -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 +168 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +136 -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/useNavigateBack.ts +3 -3
- package/src/hooks/useSwapInput.ts +58 -23
- package/src/hooks/useSyncStoresWithConfig.ts +22 -19
- package/src/hooks/useWalletList.ts +3 -5
- package/src/index.ts +10 -3
- package/src/pages/ConfirmSwapPage.tsx +58 -235
- package/src/pages/HistoryPage.tsx +1 -1
- package/src/pages/Home.tsx +58 -247
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +23 -32
- package/src/pages/SelectBlockchainPage.tsx +6 -7
- package/src/pages/SelectSwapItemsPage.tsx +5 -5
- package/src/pages/SettingsPage.tsx +9 -13
- package/src/pages/SwapDetailsPage.tsx +3 -3
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +5 -12
- package/src/store/AppStore.tsx +35 -0
- package/src/store/app.ts +18 -6
- package/src/store/{bestRoute.ts → quote.ts} +68 -60
- package/src/store/settings.ts +7 -4
- package/src/store/slices/config.ts +25 -15
- package/src/store/slices/data.ts +64 -29
- package/src/store/wallets.ts +11 -8
- package/src/types/config.ts +5 -5
- package/src/types/index.ts +1 -1
- package/src/types/quote.ts +107 -0
- package/src/utils/numbers.ts +1 -1
- package/src/utils/quote.ts +338 -0
- package/src/utils/settings.ts +8 -7
- package/src/utils/swap.ts +113 -85
- package/src/utils/wallets.ts +29 -17
- 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/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.map +0 -1
- package/dist/store/meta.d.ts +0 -23
- package/dist/store/meta.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.map +0 -1
- package/src/Widget.tsx +0 -119
- 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/types/routing.ts +0 -77
- package/src/utils/routing.ts +0 -321
- /package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +0 -0
package/src/utils/swap.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import type {
|
|
2
|
+
import type { FetchStatus } from '../store/slices/data';
|
|
3
3
|
import type { ConnectedWallet } from '../store/wallets';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
ConvertedToken,
|
|
6
|
+
RecommendedSlippages,
|
|
7
|
+
SwapButtonState,
|
|
8
|
+
Wallet,
|
|
9
|
+
} from '../types';
|
|
5
10
|
import type {
|
|
6
11
|
PendingSwap,
|
|
7
12
|
PendingSwapStep,
|
|
@@ -30,12 +35,11 @@ import {
|
|
|
30
35
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
31
36
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
32
37
|
} from '../constants/routing';
|
|
33
|
-
import { useMetaStore } from '../store/meta';
|
|
34
38
|
import { ButtonState } from '../types';
|
|
35
39
|
|
|
36
40
|
import { removeDuplicateFrom } from './common';
|
|
37
41
|
import { numberToString } from './numbers';
|
|
38
|
-
import { getRequiredBalanceOfWallet } from './
|
|
42
|
+
import { getRequiredBalanceOfWallet } from './quote';
|
|
39
43
|
import { getRequiredChains } from './wallets';
|
|
40
44
|
|
|
41
45
|
export function getOutputRatio(
|
|
@@ -50,25 +54,29 @@ export function getOutputRatio(
|
|
|
50
54
|
) {
|
|
51
55
|
return 0;
|
|
52
56
|
}
|
|
53
|
-
return outputUsdValue
|
|
57
|
+
return outputUsdValue
|
|
58
|
+
.div(inputUsdValue)
|
|
59
|
+
.minus(1)
|
|
60
|
+
.multipliedBy(100)
|
|
61
|
+
.toNumber();
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
export function
|
|
64
|
+
export function hasHighValueLoss(
|
|
57
65
|
inputUsdValue: BigNumber | null,
|
|
58
|
-
|
|
66
|
+
priceImpact: number
|
|
59
67
|
): boolean {
|
|
60
68
|
return (
|
|
61
|
-
((parseInt(
|
|
69
|
+
((parseInt(priceImpact.toFixed(2) || '0') <= -10 &&
|
|
62
70
|
inputUsdValue?.gte(new BigNumber(400))) ||
|
|
63
|
-
(parseInt(
|
|
71
|
+
(parseInt(priceImpact.toFixed(2) || '0') <= -5 &&
|
|
64
72
|
inputUsdValue?.gte(new BigNumber(1000)))) ??
|
|
65
73
|
false
|
|
66
74
|
);
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
export function hasLimitError(
|
|
77
|
+
export function hasLimitError(quote: BestRouteResponse | null): boolean {
|
|
70
78
|
return (
|
|
71
|
-
(
|
|
79
|
+
(quote?.result?.swaps || []).filter((swap) => {
|
|
72
80
|
const minimum = !!swap.fromAmountMinValue
|
|
73
81
|
? new BigNumber(swap.fromAmountMinValue)
|
|
74
82
|
: null;
|
|
@@ -83,16 +91,12 @@ export function hasLimitError(bestRoute: BestRouteResponse | null): boolean {
|
|
|
83
91
|
}).length > 0
|
|
84
92
|
);
|
|
85
93
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
swap: SwapResult | null;
|
|
94
|
+
export function getLimitErrorMessage(quote: BestRouteResponse): {
|
|
95
|
+
swap: SwapResult;
|
|
89
96
|
fromAmountRangeError: string;
|
|
90
97
|
recommendation: string;
|
|
91
98
|
} {
|
|
92
|
-
|
|
93
|
-
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
94
|
-
}
|
|
95
|
-
const swap = (bestRoute?.result?.swaps || []).filter((swap) => {
|
|
99
|
+
const swap = (quote.result?.swaps || []).filter((swap) => {
|
|
96
100
|
const minimum = !!swap.fromAmountMinValue
|
|
97
101
|
? new BigNumber(swap.fromAmountMinValue)
|
|
98
102
|
: null;
|
|
@@ -105,9 +109,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
105
109
|
}
|
|
106
110
|
return minimum?.gt(swap.fromAmount) || maximum?.lt(swap.fromAmount);
|
|
107
111
|
})[0];
|
|
108
|
-
|
|
109
|
-
return { swap: null, fromAmountRangeError: '', recommendation: '' };
|
|
110
|
-
}
|
|
112
|
+
|
|
111
113
|
const minimum = !!swap.fromAmountMinValue
|
|
112
114
|
? new BigNumber(swap.fromAmountMinValue)
|
|
113
115
|
: null;
|
|
@@ -178,10 +180,10 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
export function getSwapButtonState(
|
|
181
|
-
loadingMetaStatus:
|
|
183
|
+
loadingMetaStatus: FetchStatus,
|
|
182
184
|
connectedWallets: ConnectedWallet[],
|
|
183
185
|
loading: boolean,
|
|
184
|
-
|
|
186
|
+
quote: BestRouteResponse | null,
|
|
185
187
|
hasLimitError: boolean,
|
|
186
188
|
highValueLoss: boolean,
|
|
187
189
|
priceImpactCanNotBeComputed: boolean,
|
|
@@ -204,8 +206,8 @@ export function getSwapButtonState(
|
|
|
204
206
|
}
|
|
205
207
|
if (
|
|
206
208
|
loading ||
|
|
207
|
-
!
|
|
208
|
-
!
|
|
209
|
+
!quote ||
|
|
210
|
+
!quote.result ||
|
|
209
211
|
hasLimitError ||
|
|
210
212
|
!inputAmount ||
|
|
211
213
|
inputAmount === '0'
|
|
@@ -224,7 +226,7 @@ export function getSwapButtonState(
|
|
|
224
226
|
};
|
|
225
227
|
} else if (needsToWarnEthOnPath) {
|
|
226
228
|
return {
|
|
227
|
-
title: swapButtonTitles().
|
|
229
|
+
title: swapButtonTitles().ethWarning,
|
|
228
230
|
disabled: false,
|
|
229
231
|
hasWarning: true,
|
|
230
232
|
state: ButtonState.WARNING,
|
|
@@ -238,24 +240,24 @@ export function getSwapButtonState(
|
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
export function canComputePriceImpact(
|
|
241
|
-
|
|
243
|
+
quote: BestRouteResponse | null,
|
|
242
244
|
inputAmount: string,
|
|
243
245
|
usdValue: BigNumber | null
|
|
244
246
|
) {
|
|
245
247
|
return !(
|
|
246
248
|
(!usdValue || usdValue.lte(ZERO)) &&
|
|
247
|
-
!!
|
|
249
|
+
!!quote?.result &&
|
|
248
250
|
!!inputAmount &&
|
|
249
251
|
inputAmount !== '0' &&
|
|
250
252
|
parseFloat(inputAmount || '0') !== 0 &&
|
|
251
|
-
!!
|
|
253
|
+
!!quote.result
|
|
252
254
|
);
|
|
253
255
|
}
|
|
254
256
|
|
|
255
|
-
export function requiredWallets(
|
|
257
|
+
export function requiredWallets(quote: BestRouteResponse | null) {
|
|
256
258
|
const wallets: string[] = [];
|
|
257
259
|
|
|
258
|
-
|
|
260
|
+
quote?.result?.swaps.forEach((swap) => {
|
|
259
261
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
260
262
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
261
263
|
let lastAddedWallet = wallets[wallets.length - 1];
|
|
@@ -311,15 +313,13 @@ export function getUsdFeeOfStep(
|
|
|
311
313
|
}
|
|
312
314
|
|
|
313
315
|
export function getTotalFeeInUsd(
|
|
314
|
-
|
|
316
|
+
swaps: SwapResult[],
|
|
315
317
|
allTokens: Token[]
|
|
316
|
-
): BigNumber
|
|
317
|
-
return (
|
|
318
|
-
|
|
319
|
-
(
|
|
320
|
-
|
|
321
|
-
ZERO
|
|
322
|
-
) || null
|
|
318
|
+
): BigNumber {
|
|
319
|
+
return swaps.reduce(
|
|
320
|
+
(totalFee: BigNumber, step) =>
|
|
321
|
+
totalFee.plus(getUsdFeeOfStep(step, allTokens)),
|
|
322
|
+
ZERO
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
325
|
|
|
@@ -336,10 +336,44 @@ export function hasSlippageError(
|
|
|
336
336
|
return (slippages?.filter((s) => !!s?.error)?.length || 0) > 0;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
export function checkSlippageErrors(
|
|
340
|
+
quote: BestRouteResponse
|
|
341
|
+
): RecommendedSlippages | null {
|
|
342
|
+
const recommendedSlippages: RecommendedSlippages = new Map();
|
|
343
|
+
quote.result?.swaps.forEach((swap, index) => {
|
|
344
|
+
if (swap.recommendedSlippage?.error) {
|
|
345
|
+
recommendedSlippages.set(index, swap.recommendedSlippage.slippage);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
if (recommendedSlippages.size > 0) {
|
|
349
|
+
return recommendedSlippages;
|
|
350
|
+
}
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function checkSlippageWarnings(
|
|
355
|
+
quote: BestRouteResponse,
|
|
356
|
+
userSlippage: number
|
|
357
|
+
): RecommendedSlippages | null {
|
|
358
|
+
const recommendedSlippages: RecommendedSlippages = new Map();
|
|
359
|
+
quote.result?.swaps.forEach((swap, index) => {
|
|
360
|
+
if (
|
|
361
|
+
swap.recommendedSlippage?.slippage &&
|
|
362
|
+
parseInt(swap.recommendedSlippage?.slippage) > userSlippage
|
|
363
|
+
) {
|
|
364
|
+
recommendedSlippages.set(index, swap.recommendedSlippage.slippage);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
if (recommendedSlippages.size > 0) {
|
|
368
|
+
return recommendedSlippages;
|
|
369
|
+
}
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
|
|
339
373
|
export function getMinRequiredSlippage(
|
|
340
|
-
|
|
374
|
+
quote: BestRouteResponse
|
|
341
375
|
): string | null {
|
|
342
|
-
const slippages =
|
|
376
|
+
const slippages = quote.result?.swaps.map(
|
|
343
377
|
(slippage) => slippage.recommendedSlippage
|
|
344
378
|
);
|
|
345
379
|
return (
|
|
@@ -362,10 +396,10 @@ export function hasProperSlippage(
|
|
|
362
396
|
}
|
|
363
397
|
|
|
364
398
|
export function hasEnoughBalance(
|
|
365
|
-
|
|
399
|
+
quote: BestRouteResponse,
|
|
366
400
|
selectedWallets: Wallet[]
|
|
367
401
|
) {
|
|
368
|
-
const fee =
|
|
402
|
+
const fee = quote.validationStatus;
|
|
369
403
|
|
|
370
404
|
if (fee === null || fee.length === 0) {
|
|
371
405
|
return true;
|
|
@@ -389,29 +423,31 @@ export function hasEnoughBalance(
|
|
|
389
423
|
}
|
|
390
424
|
|
|
391
425
|
export function hasEnoughBalanceAndProperSlippage(
|
|
392
|
-
|
|
426
|
+
quote: BestRouteResponse,
|
|
393
427
|
selectedWallets: Wallet[],
|
|
394
428
|
userSlippage: string,
|
|
395
429
|
minRequiredSlippage: string | null
|
|
396
430
|
): boolean {
|
|
397
431
|
return (
|
|
398
|
-
hasEnoughBalance(
|
|
432
|
+
hasEnoughBalance(quote, selectedWallets) &&
|
|
399
433
|
hasProperSlippage(userSlippage, minRequiredSlippage)
|
|
400
434
|
);
|
|
401
435
|
}
|
|
402
436
|
|
|
403
|
-
export function
|
|
437
|
+
export function createQuoteRequestBody(params: {
|
|
404
438
|
fromToken: Token;
|
|
405
439
|
toToken: Token;
|
|
406
440
|
inputAmount: string;
|
|
407
441
|
wallets?: Wallet[];
|
|
408
442
|
selectedWallets?: Wallet[];
|
|
443
|
+
liquiditySources?: string[];
|
|
444
|
+
excludeLiquiditySources?: boolean;
|
|
409
445
|
disabledLiquiditySources: string[];
|
|
410
446
|
slippage: number;
|
|
411
447
|
affiliateRef: string | null;
|
|
412
448
|
affiliatePercent: number | null;
|
|
413
449
|
affiliateWallets: { [key: string]: string } | null;
|
|
414
|
-
|
|
450
|
+
initialQuote?: BestRouteResponse;
|
|
415
451
|
destination?: string;
|
|
416
452
|
}): BestRouteRequest {
|
|
417
453
|
const {
|
|
@@ -421,11 +457,13 @@ export function createBestRouteRequestBody(params: {
|
|
|
421
457
|
wallets,
|
|
422
458
|
selectedWallets,
|
|
423
459
|
disabledLiquiditySources,
|
|
460
|
+
liquiditySources,
|
|
461
|
+
excludeLiquiditySources,
|
|
424
462
|
slippage,
|
|
425
463
|
affiliateRef,
|
|
426
464
|
affiliatePercent,
|
|
427
465
|
affiliateWallets,
|
|
428
|
-
|
|
466
|
+
initialQuote,
|
|
429
467
|
destination,
|
|
430
468
|
} = params;
|
|
431
469
|
const selectedWalletsMap = selectedWallets?.reduce(
|
|
@@ -455,10 +493,10 @@ export function createBestRouteRequestBody(params: {
|
|
|
455
493
|
}
|
|
456
494
|
});
|
|
457
495
|
|
|
458
|
-
const checkPrerequisites = !!
|
|
496
|
+
const checkPrerequisites = !!initialQuote;
|
|
459
497
|
|
|
460
498
|
const filteredBlockchains = removeDuplicateFrom(
|
|
461
|
-
(
|
|
499
|
+
(initialQuote?.result?.swaps || []).reduce(
|
|
462
500
|
(blockchains: string[], swap) => {
|
|
463
501
|
blockchains.push(swap.from.blockchain, swap.to.blockchain);
|
|
464
502
|
// Check if internalSwaps array exists
|
|
@@ -496,13 +534,18 @@ export function createBestRouteRequestBody(params: {
|
|
|
496
534
|
selectedWallets: selectedWalletsMap ?? {},
|
|
497
535
|
slippage: slippage.toString(),
|
|
498
536
|
...(destination && { destination: destination }),
|
|
499
|
-
...(
|
|
500
|
-
swapperGroups: disabledLiquiditySources,
|
|
537
|
+
...(excludeLiquiditySources && {
|
|
538
|
+
swapperGroups: disabledLiquiditySources.concat(liquiditySources ?? []),
|
|
501
539
|
swappersGroupsExclude: true,
|
|
502
540
|
}),
|
|
541
|
+
...(!excludeLiquiditySources && {
|
|
542
|
+
swapperGroups: liquiditySources?.filter(
|
|
543
|
+
(liquiditySource) => !disabledLiquiditySources.includes(liquiditySource)
|
|
544
|
+
),
|
|
545
|
+
swappersGroupsExclude: false,
|
|
546
|
+
}),
|
|
503
547
|
...(checkPrerequisites && { blockchains: filteredBlockchains }),
|
|
504
548
|
};
|
|
505
|
-
|
|
506
549
|
return requestBody;
|
|
507
550
|
}
|
|
508
551
|
|
|
@@ -526,29 +569,24 @@ export function getWalletsForNewSwap(selectedWallets: Wallet[]) {
|
|
|
526
569
|
return wallets;
|
|
527
570
|
}
|
|
528
571
|
|
|
529
|
-
export function
|
|
530
|
-
return
|
|
572
|
+
export function getQuoteOutputAmount(quote: BestRouteResponse) {
|
|
573
|
+
return quote.result?.outputAmount || null;
|
|
531
574
|
}
|
|
532
575
|
|
|
533
|
-
export function getPercentageChange(
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
) {
|
|
537
|
-
if (!inputUsdValue || !outputUsdValue) {
|
|
538
|
-
return null;
|
|
539
|
-
}
|
|
540
|
-
return new BigNumber(outputUsdValue)
|
|
541
|
-
.div(new BigNumber(inputUsdValue))
|
|
576
|
+
export function getPercentageChange(input: string, output: string) {
|
|
577
|
+
return new BigNumber(output)
|
|
578
|
+
.div(new BigNumber(input))
|
|
542
579
|
.minus(1)
|
|
543
|
-
.multipliedBy(100)
|
|
580
|
+
.multipliedBy(100)
|
|
581
|
+
.toNumber();
|
|
544
582
|
}
|
|
545
583
|
|
|
546
584
|
export function isOutputAmountChangedALot(
|
|
547
|
-
|
|
548
|
-
|
|
585
|
+
oldQuote: BestRouteResponse,
|
|
586
|
+
newQuote: BestRouteResponse
|
|
549
587
|
) {
|
|
550
|
-
const oldOutputAmount =
|
|
551
|
-
const newOutputAmount =
|
|
588
|
+
const oldOutputAmount = getQuoteOutputAmount(oldQuote);
|
|
589
|
+
const newOutputAmount = getQuoteOutputAmount(newQuote);
|
|
552
590
|
if (!oldOutputAmount || !newOutputAmount) {
|
|
553
591
|
return false;
|
|
554
592
|
}
|
|
@@ -560,15 +598,15 @@ export function isOutputAmountChangedALot(
|
|
|
560
598
|
return true;
|
|
561
599
|
}
|
|
562
600
|
|
|
563
|
-
return percentageChange
|
|
601
|
+
return percentageChange <= -1;
|
|
564
602
|
}
|
|
565
603
|
|
|
566
604
|
export function getBalanceWarnings(
|
|
567
|
-
|
|
605
|
+
quote: BestRouteResponse,
|
|
568
606
|
selectedWallets: Wallet[]
|
|
569
607
|
) {
|
|
570
|
-
const fee =
|
|
571
|
-
const requiredWallets = getRequiredChains(
|
|
608
|
+
const fee = quote.validationStatus;
|
|
609
|
+
const requiredWallets = getRequiredChains(quote);
|
|
572
610
|
const walletsSortedByRequiredWallets = selectedWallets.sort(
|
|
573
611
|
(selectedWallet1, selectedWallet2) =>
|
|
574
612
|
requiredWallets.indexOf(selectedWallet1.chain) -
|
|
@@ -714,29 +752,19 @@ export function shouldRetrySwap(pendingSwap: PendingSwap) {
|
|
|
714
752
|
new Date().getTime() - parseInt(pendingSwap.finishTime) < 4 * 3600 * 1000
|
|
715
753
|
);
|
|
716
754
|
}
|
|
717
|
-
export function isValidCustomDestination(
|
|
718
|
-
blockchain: string,
|
|
719
|
-
address: string
|
|
720
|
-
): boolean {
|
|
721
|
-
const blockchains = useMetaStore.getState().meta.blockchains;
|
|
722
|
-
const regex =
|
|
723
|
-
blockchains.find((chain) => chain.name === blockchain)?.addressPatterns ||
|
|
724
|
-
[];
|
|
725
|
-
return regex.filter((r) => new RegExp(r).test(address)).length > 0;
|
|
726
|
-
}
|
|
727
755
|
|
|
728
756
|
export function confirmSwapDisabled(
|
|
729
757
|
fetching: boolean,
|
|
730
758
|
showCustomDestination: boolean,
|
|
731
759
|
customDestination: string,
|
|
732
|
-
|
|
760
|
+
quote: BestRouteResponse | null,
|
|
733
761
|
selectedWallets: { walletType: string; chain: string }[],
|
|
734
762
|
lastStepToBlockchain?: BlockchainMeta
|
|
735
763
|
) {
|
|
736
764
|
return (
|
|
737
765
|
fetching ||
|
|
738
766
|
(!showCustomDestination &&
|
|
739
|
-
!requiredWallets(
|
|
767
|
+
!requiredWallets(quote).every((chain) =>
|
|
740
768
|
selectedWallets.map((wallet) => wallet.chain).includes(chain)
|
|
741
769
|
)) ||
|
|
742
770
|
(!!showCustomDestination && !customDestination) ||
|
package/src/utils/wallets.ts
CHANGED
|
@@ -55,8 +55,11 @@ export function mapWalletTypesToWalletInfo(
|
|
|
55
55
|
return list
|
|
56
56
|
.filter((wallet) => !EXCLUDED_WALLETS.includes(wallet as WalletTypes))
|
|
57
57
|
.filter((wallet) => {
|
|
58
|
-
const { supportedChains,
|
|
59
|
-
|
|
58
|
+
const { supportedChains, isContractWallet } = getWalletInfo(wallet);
|
|
59
|
+
const { installed, network } = getState(wallet);
|
|
60
|
+
const filterContractWallets =
|
|
61
|
+
isContractWallet && (!installed || (!!chain && network !== chain));
|
|
62
|
+
if (filterContractWallets) {
|
|
60
63
|
return false;
|
|
61
64
|
}
|
|
62
65
|
if (chain) {
|
|
@@ -97,7 +100,8 @@ export function prepareAccountsForWalletStore(
|
|
|
97
100
|
wallet: WalletType,
|
|
98
101
|
accounts: string[],
|
|
99
102
|
evmBasedChains: string[],
|
|
100
|
-
supportedChainNames: Network[] | null
|
|
103
|
+
supportedChainNames: Network[] | null,
|
|
104
|
+
isContractWallet: boolean
|
|
101
105
|
): Wallet[] {
|
|
102
106
|
const result: Wallet[] = [];
|
|
103
107
|
|
|
@@ -151,21 +155,29 @@ export function prepareAccountsForWalletStore(
|
|
|
151
155
|
|
|
152
156
|
// If it's an evm network, we will add the address to all the evm chains.
|
|
153
157
|
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) => {
|
|
158
|
+
if (isContractWallet) {
|
|
163
159
|
/*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
160
|
+
* for contract wallets like Safe wallet, we should add only account for the
|
|
161
|
+
* current connected blockchain not all of the supported blockchains
|
|
166
162
|
*/
|
|
167
163
|
addAccount(network, address.toLowerCase());
|
|
168
|
-
}
|
|
164
|
+
} else {
|
|
165
|
+
/*
|
|
166
|
+
* all evm chains are not supported in wallets, so we are adding
|
|
167
|
+
* only to those that are supported by wallet.
|
|
168
|
+
*/
|
|
169
|
+
const evmChainsSupportedByWallet = supportedBlockchains.filter(
|
|
170
|
+
(chain) => evmBasedChains.includes(chain)
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
evmChainsSupportedByWallet.forEach((network) => {
|
|
174
|
+
/*
|
|
175
|
+
* EVM addresses are not case sensitive.
|
|
176
|
+
* Some wallets like Binance-chain return some letters in uppercase which produces bugs in our wallet state.
|
|
177
|
+
*/
|
|
178
|
+
addAccount(network, address.toLowerCase());
|
|
179
|
+
});
|
|
180
|
+
}
|
|
169
181
|
} else {
|
|
170
182
|
addAccount(network, address);
|
|
171
183
|
}
|
|
@@ -174,10 +186,10 @@ export function prepareAccountsForWalletStore(
|
|
|
174
186
|
return result;
|
|
175
187
|
}
|
|
176
188
|
|
|
177
|
-
export function getRequiredChains(
|
|
189
|
+
export function getRequiredChains(quote: BestRouteResponse | null) {
|
|
178
190
|
const wallets: string[] = [];
|
|
179
191
|
|
|
180
|
-
|
|
192
|
+
quote?.result?.swaps.forEach((swap) => {
|
|
181
193
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
182
194
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
183
195
|
if (!wallets.includes(currentStepFromBlockchain)) {
|
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":"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 +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"}
|