@rango-dev/widget-embedded 0.17.1-next.2 → 0.17.1-next.3
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/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.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/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/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/warnings.d.ts +2 -2
- package/dist/constants/warnings.d.ts.map +1 -1
- 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/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/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/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/store/app.d.ts +2 -2
- package/dist/store/{bestRoute.d.ts → quote.d.ts} +25 -20
- package/dist/store/quote.d.ts.map +1 -0
- 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 +1 -1
- package/dist/utils/swap.d.ts +22 -20
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +3 -3
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +23 -26
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -1
- 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} +7 -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/Quote/Quote.styles.ts +212 -0
- package/src/components/Quote/Quote.tsx +347 -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 +13 -16
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/UpdateUrl.tsx +12 -12
- package/src/constants/errors.ts +8 -10
- package/src/constants/messages.ts +1 -1
- package/src/constants/warnings.ts +7 -7
- 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/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/useNavigateBack.ts +3 -3
- package/src/hooks/useSwapInput.ts +57 -23
- package/src/hooks/useSyncStoresWithConfig.ts +2 -2
- package/src/pages/ConfirmSwapPage.tsx +58 -227
- package/src/pages/HistoryPage.tsx +1 -1
- package/src/pages/Home.tsx +52 -241
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +1 -1
- package/src/pages/SelectBlockchainPage.tsx +3 -3
- package/src/pages/SelectSwapItemsPage.tsx +2 -2
- package/src/pages/SettingsPage.tsx +1 -1
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +1 -1
- package/src/store/{bestRoute.ts → quote.ts} +42 -38
- 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/swap.ts +99 -69
- package/src/utils/wallets.ts +2 -2
- 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/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/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/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
|
@@ -18,11 +18,11 @@ import {
|
|
|
18
18
|
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
19
19
|
import { useNavigate } from 'react-router-dom';
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { getQuoteErrorMessage } from '../../constants/errors';
|
|
22
22
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
23
|
-
import {
|
|
24
|
-
import { useBestRouteStore } from '../../store/bestRoute';
|
|
23
|
+
import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
|
|
25
24
|
import { useMetaStore } from '../../store/meta';
|
|
25
|
+
import { useQuoteStore } from '../../store/quote';
|
|
26
26
|
import { useWalletsStore } from '../../store/wallets';
|
|
27
27
|
import { confirmSwapDisabled } from '../../utils/swap';
|
|
28
28
|
|
|
@@ -53,20 +53,20 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
53
53
|
const { open, onClose, onCancel, onCheckBalance, config, loading } = props;
|
|
54
54
|
const { blockchains } = useMetaStore.use.meta();
|
|
55
55
|
const {
|
|
56
|
-
|
|
57
|
-
setSelectedWallets:
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
quote,
|
|
57
|
+
setSelectedWallets: selectQuoteWallets,
|
|
58
|
+
quoteWalletsConfirmed: quoteWalletsConfirmed,
|
|
59
|
+
setQuoteWalletConfirmed: setQuoteWalletConfirmed,
|
|
60
60
|
customDestination,
|
|
61
61
|
setCustomDestination,
|
|
62
|
-
} =
|
|
62
|
+
} = useQuoteStore();
|
|
63
63
|
const { connectedWallets, selectWallets } = useWalletsStore();
|
|
64
64
|
|
|
65
65
|
const [showMoreWalletFor, setShowMoreWalletFor] = useState('');
|
|
66
66
|
const [balanceWarnings, setBalanceWarnings] = useState<string[]>([]);
|
|
67
67
|
const [error, setError] = useState('');
|
|
68
|
-
const [
|
|
69
|
-
ConfirmSwapWarnings['
|
|
68
|
+
const [quoteWarning, setQuoteWarning] = useState<
|
|
69
|
+
ConfirmSwapWarnings['quoteUpdate'] | null
|
|
70
70
|
>(null);
|
|
71
71
|
const [destination, setDestination] = useState(customDestination);
|
|
72
72
|
const [showCustomDestination, setShowCustomDestination] = useState(
|
|
@@ -74,7 +74,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
74
74
|
);
|
|
75
75
|
const customDestinationRef = useRef<HTMLDivElement | null>(null);
|
|
76
76
|
|
|
77
|
-
const requiredWallets = getRequiredWallets(
|
|
77
|
+
const requiredWallets = getRequiredWallets(quote);
|
|
78
78
|
const customDestinationEnabled =
|
|
79
79
|
typeof config?.customDestination === 'undefined'
|
|
80
80
|
? true
|
|
@@ -83,13 +83,10 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
83
83
|
const lastStepToBlockchain = blockchains.find(
|
|
84
84
|
(blockchain) =>
|
|
85
85
|
blockchain.name ===
|
|
86
|
-
|
|
87
|
-
.blockchain
|
|
86
|
+
quote?.result?.swaps[quote?.result?.swaps.length - 1].to.blockchain
|
|
88
87
|
);
|
|
89
88
|
const isWalletRequiredFor = (blockchain: string) =>
|
|
90
|
-
!!
|
|
91
|
-
(swap) => swap.from.blockchain === blockchain
|
|
92
|
-
);
|
|
89
|
+
!!quote?.result?.swaps.find((swap) => swap.from.blockchain === blockchain);
|
|
93
90
|
|
|
94
91
|
const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
|
|
95
92
|
connectedWallets.filter((connectedWallet) => {
|
|
@@ -175,16 +172,16 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
175
172
|
(wallet) => wallet.selected
|
|
176
173
|
);
|
|
177
174
|
selectWallets(lastSelectedWallets);
|
|
178
|
-
|
|
175
|
+
selectQuoteWallets(lastSelectedWallets);
|
|
179
176
|
setCustomDestination(destination);
|
|
180
|
-
|
|
177
|
+
setQuoteWalletConfirmed(true);
|
|
181
178
|
onClose();
|
|
182
179
|
};
|
|
183
180
|
|
|
184
181
|
const onConfirmWallets = async () => {
|
|
185
182
|
setBalanceWarnings([]);
|
|
186
183
|
setError('');
|
|
187
|
-
|
|
184
|
+
setQuoteWarning(null);
|
|
188
185
|
const selectedWallets = connectedWallets.filter((connectedWallet) =>
|
|
189
186
|
selectableWallets.find(
|
|
190
187
|
(selectableWallet) =>
|
|
@@ -201,11 +198,11 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
201
198
|
if (warnings?.balance?.messages) {
|
|
202
199
|
setBalanceWarnings(warnings.balance.messages);
|
|
203
200
|
}
|
|
204
|
-
if (warnings?.
|
|
205
|
-
|
|
201
|
+
if (warnings?.quoteUpdate) {
|
|
202
|
+
setQuoteWarning(warnings.quoteUpdate);
|
|
206
203
|
}
|
|
207
204
|
if (result.error) {
|
|
208
|
-
setError(
|
|
205
|
+
setError(getQuoteErrorMessage(result.error));
|
|
209
206
|
}
|
|
210
207
|
|
|
211
208
|
if (!result.error && (!warnings?.balance?.messages.length || 0 > 0)) {
|
|
@@ -249,7 +246,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
249
246
|
<Modal
|
|
250
247
|
open={open}
|
|
251
248
|
onClose={() => {
|
|
252
|
-
if (!
|
|
249
|
+
if (!quoteWalletsConfirmed) {
|
|
253
250
|
navigate(navigationRoutes.home, { replace: true });
|
|
254
251
|
}
|
|
255
252
|
onClose();
|
|
@@ -265,7 +262,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
265
262
|
loading,
|
|
266
263
|
showCustomDestination,
|
|
267
264
|
destination,
|
|
268
|
-
|
|
265
|
+
quote,
|
|
269
266
|
selectableWallets,
|
|
270
267
|
lastStepToBlockchain
|
|
271
268
|
)}
|
|
@@ -339,12 +336,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
339
336
|
<Divider size={12} />
|
|
340
337
|
</>
|
|
341
338
|
)}
|
|
342
|
-
{
|
|
339
|
+
{quoteWarning && (
|
|
343
340
|
<>
|
|
344
341
|
<Alert
|
|
345
342
|
variant="alarm"
|
|
346
343
|
type="warning"
|
|
347
|
-
title={
|
|
344
|
+
title={getQuoteUpdateWarningMessage(quoteWarning)}
|
|
348
345
|
/>
|
|
349
346
|
<Divider size={12} />
|
|
350
347
|
</>
|
|
@@ -10,11 +10,11 @@ export const Container = styled('div', {
|
|
|
10
10
|
display: 'flex',
|
|
11
11
|
},
|
|
12
12
|
|
|
13
|
-
'.
|
|
13
|
+
'.quote-summary': {
|
|
14
14
|
padding: '$15 $0',
|
|
15
15
|
},
|
|
16
16
|
|
|
17
|
-
'.
|
|
17
|
+
'.quote-summary-item': {
|
|
18
18
|
display: 'flex',
|
|
19
19
|
justifyContent: 'space-between',
|
|
20
20
|
alignItems: 'center',
|
|
@@ -26,7 +26,7 @@ export const Container = styled('div', {
|
|
|
26
26
|
alignItems: 'center',
|
|
27
27
|
},
|
|
28
28
|
|
|
29
|
-
'.
|
|
29
|
+
'.quote-summary-separator': {
|
|
30
30
|
width: '0px',
|
|
31
31
|
height: '$16',
|
|
32
32
|
borderLeft: '1px solid $neutral400',
|
|
@@ -6,8 +6,8 @@ import { Container, StepSeparator } from './LoadingSwapDetails.styles';
|
|
|
6
6
|
import { LoadingSwapDetailStep } from './LoadingSwapDetailStep';
|
|
7
7
|
|
|
8
8
|
export function LoadingSwapDetails() {
|
|
9
|
-
const
|
|
10
|
-
<div className="
|
|
9
|
+
const quoteSummary = (
|
|
10
|
+
<div className="quote-summary-item">
|
|
11
11
|
<div className="token-amount">
|
|
12
12
|
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
13
13
|
<Divider size={8} direction="horizontal" />
|
|
@@ -27,10 +27,10 @@ export function LoadingSwapDetails() {
|
|
|
27
27
|
<Skeleton width={60} height={10} variant="rounded" />
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
<div className="
|
|
31
|
-
{
|
|
32
|
-
<div className="
|
|
33
|
-
{
|
|
30
|
+
<div className="quote-summary">
|
|
31
|
+
{quoteSummary}
|
|
32
|
+
<div className="quote-summary-separator"></div>
|
|
33
|
+
{quoteSummary}
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
36
|
<div className="swaps-steps">
|
|
@@ -1,33 +1,40 @@
|
|
|
1
|
-
import type { Info } from './
|
|
1
|
+
import type { Info } from './NoResult.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
4
|
|
|
5
5
|
import { errorMessages } from '../../constants/errors';
|
|
6
|
+
import {
|
|
7
|
+
type NoResultError,
|
|
8
|
+
QuoteErrorType,
|
|
9
|
+
type QuoteRequestFailed,
|
|
10
|
+
} from '../../types';
|
|
6
11
|
|
|
7
12
|
export function makeInfo(
|
|
8
|
-
|
|
13
|
+
error: NoResultError | QuoteRequestFailed | null,
|
|
9
14
|
disabledLiquiditySources: string[],
|
|
10
|
-
hasError: boolean,
|
|
11
15
|
toggleAllLiquiditySources: (shouldReset: boolean) => void,
|
|
12
|
-
|
|
16
|
+
refetchQuote: () => void
|
|
13
17
|
): Info {
|
|
14
|
-
if (
|
|
18
|
+
if (error?.type === QuoteErrorType.REQUEST_FAILED) {
|
|
15
19
|
return {
|
|
16
20
|
alert: {
|
|
17
21
|
type: 'warning',
|
|
18
22
|
text: errorMessages().genericServerError,
|
|
19
23
|
action: {
|
|
20
|
-
onClick:
|
|
24
|
+
onClick: refetchQuote,
|
|
21
25
|
title: i18n.t('Retry'),
|
|
22
26
|
},
|
|
23
27
|
},
|
|
24
28
|
description: '',
|
|
25
29
|
};
|
|
26
|
-
} else if (
|
|
30
|
+
} else if (
|
|
31
|
+
error?.type === QuoteErrorType.NO_RESULT &&
|
|
32
|
+
error.diagnosisMessage
|
|
33
|
+
) {
|
|
27
34
|
return {
|
|
28
35
|
alert: {
|
|
29
36
|
type: 'error',
|
|
30
|
-
text: diagnosisMessage,
|
|
37
|
+
text: error.diagnosisMessage,
|
|
31
38
|
action: null,
|
|
32
39
|
},
|
|
33
40
|
description: '',
|
|
@@ -47,6 +54,6 @@ export function makeInfo(
|
|
|
47
54
|
}
|
|
48
55
|
return {
|
|
49
56
|
alert: null,
|
|
50
|
-
description: errorMessages().
|
|
57
|
+
description: errorMessages().noResultError.description,
|
|
51
58
|
};
|
|
52
59
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropTypes } from './
|
|
1
|
+
import type { PropTypes } from './NoResult.types';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Alert,
|
|
@@ -11,26 +11,21 @@ import {
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
13
|
import { errorMessages } from '../../constants/errors';
|
|
14
|
-
import { useMetaStore } from '../../store/meta';
|
|
15
14
|
import { useSettingsStore } from '../../store/settings';
|
|
16
15
|
|
|
17
|
-
import { makeInfo } from './
|
|
18
|
-
import { Container, Footer, PrefixIcon } from './
|
|
16
|
+
import { makeInfo } from './NoResult.helpers';
|
|
17
|
+
import { Container, Footer, PrefixIcon } from './NoResult.styles';
|
|
19
18
|
|
|
20
|
-
export function
|
|
21
|
-
const {
|
|
19
|
+
export function NoResult(props: PropTypes) {
|
|
20
|
+
const { fetch, error } = props;
|
|
22
21
|
const disabledLiquiditySources =
|
|
23
22
|
useSettingsStore.use.disabledLiquiditySources();
|
|
24
|
-
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
25
23
|
const toggleAllLiquiditySources =
|
|
26
24
|
useSettingsStore.use.toggleAllLiquiditySources();
|
|
27
25
|
|
|
28
|
-
const hasError = error || loadingMetaStatus === 'failed';
|
|
29
|
-
|
|
30
26
|
const info = makeInfo(
|
|
31
|
-
|
|
27
|
+
error,
|
|
32
28
|
disabledLiquiditySources,
|
|
33
|
-
hasError,
|
|
34
29
|
toggleAllLiquiditySources,
|
|
35
30
|
fetch
|
|
36
31
|
);
|
|
@@ -40,7 +35,7 @@ export function NoRoutes(props: PropTypes) {
|
|
|
40
35
|
<NoRouteIcon size={24} color="gray" />
|
|
41
36
|
<Divider size={4} />
|
|
42
37
|
<Typography variant="title" size="small">
|
|
43
|
-
{errorMessages().
|
|
38
|
+
{errorMessages().noResultError.title}
|
|
44
39
|
</Typography>
|
|
45
40
|
{!!info.description && (
|
|
46
41
|
<Typography
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NoResult } from './NoResult';
|
|
@@ -0,0 +1,212 @@
|
|
|
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
|
+
});
|