@rango-dev/widget-embedded 0.17.1-next.9 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/QueueManager.d.ts +1 -2
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/Wallets.d.ts +0 -1
- package/dist/Wallets.d.ts.map +1 -1
- package/dist/Widget.d.ts +1 -1
- package/dist/Widget.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +2 -0
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +6 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
- 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 +3 -1
- 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 +4 -1
- package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
- package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
- package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
- package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
- package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
- package/dist/components/NoRoutes/index.d.ts +2 -0
- package/dist/components/NoRoutes/index.d.ts.map +1 -0
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
- package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/RouteErrors/index.d.ts +2 -0
- package/dist/components/RouteErrors/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 +6 -1
- 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 +1 -2
- 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/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
- package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
- package/dist/hooks/useSwapInput.d.ts +2 -4
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts +6 -1
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts +2 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +6 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +8 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/app.d.ts +23 -5
- package/dist/store/app.d.ts.map +1 -1
- package/dist/store/{quote.d.ts → bestRoute.d.ts} +27 -39
- package/dist/store/bestRoute.d.ts.map +1 -0
- package/dist/store/meta.d.ts +23 -0
- package/dist/store/meta.d.ts.map +1 -0
- package/dist/store/settings.d.ts +2 -3
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +2 -3
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +0 -3
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +4 -5
- 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/routing.d.ts +65 -0
- package/dist/types/routing.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/{quote.d.ts → routing.d.ts} +12 -16
- package/dist/utils/routing.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +2 -3
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +22 -25
- 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 +8 -8
- package/src/QueueManager.tsx +14 -14
- package/src/Wallets.tsx +15 -35
- package/src/Widget.tsx +24 -11
- package/src/components/AppRouter.tsx +5 -6
- package/src/components/AppRoutes.tsx +39 -6
- package/src/components/BlockchainList/BlockchainList.tsx +4 -4
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +40 -28
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
- package/src/components/ConfirmWalletsModal/WalletList.tsx +5 -6
- package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
- package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +9 -16
- package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
- package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +12 -10
- package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
- package/src/components/NoRoutes/index.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +2 -3
- package/src/components/RouteErrors/RouteErrors.tsx +79 -0
- package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
- package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
- package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +3 -3
- package/src/components/RouteErrors/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +22 -18
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/TokenList/TokenList.tsx +6 -5
- package/src/components/UpdateUrl.tsx +26 -36
- package/src/components/WidgetEvents.tsx +2 -4
- package/src/constants/errors.ts +10 -8
- package/src/constants/messages.ts +1 -1
- package/src/constants/searchParams.ts +0 -1
- package/src/constants/warnings.ts +7 -7
- package/src/hooks/useConfirmSwap.ts +303 -0
- package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
- package/src/hooks/useNavigateBack.ts +3 -3
- package/src/hooks/useSwapInput.ts +23 -58
- package/src/hooks/useSyncStoresWithConfig.ts +19 -22
- package/src/hooks/useWalletList.ts +5 -3
- package/src/pages/ConfirmSwapPage.tsx +235 -58
- package/src/pages/HistoryPage.tsx +1 -1
- package/src/pages/Home.tsx +247 -58
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +32 -23
- package/src/pages/SelectBlockchainPage.tsx +7 -6
- package/src/pages/SelectSwapItemsPage.tsx +5 -5
- package/src/pages/SettingsPage.tsx +13 -9
- package/src/pages/SwapDetailsPage.tsx +3 -3
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +12 -5
- package/src/store/app.ts +6 -18
- package/src/store/{quote.ts → bestRoute.ts} +60 -68
- package/src/store/meta.ts +39 -0
- package/src/store/settings.ts +4 -7
- package/src/store/slices/config.ts +15 -25
- package/src/store/slices/data.ts +29 -64
- package/src/store/wallets.ts +8 -11
- package/src/types/config.ts +5 -5
- package/src/types/index.ts +1 -1
- package/src/types/routing.ts +77 -0
- package/src/utils/numbers.ts +1 -1
- package/src/utils/routing.ts +321 -0
- package/src/utils/settings.ts +7 -8
- package/src/utils/swap.ts +85 -113
- package/src/utils/wallets.ts +17 -29
- package/dist/components/NoResult/NoResult.d.ts +0 -4
- package/dist/components/NoResult/NoResult.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
- package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
- package/dist/components/NoResult/index.d.ts +0 -2
- package/dist/components/NoResult/index.d.ts.map +0 -1
- package/dist/components/Quote/Quote.d.ts +0 -4
- package/dist/components/Quote/Quote.d.ts.map +0 -1
- package/dist/components/Quote/Quote.styles.d.ts +0 -1429
- package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -22
- package/dist/components/Quote/Quote.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.d.ts +0 -4
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts +0 -319
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.types.d.ts +0 -6
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.d.ts +0 -11
- package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -158
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
- package/dist/components/Quote/index.d.ts +0 -4
- package/dist/components/Quote/index.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -22
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -472
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -17
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
- package/dist/containers/QuoteInfo/index.d.ts +0 -2
- package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
- package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -16
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
- package/dist/hooks/useFetchQuote.d.ts.map +0 -1
- package/dist/hooks/useForceAutoConnect.d.ts +0 -2
- package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
- package/dist/store/AppStore.d.ts +0 -11
- package/dist/store/AppStore.d.ts.map +0 -1
- package/dist/store/quote.d.ts.map +0 -1
- package/dist/types/quote.d.ts +0 -82
- package/dist/types/quote.d.ts.map +0 -1
- package/dist/utils/quote.d.ts.map +0 -1
- package/src/components/NoResult/index.ts +0 -1
- package/src/components/Quote/Quote.styles.ts +0 -212
- package/src/components/Quote/Quote.tsx +0 -345
- package/src/components/Quote/Quote.types.ts +0 -16
- package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
- package/src/components/Quote/QuoteSkeleton.tsx +0 -108
- package/src/components/Quote/QuoteSkeleton.types.ts +0 -5
- package/src/components/Quote/QuoteSummary.styles.ts +0 -15
- package/src/components/Quote/QuoteSummary.tsx +0 -46
- package/src/components/Quote/index.ts +0 -3
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -67
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -24
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
- package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
- package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -97
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -17
- package/src/containers/QuoteInfo/index.ts +0 -1
- package/src/hooks/useConfirmSwap/index.ts +0 -1
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -168
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -136
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
- package/src/hooks/useForceAutoConnect.ts +0 -27
- package/src/store/AppStore.tsx +0 -35
- package/src/types/quote.ts +0 -107
- package/src/utils/quote.ts +0 -338
- /package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +0 -0
package/dist/utils/settings.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SwapperMeta } from 'rango-sdk';
|
|
2
1
|
export type LiquiditySourceType = 'BRIDGE' | 'AGGREGATOR' | 'DEX';
|
|
3
2
|
export type UniqueSwappersGroupType = {
|
|
4
3
|
id: string;
|
|
@@ -7,6 +6,6 @@ export type UniqueSwappersGroupType = {
|
|
|
7
6
|
type: LiquiditySourceType;
|
|
8
7
|
selected: boolean;
|
|
9
8
|
};
|
|
10
|
-
export declare function getUniqueSwappersGroups(
|
|
11
|
-
export declare function sortLiquiditySourcesByGroupTitle(a:
|
|
9
|
+
export declare function getUniqueSwappersGroups(supportedSwappers?: string[]): UniqueSwappersGroupType[];
|
|
10
|
+
export declare function sortLiquiditySourcesByGroupTitle(a: UniqueSwappersGroupType, b: UniqueSwappersGroupType): 0 | 1 | -1;
|
|
12
11
|
//# 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":"AAKA,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,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC3B,uBAAuB,EAAE,CAuC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,uBAAuB,EAC1B,CAAC,EAAE,uBAAuB,cAW3B"}
|
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoadingStatus } from '../store/meta';
|
|
2
2
|
import type { ConnectedWallet } from '../store/wallets';
|
|
3
|
-
import type { ConvertedToken,
|
|
3
|
+
import type { ConvertedToken, 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): BigNumber | 0;
|
|
9
|
+
export declare function outputRatioHasWarning(inputUsdValue: BigNumber | null, outputRatio: BigNumber | 0): boolean;
|
|
10
|
+
export declare function hasLimitError(bestRoute: BestRouteResponse | null): boolean;
|
|
11
|
+
export declare function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
12
|
+
swap: SwapResult | null;
|
|
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: LoadingStatus, connectedWallets: ConnectedWallet[], loading: boolean, bestRoute: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
|
|
17
|
+
export declare function canComputePriceImpact(bestRoute: BestRouteResponse | null, inputAmount: string, usdValue: BigNumber | null): boolean;
|
|
18
|
+
export declare function requiredWallets(route: 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(bestRoute: BestRouteResponse | null, allTokens: Token[]): BigNumber | null;
|
|
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
|
|
25
|
-
export declare function checkSlippageWarnings(quote: BestRouteResponse, userSlippage: number): RecommendedSlippages | null;
|
|
26
|
-
export declare function getMinRequiredSlippage(quote: BestRouteResponse): string | null;
|
|
24
|
+
export declare function getMinRequiredSlippage(route: BestRouteResponse): string | null;
|
|
27
25
|
export declare function hasProperSlippage(userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
28
|
-
export declare function hasEnoughBalance(
|
|
29
|
-
export declare function hasEnoughBalanceAndProperSlippage(
|
|
30
|
-
export declare function
|
|
26
|
+
export declare function hasEnoughBalance(route: BestRouteResponse, selectedWallets: Wallet[]): boolean;
|
|
27
|
+
export declare function hasEnoughBalanceAndProperSlippage(route: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
28
|
+
export declare function createBestRouteRequestBody(params: {
|
|
31
29
|
fromToken: Token;
|
|
32
30
|
toToken: Token;
|
|
33
31
|
inputAmount: string;
|
|
34
32
|
wallets?: Wallet[];
|
|
35
33
|
selectedWallets?: Wallet[];
|
|
36
|
-
liquiditySources?: string[];
|
|
37
|
-
excludeLiquiditySources?: boolean;
|
|
38
34
|
disabledLiquiditySources: string[];
|
|
39
35
|
slippage: number;
|
|
40
36
|
affiliateRef: string | null;
|
|
@@ -42,7 +38,7 @@ export declare function createQuoteRequestBody(params: {
|
|
|
42
38
|
affiliateWallets: {
|
|
43
39
|
[key: string]: string;
|
|
44
40
|
} | null;
|
|
45
|
-
|
|
41
|
+
initialRoute?: BestRouteResponse;
|
|
46
42
|
destination?: string;
|
|
47
43
|
}): BestRouteRequest;
|
|
48
44
|
export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
@@ -51,10 +47,10 @@ export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
|
51
47
|
walletType: WalletType;
|
|
52
48
|
};
|
|
53
49
|
};
|
|
54
|
-
export declare function
|
|
55
|
-
export declare function getPercentageChange(
|
|
56
|
-
export declare function isOutputAmountChangedALot(
|
|
57
|
-
export declare function getBalanceWarnings(
|
|
50
|
+
export declare function getRouteOutputAmount(route: BestRouteResponse | null): string | null;
|
|
51
|
+
export declare function getPercentageChange(inputUsdValue: string | number | null, outputUsdValue: string | number | null): BigNumber | null;
|
|
52
|
+
export declare function isOutputAmountChangedALot(oldRoute: BestRouteResponse, newRoute: BestRouteResponse): boolean;
|
|
53
|
+
export declare function getBalanceWarnings(route: BestRouteResponse, selectedWallets: Wallet[]): string[];
|
|
58
54
|
export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
|
|
59
55
|
export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
|
|
60
56
|
export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
|
|
@@ -66,7 +62,8 @@ export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: P
|
|
|
66
62
|
};
|
|
67
63
|
export declare function getLastConvertedTokenInFailedSwap(pendingSwap: PendingSwap): ConvertedToken;
|
|
68
64
|
export declare function shouldRetrySwap(pendingSwap: PendingSwap): boolean;
|
|
69
|
-
export declare function
|
|
65
|
+
export declare function isValidCustomDestination(blockchain: string, address: string): boolean;
|
|
66
|
+
export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string, bestRoute: BestRouteResponse | null, selectedWallets: {
|
|
70
67
|
walletType: string;
|
|
71
68
|
chain: string;
|
|
72
69
|
}[], 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,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,KAAK,EACN,MAAM,WAAW,CAAC;AAInB,OAAO,SAAS,MAAM,cAAc,CAAC;AAoBrC,w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AAE,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
|
|
12
|
-
export declare function getRequiredChains(
|
|
11
|
+
export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null): Wallet[];
|
|
12
|
+
export declare function getRequiredChains(route: 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,O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/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.
|
|
23
|
-
"@rango-dev/queue-manager-core": "^0.
|
|
24
|
-
"@rango-dev/queue-manager-rango-preset": "^0.
|
|
25
|
-
"@rango-dev/queue-manager-react": "^0.
|
|
26
|
-
"@rango-dev/ui": "^0.
|
|
27
|
-
"@rango-dev/wallets-react": "^0.
|
|
28
|
-
"@rango-dev/wallets-shared": "^0.
|
|
22
|
+
"@rango-dev/provider-all": "^0.24.0",
|
|
23
|
+
"@rango-dev/queue-manager-core": "^0.23.0",
|
|
24
|
+
"@rango-dev/queue-manager-rango-preset": "^0.24.0",
|
|
25
|
+
"@rango-dev/queue-manager-react": "^0.23.0",
|
|
26
|
+
"@rango-dev/ui": "^0.24.0",
|
|
27
|
+
"@rango-dev/wallets-react": "^0.10.0",
|
|
28
|
+
"@rango-dev/wallets-shared": "^0.23.0",
|
|
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,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { PropsWithChildren } from 'react';
|
|
4
|
-
|
|
1
|
+
import React, { PropsWithChildren, useMemo } from 'react';
|
|
2
|
+
import { Provider as ManagerProvider } from '@rango-dev/queue-manager-react';
|
|
5
3
|
import {
|
|
6
|
-
checkWaitingForNetworkChange,
|
|
7
4
|
makeQueueDefinition,
|
|
5
|
+
SwapQueueContext,
|
|
6
|
+
checkWaitingForNetworkChange,
|
|
8
7
|
} from '@rango-dev/queue-manager-rango-preset';
|
|
9
|
-
import { Provider as ManagerProvider } from '@rango-dev/queue-manager-react';
|
|
10
8
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import {
|
|
10
|
+
convertEvmBlockchainMetaToEvmChainInfo,
|
|
11
|
+
Network,
|
|
12
|
+
WalletType,
|
|
13
|
+
} from '@rango-dev/wallets-shared';
|
|
14
|
+
import { useMetaStore } from './store/meta';
|
|
16
15
|
import { useWalletsStore } from './store/wallets';
|
|
17
|
-
import { getConfig } from './utils/configs';
|
|
18
16
|
import { walletAndSupportedChainsNames } from './utils/wallets';
|
|
17
|
+
import { getConfig } from './utils/configs';
|
|
18
|
+
import { isEvmBlockchain } from 'rango-types';
|
|
19
19
|
|
|
20
20
|
function QueueManager(props: PropsWithChildren) {
|
|
21
21
|
const {
|
|
@@ -33,7 +33,7 @@ function QueueManager(props: PropsWithChildren) {
|
|
|
33
33
|
});
|
|
34
34
|
}, []);
|
|
35
35
|
|
|
36
|
-
const blockchains =
|
|
36
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
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 =
|
|
46
|
+
const switchNetwork = (wallet: WalletType, network: Network) => {
|
|
47
47
|
if (!canSwitchNetworkTo(wallet, network)) {
|
|
48
48
|
return undefined;
|
|
49
49
|
}
|
package/src/Wallets.tsx
CHANGED
|
@@ -6,10 +6,10 @@ import type { PropsWithChildren } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Events, Provider } from '@rango-dev/wallets-react';
|
|
8
8
|
import { isEvmBlockchain } from 'rango-sdk';
|
|
9
|
-
import React, { createContext,
|
|
9
|
+
import React, { createContext, useRef } from 'react';
|
|
10
10
|
|
|
11
11
|
import { useWalletProviders } from './hooks/useWalletProviders';
|
|
12
|
-
import {
|
|
12
|
+
import { useMetaStore } from './store/meta';
|
|
13
13
|
import { useWalletsStore } from './store/wallets';
|
|
14
14
|
import {
|
|
15
15
|
prepareAccountsForWalletStore,
|
|
@@ -27,45 +27,41 @@ export const WidgetContext = createContext<WidgetContextInterface>({
|
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
export function WidgetWallets(
|
|
31
31
|
props: PropsWithChildren<{
|
|
32
32
|
providers: WidgetConfig['wallets'];
|
|
33
33
|
options?: ProvidersOptions;
|
|
34
34
|
onUpdateState?: EventHandler;
|
|
35
|
-
config: WidgetConfig;
|
|
36
35
|
}>
|
|
37
36
|
) {
|
|
38
|
-
const
|
|
39
|
-
const blockchains = useAppStore().blockchains();
|
|
40
|
-
const tokens = useAppStore().tokens();
|
|
37
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
41
38
|
const { providers } = useWalletProviders(props.providers, props?.options);
|
|
42
39
|
const disconnectWallet = useWalletsStore.use.disconnectWallet();
|
|
43
40
|
const connectWallet = useWalletsStore.use.connectWallet();
|
|
44
41
|
const onConnectWalletHandler = useRef<OnConnectHandler>();
|
|
45
42
|
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (props.config) {
|
|
48
|
-
updateConfig(props.config);
|
|
49
|
-
}
|
|
50
|
-
}, [props.config]);
|
|
51
|
-
|
|
52
43
|
const evmBasedChainNames = blockchains
|
|
53
44
|
.filter(isEvmBlockchain)
|
|
54
45
|
.map((chain) => chain.name);
|
|
55
46
|
|
|
56
|
-
const onUpdateState: EventHandler = (
|
|
47
|
+
const onUpdateState: EventHandler = (
|
|
48
|
+
type,
|
|
49
|
+
event,
|
|
50
|
+
value,
|
|
51
|
+
state,
|
|
52
|
+
supportedBlockchains
|
|
53
|
+
) => {
|
|
57
54
|
if (event === Events.ACCOUNTS) {
|
|
58
55
|
if (value) {
|
|
59
56
|
const supportedChainNames: Network[] | null =
|
|
60
|
-
walletAndSupportedChainsNames(
|
|
57
|
+
walletAndSupportedChainsNames(supportedBlockchains);
|
|
61
58
|
const data = prepareAccountsForWalletStore(
|
|
62
59
|
type,
|
|
63
60
|
value,
|
|
64
61
|
evmBasedChainNames,
|
|
65
|
-
supportedChainNames
|
|
66
|
-
meta.isContractWallet
|
|
62
|
+
supportedChainNames
|
|
67
63
|
);
|
|
68
|
-
connectWallet(data
|
|
64
|
+
connectWallet(data);
|
|
69
65
|
} else {
|
|
70
66
|
disconnectWallet(type);
|
|
71
67
|
}
|
|
@@ -95,7 +91,7 @@ function Main(
|
|
|
95
91
|
|
|
96
92
|
// propagate updates for Dapps using external wallets
|
|
97
93
|
if (props.onUpdateState) {
|
|
98
|
-
props.onUpdateState(type, event, value, state,
|
|
94
|
+
props.onUpdateState(type, event, value, state, supportedBlockchains);
|
|
99
95
|
}
|
|
100
96
|
};
|
|
101
97
|
return (
|
|
@@ -116,19 +112,3 @@ function Main(
|
|
|
116
112
|
</WidgetContext.Provider>
|
|
117
113
|
);
|
|
118
114
|
}
|
|
119
|
-
|
|
120
|
-
export function WidgetWallets(
|
|
121
|
-
props: PropsWithChildren<{
|
|
122
|
-
providers: WidgetConfig['wallets'];
|
|
123
|
-
options?: ProvidersOptions;
|
|
124
|
-
onUpdateState?: EventHandler;
|
|
125
|
-
config: WidgetConfig;
|
|
126
|
-
}>
|
|
127
|
-
) {
|
|
128
|
-
const { config, ...otherProps } = props;
|
|
129
|
-
return (
|
|
130
|
-
<AppStoreProvider config={config}>
|
|
131
|
-
<Main {...otherProps} config={config} />
|
|
132
|
-
</AppStoreProvider>
|
|
133
|
-
);
|
|
134
|
-
}
|
package/src/Widget.tsx
CHANGED
|
@@ -12,10 +12,10 @@ import { globalFont } from './globalStyles';
|
|
|
12
12
|
import { useLanguage } from './hooks/useLanguage';
|
|
13
13
|
import { useTheme } from './hooks/useTheme';
|
|
14
14
|
import QueueManager from './QueueManager';
|
|
15
|
-
import { useAppStore } from './store/
|
|
15
|
+
import { useAppStore } from './store/app';
|
|
16
|
+
import { useMetaStore } from './store/meta';
|
|
16
17
|
import { useNotificationStore } from './store/notification';
|
|
17
18
|
import { useSettingsStore } from './store/settings';
|
|
18
|
-
import { DEFAULT_CONFIG } from './store/slices/config';
|
|
19
19
|
import { initConfig } from './utils/configs';
|
|
20
20
|
import { WidgetContext, WidgetWallets } from './Wallets';
|
|
21
21
|
|
|
@@ -40,16 +40,18 @@ export type WidgetProps = {
|
|
|
40
40
|
config?: WidgetConfig;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export function Main() {
|
|
43
|
+
export function Main(props: PropsWithChildren<WidgetProps>) {
|
|
44
|
+
const { config } = props;
|
|
44
45
|
globalFont();
|
|
45
46
|
|
|
46
|
-
const { fetch: fetchMeta, config } = useAppStore();
|
|
47
47
|
const { activeTheme } = useTheme(config?.theme || {});
|
|
48
48
|
const { activeLanguage, changeLanguage } = useLanguage();
|
|
49
|
+
|
|
49
50
|
const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
|
|
50
51
|
useState<string>('');
|
|
51
52
|
const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
|
|
52
53
|
const widgetContext = useContext(WidgetContext);
|
|
54
|
+
const fetchMeta = useMetaStore.use.fetchMeta();
|
|
53
55
|
|
|
54
56
|
useMemo(() => {
|
|
55
57
|
if (config?.apiKey) {
|
|
@@ -58,12 +60,14 @@ export function Main() {
|
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
}, [config]);
|
|
63
|
+
|
|
61
64
|
useEffect(() => {
|
|
62
|
-
void fetchMeta()
|
|
65
|
+
void fetchMeta();
|
|
63
66
|
void useSettingsStore.persist.rehydrate();
|
|
64
67
|
void useNotificationStore.persist.rehydrate();
|
|
65
68
|
widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
|
|
66
69
|
}, []);
|
|
70
|
+
|
|
67
71
|
useEffect(() => {
|
|
68
72
|
if (config?.language) {
|
|
69
73
|
changeLanguage(config.language);
|
|
@@ -76,12 +80,13 @@ export function Main() {
|
|
|
76
80
|
<QueueManager>
|
|
77
81
|
<WidgetEvents />
|
|
78
82
|
<AppRouter
|
|
83
|
+
config={config}
|
|
79
84
|
lastConnectedWallet={lastConnectedWalletWithNetwork}
|
|
80
85
|
disconnectedWallet={disconnectedWallet}
|
|
81
86
|
clearDisconnectedWallet={() => {
|
|
82
87
|
setDisconnectedWallet(undefined);
|
|
83
88
|
}}>
|
|
84
|
-
<AppRoutes />
|
|
89
|
+
<AppRoutes config={config} />
|
|
85
90
|
</AppRouter>
|
|
86
91
|
</QueueManager>
|
|
87
92
|
</MainContainer>
|
|
@@ -90,17 +95,25 @@ export function Main() {
|
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
export function Widget(props: PropsWithChildren<WidgetProps>) {
|
|
98
|
+
const { updateConfig, config } = useAppStore();
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (props.config) {
|
|
101
|
+
updateConfig(props.config);
|
|
102
|
+
}
|
|
103
|
+
}, [props.config]);
|
|
104
|
+
|
|
93
105
|
if (!props.config?.externalWallets) {
|
|
94
106
|
return (
|
|
95
107
|
<WidgetWallets
|
|
96
|
-
|
|
97
|
-
providers={props.config?.wallets}
|
|
108
|
+
providers={config?.wallets}
|
|
98
109
|
options={{
|
|
99
|
-
walletConnectProjectId:
|
|
110
|
+
walletConnectProjectId:
|
|
111
|
+
config?.walletConnectProjectId ||
|
|
112
|
+
props.config?.walletConnectProjectId,
|
|
100
113
|
}}>
|
|
101
|
-
<Main />
|
|
114
|
+
<Main {...props} />
|
|
102
115
|
</WidgetWallets>
|
|
103
116
|
);
|
|
104
117
|
}
|
|
105
|
-
return <Main />;
|
|
118
|
+
return <Main {...props} />;
|
|
106
119
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../types';
|
|
1
2
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
2
3
|
import type { PropsWithChildren } from 'react';
|
|
3
4
|
|
|
@@ -9,9 +10,8 @@ import { MemoryRouter, useInRouterContext } from 'react-router';
|
|
|
9
10
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
10
11
|
|
|
11
12
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
12
|
-
import { useForceAutoConnect } from '../hooks/useForceAutoConnect';
|
|
13
13
|
import { Home } from '../pages/Home';
|
|
14
|
-
import {
|
|
14
|
+
import { useMetaStore } from '../store/meta';
|
|
15
15
|
|
|
16
16
|
import { UpdateUrl } from './UpdateUrl';
|
|
17
17
|
|
|
@@ -44,14 +44,13 @@ export function AppRouter({
|
|
|
44
44
|
lastConnectedWallet: string;
|
|
45
45
|
disconnectedWallet: WalletType | undefined;
|
|
46
46
|
clearDisconnectedWallet: () => void;
|
|
47
|
+
config: WidgetConfig | undefined;
|
|
47
48
|
}) {
|
|
48
49
|
const isRouterInContext = useInRouterContext();
|
|
49
50
|
const Router = isRouterInContext ? Route : MemoryRouter;
|
|
50
|
-
const blockchains =
|
|
51
|
+
const { blockchains } = useMetaStore.use.meta();
|
|
51
52
|
const { canSwitchNetworkTo } = useWallets();
|
|
52
53
|
|
|
53
|
-
useForceAutoConnect();
|
|
54
|
-
|
|
55
54
|
const evmChains = blockchains.filter(isEvmBlockchain);
|
|
56
55
|
|
|
57
56
|
useQueueManager({
|
|
@@ -65,7 +64,7 @@ export function AppRouter({
|
|
|
65
64
|
return (
|
|
66
65
|
<>
|
|
67
66
|
<Router>{children}</Router>
|
|
68
|
-
{isRouterInContext && <UpdateUrl />}
|
|
67
|
+
{isRouterInContext && <UpdateUrl config={props.config} />}
|
|
69
68
|
</>
|
|
70
69
|
);
|
|
71
70
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WidgetConfig } from '../types';
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { useRoutes } from 'react-router-dom';
|
|
3
5
|
|
|
@@ -16,7 +18,13 @@ import { WalletsPage } from '../pages/WalletsPage';
|
|
|
16
18
|
|
|
17
19
|
const getAbsolutePath = (path: string) => path.replace('/', '');
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
interface PropTypes {
|
|
22
|
+
config?: WidgetConfig;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function AppRoutes(props: PropTypes) {
|
|
26
|
+
const { config } = props;
|
|
27
|
+
|
|
20
28
|
return useRoutes([
|
|
21
29
|
{
|
|
22
30
|
path: navigationRoutes.home,
|
|
@@ -40,7 +48,12 @@ export function AppRoutes() {
|
|
|
40
48
|
},
|
|
41
49
|
{
|
|
42
50
|
path: navigationRoutes.settings,
|
|
43
|
-
element:
|
|
51
|
+
element: (
|
|
52
|
+
<SettingsPage
|
|
53
|
+
singleTheme={config?.theme?.singleTheme}
|
|
54
|
+
supportedSwappers={config?.liquiditySources}
|
|
55
|
+
/>
|
|
56
|
+
),
|
|
44
57
|
},
|
|
45
58
|
{
|
|
46
59
|
path: navigationRoutes.themes,
|
|
@@ -52,11 +65,21 @@ export function AppRoutes() {
|
|
|
52
65
|
},
|
|
53
66
|
{
|
|
54
67
|
path: navigationRoutes.exchanges,
|
|
55
|
-
element:
|
|
68
|
+
element: (
|
|
69
|
+
<LiquiditySourcePage
|
|
70
|
+
sourceType="Exchanges"
|
|
71
|
+
supportedSwappers={config?.liquiditySources}
|
|
72
|
+
/>
|
|
73
|
+
),
|
|
56
74
|
},
|
|
57
75
|
{
|
|
58
76
|
path: navigationRoutes.bridges,
|
|
59
|
-
element:
|
|
77
|
+
element: (
|
|
78
|
+
<LiquiditySourcePage
|
|
79
|
+
sourceType="Bridges"
|
|
80
|
+
supportedSwappers={config?.liquiditySources}
|
|
81
|
+
/>
|
|
82
|
+
),
|
|
60
83
|
},
|
|
61
84
|
{ path: navigationRoutes.swaps, element: <HistoryPage /> },
|
|
62
85
|
{
|
|
@@ -65,11 +88,21 @@ export function AppRoutes() {
|
|
|
65
88
|
},
|
|
66
89
|
{
|
|
67
90
|
path: navigationRoutes.wallets,
|
|
68
|
-
element:
|
|
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
|
+
),
|
|
69
102
|
},
|
|
70
103
|
{
|
|
71
104
|
path: getAbsolutePath(navigationRoutes.confirmSwap),
|
|
72
|
-
element: <ConfirmSwapPage />,
|
|
105
|
+
element: <ConfirmSwapPage config={config} />,
|
|
73
106
|
},
|
|
74
107
|
]);
|
|
75
108
|
}
|
|
@@ -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 { useMetaStore } from '../../store/meta';
|
|
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 loadingStatus = useMetaStore.use.loadingStatus();
|
|
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
|
+
{loadingStatus === 'loading' && <LoadingBlockchainList />}
|
|
70
|
+
{loadingStatus === '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 { useBestRouteStore } from '../../store/bestRoute';
|
|
17
|
+
import { useMetaStore } from '../../store/meta';
|
|
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 loadingStatus = useMetaStore.use.loadingStatus();
|
|
31
|
+
const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
|
|
32
|
+
const resetFromBlockchain = useBestRouteStore.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
|
+
{loadingStatus === 'loading' &&
|
|
49
49
|
Array.from(Array(NUMBER_OF_LOADING), (e) => (
|
|
50
50
|
<Skeleton key={e} variant="rounded" height={50} />
|
|
51
51
|
))}
|
|
52
|
-
{
|
|
52
|
+
{loadingStatus === 'success' && (
|
|
53
53
|
<>
|
|
54
54
|
<BlockchainsChip
|
|
55
55
|
selected={!blockchain}
|