@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../src/types/quote.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,oBAAY,cAAc;IACxB,SAAS,IAAA;IACT,cAAc,IAAA;IACd,gBAAgB,IAAA;IAChB,YAAY,IAAA;IACZ,qBAAqB,IAAA;CACtB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,cAAc,CAAC,YAAY,CAAC;IAClC,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC,qBAAqB,CAAC;IAC3C,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,MAA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jB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,GACA,YAAY,GAAG,IAAI,CAgDrB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,GACvB,UAAU,GAAG,IAAI,CA+BnB;AAED,wBAAgB,cAAc,CAC5B,aAAa,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EACxC,cAAc,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,iBAgB1C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NoResult } from './NoResult';
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
|
-
import { darkTheme, styled } from '@rango-dev/ui';
|
|
3
|
-
|
|
4
|
-
import { CollapsibleContent } from '../ConfirmWalletsModal/ConfirmWallets.styles';
|
|
5
|
-
|
|
6
|
-
export const EXPANDABLE_QUOTE_TRANSITION_DURATION = 300;
|
|
7
|
-
|
|
8
|
-
export const QuoteContainer = styled(Collapsible.Root, {
|
|
9
|
-
display: 'flex',
|
|
10
|
-
flexDirection: 'column',
|
|
11
|
-
alignItems: 'start',
|
|
12
|
-
overflowX: 'auto',
|
|
13
|
-
overflowY: 'hidden',
|
|
14
|
-
width: '100%',
|
|
15
|
-
borderRadius: '$xm',
|
|
16
|
-
variants: {
|
|
17
|
-
recommended: {
|
|
18
|
-
true: {
|
|
19
|
-
$$color: '$colors$info300',
|
|
20
|
-
[`.${darkTheme} &`]: {
|
|
21
|
-
$$color: '$colors$secondary800',
|
|
22
|
-
},
|
|
23
|
-
backgroundColor: '$$color',
|
|
24
|
-
},
|
|
25
|
-
false: {
|
|
26
|
-
$$color: '$colors$neutral400',
|
|
27
|
-
[`.${darkTheme} &`]: {
|
|
28
|
-
$$color: '$colors$neutral200',
|
|
29
|
-
},
|
|
30
|
-
backgroundColor: '$$color',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
'& .steps-details': {
|
|
35
|
-
padding: '$10 $15',
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const SummaryContainer = styled('div', {
|
|
40
|
-
borderRadius: '$xm',
|
|
41
|
-
display: 'flex',
|
|
42
|
-
flexDirection: 'column',
|
|
43
|
-
alignItems: 'start',
|
|
44
|
-
justifyContent: 'space-between',
|
|
45
|
-
color: '$foreground',
|
|
46
|
-
cursor: 'pointer',
|
|
47
|
-
boxSizing: 'border-box',
|
|
48
|
-
position: 'relative',
|
|
49
|
-
variants: {
|
|
50
|
-
recommended: {
|
|
51
|
-
true: {
|
|
52
|
-
$$color: '$colors$info100',
|
|
53
|
-
[`.${darkTheme} &`]: {
|
|
54
|
-
$$color: '$colors$secondary600',
|
|
55
|
-
},
|
|
56
|
-
backgroundColor: '$$color',
|
|
57
|
-
'&:hover': {
|
|
58
|
-
backgroundColor: '$$color',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
false: {
|
|
62
|
-
$$color: '$colors$neutral200',
|
|
63
|
-
[`.${darkTheme} &`]: {
|
|
64
|
-
$$color: '$colors$neutral500',
|
|
65
|
-
},
|
|
66
|
-
backgroundColor: '$$color',
|
|
67
|
-
'&:hover': {
|
|
68
|
-
backgroundColor: '$$color',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
|
|
73
|
-
listItem: {
|
|
74
|
-
true: {},
|
|
75
|
-
false: {},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
compoundVariants: [
|
|
80
|
-
{
|
|
81
|
-
listItem: true,
|
|
82
|
-
recommended: true,
|
|
83
|
-
css: {
|
|
84
|
-
'&:hover': {
|
|
85
|
-
$$color: '$colors$secondary200',
|
|
86
|
-
[`.${darkTheme} &`]: {
|
|
87
|
-
$$color: '$colors$secondary700',
|
|
88
|
-
},
|
|
89
|
-
backgroundColor: '$$color',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
listItem: true,
|
|
95
|
-
recommended: false,
|
|
96
|
-
css: {
|
|
97
|
-
'&:hover': {
|
|
98
|
-
$$color: '$colors$neutral300',
|
|
99
|
-
[`.${darkTheme} &`]: {
|
|
100
|
-
$$color: '$colors$neutral400',
|
|
101
|
-
},
|
|
102
|
-
backgroundColor: '$$color',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
'& .summary': {
|
|
108
|
-
width: '100%',
|
|
109
|
-
padding: '$15 $15 $10 $15',
|
|
110
|
-
},
|
|
111
|
-
'& .basic-info': {
|
|
112
|
-
paddingTop: '$10',
|
|
113
|
-
display: 'flex',
|
|
114
|
-
alignItems: 'center',
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
export const Chains = styled(Collapsible.Trigger, {
|
|
119
|
-
display: 'flex',
|
|
120
|
-
width: '100%',
|
|
121
|
-
justifyContent: 'space-between',
|
|
122
|
-
alignItems: 'center',
|
|
123
|
-
height: '$36',
|
|
124
|
-
padding: '$10 $15',
|
|
125
|
-
boxSizing: 'border-box',
|
|
126
|
-
cursor: 'pointer',
|
|
127
|
-
border: 'none',
|
|
128
|
-
outline: 'none',
|
|
129
|
-
backgroundColor: 'transparent',
|
|
130
|
-
variants: {
|
|
131
|
-
error: {
|
|
132
|
-
true: {
|
|
133
|
-
[`& ${Image}`]: {
|
|
134
|
-
border: '1px $warning500 solid',
|
|
135
|
-
borderRadius: '100%',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
false: {
|
|
139
|
-
[`& ${Image}`]: {
|
|
140
|
-
border: '1px transparent solid',
|
|
141
|
-
borderRadius: '100%',
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
recommended: {
|
|
146
|
-
true: {
|
|
147
|
-
$$color: '$colors$info300',
|
|
148
|
-
[`.${darkTheme} &`]: {
|
|
149
|
-
$$color: '$colors$secondary800',
|
|
150
|
-
},
|
|
151
|
-
backgroundColor: '$$color',
|
|
152
|
-
},
|
|
153
|
-
false: {
|
|
154
|
-
$$color: '$colors$neutral400',
|
|
155
|
-
[`.${darkTheme} &`]: {
|
|
156
|
-
$$color: '$colors$neutral200',
|
|
157
|
-
},
|
|
158
|
-
backgroundColor: '$$color',
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
'& div:nth-child(1)': { display: 'flex' },
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
export const Content = styled(CollapsibleContent, {
|
|
166
|
-
width: '100%',
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
export const IconContainer = styled('div', {
|
|
170
|
-
display: 'flex',
|
|
171
|
-
justifyContent: 'center',
|
|
172
|
-
alignItems: 'center',
|
|
173
|
-
padding: '$2',
|
|
174
|
-
transition: `all ${EXPANDABLE_QUOTE_TRANSITION_DURATION}ms ease`,
|
|
175
|
-
variants: {
|
|
176
|
-
orientation: {
|
|
177
|
-
down: {
|
|
178
|
-
transform: 'rotate(0)',
|
|
179
|
-
},
|
|
180
|
-
up: {
|
|
181
|
-
transform: 'rotate(180deg)',
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
export const Separator = styled('div', {
|
|
188
|
-
height: '$12',
|
|
189
|
-
marginLeft: '$10',
|
|
190
|
-
marginRight: '$10',
|
|
191
|
-
borderLeft: '1px solid $foreground',
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
export const HorizontalSeparator = styled('div', {
|
|
195
|
-
display: 'flex',
|
|
196
|
-
justifyContent: 'center',
|
|
197
|
-
margin: '0 $15',
|
|
198
|
-
borderTop: '1px solid',
|
|
199
|
-
$$color: '$colors$neutral300',
|
|
200
|
-
[`.${darkTheme} &`]: {
|
|
201
|
-
$$color: '$colors$neutral400',
|
|
202
|
-
},
|
|
203
|
-
borderColor: '$$color',
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
export const FrameIcon = styled('div', {
|
|
207
|
-
width: '$16',
|
|
208
|
-
height: '$16',
|
|
209
|
-
justifyContent: 'center',
|
|
210
|
-
alignItems: 'center',
|
|
211
|
-
display: 'flex',
|
|
212
|
-
});
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import type { QuoteProps } from './Quote.types';
|
|
2
|
-
import type { Step } from '@rango-dev/ui';
|
|
3
|
-
import type { SwapResult } from 'rango-sdk';
|
|
4
|
-
|
|
5
|
-
import { i18n } from '@lingui/core';
|
|
6
|
-
import {
|
|
7
|
-
Alert,
|
|
8
|
-
ChevronDownIcon,
|
|
9
|
-
ChevronRightIcon,
|
|
10
|
-
Divider,
|
|
11
|
-
Image,
|
|
12
|
-
InfoIcon,
|
|
13
|
-
QuoteCost,
|
|
14
|
-
StepDetails,
|
|
15
|
-
TokenAmount,
|
|
16
|
-
Tooltip,
|
|
17
|
-
Typography,
|
|
18
|
-
} from '@rango-dev/ui';
|
|
19
|
-
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
GAS_FEE_MAX_DECIMALS,
|
|
23
|
-
GAS_FEE_MIN_DECIMALS,
|
|
24
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
25
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
26
|
-
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
27
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
28
|
-
} from '../../constants/routing';
|
|
29
|
-
import {
|
|
30
|
-
FooterAlert,
|
|
31
|
-
FooterStepAlarm,
|
|
32
|
-
} from '../../containers/QuoteInfo/QuoteInfo.styles';
|
|
33
|
-
import { useAppStore } from '../../store/AppStore';
|
|
34
|
-
import { QuoteErrorType, QuoteWarningType } from '../../types';
|
|
35
|
-
import {
|
|
36
|
-
numberToString,
|
|
37
|
-
secondsToString,
|
|
38
|
-
totalArrivalTime,
|
|
39
|
-
} from '../../utils/numbers';
|
|
40
|
-
import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
|
|
41
|
-
import { getTotalFeeInUsd } from '../../utils/swap';
|
|
42
|
-
|
|
43
|
-
import {
|
|
44
|
-
Chains,
|
|
45
|
-
Content,
|
|
46
|
-
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
47
|
-
FrameIcon,
|
|
48
|
-
HorizontalSeparator,
|
|
49
|
-
IconContainer,
|
|
50
|
-
QuoteContainer,
|
|
51
|
-
SummaryContainer,
|
|
52
|
-
} from './Quote.styles';
|
|
53
|
-
import { QuoteSummary } from './QuoteSummary';
|
|
54
|
-
|
|
55
|
-
export function Quote(props: QuoteProps) {
|
|
56
|
-
const {
|
|
57
|
-
quote,
|
|
58
|
-
input,
|
|
59
|
-
output,
|
|
60
|
-
error,
|
|
61
|
-
warning,
|
|
62
|
-
type,
|
|
63
|
-
recommended = true,
|
|
64
|
-
} = props;
|
|
65
|
-
const tokens = useAppStore().tokens();
|
|
66
|
-
|
|
67
|
-
const [expanded, setExpanded] = useState(props.expanded);
|
|
68
|
-
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
69
|
-
const totalFee = numberToString(
|
|
70
|
-
getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
|
|
71
|
-
GAS_FEE_MIN_DECIMALS,
|
|
72
|
-
GAS_FEE_MAX_DECIMALS
|
|
73
|
-
);
|
|
74
|
-
const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
|
|
75
|
-
|
|
76
|
-
const priceImpact = getPriceImpact(input.usdValue, output.usdValue ?? null);
|
|
77
|
-
const percentageChange = numberToString(
|
|
78
|
-
String(priceImpact),
|
|
79
|
-
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
80
|
-
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
81
|
-
);
|
|
82
|
-
const priceImpactWarningLevel = getPriceImpactLevel(priceImpact ?? 0);
|
|
83
|
-
|
|
84
|
-
const getQuoteSteps = (swaps: SwapResult[]): Step[] => {
|
|
85
|
-
return swaps.map((swap, index) => {
|
|
86
|
-
let stepState: 'error' | 'warning' | undefined = undefined;
|
|
87
|
-
const stepHasError =
|
|
88
|
-
(error?.type === QuoteErrorType.BRIDGE_LIMIT &&
|
|
89
|
-
error.swap.swapperId === swap.swapperId) ||
|
|
90
|
-
(warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
|
|
91
|
-
warning.recommendedSlippages?.has(index));
|
|
92
|
-
const stepHasWarning =
|
|
93
|
-
warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
|
|
94
|
-
warning.recommendedSlippages?.has(index);
|
|
95
|
-
|
|
96
|
-
if (stepHasError) {
|
|
97
|
-
stepState = 'error';
|
|
98
|
-
} else if (stepHasWarning) {
|
|
99
|
-
stepState = 'warning';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
104
|
-
from: {
|
|
105
|
-
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
106
|
-
chain: {
|
|
107
|
-
displayName: swap.from.blockchain,
|
|
108
|
-
image: swap.from.blockchainLogo,
|
|
109
|
-
},
|
|
110
|
-
price: {
|
|
111
|
-
value:
|
|
112
|
-
index === 0
|
|
113
|
-
? numberToString(
|
|
114
|
-
input.value,
|
|
115
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
116
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
117
|
-
)
|
|
118
|
-
: swap.fromAmount,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
to: {
|
|
122
|
-
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
123
|
-
chain: {
|
|
124
|
-
displayName: swap.to.blockchain,
|
|
125
|
-
image: swap.to.blockchainLogo,
|
|
126
|
-
},
|
|
127
|
-
price: {
|
|
128
|
-
value: swap.toAmount,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
state: stepState,
|
|
132
|
-
alerts:
|
|
133
|
-
stepHasError || stepHasWarning ? (
|
|
134
|
-
<FooterStepAlarm>
|
|
135
|
-
<Alert
|
|
136
|
-
type={stepHasError ? 'error' : 'warning'}
|
|
137
|
-
title={
|
|
138
|
-
error?.type === QuoteErrorType.BRIDGE_LIMIT
|
|
139
|
-
? error?.recommendation
|
|
140
|
-
: i18n.t('Slippage Error:')
|
|
141
|
-
}
|
|
142
|
-
footer={
|
|
143
|
-
<FooterAlert>
|
|
144
|
-
{error?.type === QuoteErrorType.BRIDGE_LIMIT && (
|
|
145
|
-
<>
|
|
146
|
-
<Typography
|
|
147
|
-
size="xsmall"
|
|
148
|
-
variant="body"
|
|
149
|
-
color="neutral900">
|
|
150
|
-
{error.fromAmountRangeError}
|
|
151
|
-
</Typography>
|
|
152
|
-
<Divider direction="horizontal" size={8} />
|
|
153
|
-
<Typography
|
|
154
|
-
size="xsmall"
|
|
155
|
-
variant="body"
|
|
156
|
-
color="neutral900">
|
|
157
|
-
|
|
|
158
|
-
</Typography>
|
|
159
|
-
<Divider direction="horizontal" size={8} />
|
|
160
|
-
<Typography
|
|
161
|
-
size="xsmall"
|
|
162
|
-
variant="body"
|
|
163
|
-
color="neutral900">
|
|
164
|
-
{i18n.t({
|
|
165
|
-
id: 'Yours: {amount} {symbol}',
|
|
166
|
-
values: {
|
|
167
|
-
amount: numberToString(
|
|
168
|
-
swap.fromAmount,
|
|
169
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
170
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
171
|
-
),
|
|
172
|
-
symbol: swap?.from.symbol,
|
|
173
|
-
},
|
|
174
|
-
})}
|
|
175
|
-
</Typography>
|
|
176
|
-
</>
|
|
177
|
-
)}
|
|
178
|
-
{(error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE ||
|
|
179
|
-
warning?.type ===
|
|
180
|
-
QuoteWarningType.INSUFFICIENT_SLIPPAGE) && (
|
|
181
|
-
<Typography
|
|
182
|
-
size="xsmall"
|
|
183
|
-
variant="body"
|
|
184
|
-
color="neutral900">
|
|
185
|
-
{i18n.t({
|
|
186
|
-
id: 'min required Slippage: {minRequiredSlippage}',
|
|
187
|
-
values: {
|
|
188
|
-
...(error?.type ===
|
|
189
|
-
QuoteErrorType.INSUFFICIENT_SLIPPAGE && {
|
|
190
|
-
minRequiredSlippage:
|
|
191
|
-
error.recommendedSlippages?.get(index),
|
|
192
|
-
}),
|
|
193
|
-
...(warning?.type ===
|
|
194
|
-
QuoteWarningType.INSUFFICIENT_SLIPPAGE && {
|
|
195
|
-
minRequiredSlippage:
|
|
196
|
-
warning.recommendedSlippages?.get(index),
|
|
197
|
-
}),
|
|
198
|
-
},
|
|
199
|
-
})}
|
|
200
|
-
</Typography>
|
|
201
|
-
)}
|
|
202
|
-
</FooterAlert>
|
|
203
|
-
}
|
|
204
|
-
/>
|
|
205
|
-
</FooterStepAlarm>
|
|
206
|
-
) : undefined,
|
|
207
|
-
};
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
const steps = getQuoteSteps(quote.result?.swaps ?? []);
|
|
211
|
-
const numberOfSteps = steps.length;
|
|
212
|
-
|
|
213
|
-
useLayoutEffect(() => {
|
|
214
|
-
if (expanded && quoteRef.current) {
|
|
215
|
-
setTimeout(() => {
|
|
216
|
-
quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
217
|
-
}, EXPANDABLE_QUOTE_TRANSITION_DURATION);
|
|
218
|
-
}
|
|
219
|
-
}, [expanded]);
|
|
220
|
-
|
|
221
|
-
return (
|
|
222
|
-
<>
|
|
223
|
-
<SummaryContainer
|
|
224
|
-
recommended={recommended}
|
|
225
|
-
listItem={type === 'list-item'}
|
|
226
|
-
basic={type === 'basic'}>
|
|
227
|
-
<div className="summary">
|
|
228
|
-
<QuoteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
|
|
229
|
-
{type === 'basic' && (
|
|
230
|
-
<div className="basic-info">
|
|
231
|
-
<FrameIcon>
|
|
232
|
-
<InfoIcon size={12} color="gray" />
|
|
233
|
-
</FrameIcon>
|
|
234
|
-
<Typography
|
|
235
|
-
size="small"
|
|
236
|
-
variant="body"
|
|
237
|
-
style={{ letterSpacing: 0.4 }}>
|
|
238
|
-
{`${input.value} ${steps[0].from.token.displayName} = ${
|
|
239
|
-
output.value
|
|
240
|
-
} ${steps[steps.length - 1].to.token.displayName}`}
|
|
241
|
-
</Typography>
|
|
242
|
-
<Typography
|
|
243
|
-
color="$neutral600"
|
|
244
|
-
ml={2}
|
|
245
|
-
size="xsmall"
|
|
246
|
-
variant="body">
|
|
247
|
-
{`($${output.usdValue})`}
|
|
248
|
-
</Typography>
|
|
249
|
-
</div>
|
|
250
|
-
)}
|
|
251
|
-
{type === 'list-item' && (
|
|
252
|
-
<TokenAmount
|
|
253
|
-
type="output"
|
|
254
|
-
direction="vertical"
|
|
255
|
-
price={{ value: output.value, usdValue: output.usdValue }}
|
|
256
|
-
token={{
|
|
257
|
-
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
258
|
-
image: steps[numberOfSteps - 1].to.token.image,
|
|
259
|
-
}}
|
|
260
|
-
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
261
|
-
percentageChange={percentageChange}
|
|
262
|
-
warningLevel={priceImpactWarningLevel}
|
|
263
|
-
/>
|
|
264
|
-
)}
|
|
265
|
-
{type === 'swap-preview' && (
|
|
266
|
-
<>
|
|
267
|
-
<QuoteSummary
|
|
268
|
-
from={steps[0].from}
|
|
269
|
-
to={steps[numberOfSteps - 1].to}
|
|
270
|
-
percentageChange={percentageChange}
|
|
271
|
-
warningLevel={priceImpactWarningLevel}
|
|
272
|
-
/>
|
|
273
|
-
<Divider size={4} />
|
|
274
|
-
</>
|
|
275
|
-
)}
|
|
276
|
-
</div>
|
|
277
|
-
<QuoteContainer
|
|
278
|
-
recommended={recommended}
|
|
279
|
-
open={expanded}
|
|
280
|
-
onOpenChange={setExpanded}>
|
|
281
|
-
<Chains
|
|
282
|
-
ref={(ref) => (quoteRef.current = ref)}
|
|
283
|
-
recommended={recommended}
|
|
284
|
-
onClick={setExpanded.bind(null, (prevState) => !prevState)}>
|
|
285
|
-
<div>
|
|
286
|
-
{steps.map((step, index) => {
|
|
287
|
-
const key = `item-${index}`;
|
|
288
|
-
return (
|
|
289
|
-
<React.Fragment key={key}>
|
|
290
|
-
<Tooltip
|
|
291
|
-
container={props.tooltipContainer}
|
|
292
|
-
side="bottom"
|
|
293
|
-
sideOffset={4}
|
|
294
|
-
content={step.from.chain.displayName}>
|
|
295
|
-
<Image src={step.from.chain.image} size={16} />
|
|
296
|
-
</Tooltip>
|
|
297
|
-
{index === numberOfSteps - 1 && (
|
|
298
|
-
<>
|
|
299
|
-
<IconContainer>
|
|
300
|
-
<ChevronRightIcon size={12} color="black" />
|
|
301
|
-
</IconContainer>
|
|
302
|
-
<Tooltip
|
|
303
|
-
container={props.tooltipContainer}
|
|
304
|
-
side="bottom"
|
|
305
|
-
sideOffset={4}
|
|
306
|
-
content={step.to.chain.displayName}>
|
|
307
|
-
<Image src={step.to.chain.image} size={16} />
|
|
308
|
-
</Tooltip>
|
|
309
|
-
</>
|
|
310
|
-
)}
|
|
311
|
-
{index !== numberOfSteps - 1 && (
|
|
312
|
-
<IconContainer>
|
|
313
|
-
<ChevronRightIcon size={12} color="black" />
|
|
314
|
-
</IconContainer>
|
|
315
|
-
)}
|
|
316
|
-
</React.Fragment>
|
|
317
|
-
);
|
|
318
|
-
})}
|
|
319
|
-
</div>
|
|
320
|
-
<IconContainer orientation={expanded ? 'up' : 'down'}>
|
|
321
|
-
<ChevronDownIcon size={12} color="black" />
|
|
322
|
-
</IconContainer>
|
|
323
|
-
</Chains>
|
|
324
|
-
<Content open={expanded}>
|
|
325
|
-
<HorizontalSeparator />
|
|
326
|
-
<div className="steps-details">
|
|
327
|
-
{steps.map((step, index) => {
|
|
328
|
-
const key = `item-${index}`;
|
|
329
|
-
return (
|
|
330
|
-
<StepDetails
|
|
331
|
-
type="quote-details"
|
|
332
|
-
key={key}
|
|
333
|
-
step={step}
|
|
334
|
-
hasSeparator={index !== steps.length - 1}
|
|
335
|
-
state={step.state}
|
|
336
|
-
/>
|
|
337
|
-
);
|
|
338
|
-
})}
|
|
339
|
-
</div>
|
|
340
|
-
</Content>
|
|
341
|
-
</QuoteContainer>
|
|
342
|
-
</SummaryContainer>
|
|
343
|
-
</>
|
|
344
|
-
);
|
|
345
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { QuoteError, QuoteWarning } from '../../types';
|
|
2
|
-
import type { BestRouteResponse } from 'rango-sdk';
|
|
3
|
-
import type { ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
export type QuoteProps = {
|
|
6
|
-
type: 'basic' | 'list-item' | 'swap-preview';
|
|
7
|
-
error: QuoteError | null;
|
|
8
|
-
warning: QuoteWarning | null;
|
|
9
|
-
recommended: boolean;
|
|
10
|
-
tag?: ReactNode;
|
|
11
|
-
quote: BestRouteResponse;
|
|
12
|
-
input: { value: string; usdValue: string };
|
|
13
|
-
output: { value: string; usdValue?: string };
|
|
14
|
-
expanded?: boolean;
|
|
15
|
-
tooltipContainer?: HTMLElement;
|
|
16
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { darkTheme, styled } from '@rango-dev/ui';
|
|
2
|
-
|
|
3
|
-
export const Container = styled('div', {
|
|
4
|
-
$$color: '$colors$neutral100',
|
|
5
|
-
[`.${darkTheme} &`]: {
|
|
6
|
-
$$color: '$colors$neutral300',
|
|
7
|
-
},
|
|
8
|
-
backgroundColor: '$$color',
|
|
9
|
-
borderBottomLeftRadius: '$xm',
|
|
10
|
-
borderBottomRightRadius: '$xm',
|
|
11
|
-
padding: '$15 ',
|
|
12
|
-
'& .cost-and-tag': {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
height: '22px',
|
|
17
|
-
},
|
|
18
|
-
variants: {
|
|
19
|
-
rounded: {
|
|
20
|
-
true: {
|
|
21
|
-
borderRadius: '$xm',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
'& .cost': {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
},
|
|
28
|
-
'& .basic-summary': {
|
|
29
|
-
padding: '$15 $0 14px $0',
|
|
30
|
-
},
|
|
31
|
-
'& .output': {
|
|
32
|
-
padding: '$6 $0 $15 $0',
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
},
|
|
36
|
-
'& .output__token-info': {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
justifyContent: 'start',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
paddingBottom: '$5',
|
|
41
|
-
},
|
|
42
|
-
'& .quote-summary': {
|
|
43
|
-
display: 'flex',
|
|
44
|
-
justifyContent: 'space-between',
|
|
45
|
-
alignItems: 'end',
|
|
46
|
-
},
|
|
47
|
-
'& .quote-summary__separator': {
|
|
48
|
-
height: '$28',
|
|
49
|
-
marginLeft: '13px',
|
|
50
|
-
borderLeft: '1px solid $neutral700',
|
|
51
|
-
},
|
|
52
|
-
'& .token-amount': {
|
|
53
|
-
display: 'flex',
|
|
54
|
-
justifyContent: 'space-between',
|
|
55
|
-
},
|
|
56
|
-
'& .token-amount__label': {
|
|
57
|
-
display: 'flex',
|
|
58
|
-
flexDirection: 'column',
|
|
59
|
-
alignItems: 'start',
|
|
60
|
-
},
|
|
61
|
-
'& .chains': {
|
|
62
|
-
paddingTop: '$2',
|
|
63
|
-
},
|
|
64
|
-
'& .swap-preview': {
|
|
65
|
-
padding: '$15 $0 $15 $0',
|
|
66
|
-
},
|
|
67
|
-
'& .steps': {
|
|
68
|
-
paddingLeft: '$8',
|
|
69
|
-
},
|
|
70
|
-
'& .step__title': {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
},
|
|
74
|
-
'& .step__content': {
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'start',
|
|
77
|
-
},
|
|
78
|
-
'& .step__tokens': {
|
|
79
|
-
paddingTop: '$5',
|
|
80
|
-
paddingBottom: '$10',
|
|
81
|
-
display: 'flex',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
},
|
|
84
|
-
'& .step__token-info': {
|
|
85
|
-
display: 'flex',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
},
|
|
88
|
-
'& .step__icon-container': {
|
|
89
|
-
margin: '$0 $2',
|
|
90
|
-
padding: '$4',
|
|
91
|
-
display: 'flex',
|
|
92
|
-
justifyContent: 'center',
|
|
93
|
-
alignItems: 'center',
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
export const StepSeparator = styled('div', {
|
|
98
|
-
borderLeft: '1px dashed black',
|
|
99
|
-
minHeight: ' 64px',
|
|
100
|
-
margin: '0px 11.5px',
|
|
101
|
-
alignSelf: 'stretch',
|
|
102
|
-
variants: {
|
|
103
|
-
hideSeparator: {
|
|
104
|
-
true: {
|
|
105
|
-
minHeight: 'unset',
|
|
106
|
-
height: '0',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|