@rango-dev/widget-embedded 0.1.10-next.98 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts.map +1 -1
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/AppRouter.d.ts +6 -1
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ChangeSlippageButton.d.ts.map +1 -1
- package/dist/components/HeaderButtons.d.ts +4 -1
- package/dist/components/HeaderButtons.d.ts.map +1 -1
- package/dist/components/Layout.d.ts.map +1 -1
- package/dist/components/RoutesOverview.d.ts +10 -0
- package/dist/components/RoutesOverview.d.ts.map +1 -0
- package/dist/components/SwapDetailsPlaceholder.d.ts +9 -0
- package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -0
- package/dist/components/TokenInfo.d.ts.map +1 -1
- package/dist/components/TokenPreview.d.ts +20 -0
- package/dist/components/TokenPreview.d.ts.map +1 -0
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/warnings/BalanceWarnings.d.ts.map +1 -1
- package/dist/components/warnings/HighSlippageWarning.d.ts.map +1 -1
- package/dist/components/warnings/MinRequiredSlippage.d.ts +1 -1
- package/dist/components/warnings/MinRequiredSlippage.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +0 -1
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/lib.d.ts.map +1 -1
- 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/LiquiditySourcesPage.d.ts.map +1 -1
- package/dist/pages/SelectTokenPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +1 -0
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +2 -0
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +14 -0
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/routing.d.ts +1 -1
- package/dist/types/swap.d.ts +6 -0
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts +3 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/routing.d.ts +1 -0
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +18 -6
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +4 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/wallets.d.ts +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +1004 -418
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +1004 -418
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +1008 -423
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +12 -11
- package/readme.md +1 -2
- package/src/App.tsx +30 -5
- package/src/QueueManager.tsx +5 -2
- package/src/components/AppRouter.tsx +24 -13
- package/src/components/AppRoutes.tsx +15 -12
- package/src/components/ChangeSlippageButton.tsx +4 -8
- package/src/components/HeaderButtons.tsx +11 -4
- package/src/components/Layout.tsx +37 -5
- package/src/components/RoutesOverview.tsx +60 -0
- package/src/components/SwapDetailsPlaceholder.tsx +32 -0
- package/src/components/TokenInfo.tsx +125 -77
- package/src/components/TokenPreview.tsx +178 -0
- package/src/components/UpdateUrl.tsx +1 -3
- package/src/components/warnings/BalanceWarnings.tsx +1 -0
- package/src/components/warnings/HighSlippageWarning.tsx +4 -7
- package/src/components/warnings/MinRequiredSlippage.tsx +9 -4
- package/src/constants/navigationRoutes.ts +0 -1
- package/src/globalStyles.ts +3 -2
- package/src/hooks/useConfirmSwap.ts +2 -1
- package/src/hooks/useNavigateBack.ts +3 -3
- package/src/hooks/useTheme.ts +9 -9
- package/src/languages/en.json +9 -8
- package/src/lib.tsx +25 -3
- package/src/pages/ConfirmSwapPage.tsx +128 -20
- package/src/pages/HistoryPage.tsx +4 -4
- package/src/pages/Home.tsx +51 -42
- package/src/pages/LiquiditySourcesPage.tsx +2 -0
- package/src/pages/SelectTokenPage.tsx +3 -1
- package/src/pages/SettingsPage.tsx +3 -0
- package/src/pages/SwapDetailsPage.tsx +142 -6
- package/src/pages/WalletsPage.tsx +49 -16
- package/src/store/bestRoute.ts +114 -17
- package/src/store/ui.ts +4 -0
- package/src/store/wallets.ts +4 -1
- package/src/types/routing.ts +1 -1
- package/src/types/swap.ts +7 -0
- package/src/utils/common.ts +14 -0
- package/src/utils/date.ts +62 -0
- package/src/utils/routing.ts +23 -13
- package/src/utils/swap.ts +113 -11
- package/src/utils/time.ts +52 -0
- package/src/utils/wallets.ts +13 -4
- package/dist/components/Header.d.ts +0 -10
- package/dist/components/Header.d.ts.map +0 -1
- package/dist/pages/ConfirmWalletsPage.d.ts +0 -3
- package/dist/pages/ConfirmWalletsPage.d.ts.map +0 -1
- package/src/components/Header.tsx +0 -37
- package/src/pages/ConfirmWalletsPage.tsx +0 -80
|
@@ -16,6 +16,7 @@ import BigNumber from 'bignumber.js';
|
|
|
16
16
|
import { getBalanceFromWallet } from '../utils/wallets';
|
|
17
17
|
import { useWalletsStore } from '../store/wallets';
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { Spacer } from '@rango-dev/ui';
|
|
19
20
|
|
|
20
21
|
type PropTypes = (
|
|
21
22
|
| {
|
|
@@ -38,14 +39,46 @@ const Box = styled('div', {
|
|
|
38
39
|
|
|
39
40
|
const Container = styled('div', {
|
|
40
41
|
boxSizing: 'border-box',
|
|
41
|
-
backgroundColor: '$neutrals300',
|
|
42
42
|
borderRadius: '$5',
|
|
43
|
-
padding: '$8
|
|
43
|
+
padding: '$8 $16 $16 $16',
|
|
44
|
+
|
|
45
|
+
variants: {
|
|
46
|
+
type: {
|
|
47
|
+
filled: {
|
|
48
|
+
backgroundColor: '$neutrals300',
|
|
49
|
+
},
|
|
50
|
+
outlined: {
|
|
51
|
+
border: '1px solid $neutrals300',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
type: 'filled',
|
|
58
|
+
},
|
|
44
59
|
|
|
60
|
+
'.head': {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
justifyContent: 'space-between',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
minHeight: '32px',
|
|
65
|
+
},
|
|
45
66
|
'.form': {
|
|
46
67
|
display: 'flex',
|
|
47
68
|
width: '100%',
|
|
48
|
-
padding: '$
|
|
69
|
+
padding: '$2 0',
|
|
70
|
+
'.selectors': {
|
|
71
|
+
width: '35%',
|
|
72
|
+
|
|
73
|
+
'._text': {
|
|
74
|
+
whiteSpace: 'nowrap',
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
textOverflow: 'ellipsis',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
'.amount': {
|
|
80
|
+
width: '30%',
|
|
81
|
+
},
|
|
49
82
|
},
|
|
50
83
|
});
|
|
51
84
|
|
|
@@ -57,7 +90,11 @@ const StyledImage = styled('img', {
|
|
|
57
90
|
const Options = styled('div', {
|
|
58
91
|
display: 'flex',
|
|
59
92
|
justifyContent: 'flex-end',
|
|
60
|
-
|
|
93
|
+
|
|
94
|
+
'.balance': {
|
|
95
|
+
display: 'flex',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
},
|
|
61
98
|
});
|
|
62
99
|
|
|
63
100
|
const ImagePlaceholder = styled('span', {
|
|
@@ -68,10 +105,9 @@ const ImagePlaceholder = styled('span', {
|
|
|
68
105
|
});
|
|
69
106
|
|
|
70
107
|
const OutputContainer = styled('div', {
|
|
108
|
+
windth: '100%',
|
|
71
109
|
height: '$48',
|
|
72
110
|
borderRadius: '$5',
|
|
73
|
-
flexGrow: 1,
|
|
74
|
-
width: '70%',
|
|
75
111
|
backgroundColor: '$background',
|
|
76
112
|
border: '1px solid transparent',
|
|
77
113
|
position: 'relative',
|
|
@@ -141,29 +177,39 @@ export function TokenInfo(props: PropTypes) {
|
|
|
141
177
|
|
|
142
178
|
return (
|
|
143
179
|
<Box>
|
|
144
|
-
<
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<Typography variant="
|
|
159
|
-
|
|
160
|
-
}`}</Typography>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
180
|
+
<Container type={props.type === 'From' ? 'filled' : 'outlined'}>
|
|
181
|
+
<div className="head">
|
|
182
|
+
<Typography variant="body2" color="neutrals800">
|
|
183
|
+
{t(type)}
|
|
184
|
+
</Typography>
|
|
185
|
+
{props.type === 'From' ? (
|
|
186
|
+
<Options>
|
|
187
|
+
<div
|
|
188
|
+
className="balance"
|
|
189
|
+
onClick={() => {
|
|
190
|
+
if (tokenBalance !== '0')
|
|
191
|
+
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
<Typography variant="body3" color="neutrals600">{`${t(
|
|
195
|
+
'Balance'
|
|
196
|
+
)}: ${tokenBalance} ${fromToken?.symbol || ''}`}</Typography>
|
|
197
|
+
<Spacer size={4} />
|
|
198
|
+
<Button type="primary" variant="ghost" size="compact">
|
|
199
|
+
{t('Max')}
|
|
200
|
+
</Button>
|
|
201
|
+
</div>
|
|
202
|
+
</Options>
|
|
203
|
+
) : (
|
|
204
|
+
<Typography
|
|
205
|
+
variant="caption"
|
|
206
|
+
color="neutrals600"
|
|
207
|
+
>{`$${numberToString(props.outputUsdValue)}`}</Typography>
|
|
208
|
+
)}
|
|
209
|
+
</div>
|
|
165
210
|
<div className="form">
|
|
166
211
|
<Button
|
|
212
|
+
className="selectors"
|
|
167
213
|
onClick={() => {
|
|
168
214
|
navigate(`/${props.type.toLowerCase()}-chain`);
|
|
169
215
|
}}
|
|
@@ -180,11 +226,14 @@ export function TokenInfo(props: PropTypes) {
|
|
|
180
226
|
suffix={ItemSuffix}
|
|
181
227
|
align="start"
|
|
182
228
|
size="large"
|
|
183
|
-
style={{ marginRight: '.5rem' }}
|
|
184
229
|
>
|
|
185
|
-
{loadingStatus === 'success' && chain
|
|
230
|
+
{loadingStatus === 'success' && chain
|
|
231
|
+
? chain.displayName
|
|
232
|
+
: t('Chain')}
|
|
186
233
|
</Button>
|
|
234
|
+
<Spacer size={12} />
|
|
187
235
|
<Button
|
|
236
|
+
className="selectors"
|
|
188
237
|
onClick={() => {
|
|
189
238
|
navigate(`/${props.type.toLowerCase()}-token`);
|
|
190
239
|
}}
|
|
@@ -205,57 +254,56 @@ export function TokenInfo(props: PropTypes) {
|
|
|
205
254
|
suffix={ItemSuffix}
|
|
206
255
|
size="large"
|
|
207
256
|
align="start"
|
|
208
|
-
style={{ marginRight: '.5rem' }}
|
|
209
257
|
>
|
|
210
258
|
{loadingStatus === 'success' && token ? token.symbol : t('Token')}
|
|
211
259
|
</Button>
|
|
212
|
-
{
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
</
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
<Spacer size={12} />
|
|
261
|
+
<div className="amount">
|
|
262
|
+
{props.type === 'From' ? (
|
|
263
|
+
<TextField
|
|
264
|
+
type="number"
|
|
265
|
+
size="large"
|
|
266
|
+
autoFocus
|
|
267
|
+
placeholder="0"
|
|
268
|
+
style={{
|
|
269
|
+
position: 'relative',
|
|
270
|
+
backgroundColor: '$background !important',
|
|
271
|
+
}}
|
|
272
|
+
suffix={
|
|
273
|
+
<span
|
|
274
|
+
style={{
|
|
275
|
+
position: 'absolute',
|
|
276
|
+
right: '4px',
|
|
277
|
+
bottom: '2px',
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
<Typography
|
|
281
|
+
variant="caption"
|
|
282
|
+
color="neutrals800"
|
|
283
|
+
>{`$${numberToString(inputUsdValue)}`}</Typography>
|
|
284
|
+
</span>
|
|
285
|
+
}
|
|
286
|
+
value={props.inputAmount || ''}
|
|
287
|
+
onChange={
|
|
288
|
+
props.type === 'From'
|
|
289
|
+
? (event) => {
|
|
290
|
+
props.onAmountChange(event.target.value);
|
|
291
|
+
}
|
|
292
|
+
: undefined
|
|
293
|
+
}
|
|
294
|
+
/>
|
|
295
|
+
) : (
|
|
296
|
+
<OutputContainer>
|
|
297
|
+
<Typography variant="h4">
|
|
298
|
+
{bestRoute
|
|
299
|
+
? `≈ ${numberToString(props.outputAmount)}`
|
|
300
|
+
: inputAmount
|
|
301
|
+
? '?'
|
|
302
|
+
: '0'}
|
|
303
|
+
</Typography>
|
|
304
|
+
</OutputContainer>
|
|
305
|
+
)}
|
|
306
|
+
</div>
|
|
259
307
|
</div>
|
|
260
308
|
</Container>
|
|
261
309
|
</Box>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, InfoCircleIcon, styled, Typography } from '@rango-dev/ui';
|
|
3
|
+
import { LoadingStatus } from '../store/meta';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Spacer } from '@rango-dev/ui';
|
|
6
|
+
import BigNumber from 'bignumber.js';
|
|
7
|
+
import { numberToString } from '../utils/numbers';
|
|
8
|
+
|
|
9
|
+
const Box = styled('div', {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
width: '100%',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const Container = styled('div', {
|
|
16
|
+
boxSizing: 'border-box',
|
|
17
|
+
borderRadius: '$5',
|
|
18
|
+
padding: '$8 $16 $16 $16',
|
|
19
|
+
|
|
20
|
+
variants: {
|
|
21
|
+
type: {
|
|
22
|
+
filled: {
|
|
23
|
+
backgroundColor: '$neutrals300',
|
|
24
|
+
},
|
|
25
|
+
outlined: {
|
|
26
|
+
border: '1px solid $neutrals300',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
type: 'filled',
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
'.head': {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
minHeight: '32px',
|
|
40
|
+
},
|
|
41
|
+
'.form': {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
width: '100%',
|
|
44
|
+
padding: '$2 0',
|
|
45
|
+
'.selectors': {
|
|
46
|
+
width: '35%',
|
|
47
|
+
|
|
48
|
+
'._text': {
|
|
49
|
+
whiteSpace: 'nowrap',
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
textOverflow: 'ellipsis',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
'.amount': {
|
|
55
|
+
width: '30%',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const StyledImage = styled('img', {
|
|
61
|
+
width: '$24',
|
|
62
|
+
maxHeight: '$24',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const ImagePlaceholder = styled('span', {
|
|
66
|
+
width: '24px',
|
|
67
|
+
height: '24px',
|
|
68
|
+
backgroundColor: '$neutrals300',
|
|
69
|
+
borderRadius: '99999px',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const OutputContainer = styled('div', {
|
|
73
|
+
windth: '100%',
|
|
74
|
+
height: '$48',
|
|
75
|
+
borderRadius: '$5',
|
|
76
|
+
backgroundColor: '$background',
|
|
77
|
+
border: '1px solid transparent',
|
|
78
|
+
position: 'relative',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
paddingLeft: '$8',
|
|
82
|
+
paddingRight: '$8',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
interface PropTypes {
|
|
86
|
+
label: string;
|
|
87
|
+
amount: string;
|
|
88
|
+
usdValue?: BigNumber;
|
|
89
|
+
loadingStatus: LoadingStatus;
|
|
90
|
+
chain: {
|
|
91
|
+
displayName: string;
|
|
92
|
+
logo: string;
|
|
93
|
+
};
|
|
94
|
+
token: {
|
|
95
|
+
symbol: string;
|
|
96
|
+
image: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function TokenPreview(props: PropTypes) {
|
|
101
|
+
const { chain, token, loadingStatus } = props;
|
|
102
|
+
const { t } = useTranslation();
|
|
103
|
+
|
|
104
|
+
const ItemSuffix = (
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
display: 'flex',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
{loadingStatus === 'failed' && <InfoCircleIcon color="error" size={24} />}
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Box>
|
|
118
|
+
<Container type={'outlined'}>
|
|
119
|
+
<div className="head">
|
|
120
|
+
<Typography variant="body2" color="neutrals800">
|
|
121
|
+
{props.label}
|
|
122
|
+
</Typography>
|
|
123
|
+
{props.usdValue && (
|
|
124
|
+
<Typography
|
|
125
|
+
variant="caption"
|
|
126
|
+
color="neutrals600"
|
|
127
|
+
>{`$${numberToString(props.usdValue)}`}</Typography>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
<div className="form">
|
|
131
|
+
<Button
|
|
132
|
+
className="selectors"
|
|
133
|
+
variant="outlined"
|
|
134
|
+
loading={loadingStatus === 'loading'}
|
|
135
|
+
prefix={
|
|
136
|
+
loadingStatus === 'success' && chain ? (
|
|
137
|
+
<StyledImage src={chain.logo} />
|
|
138
|
+
) : (
|
|
139
|
+
<ImagePlaceholder />
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
suffix={ItemSuffix}
|
|
143
|
+
align="start"
|
|
144
|
+
size="large"
|
|
145
|
+
>
|
|
146
|
+
{loadingStatus === 'success' && chain
|
|
147
|
+
? chain.displayName
|
|
148
|
+
: t('Chain')}
|
|
149
|
+
</Button>
|
|
150
|
+
<Spacer size={12} />
|
|
151
|
+
<Button
|
|
152
|
+
className="selectors"
|
|
153
|
+
variant="outlined"
|
|
154
|
+
loading={loadingStatus === 'loading'}
|
|
155
|
+
prefix={
|
|
156
|
+
loadingStatus === 'success' && token ? (
|
|
157
|
+
<StyledImage src={token.image} />
|
|
158
|
+
) : (
|
|
159
|
+
<ImagePlaceholder />
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
suffix={ItemSuffix}
|
|
163
|
+
size="large"
|
|
164
|
+
align="start"
|
|
165
|
+
>
|
|
166
|
+
{loadingStatus === 'success' && token ? token.symbol : t('Token')}
|
|
167
|
+
</Button>
|
|
168
|
+
<Spacer size={12} />
|
|
169
|
+
<div className="amount">
|
|
170
|
+
<OutputContainer>
|
|
171
|
+
<Typography variant="h4">{props.amount}</Typography>
|
|
172
|
+
</OutputContainer>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</Container>
|
|
176
|
+
</Box>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
@@ -52,9 +52,7 @@ export function UpdateUrl() {
|
|
|
52
52
|
fromAmount = '';
|
|
53
53
|
if (
|
|
54
54
|
loadingStatus !== 'success' &&
|
|
55
|
-
|
|
56
|
-
location.pathname
|
|
57
|
-
)
|
|
55
|
+
location.pathname != navigationRoutes.confirmSwap
|
|
58
56
|
) {
|
|
59
57
|
fromChainString = searchParamsRef.current[SearchParams.FROM_CHAIN];
|
|
60
58
|
fromTokenString = searchParamsRef.current[SearchParams.FROM_TOKEN];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alert
|
|
1
|
+
import { Alert } from '@rango-dev/ui';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeSlippageButton } from '../ChangeSlippageButton';
|
|
4
4
|
|
|
@@ -10,12 +10,9 @@ export function HighSlippageWarning(props: PropTypes) {
|
|
|
10
10
|
const { selectedSlippage } = props;
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
|
-
<Alert type="warning">
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{selectedSlippage}). Your trade may be front run.
|
|
17
|
-
<ChangeSlippageButton />
|
|
18
|
-
</Typography>
|
|
13
|
+
<Alert type="warning" footer={<ChangeSlippageButton />}>
|
|
14
|
+
Caution, your slippage is high (=
|
|
15
|
+
{selectedSlippage}). Your trade may be front run.
|
|
19
16
|
</Alert>
|
|
20
17
|
);
|
|
21
18
|
}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { Typography } from '@rango-dev/ui';
|
|
1
|
+
import { Spacer, Typography, styled } from '@rango-dev/ui';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeSlippageButton } from '../ChangeSlippageButton';
|
|
4
4
|
|
|
5
5
|
interface PropTypes {
|
|
6
|
-
minRequiredSlippage:
|
|
6
|
+
minRequiredSlippage: string | null;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
const StyledMessage = styled(Typography, {
|
|
10
|
+
color: '$error500 !important',
|
|
11
|
+
});
|
|
12
|
+
|
|
9
13
|
export function MinRequiredSlippage({ minRequiredSlippage }: PropTypes) {
|
|
10
14
|
return (
|
|
11
|
-
<
|
|
15
|
+
<StyledMessage variant="body2">
|
|
12
16
|
We recommend you to increase slippage to at least
|
|
13
17
|
{minRequiredSlippage}
|
|
14
18
|
for this route.
|
|
19
|
+
<Spacer size={8} direction="vertical" />
|
|
15
20
|
<ChangeSlippageButton />
|
|
16
|
-
</
|
|
21
|
+
</StyledMessage>
|
|
17
22
|
);
|
|
18
23
|
}
|
package/src/globalStyles.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { globalCss } from '@rango-dev/ui';
|
|
|
2
2
|
|
|
3
3
|
export const globalStyles = globalCss({
|
|
4
4
|
'*': {
|
|
5
|
-
'&::-webkit-scrollbar': { width: '$8' },
|
|
5
|
+
'&::-webkit-scrollbar': { width: '$8', height: '$8' },
|
|
6
6
|
'&::-webkit-scrollbar-thumb': {
|
|
7
7
|
backgroundColor: '$neutrals400',
|
|
8
|
+
borderRadius: '$10',
|
|
8
9
|
},
|
|
9
10
|
'&::-webkit-scrollbar-thumb:hover': {
|
|
10
11
|
backgroundColor: '$neutrals500',
|
|
@@ -20,7 +21,7 @@ export const globalFont = (fontFamily: string) =>
|
|
|
20
21
|
"url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap')",
|
|
21
22
|
"url('https://fonts.cdnfonts.com/css/times-new-roman')",
|
|
22
23
|
],
|
|
23
|
-
|
|
24
|
+
body: {
|
|
24
25
|
fontFamily,
|
|
25
26
|
},
|
|
26
27
|
})();
|
|
@@ -93,6 +93,7 @@ export function useConfirmSwap(): ConfirmSwap {
|
|
|
93
93
|
meta
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
+
//@ts-ignore
|
|
96
97
|
return newSwap;
|
|
97
98
|
}
|
|
98
99
|
return;
|
|
@@ -228,7 +229,7 @@ export function useConfirmSwap(): ConfirmSwap {
|
|
|
228
229
|
false,
|
|
229
230
|
meta
|
|
230
231
|
);
|
|
231
|
-
|
|
232
|
+
//@ts-ignore
|
|
232
233
|
return newSwap;
|
|
233
234
|
} else if (!proceedAnywayRef.current) {
|
|
234
235
|
proceedAnywayRef.current = true;
|
|
@@ -8,6 +8,8 @@ export function useNavigateBack() {
|
|
|
8
8
|
navigationRoutes;
|
|
9
9
|
|
|
10
10
|
const navigateBackFrom = (currentRoute: string) => {
|
|
11
|
+
if (currentRoute === navigationRoutes.swapDetails)
|
|
12
|
+
return navigate(navigationRoutes.swaps, { replace: true });
|
|
11
13
|
if (
|
|
12
14
|
!isRouterInContext ||
|
|
13
15
|
(window.history.state && window.history.state.idx > 0)
|
|
@@ -23,7 +25,7 @@ export function useNavigateBack() {
|
|
|
23
25
|
navigationRoutes.settings,
|
|
24
26
|
navigationRoutes.wallets,
|
|
25
27
|
navigationRoutes.swaps,
|
|
26
|
-
navigationRoutes.
|
|
28
|
+
navigationRoutes.confirmSwap,
|
|
27
29
|
].includes(currentRoute)
|
|
28
30
|
)
|
|
29
31
|
navigate(navigationRoutes.home, { replace: true });
|
|
@@ -31,8 +33,6 @@ export function useNavigateBack() {
|
|
|
31
33
|
navigate(navigationRoutes.settings, { replace: true });
|
|
32
34
|
else if (currentRoute === navigationRoutes.swapDetails)
|
|
33
35
|
navigate(navigationRoutes.swaps, { replace: true });
|
|
34
|
-
else if (currentRoute === navigationRoutes.confirmSwap)
|
|
35
|
-
navigate(navigationRoutes.confirmWallets, { replace: true });
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -14,16 +14,16 @@ export function useTheme({
|
|
|
14
14
|
warning = '#F5A623',
|
|
15
15
|
success = '#0070F3',
|
|
16
16
|
fontFamily = 'Robot',
|
|
17
|
-
borderRadius =
|
|
17
|
+
borderRadius = 8,
|
|
18
18
|
}: Colors & { borderRadius?: number; fontFamily?: string }) {
|
|
19
19
|
const theme = useSettingsStore.use.theme();
|
|
20
20
|
const fetchMeta = useMetaStore.use.fetchMeta();
|
|
21
21
|
const colors = {
|
|
22
22
|
neutrals200: '#FAFAFA',
|
|
23
|
-
neutrals300: '#
|
|
24
|
-
neutrals400: '#
|
|
25
|
-
neutrals500: '#
|
|
26
|
-
neutrals600: '#
|
|
23
|
+
neutrals300: '#f2f2f2',
|
|
24
|
+
neutrals400: '#dedede',
|
|
25
|
+
neutrals500: '#cccccc',
|
|
26
|
+
neutrals600: '#acacac',
|
|
27
27
|
neutrals700: '#444444',
|
|
28
28
|
neutrals800: '#333333',
|
|
29
29
|
neutrals900: '#111111',
|
|
@@ -69,10 +69,10 @@ export function useTheme({
|
|
|
69
69
|
neutrals200: '#111111',
|
|
70
70
|
neutrals300: '#333333',
|
|
71
71
|
neutrals400: '#444444',
|
|
72
|
-
neutrals500: '#
|
|
73
|
-
neutrals600: '#
|
|
74
|
-
neutrals700: '#
|
|
75
|
-
neutrals800: '#
|
|
72
|
+
neutrals500: '#acacac',
|
|
73
|
+
neutrals600: '#cccccc',
|
|
74
|
+
neutrals700: '#dedede',
|
|
75
|
+
neutrals800: '#f2f2f2',
|
|
76
76
|
neutrals900: '#FAFAFA',
|
|
77
77
|
foreground: background,
|
|
78
78
|
background: foreground,
|
package/src/languages/en.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"swap": "SWAP",
|
|
3
|
-
"Connect Wallet":"Connect Wallet",
|
|
4
|
-
"Powered By":"Powered By",
|
|
5
|
-
"From":"
|
|
6
|
-
"To":"
|
|
7
|
-
"
|
|
3
|
+
"Connect Wallet": "Connect Wallet",
|
|
4
|
+
"Powered By": "Powered By",
|
|
5
|
+
"From": "You sell",
|
|
6
|
+
"To": "You receive",
|
|
7
|
+
"Balance": "Balance",
|
|
8
|
+
"Max": "Max",
|
|
8
9
|
"Chain": "Chain",
|
|
9
10
|
"Token": "Token",
|
|
10
|
-
"Source"
|
|
11
|
-
"Destination"
|
|
12
|
-
"Select Wallet":"
|
|
11
|
+
"Source": "Source",
|
|
12
|
+
"Destination": "Destination",
|
|
13
|
+
"Select Wallet": "Connect Your Wallet"
|
|
13
14
|
}
|