@rango-dev/widget-embedded 0.20.1-next.2 → 0.20.1-next.21
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/BlockchainList/BlockchainList.styles.d.ts +169 -1
- package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +4 -0
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +514 -1088
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +12 -0
- package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
- package/dist/components/CustomCollapsible/CustomCollapsible.d.ts +5 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +654 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts +10 -0
- package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts.map +1 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +179 -0
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -2
- package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/HeaderButtons/RefreshButton.d.ts +6 -0
- package/dist/components/HeaderButtons/RefreshButton.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts +2 -3
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.helpers.d.ts +2 -0
- package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
- package/dist/components/Layout/Layout.styles.d.ts +14 -4
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +6 -3
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/Layout/PageContainer.d.ts +166 -0
- package/dist/components/Layout/PageContainer.d.ts.map +1 -0
- package/dist/components/Layout/ScrollableArea.d.ts +164 -0
- package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
- package/dist/components/Layout/index.d.ts +2 -0
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +4 -0
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +56 -0
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.styles.d.ts +12 -0
- package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +16 -0
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +386 -2
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +19 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts +4 -0
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -0
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts +806 -0
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.styles.d.ts +8 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteTrigger .d.ts +4 -0
- package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +16 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +40 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +20 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +16 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +11 -156
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/SettingsContainer/index.d.ts +1 -1
- package/dist/components/SettingsContainer/index.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +20 -0
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +523 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +4 -0
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +20 -0
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +68 -0
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts +16 -0
- package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/quote.d.ts +12 -0
- package/dist/constants/quote.d.ts.map +1 -0
- package/dist/containers/App/App.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts +4 -0
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +10 -314
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +5 -0
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/hooks/useLanguage.d.ts +2 -1
- package/dist/hooks/useLanguage.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LanguagePage.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/ThemePage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +2 -2
- package/dist/store/app.d.ts +2 -2
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts +2 -2
- package/dist/store/slices/settings.d.ts.map +1 -1
- package/dist/types/config.d.ts +16 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +1 -2
- package/dist/types/notification.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +8 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/quote.d.ts +5 -1
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +1 -1
- package/dist/utils/swap.d.ts +5 -1
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/ui.d.ts +2 -0
- package/dist/utils/ui.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
- package/src/components/BlockchainList/BlockchainList.tsx +1 -1
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +27 -96
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +25 -40
- package/src/components/CustomCollapsible/CustomCollapsible.styles.ts +75 -0
- package/src/components/CustomCollapsible/CustomCollapsible.tsx +55 -0
- package/src/components/CustomCollapsible/CustomCollapsible.types.ts +10 -0
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +16 -1
- package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -2
- package/src/components/HeaderButtons/HomeButtons.tsx +19 -33
- package/src/components/HeaderButtons/RefreshButton.tsx +81 -0
- package/src/components/Layout/Layout.helpers.ts +16 -0
- package/src/components/Layout/Layout.styles.ts +17 -31
- package/src/components/Layout/Layout.tsx +23 -21
- package/src/components/Layout/Layout.types.ts +9 -8
- package/src/components/Layout/PageContainer.tsx +24 -0
- package/src/components/Layout/ScrollableArea.tsx +11 -0
- package/src/components/Layout/index.ts +2 -0
- package/src/components/NotificationContent/NotificationContent.tsx +10 -1
- package/src/components/Quote/Quote.styles.ts +44 -5
- package/src/components/Quote/Quote.tsx +10 -77
- package/src/components/Quote/Quote.types.ts +22 -0
- package/src/components/Quote/QuoteCostDetails.styles.ts +50 -0
- package/src/components/Quote/QuoteCostDetails.tsx +218 -0
- package/src/components/Quote/QuoteSummary.tsx +3 -2
- package/src/components/Quote/QuoteTrigger .tsx +215 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
- package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
- package/src/components/SettingsContainer/index.ts +0 -1
- package/src/components/Slippage/Slippage.tsx +5 -5
- package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +12 -13
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +43 -3
- package/src/components/SwapDetails/SwapDetails.styles.ts +18 -6
- package/src/components/SwapDetails/SwapDetails.tsx +13 -5
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +13 -7
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +2 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +18 -7
- package/src/components/TokenList/TokenList.styles.ts +2 -0
- package/src/components/TokenList/TokenList.tsx +1 -1
- package/src/components/WidgetEvents.tsx +2 -14
- package/src/constants/index.ts +1 -0
- package/src/constants/quote.ts +23 -0
- package/src/containers/App/App.styles.ts +2 -0
- package/src/containers/App/App.tsx +1 -4
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
- package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
- package/src/containers/Wallets/Wallets.tsx +11 -2
- package/src/containers/WidgetInfo/WidgetInfo.tsx +8 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +5 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +2 -1
- package/src/hooks/useLanguage.ts +6 -4
- package/src/hooks/useSwapInput.ts +6 -2
- package/src/hooks/useSyncStoresWithConfig.ts +17 -34
- package/src/index.ts +4 -2
- package/src/pages/ConfirmSwapPage.tsx +59 -50
- package/src/pages/HistoryPage.tsx +4 -11
- package/src/pages/Home.tsx +40 -38
- package/src/pages/LanguagePage.tsx +3 -4
- package/src/pages/LiquiditySourcePage.tsx +8 -6
- package/src/pages/SelectBlockchainPage.tsx +41 -41
- package/src/pages/SelectSwapItemsPage.tsx +45 -39
- package/src/pages/SettingsPage.tsx +3 -4
- package/src/pages/ThemePage.tsx +3 -4
- package/src/pages/WalletsPage.tsx +12 -13
- package/src/store/slices/data.ts +5 -7
- package/src/store/slices/settings.ts +3 -3
- package/src/types/config.ts +16 -3
- package/src/types/notification.ts +0 -7
- package/src/utils/configs.ts +41 -0
- package/src/utils/date.ts +5 -4
- package/src/utils/quote.ts +18 -1
- package/src/utils/swap.ts +35 -0
- package/src/utils/ui.ts +20 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
const PageContainer = styled('div', {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
flexDirection: 'column',
|
|
6
|
+
padding: '20px 20px 10px',
|
|
7
|
+
flexGrow: 1,
|
|
8
|
+
|
|
9
|
+
variants: {
|
|
10
|
+
view: {
|
|
11
|
+
true: {
|
|
12
|
+
flexGrow: 1,
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
compact: {
|
|
17
|
+
true: {
|
|
18
|
+
padding: 0,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { PageContainer };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Notification } from '../../types/notification';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
+
import { EventSeverity } from '@rango-dev/queue-manager-rango-preset';
|
|
4
5
|
import {
|
|
5
6
|
ChainToken,
|
|
6
7
|
ChevronRightIcon,
|
|
@@ -74,7 +75,15 @@ export function NotificationContent() {
|
|
|
74
75
|
key={notificationItem.requestId}
|
|
75
76
|
onClick={() => handleOnClick(notificationItem.requestId)}
|
|
76
77
|
title={
|
|
77
|
-
<Typography
|
|
78
|
+
<Typography
|
|
79
|
+
variant="body"
|
|
80
|
+
size="small"
|
|
81
|
+
color={
|
|
82
|
+
notificationItem.event.messageSeverity ===
|
|
83
|
+
EventSeverity.WARNING
|
|
84
|
+
? '$foreground'
|
|
85
|
+
: '$neutral700'
|
|
86
|
+
}>
|
|
78
87
|
{i18n.t(notificationItem.event.message)}
|
|
79
88
|
</Typography>
|
|
80
89
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
2
|
import { css, darkTheme, Image, styled, Typography } from '@rango-dev/ui';
|
|
3
3
|
|
|
4
|
-
import { CollapsibleContent } from '../
|
|
4
|
+
import { CollapsibleContent } from '../CustomCollapsible/CustomCollapsible.styles';
|
|
5
5
|
|
|
6
6
|
export const EXPANDABLE_QUOTE_TRANSITION_DURATION = 300;
|
|
7
7
|
|
|
@@ -114,6 +114,15 @@ export const summaryStyles = css({
|
|
|
114
114
|
cursor: 'default',
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
+
export const rowStyles = css({
|
|
118
|
+
display: 'flex',
|
|
119
|
+
flexDirection: 'row',
|
|
120
|
+
justifyContent: 'center',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
'.blockchainImage': {
|
|
123
|
+
marginLeft: '-$8',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
117
126
|
export const basicInfoStyles = css({
|
|
118
127
|
paddingTop: '$10',
|
|
119
128
|
display: 'flex',
|
|
@@ -127,7 +136,7 @@ export const basicInfoStyles = css({
|
|
|
127
136
|
},
|
|
128
137
|
});
|
|
129
138
|
|
|
130
|
-
export const
|
|
139
|
+
export const Trigger = styled(Collapsible.Trigger, {
|
|
131
140
|
display: 'flex',
|
|
132
141
|
width: '100%',
|
|
133
142
|
justifyContent: 'space-between',
|
|
@@ -171,17 +180,27 @@ export const Chains = styled(Collapsible.Trigger, {
|
|
|
171
180
|
},
|
|
172
181
|
},
|
|
173
182
|
},
|
|
174
|
-
'
|
|
183
|
+
'.blockchains_section': {
|
|
184
|
+
display: 'none',
|
|
185
|
+
},
|
|
186
|
+
'@xs': {
|
|
187
|
+
'.blockchains_section': {
|
|
188
|
+
display: 'block',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
175
191
|
});
|
|
176
192
|
|
|
177
|
-
export const
|
|
193
|
+
export const ImageContainer = styled('div', {
|
|
178
194
|
width: '18px',
|
|
179
195
|
height: '18px',
|
|
180
196
|
borderRadius: '100%',
|
|
181
|
-
border: '1.5px transparent solid',
|
|
182
197
|
display: 'flex',
|
|
183
198
|
justifyContent: 'center',
|
|
184
199
|
alignItems: 'center',
|
|
200
|
+
border: '1.5px transparent solid',
|
|
201
|
+
img: {
|
|
202
|
+
borderRadius: '100%',
|
|
203
|
+
},
|
|
185
204
|
variants: {
|
|
186
205
|
state: {
|
|
187
206
|
error: {
|
|
@@ -252,3 +271,23 @@ export const ContainerInfoOutput = styled('div', {
|
|
|
252
271
|
display: 'flex',
|
|
253
272
|
flexWrap: 'wrap',
|
|
254
273
|
});
|
|
274
|
+
|
|
275
|
+
export const MoreStep = styled('div', {
|
|
276
|
+
width: '18px',
|
|
277
|
+
height: '18px',
|
|
278
|
+
borderRadius: '100%',
|
|
279
|
+
backgroundColor: '$background',
|
|
280
|
+
cursor: 'default',
|
|
281
|
+
display: 'flex',
|
|
282
|
+
justifyContent: 'center',
|
|
283
|
+
alignItems: 'center',
|
|
284
|
+
border: '1.5px transparent solid',
|
|
285
|
+
variants: {
|
|
286
|
+
state: {
|
|
287
|
+
error: {
|
|
288
|
+
borderColor: '$error500',
|
|
289
|
+
},
|
|
290
|
+
warning: { borderColor: '$warning500' },
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
});
|
|
@@ -5,12 +5,8 @@ import type { SwapResult } from 'rango-sdk';
|
|
|
5
5
|
import { i18n } from '@lingui/core';
|
|
6
6
|
import {
|
|
7
7
|
Alert,
|
|
8
|
-
ChevronDownIcon,
|
|
9
|
-
ChevronRightIcon,
|
|
10
8
|
Divider,
|
|
11
|
-
Image,
|
|
12
9
|
InfoIcon,
|
|
13
|
-
QuoteCost,
|
|
14
10
|
StepDetails,
|
|
15
11
|
TokenAmount,
|
|
16
12
|
Tooltip,
|
|
@@ -20,8 +16,6 @@ import BigNumber from 'bignumber.js';
|
|
|
20
16
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
21
17
|
|
|
22
18
|
import {
|
|
23
|
-
GAS_FEE_MAX_DECIMALS,
|
|
24
|
-
GAS_FEE_MIN_DECIMALS,
|
|
25
19
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
26
20
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
27
21
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
@@ -40,32 +34,25 @@ import {
|
|
|
40
34
|
getBlockchainShortNameFor,
|
|
41
35
|
getSwapperDisplayName,
|
|
42
36
|
} from '../../utils/meta';
|
|
43
|
-
import {
|
|
44
|
-
formatTooltipNumbers,
|
|
45
|
-
numberToString,
|
|
46
|
-
secondsToString,
|
|
47
|
-
totalArrivalTime,
|
|
48
|
-
} from '../../utils/numbers';
|
|
37
|
+
import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
|
|
49
38
|
import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
|
|
50
|
-
import { getTotalFeeInUsd } from '../../utils/swap';
|
|
51
39
|
|
|
52
40
|
import {
|
|
53
41
|
BasicInfoOutput,
|
|
54
42
|
basicInfoStyles,
|
|
55
|
-
ChainImageContainer,
|
|
56
|
-
Chains,
|
|
57
43
|
ContainerInfoOutput,
|
|
58
44
|
Content,
|
|
59
45
|
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
60
46
|
FrameIcon,
|
|
61
47
|
HorizontalSeparator,
|
|
62
|
-
IconContainer,
|
|
63
48
|
QuoteContainer,
|
|
64
49
|
stepsDetailsStyles,
|
|
65
50
|
SummaryContainer,
|
|
66
51
|
summaryStyles,
|
|
67
52
|
} from './Quote.styles';
|
|
53
|
+
import { QuoteCostDetails } from './QuoteCostDetails';
|
|
68
54
|
import { QuoteSummary } from './QuoteSummary';
|
|
55
|
+
import { QuoteTrigger } from './QuoteTrigger ';
|
|
69
56
|
|
|
70
57
|
export function Quote(props: QuoteProps) {
|
|
71
58
|
const {
|
|
@@ -77,19 +64,12 @@ export function Quote(props: QuoteProps) {
|
|
|
77
64
|
type,
|
|
78
65
|
recommended = true,
|
|
79
66
|
} = props;
|
|
80
|
-
const tokens = useAppStore().tokens();
|
|
81
67
|
const blockchains = useAppStore().blockchains();
|
|
82
68
|
const swappers = useAppStore().swappers();
|
|
83
69
|
|
|
84
70
|
const [expanded, setExpanded] = useState(props.expanded);
|
|
85
71
|
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
86
72
|
const prevExpanded = useRef(expanded);
|
|
87
|
-
const totalFee = numberToString(
|
|
88
|
-
getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
|
|
89
|
-
GAS_FEE_MIN_DECIMALS,
|
|
90
|
-
GAS_FEE_MAX_DECIMALS
|
|
91
|
-
);
|
|
92
|
-
const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
|
|
93
73
|
const roundedInput = numberToString(
|
|
94
74
|
input.value,
|
|
95
75
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
@@ -283,7 +263,6 @@ export function Quote(props: QuoteProps) {
|
|
|
283
263
|
const steps = getQuoteSteps(quote.result?.swaps ?? []);
|
|
284
264
|
const numberOfSteps = steps.length;
|
|
285
265
|
const tooltipContainer = getContainer();
|
|
286
|
-
|
|
287
266
|
useLayoutEffect(() => {
|
|
288
267
|
if (expanded && !prevExpanded.current && quoteRef.current) {
|
|
289
268
|
setTimeout(() => {
|
|
@@ -300,7 +279,7 @@ export function Quote(props: QuoteProps) {
|
|
|
300
279
|
listItem={type === 'list-item'}
|
|
301
280
|
basic={type === 'basic'}>
|
|
302
281
|
<div className={summaryStyles()}>
|
|
303
|
-
<
|
|
282
|
+
<QuoteCostDetails steps={numberOfSteps} quote={quote} />
|
|
304
283
|
{type === 'basic' && (
|
|
305
284
|
<div className={basicInfoStyles()}>
|
|
306
285
|
<FrameIcon>
|
|
@@ -374,59 +353,13 @@ export function Quote(props: QuoteProps) {
|
|
|
374
353
|
recommended={recommended}
|
|
375
354
|
open={expanded}
|
|
376
355
|
onOpenChange={setExpanded}>
|
|
377
|
-
<
|
|
378
|
-
|
|
356
|
+
<QuoteTrigger
|
|
357
|
+
quoteRef={quoteRef}
|
|
379
358
|
recommended={recommended}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
const arrow = (
|
|
385
|
-
<IconContainer>
|
|
386
|
-
<ChevronRightIcon
|
|
387
|
-
size={12}
|
|
388
|
-
color="black"
|
|
389
|
-
{...(step.state && {
|
|
390
|
-
color: step.state === 'error' ? 'error' : 'warning',
|
|
391
|
-
})}
|
|
392
|
-
/>
|
|
393
|
-
</IconContainer>
|
|
394
|
-
);
|
|
395
|
-
return (
|
|
396
|
-
<React.Fragment key={key}>
|
|
397
|
-
<Tooltip
|
|
398
|
-
container={tooltipContainer}
|
|
399
|
-
side="bottom"
|
|
400
|
-
sideOffset={4}
|
|
401
|
-
content={step.from.chain.displayName}>
|
|
402
|
-
<ChainImageContainer
|
|
403
|
-
state={step.state || steps[index - 1]?.state}>
|
|
404
|
-
<Image src={step.from.chain.image} size={16} />
|
|
405
|
-
</ChainImageContainer>
|
|
406
|
-
</Tooltip>
|
|
407
|
-
{index === numberOfSteps - 1 && (
|
|
408
|
-
<>
|
|
409
|
-
{arrow}
|
|
410
|
-
<Tooltip
|
|
411
|
-
container={tooltipContainer}
|
|
412
|
-
side="bottom"
|
|
413
|
-
sideOffset={4}
|
|
414
|
-
content={step.to.chain.displayName}>
|
|
415
|
-
<ChainImageContainer state={step.state}>
|
|
416
|
-
<Image src={step.to.chain.image} size={16} />
|
|
417
|
-
</ChainImageContainer>
|
|
418
|
-
</Tooltip>
|
|
419
|
-
</>
|
|
420
|
-
)}
|
|
421
|
-
{index !== numberOfSteps - 1 && <>{arrow}</>}
|
|
422
|
-
</React.Fragment>
|
|
423
|
-
);
|
|
424
|
-
})}
|
|
425
|
-
</div>
|
|
426
|
-
<IconContainer orientation={expanded ? 'up' : 'down'}>
|
|
427
|
-
<ChevronDownIcon size={12} color="black" />
|
|
428
|
-
</IconContainer>
|
|
429
|
-
</Chains>
|
|
359
|
+
setExpanded={setExpanded}
|
|
360
|
+
expanded={expanded}
|
|
361
|
+
steps={steps}
|
|
362
|
+
/>
|
|
430
363
|
<Content open={expanded}>
|
|
431
364
|
<HorizontalSeparator />
|
|
432
365
|
<div className={stepsDetailsStyles()}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { QuoteError, QuoteWarning } from '../../types';
|
|
2
|
+
import type { Step } from '@rango-dev/ui';
|
|
2
3
|
import type { BestRouteResponse } from 'rango-sdk';
|
|
3
4
|
import type { ReactNode } from 'react';
|
|
4
5
|
|
|
@@ -13,3 +14,24 @@ export type QuoteProps = {
|
|
|
13
14
|
output: { value: string; usdValue?: string };
|
|
14
15
|
expanded?: boolean;
|
|
15
16
|
};
|
|
17
|
+
|
|
18
|
+
export type QuoteTriggerProps = {
|
|
19
|
+
quoteRef: React.MutableRefObject<HTMLButtonElement | null>;
|
|
20
|
+
recommended: boolean;
|
|
21
|
+
setExpanded: React.Dispatch<React.SetStateAction<boolean | undefined>>;
|
|
22
|
+
steps: Step[];
|
|
23
|
+
expanded?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type QuoteTriggerImagesProps = {
|
|
27
|
+
content: ReactNode;
|
|
28
|
+
state?: 'error' | 'warning' | undefined;
|
|
29
|
+
src: string;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type QuoteCostDetailsProps = {
|
|
35
|
+
quote: BestRouteResponse;
|
|
36
|
+
steps: number;
|
|
37
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { css, styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const FeeSection = styled('div', {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
justifyContent: 'space-between',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
padding: '$5 0',
|
|
8
|
+
'&.total_payable_fee': {
|
|
9
|
+
padding: '$12 0',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const Line = styled('div', {
|
|
14
|
+
width: '100%',
|
|
15
|
+
borderTop: '1px solid $neutral300',
|
|
16
|
+
margin: '$10 0',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const ModalContainer = styled('div', {
|
|
20
|
+
padding: '$20 0',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'column',
|
|
23
|
+
'& .collapsible_trigger': {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const ModalHeader = styled('div', {
|
|
30
|
+
padding: '$20 $20 $10',
|
|
31
|
+
textAlign: 'center',
|
|
32
|
+
position: 'relative',
|
|
33
|
+
'._icon-button': {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
zIndex: 10,
|
|
36
|
+
top: '$16',
|
|
37
|
+
right: '$16',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export const trigger = css({
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
padding: '$5',
|
|
45
|
+
'&:hover': {
|
|
46
|
+
'& ._typography, & svg': {
|
|
47
|
+
color: '$secondary',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { QuoteCostDetailsProps } from './Quote.types';
|
|
2
|
+
import type { NameOfFees } from '../../constants/quote';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import {
|
|
6
|
+
ChevronDownIcon,
|
|
7
|
+
CloseIcon,
|
|
8
|
+
Divider,
|
|
9
|
+
IconButton,
|
|
10
|
+
Modal,
|
|
11
|
+
QuoteCost,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Typography,
|
|
14
|
+
} from '@rango-dev/ui';
|
|
15
|
+
import BigNumber from 'bignumber.js';
|
|
16
|
+
import React, { useState } from 'react';
|
|
17
|
+
|
|
18
|
+
import { NAME_OF_FEES } from '../../constants/quote';
|
|
19
|
+
import {
|
|
20
|
+
GAS_FEE_MAX_DECIMALS,
|
|
21
|
+
GAS_FEE_MIN_DECIMALS,
|
|
22
|
+
USD_VALUE_MAX_DECIMALS,
|
|
23
|
+
USD_VALUE_MIN_DECIMALS,
|
|
24
|
+
} from '../../constants/routing';
|
|
25
|
+
import { useAppStore } from '../../store/AppStore';
|
|
26
|
+
import { getContainer } from '../../utils/common';
|
|
27
|
+
import {
|
|
28
|
+
formatTooltipNumbers,
|
|
29
|
+
numberToString,
|
|
30
|
+
secondsToString,
|
|
31
|
+
totalArrivalTime,
|
|
32
|
+
} from '../../utils/numbers';
|
|
33
|
+
import {
|
|
34
|
+
getFeesGroup,
|
|
35
|
+
getTotalFeeInUsd,
|
|
36
|
+
getTotalFeesInUsd,
|
|
37
|
+
getUsdFee,
|
|
38
|
+
} from '../../utils/swap';
|
|
39
|
+
import { CustomCollapsible } from '../CustomCollapsible/CustomCollapsible';
|
|
40
|
+
import { ExpandedIcon } from '../CustomCollapsible/CustomCollapsible.styles';
|
|
41
|
+
|
|
42
|
+
import {
|
|
43
|
+
FeeSection,
|
|
44
|
+
Line,
|
|
45
|
+
ModalContainer,
|
|
46
|
+
ModalHeader,
|
|
47
|
+
trigger,
|
|
48
|
+
} from './QuoteCostDetails.styles';
|
|
49
|
+
|
|
50
|
+
const GAS_FEE_MAX = 30;
|
|
51
|
+
|
|
52
|
+
const NonPayableFee = (props: { fee: BigNumber; label: string }) => {
|
|
53
|
+
return !props.fee.isZero() ? (
|
|
54
|
+
<FeeSection>
|
|
55
|
+
<Typography variant="label" size="medium" color="neutral600">
|
|
56
|
+
{props.label}
|
|
57
|
+
</Typography>
|
|
58
|
+
<Typography variant="label" size="medium">
|
|
59
|
+
$
|
|
60
|
+
{numberToString(
|
|
61
|
+
props.fee,
|
|
62
|
+
USD_VALUE_MIN_DECIMALS,
|
|
63
|
+
USD_VALUE_MAX_DECIMALS
|
|
64
|
+
)}
|
|
65
|
+
</Typography>
|
|
66
|
+
</FeeSection>
|
|
67
|
+
) : null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
71
|
+
const [open, setOpen] = useState<boolean>(false);
|
|
72
|
+
const [openCollapse, setOpenCollapse] = useState<boolean>(false);
|
|
73
|
+
const { steps, quote } = props;
|
|
74
|
+
const tokens = useAppStore().tokens();
|
|
75
|
+
const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
|
|
76
|
+
const swaps = quote.result?.swaps ?? [];
|
|
77
|
+
const container = getContainer();
|
|
78
|
+
|
|
79
|
+
const totalFee = getTotalFeeInUsd(swaps, tokens);
|
|
80
|
+
|
|
81
|
+
const feesGroup = getFeesGroup(swaps);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<QuoteCost
|
|
86
|
+
onClickFee={() => setOpen(!open)}
|
|
87
|
+
fee={numberToString(
|
|
88
|
+
totalFee,
|
|
89
|
+
GAS_FEE_MIN_DECIMALS,
|
|
90
|
+
GAS_FEE_MAX_DECIMALS
|
|
91
|
+
)}
|
|
92
|
+
feeWarning={totalFee.gte(new BigNumber(GAS_FEE_MAX))}
|
|
93
|
+
time={totalTime}
|
|
94
|
+
steps={steps}
|
|
95
|
+
tooltipGas={i18n.t('View more info')}
|
|
96
|
+
tooltipContainer={container}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
<Modal
|
|
100
|
+
container={container}
|
|
101
|
+
open={open}
|
|
102
|
+
header={
|
|
103
|
+
<ModalHeader>
|
|
104
|
+
<Typography variant="title" size="medium">
|
|
105
|
+
{i18n.t('Gas & Fee Explanation')}
|
|
106
|
+
</Typography>
|
|
107
|
+
|
|
108
|
+
<IconButton onClick={() => setOpen(false)} variant="ghost">
|
|
109
|
+
<CloseIcon color="gray" size={14} />
|
|
110
|
+
</IconButton>
|
|
111
|
+
</ModalHeader>
|
|
112
|
+
}
|
|
113
|
+
onClose={() => setOpen(false)}>
|
|
114
|
+
<ModalContainer>
|
|
115
|
+
<Typography variant="title" size="small">
|
|
116
|
+
{i18n.t('Details')}
|
|
117
|
+
</Typography>
|
|
118
|
+
<Divider size={10} />
|
|
119
|
+
{Object.entries(feesGroup.payable).flatMap(
|
|
120
|
+
([payableFeesKey, feeArray]) =>
|
|
121
|
+
feeArray.map((fee, index) => {
|
|
122
|
+
const key = `payable-fee-${index}`;
|
|
123
|
+
const usdValue = getUsdFee(fee);
|
|
124
|
+
return (
|
|
125
|
+
<FeeSection key={key}>
|
|
126
|
+
<Typography
|
|
127
|
+
variant="label"
|
|
128
|
+
size="medium"
|
|
129
|
+
color="neutral600">
|
|
130
|
+
{NAME_OF_FEES[payableFeesKey as NameOfFees]}
|
|
131
|
+
</Typography>
|
|
132
|
+
<Tooltip
|
|
133
|
+
content={formatTooltipNumbers(fee.amount)}
|
|
134
|
+
container={container}>
|
|
135
|
+
<Typography variant="label" size="medium">
|
|
136
|
+
{numberToString(
|
|
137
|
+
fee.amount,
|
|
138
|
+
GAS_FEE_MIN_DECIMALS,
|
|
139
|
+
GAS_FEE_MAX_DECIMALS
|
|
140
|
+
)}{' '}
|
|
141
|
+
{fee.asset.symbol} ($
|
|
142
|
+
{numberToString(
|
|
143
|
+
usdValue,
|
|
144
|
+
USD_VALUE_MIN_DECIMALS,
|
|
145
|
+
USD_VALUE_MAX_DECIMALS
|
|
146
|
+
)}
|
|
147
|
+
)
|
|
148
|
+
</Typography>
|
|
149
|
+
</Tooltip>
|
|
150
|
+
</FeeSection>
|
|
151
|
+
);
|
|
152
|
+
})
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
<FeeSection className="total_payable_fee">
|
|
156
|
+
<Typography variant="label" size="medium">
|
|
157
|
+
{i18n.t('Total Payable Fee')}
|
|
158
|
+
</Typography>
|
|
159
|
+
<Typography variant="label" size="medium">
|
|
160
|
+
$
|
|
161
|
+
{numberToString(
|
|
162
|
+
totalFee,
|
|
163
|
+
USD_VALUE_MIN_DECIMALS,
|
|
164
|
+
USD_VALUE_MAX_DECIMALS
|
|
165
|
+
)}
|
|
166
|
+
</Typography>
|
|
167
|
+
</FeeSection>
|
|
168
|
+
<Line />
|
|
169
|
+
{Object.keys(feesGroup.nonePayable).length && (
|
|
170
|
+
<CustomCollapsible
|
|
171
|
+
triggerAnchor="bottom"
|
|
172
|
+
onClickTrigger={() => setOpenCollapse((prev) => !prev)}
|
|
173
|
+
trigger={
|
|
174
|
+
<div className={trigger()}>
|
|
175
|
+
<Typography size="small" variant="body" color="neutral700">
|
|
176
|
+
{openCollapse
|
|
177
|
+
? i18n.t('Hide non-payable fees')
|
|
178
|
+
: i18n.t('Show non-payable fees')}
|
|
179
|
+
</Typography>
|
|
180
|
+
<Divider size={4} direction="horizontal" />
|
|
181
|
+
<ExpandedIcon orientation={openCollapse ? 'up' : 'down'}>
|
|
182
|
+
<ChevronDownIcon size={12} color="gray" />
|
|
183
|
+
</ExpandedIcon>
|
|
184
|
+
</div>
|
|
185
|
+
}
|
|
186
|
+
open={openCollapse}>
|
|
187
|
+
<Typography size="small" variant="title">
|
|
188
|
+
{i18n.t('Description')}
|
|
189
|
+
</Typography>
|
|
190
|
+
<Divider size={4} />
|
|
191
|
+
<Typography size="small" variant="body" color="neutral700">
|
|
192
|
+
{i18n.t(`The following fees are considered in the transaction output and
|
|
193
|
+
you won’t need to pay extra gas for them.`)}
|
|
194
|
+
</Typography>
|
|
195
|
+
<Divider size={10} />
|
|
196
|
+
{Object.entries(feesGroup.nonePayable).map(
|
|
197
|
+
([nonPayableFeesKey, fees], index) => {
|
|
198
|
+
const totalFeeInUsd = getTotalFeesInUsd(fees);
|
|
199
|
+
const label = NAME_OF_FEES[nonPayableFeesKey as NameOfFees];
|
|
200
|
+
const key = `non-payable-fee-${index}`;
|
|
201
|
+
return (
|
|
202
|
+
<NonPayableFee
|
|
203
|
+
key={key}
|
|
204
|
+
fee={totalFeeInUsd}
|
|
205
|
+
label={label}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
)}
|
|
210
|
+
|
|
211
|
+
<Line />
|
|
212
|
+
</CustomCollapsible>
|
|
213
|
+
)}
|
|
214
|
+
</ModalContainer>
|
|
215
|
+
</Modal>
|
|
216
|
+
</>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PriceImpactWarningLevel, Step } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
3
4
|
import { TokenAmount } from '@rango-dev/ui';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
|
|
@@ -21,7 +22,7 @@ export function QuoteSummary(props: PropTypes) {
|
|
|
21
22
|
<Container>
|
|
22
23
|
<TokenAmount
|
|
23
24
|
direction="horizontal"
|
|
24
|
-
label=
|
|
25
|
+
label={i18n.t('Swap input')}
|
|
25
26
|
type="input"
|
|
26
27
|
tooltipContainer={getContainer()}
|
|
27
28
|
price={{
|
|
@@ -39,8 +40,8 @@ export function QuoteSummary(props: PropTypes) {
|
|
|
39
40
|
<div className={separatorStyles()} />
|
|
40
41
|
<TokenAmount
|
|
41
42
|
direction="horizontal"
|
|
42
|
-
label="Estimated output"
|
|
43
43
|
tooltipContainer={getContainer()}
|
|
44
|
+
label={i18n.t('Estimated output')}
|
|
44
45
|
type="output"
|
|
45
46
|
price={{
|
|
46
47
|
value: to.price.value,
|