@rango-dev/widget-embedded 0.17.1-next.0 → 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/dist/utils/settings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SwapperMeta } from 'rango-sdk';
|
|
1
2
|
export type LiquiditySourceType = 'BRIDGE' | 'AGGREGATOR' | 'DEX';
|
|
2
3
|
export type UniqueSwappersGroupType = {
|
|
3
4
|
id: string;
|
|
@@ -6,6 +7,6 @@ export type UniqueSwappersGroupType = {
|
|
|
6
7
|
type: LiquiditySourceType;
|
|
7
8
|
selected: boolean;
|
|
8
9
|
};
|
|
9
|
-
export declare function getUniqueSwappersGroups(
|
|
10
|
-
export declare function sortLiquiditySourcesByGroupTitle(a:
|
|
10
|
+
export declare function getUniqueSwappersGroups(swappers: SwapperMeta[]): UniqueSwappersGroupType[];
|
|
11
|
+
export declare function sortLiquiditySourcesByGroupTitle(a: SwapperMeta, b: SwapperMeta): 1 | -1 | 0;
|
|
11
12
|
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,EAAE,GACtB,uBAAuB,EAAE,CAuC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,cAWf"}
|
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FetchStatus } from '../store/slices/data';
|
|
2
2
|
import type { ConnectedWallet } from '../store/wallets';
|
|
3
|
-
import type { ConvertedToken, SwapButtonState, Wallet } from '../types';
|
|
3
|
+
import type { ConvertedToken, RecommendedSlippages, SwapButtonState, Wallet } from '../types';
|
|
4
4
|
import type { PendingSwap, PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
5
5
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
6
6
|
import type { BestRouteRequest, BestRouteResponse, BlockchainMeta, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
|
|
7
7
|
import BigNumber from 'bignumber.js';
|
|
8
|
-
export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null):
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function hasLimitError(
|
|
11
|
-
export declare function
|
|
12
|
-
swap: SwapResult
|
|
8
|
+
export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null): number;
|
|
9
|
+
export declare function hasHighValueLoss(inputUsdValue: BigNumber | null, priceImpact: number): boolean;
|
|
10
|
+
export declare function hasLimitError(quote: BestRouteResponse | null): boolean;
|
|
11
|
+
export declare function getLimitErrorMessage(quote: BestRouteResponse): {
|
|
12
|
+
swap: SwapResult;
|
|
13
13
|
fromAmountRangeError: string;
|
|
14
14
|
recommendation: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function getSwapButtonState(loadingMetaStatus:
|
|
17
|
-
export declare function canComputePriceImpact(
|
|
18
|
-
export declare function requiredWallets(
|
|
16
|
+
export declare function getSwapButtonState(loadingMetaStatus: FetchStatus, connectedWallets: ConnectedWallet[], loading: boolean, quote: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
|
|
17
|
+
export declare function canComputePriceImpact(quote: BestRouteResponse | null, inputAmount: string, usdValue: BigNumber | null): boolean;
|
|
18
|
+
export declare function requiredWallets(quote: BestRouteResponse | null): string[];
|
|
19
19
|
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
20
20
|
export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
|
|
21
|
-
export declare function getTotalFeeInUsd(
|
|
21
|
+
export declare function getTotalFeeInUsd(swaps: SwapResult[], allTokens: Token[]): BigNumber;
|
|
22
22
|
export declare function hasHighFee(totalFeeInUsd: BigNumber | null): boolean;
|
|
23
23
|
export declare function hasSlippageError(slippages: (RecommendedSlippage | null)[] | undefined): boolean;
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function checkSlippageErrors(quote: BestRouteResponse): RecommendedSlippages | null;
|
|
25
|
+
export declare function checkSlippageWarnings(quote: BestRouteResponse, userSlippage: number): RecommendedSlippages | null;
|
|
26
|
+
export declare function getMinRequiredSlippage(quote: BestRouteResponse): string | null;
|
|
25
27
|
export declare function hasProperSlippage(userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
26
|
-
export declare function hasEnoughBalance(
|
|
27
|
-
export declare function hasEnoughBalanceAndProperSlippage(
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function hasEnoughBalance(quote: BestRouteResponse, selectedWallets: Wallet[]): boolean;
|
|
29
|
+
export declare function hasEnoughBalanceAndProperSlippage(quote: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
30
|
+
export declare function createQuoteRequestBody(params: {
|
|
29
31
|
fromToken: Token;
|
|
30
32
|
toToken: Token;
|
|
31
33
|
inputAmount: string;
|
|
32
34
|
wallets?: Wallet[];
|
|
33
35
|
selectedWallets?: Wallet[];
|
|
36
|
+
liquiditySources?: string[];
|
|
37
|
+
excludeLiquiditySources?: boolean;
|
|
34
38
|
disabledLiquiditySources: string[];
|
|
35
39
|
slippage: number;
|
|
36
40
|
affiliateRef: string | null;
|
|
@@ -38,7 +42,7 @@ export declare function createBestRouteRequestBody(params: {
|
|
|
38
42
|
affiliateWallets: {
|
|
39
43
|
[key: string]: string;
|
|
40
44
|
} | null;
|
|
41
|
-
|
|
45
|
+
initialQuote?: BestRouteResponse;
|
|
42
46
|
destination?: string;
|
|
43
47
|
}): BestRouteRequest;
|
|
44
48
|
export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
@@ -47,10 +51,10 @@ export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
|
47
51
|
walletType: WalletType;
|
|
48
52
|
};
|
|
49
53
|
};
|
|
50
|
-
export declare function
|
|
51
|
-
export declare function getPercentageChange(
|
|
52
|
-
export declare function isOutputAmountChangedALot(
|
|
53
|
-
export declare function getBalanceWarnings(
|
|
54
|
+
export declare function getQuoteOutputAmount(quote: BestRouteResponse): string | null;
|
|
55
|
+
export declare function getPercentageChange(input: string, output: string): number;
|
|
56
|
+
export declare function isOutputAmountChangedALot(oldQuote: BestRouteResponse, newQuote: BestRouteResponse): boolean;
|
|
57
|
+
export declare function getBalanceWarnings(quote: BestRouteResponse, selectedWallets: Wallet[]): string[];
|
|
54
58
|
export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
|
|
55
59
|
export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
|
|
56
60
|
export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
|
|
@@ -62,8 +66,7 @@ export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: P
|
|
|
62
66
|
};
|
|
63
67
|
export declare function getLastConvertedTokenInFailedSwap(pendingSwap: PendingSwap): ConvertedToken;
|
|
64
68
|
export declare function shouldRetrySwap(pendingSwap: PendingSwap): boolean;
|
|
65
|
-
export declare function
|
|
66
|
-
export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string, bestRoute: BestRouteResponse | null, selectedWallets: {
|
|
69
|
+
export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string, quote: BestRouteResponse | null, selectedWallets: {
|
|
67
70
|
walletType: string;
|
|
68
71
|
chain: string;
|
|
69
72
|
}[], lastStepToBlockchain?: BlockchainMeta): boolean | undefined;
|
package/dist/utils/swap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CA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W,EAAE,WAAW,EACxB,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD,CAyCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAMvD;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,qBAAqB,EAAE,OAAO,EAC9B,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAC/B,eAAe,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACxD,oBAAoB,CAAC,EAAE,cAAc,uBActC"}
|
package/dist/utils/wallets.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import { WalletState as WalletStatus } from '@rango-dev/ui';
|
|
|
8
8
|
export declare function mapStatusToWalletState(state: WalletState): WalletStatus;
|
|
9
9
|
export declare function mapWalletTypesToWalletInfo(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[], chain?: string): ModalWalletInfo[];
|
|
10
10
|
export declare function walletAndSupportedChainsNames(supportedBlockchains: BlockchainMeta[]): Network[] | null;
|
|
11
|
-
export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null): Wallet[];
|
|
12
|
-
export declare function getRequiredChains(
|
|
11
|
+
export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null, isContractWallet: boolean): Wallet[];
|
|
12
|
+
export declare function getRequiredChains(quote: BestRouteResponse | null): string[];
|
|
13
13
|
export declare function getBalanceFromWallet(connectedWallets: ConnectedWallet[], chain: string, symbol: string, address: string | null): TokenBalance | null;
|
|
14
14
|
export declare function isAccountAndWalletMatched(account: Wallet, connectedWallet: ConnectedWallet): boolean;
|
|
15
15
|
export declare function makeBalanceFor(retrievedBalance: WalletDetail, tokens: Token[]): TokenBalance[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EAEX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB5D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAWvE;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,EAC3C,aAAa,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,EAC/C,IAAI,EAAE,UAAU,EAAE,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAA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AO,EAAE,eAAe,EAAE,GACzB,eAAe,EAAE,CAcnB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAEf,QAAQ,SAAI,EAEZ,cAAc,SAAI,GACjB,MAAM,CAOR;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,gBAAgB,EAChB,UAAU,GACX,EAAE;IACD,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,GAAG,SAAS,CAMrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.17.1-next.
|
|
3
|
+
"version": "0.17.1-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lingui/core": "4.2.1",
|
|
21
21
|
"@lingui/react": "4.2.1",
|
|
22
|
-
"@rango-dev/provider-all": "^0.22.1-next.
|
|
22
|
+
"@rango-dev/provider-all": "^0.22.1-next.4",
|
|
23
23
|
"@rango-dev/queue-manager-core": "^0.22.1-next.0",
|
|
24
|
-
"@rango-dev/queue-manager-rango-preset": "^0.22.1-next.
|
|
24
|
+
"@rango-dev/queue-manager-rango-preset": "^0.22.1-next.5",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.22.1-next.0",
|
|
26
|
-
"@rango-dev/ui": "^0.22.1-next.
|
|
27
|
-
"@rango-dev/wallets-react": "^0.8.1-next.
|
|
28
|
-
"@rango-dev/wallets-shared": "^0.21.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.22.1-next.6",
|
|
27
|
+
"@rango-dev/wallets-react": "^0.8.1-next.3",
|
|
28
|
+
"@rango-dev/wallets-shared": "^0.21.1-next.3",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
30
30
|
"copy-to-clipboard": "^3.3.3",
|
|
31
31
|
"dayjs": "^1.11.7",
|
package/src/QueueManager.tsx
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { SwapQueueContext } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
+
import type { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
3
|
+
import type { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
|
-
makeQueueDefinition,
|
|
5
|
-
SwapQueueContext,
|
|
6
6
|
checkWaitingForNetworkChange,
|
|
7
|
+
makeQueueDefinition,
|
|
7
8
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
9
|
+
import { Provider as ManagerProvider } from '@rango-dev/queue-manager-react';
|
|
8
10
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '
|
|
14
|
-
import { useMetaStore } from './store/meta';
|
|
11
|
+
import { convertEvmBlockchainMetaToEvmChainInfo } from '@rango-dev/wallets-shared';
|
|
12
|
+
import { isEvmBlockchain } from 'rango-types';
|
|
13
|
+
import React, { useMemo } from 'react';
|
|
14
|
+
|
|
15
|
+
import { useAppStore } from './store/AppStore';
|
|
15
16
|
import { useWalletsStore } from './store/wallets';
|
|
16
|
-
import { walletAndSupportedChainsNames } from './utils/wallets';
|
|
17
17
|
import { getConfig } from './utils/configs';
|
|
18
|
-
import {
|
|
18
|
+
import { walletAndSupportedChainsNames } from './utils/wallets';
|
|
19
19
|
|
|
20
|
-
function QueueManager(props: PropsWithChildren) {
|
|
20
|
+
function QueueManager(props: PropsWithChildren<{ apiKey?: string }>) {
|
|
21
21
|
const {
|
|
22
22
|
providers,
|
|
23
23
|
getSigners,
|
|
@@ -29,11 +29,11 @@ function QueueManager(props: PropsWithChildren) {
|
|
|
29
29
|
|
|
30
30
|
const swapQueueDef = useMemo(() => {
|
|
31
31
|
return makeQueueDefinition({
|
|
32
|
-
API_KEY: getConfig('API_KEY'),
|
|
32
|
+
API_KEY: props.apiKey || getConfig('API_KEY'),
|
|
33
33
|
});
|
|
34
|
-
}, []);
|
|
34
|
+
}, [props.apiKey]);
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const blockchains = useAppStore().blockchains();
|
|
37
37
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
38
38
|
|
|
39
39
|
const wallets = {
|
|
@@ -43,7 +43,7 @@ function QueueManager(props: PropsWithChildren) {
|
|
|
43
43
|
})),
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const switchNetwork = (wallet: WalletType, network: Network) => {
|
|
46
|
+
const switchNetwork = async (wallet: WalletType, network: Network) => {
|
|
47
47
|
if (!canSwitchNetworkTo(wallet, network)) {
|
|
48
48
|
return undefined;
|
|
49
49
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { WidgetConfig } from '../types';
|
|
2
1
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
3
2
|
import type { PropsWithChildren } from 'react';
|
|
4
3
|
|
|
@@ -10,8 +9,9 @@ import { MemoryRouter, useInRouterContext } from 'react-router';
|
|
|
10
9
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
11
10
|
|
|
12
11
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
12
|
+
import { useForceAutoConnect } from '../hooks/useForceAutoConnect';
|
|
13
13
|
import { Home } from '../pages/Home';
|
|
14
|
-
import {
|
|
14
|
+
import { useAppStore } from '../store/AppStore';
|
|
15
15
|
|
|
16
16
|
import { UpdateUrl } from './UpdateUrl';
|
|
17
17
|
|
|
@@ -44,13 +44,14 @@ export function AppRouter({
|
|
|
44
44
|
lastConnectedWallet: string;
|
|
45
45
|
disconnectedWallet: WalletType | undefined;
|
|
46
46
|
clearDisconnectedWallet: () => void;
|
|
47
|
-
config: WidgetConfig | undefined;
|
|
48
47
|
}) {
|
|
49
48
|
const isRouterInContext = useInRouterContext();
|
|
50
49
|
const Router = isRouterInContext ? Route : MemoryRouter;
|
|
51
|
-
const
|
|
50
|
+
const blockchains = useAppStore().blockchains();
|
|
52
51
|
const { canSwitchNetworkTo } = useWallets();
|
|
53
52
|
|
|
53
|
+
useForceAutoConnect();
|
|
54
|
+
|
|
54
55
|
const evmChains = blockchains.filter(isEvmBlockchain);
|
|
55
56
|
|
|
56
57
|
useQueueManager({
|
|
@@ -64,7 +65,7 @@ export function AppRouter({
|
|
|
64
65
|
return (
|
|
65
66
|
<>
|
|
66
67
|
<Router>{children}</Router>
|
|
67
|
-
{isRouterInContext && <UpdateUrl
|
|
68
|
+
{isRouterInContext && <UpdateUrl />}
|
|
68
69
|
</>
|
|
69
70
|
);
|
|
70
71
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { WidgetConfig } from '../types';
|
|
2
|
-
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import { useRoutes } from 'react-router-dom';
|
|
5
3
|
|
|
@@ -18,13 +16,7 @@ import { WalletsPage } from '../pages/WalletsPage';
|
|
|
18
16
|
|
|
19
17
|
const getAbsolutePath = (path: string) => path.replace('/', '');
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
config?: WidgetConfig;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function AppRoutes(props: PropTypes) {
|
|
26
|
-
const { config } = props;
|
|
27
|
-
|
|
19
|
+
export function AppRoutes() {
|
|
28
20
|
return useRoutes([
|
|
29
21
|
{
|
|
30
22
|
path: navigationRoutes.home,
|
|
@@ -48,12 +40,7 @@ export function AppRoutes(props: PropTypes) {
|
|
|
48
40
|
},
|
|
49
41
|
{
|
|
50
42
|
path: navigationRoutes.settings,
|
|
51
|
-
element:
|
|
52
|
-
<SettingsPage
|
|
53
|
-
singleTheme={config?.theme?.singleTheme}
|
|
54
|
-
supportedSwappers={config?.liquiditySources}
|
|
55
|
-
/>
|
|
56
|
-
),
|
|
43
|
+
element: <SettingsPage />,
|
|
57
44
|
},
|
|
58
45
|
{
|
|
59
46
|
path: navigationRoutes.themes,
|
|
@@ -65,21 +52,11 @@ export function AppRoutes(props: PropTypes) {
|
|
|
65
52
|
},
|
|
66
53
|
{
|
|
67
54
|
path: navigationRoutes.exchanges,
|
|
68
|
-
element:
|
|
69
|
-
<LiquiditySourcePage
|
|
70
|
-
sourceType="Exchanges"
|
|
71
|
-
supportedSwappers={config?.liquiditySources}
|
|
72
|
-
/>
|
|
73
|
-
),
|
|
55
|
+
element: <LiquiditySourcePage sourceType="Exchanges" />,
|
|
74
56
|
},
|
|
75
57
|
{
|
|
76
58
|
path: navigationRoutes.bridges,
|
|
77
|
-
element:
|
|
78
|
-
<LiquiditySourcePage
|
|
79
|
-
sourceType="Bridges"
|
|
80
|
-
supportedSwappers={config?.liquiditySources}
|
|
81
|
-
/>
|
|
82
|
-
),
|
|
59
|
+
element: <LiquiditySourcePage sourceType="Bridges" />,
|
|
83
60
|
},
|
|
84
61
|
{ path: navigationRoutes.swaps, element: <HistoryPage /> },
|
|
85
62
|
{
|
|
@@ -88,21 +65,11 @@ export function AppRoutes(props: PropTypes) {
|
|
|
88
65
|
},
|
|
89
66
|
{
|
|
90
67
|
path: navigationRoutes.wallets,
|
|
91
|
-
element:
|
|
92
|
-
<WalletsPage
|
|
93
|
-
supportedWallets={config?.wallets}
|
|
94
|
-
multiWallets={
|
|
95
|
-
typeof config?.multiWallets === 'undefined'
|
|
96
|
-
? true
|
|
97
|
-
: config.multiWallets
|
|
98
|
-
}
|
|
99
|
-
config={config}
|
|
100
|
-
/>
|
|
101
|
-
),
|
|
68
|
+
element: <WalletsPage />,
|
|
102
69
|
},
|
|
103
70
|
{
|
|
104
71
|
path: getAbsolutePath(navigationRoutes.confirmSwap),
|
|
105
|
-
element: <ConfirmSwapPage
|
|
72
|
+
element: <ConfirmSwapPage />,
|
|
106
73
|
},
|
|
107
74
|
]);
|
|
108
75
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@rango-dev/ui';
|
|
12
12
|
import React, { useEffect, useState } from 'react';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { useAppStore } from '../../store/AppStore';
|
|
15
15
|
|
|
16
16
|
import { filterBlockchains } from './BlockchainList.helpers';
|
|
17
17
|
import { Container, List } from './BlockchainList.styles';
|
|
@@ -20,7 +20,7 @@ import { LoadingBlockchainList } from './LoadingBlockchainList';
|
|
|
20
20
|
export function BlockchainList(props: PropTypes) {
|
|
21
21
|
const { list, searchedFor, onChange, blockchainCategory } = props;
|
|
22
22
|
const [blockchains, setBlockchains] = useState<BlockchainMeta[]>(list);
|
|
23
|
-
const
|
|
23
|
+
const { fetchStatus } = useAppStore();
|
|
24
24
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
setBlockchains([
|
|
@@ -66,8 +66,8 @@ export function BlockchainList(props: PropTypes) {
|
|
|
66
66
|
{i18n.t('Select Blockchain')}
|
|
67
67
|
</Typography>
|
|
68
68
|
<Divider size={4} />
|
|
69
|
-
{
|
|
70
|
-
{
|
|
69
|
+
{fetchStatus === 'loading' && <LoadingBlockchainList />}
|
|
70
|
+
{fetchStatus === 'success' && renderList()}
|
|
71
71
|
</Container>
|
|
72
72
|
);
|
|
73
73
|
}
|
|
@@ -13,8 +13,8 @@ import React from 'react';
|
|
|
13
13
|
|
|
14
14
|
import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
|
|
15
15
|
import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useAppStore } from '../../store/AppStore';
|
|
17
|
+
import { useQuoteStore } from '../../store/quote';
|
|
18
18
|
|
|
19
19
|
import { Container } from './BlockchainsSection.styles';
|
|
20
20
|
|
|
@@ -27,9 +27,9 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
27
27
|
selected: blockchain?.name,
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
const resetToBlockchain =
|
|
32
|
-
const resetFromBlockchain =
|
|
30
|
+
const { fetchStatus } = useAppStore();
|
|
31
|
+
const resetToBlockchain = useQuoteStore.use.resetToBlockchain();
|
|
32
|
+
const resetFromBlockchain = useQuoteStore.use.resetFromBlockchain();
|
|
33
33
|
const hasMoreItemsInList = blockchainsList.more.length > 0;
|
|
34
34
|
/**
|
|
35
35
|
* When only one item is left on list, we will not show the `More` button and will show the item itself instead.
|
|
@@ -45,11 +45,11 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
45
45
|
</Typography>
|
|
46
46
|
<Divider size={12} />
|
|
47
47
|
<Container>
|
|
48
|
-
{
|
|
48
|
+
{fetchStatus === 'loading' &&
|
|
49
49
|
Array.from(Array(NUMBER_OF_LOADING), (e) => (
|
|
50
50
|
<Skeleton key={e} variant="rounded" height={50} />
|
|
51
51
|
))}
|
|
52
|
-
{
|
|
52
|
+
{fetchStatus === 'success' && (
|
|
53
53
|
<>
|
|
54
54
|
<BlockchainsChip
|
|
55
55
|
selected={!blockchain}
|
|
@@ -1,71 +1,9 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
|
|
3
1
|
import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
7
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
8
|
-
USD_VALUE_MAX_DECIMALS,
|
|
9
|
-
USD_VALUE_MIN_DECIMALS,
|
|
10
|
-
} from '../../constants/routing';
|
|
11
|
-
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
12
|
-
import { numberToString } from '../../utils/numbers';
|
|
13
|
-
|
|
14
|
-
export function formatBestRoute(
|
|
15
|
-
bestRoute: BestRouteResponse,
|
|
16
|
-
blockchains: BlockchainMeta[]
|
|
17
|
-
): Step[] | undefined {
|
|
18
|
-
return bestRoute.result?.swaps.map((swap) => {
|
|
19
|
-
return {
|
|
20
|
-
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
21
|
-
from: {
|
|
22
|
-
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
23
|
-
chain: {
|
|
24
|
-
displayName:
|
|
25
|
-
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
26
|
-
image: swap.from.blockchainLogo,
|
|
27
|
-
},
|
|
28
|
-
price: {
|
|
29
|
-
value: numberToString(
|
|
30
|
-
swap.fromAmount,
|
|
31
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
32
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
33
|
-
),
|
|
34
|
-
usdValue: numberToString(
|
|
35
|
-
swap.from.usdPrice?.toString(),
|
|
36
|
-
USD_VALUE_MIN_DECIMALS,
|
|
37
|
-
USD_VALUE_MAX_DECIMALS
|
|
38
|
-
),
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
to: {
|
|
42
|
-
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
43
|
-
chain: {
|
|
44
|
-
displayName:
|
|
45
|
-
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
46
|
-
image: swap.to.blockchainLogo,
|
|
47
|
-
},
|
|
48
|
-
price: {
|
|
49
|
-
value: numberToString(
|
|
50
|
-
swap.toAmount,
|
|
51
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
52
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
53
|
-
),
|
|
54
|
-
usdValue: numberToString(
|
|
55
|
-
swap.to.usdPrice?.toString(),
|
|
56
|
-
USD_VALUE_MIN_DECIMALS,
|
|
57
|
-
USD_VALUE_MAX_DECIMALS
|
|
58
|
-
),
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function getRequiredWallets(route: BestRouteResponse | null): string[] {
|
|
3
|
+
export function getRequiredWallets(quote: BestRouteResponse | null): string[] {
|
|
66
4
|
const wallets: string[] = [];
|
|
67
5
|
|
|
68
|
-
|
|
6
|
+
quote?.result?.swaps.forEach((swap) => {
|
|
69
7
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
70
8
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
71
9
|
let lastAddedWallet = wallets[wallets.length - 1];
|