@rango-dev/widget-embedded 0.17.1-next.32 → 0.17.1-next.34
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/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
- package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +315 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +158 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/index.d.ts +0 -1
- package/dist/components/Quote/index.d.ts.map +1 -1
- package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.styles.d.ts +314 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +1571 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +6 -0
- package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +786 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +4 -0
- package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +1 -0
- package/dist/components/QuoteSkeleton/index.d.ts +4 -0
- package/dist/components/QuoteSkeleton/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +158 -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.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +158 -1
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.types.d.ts +1 -0
- package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.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/WalletsPage.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts +2 -2
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +19 -10
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +20 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +3 -3
- package/src/components/Layout/Layout.styles.ts +2 -0
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +2 -1
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +25 -40
- package/src/components/Quote/Quote.styles.ts +9 -2
- package/src/components/Quote/Quote.tsx +3 -5
- package/src/components/Quote/index.ts +0 -1
- package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +42 -0
- package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +30 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +57 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +76 -0
- package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +6 -0
- package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +33 -0
- package/src/components/QuoteSkeleton/StepSkeleton.tsx +44 -0
- package/src/components/QuoteSkeleton/StepSkeleton.types.ts +1 -0
- package/src/components/QuoteSkeleton/index.ts +3 -0
- package/src/components/Slippage/Slippage.styles.ts +15 -5
- package/src/components/Slippage/Slippage.tsx +8 -5
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +0 -1
- package/src/components/TokenList/TokenList.styles.ts +17 -2
- package/src/components/TokenList/TokenList.tsx +7 -3
- package/src/components/TokenList/TokenList.types.ts +1 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -1
- package/src/pages/Home.tsx +5 -1
- package/src/pages/SelectSwapItemsPage.tsx +8 -4
- package/src/pages/SettingsPage.tsx +4 -3
- package/src/pages/WalletsPage.tsx +5 -4
- package/src/store/slices/config.ts +1 -0
- package/src/store/slices/data.ts +10 -6
- package/src/types/config.ts +3 -3
- package/src/utils/wallets.ts +60 -23
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +0 -1
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +0 -4
- package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
- package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +0 -48
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +0 -3
- package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
- package/src/components/Quote/QuoteSkeleton.tsx +0 -108
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.d.ts +0 -0
- /package/dist/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.d.ts +0 -0
- /package/src/components/{Quote → QuoteSkeleton}/QuoteSkeleton.types.ts +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { PropTypes } from './QuoteSummarySkeleton.types';
|
|
2
|
+
|
|
3
|
+
import { ChainToken, Divider, Skeleton } from '@rango-dev/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
BasicSummary,
|
|
8
|
+
Cost,
|
|
9
|
+
CostAndTag,
|
|
10
|
+
Output,
|
|
11
|
+
OutputTokenInfo,
|
|
12
|
+
QuoteSummary,
|
|
13
|
+
QuoteSummarySeparator,
|
|
14
|
+
SwapPreview,
|
|
15
|
+
TokenAmount,
|
|
16
|
+
TokenAmountLabel,
|
|
17
|
+
} from './QuoteSummarySkeleton.styles';
|
|
18
|
+
|
|
19
|
+
export function QuoteSummarySkeleton(props: PropTypes) {
|
|
20
|
+
const { type, tag = false } = props;
|
|
21
|
+
const quotePreview = (
|
|
22
|
+
<QuoteSummary>
|
|
23
|
+
<TokenAmount>
|
|
24
|
+
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
25
|
+
<Divider size={8} direction="horizontal" />
|
|
26
|
+
<TokenAmountLabel>
|
|
27
|
+
<Skeleton height={10} width={60} variant="rounded" />
|
|
28
|
+
<Divider size={4} />
|
|
29
|
+
<Skeleton height={15} variant="rounded" />
|
|
30
|
+
</TokenAmountLabel>
|
|
31
|
+
</TokenAmount>
|
|
32
|
+
<Skeleton height={12} width={64} variant="rounded" />
|
|
33
|
+
</QuoteSummary>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
<CostAndTag>
|
|
39
|
+
<Cost>
|
|
40
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
41
|
+
<Divider size={4} direction="horizontal" />
|
|
42
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
43
|
+
<Divider size={4} direction="horizontal" />
|
|
44
|
+
<Skeleton width={60} height={10} variant="rounded" />
|
|
45
|
+
</Cost>
|
|
46
|
+
{tag && <Skeleton height={22} width={100} variant="rounded" />}
|
|
47
|
+
</CostAndTag>
|
|
48
|
+
{type === 'basic' && (
|
|
49
|
+
<BasicSummary>
|
|
50
|
+
<Skeleton height={15} width={148} variant="rounded" />
|
|
51
|
+
</BasicSummary>
|
|
52
|
+
)}
|
|
53
|
+
{type === 'list-item' && (
|
|
54
|
+
<Output>
|
|
55
|
+
<OutputTokenInfo>
|
|
56
|
+
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
57
|
+
<Divider direction="horizontal" size={4} />
|
|
58
|
+
<Skeleton height={15} width={150} variant="rounded" />
|
|
59
|
+
</OutputTokenInfo>
|
|
60
|
+
<Divider size={4} />
|
|
61
|
+
<Skeleton height={10} width={184} variant="rounded" />
|
|
62
|
+
</Output>
|
|
63
|
+
)}
|
|
64
|
+
{type === 'swap-preview' && (
|
|
65
|
+
<>
|
|
66
|
+
<Divider size={4} />
|
|
67
|
+
<SwapPreview>
|
|
68
|
+
{quotePreview}
|
|
69
|
+
<QuoteSummarySeparator />
|
|
70
|
+
{quotePreview}
|
|
71
|
+
</SwapPreview>
|
|
72
|
+
</>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { styled } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const StepContent = styled('div', {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
alignItems: 'start',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const StepTokens = styled('div', {
|
|
9
|
+
flexGrow: 1,
|
|
10
|
+
paddingTop: '$5',
|
|
11
|
+
paddingBottom: '$10',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const StepTokenInfo = styled('div', {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const StepIconContainer = styled('div', {
|
|
23
|
+
margin: '$0 $2',
|
|
24
|
+
padding: '$4',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const StepTitle = styled('div', {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PropTypes } from './StepSkeleton.types';
|
|
2
|
+
|
|
3
|
+
import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { StepSeparator } from './QuoteSkeleton.styles';
|
|
7
|
+
import {
|
|
8
|
+
StepContent,
|
|
9
|
+
StepIconContainer,
|
|
10
|
+
StepTitle,
|
|
11
|
+
StepTokenInfo,
|
|
12
|
+
StepTokens,
|
|
13
|
+
} from './StepSkeleton.styles';
|
|
14
|
+
|
|
15
|
+
export function StepSkeleton(props: PropTypes) {
|
|
16
|
+
const { separator = true } = props;
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<StepTitle>
|
|
20
|
+
<Skeleton height={22} width={22} variant="circular" />
|
|
21
|
+
<Divider direction="horizontal" size={8} />
|
|
22
|
+
<Skeleton height={15} width={148} variant="rounded" />
|
|
23
|
+
</StepTitle>
|
|
24
|
+
<StepContent>
|
|
25
|
+
<StepSeparator hideSeparator={!separator} />
|
|
26
|
+
<StepTokens>
|
|
27
|
+
<StepTokenInfo>
|
|
28
|
+
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
29
|
+
<Divider direction="horizontal" size={8} />
|
|
30
|
+
<Skeleton height={12} variant="rounded" />
|
|
31
|
+
</StepTokenInfo>
|
|
32
|
+
<StepIconContainer>
|
|
33
|
+
<NextIcon color="gray" size={16} />
|
|
34
|
+
</StepIconContainer>
|
|
35
|
+
<StepTokenInfo>
|
|
36
|
+
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
37
|
+
<Divider direction="horizontal" size={8} />
|
|
38
|
+
<Skeleton height={12} variant="rounded" />
|
|
39
|
+
</StepTokenInfo>
|
|
40
|
+
</StepTokens>
|
|
41
|
+
</StepContent>
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PropTypes = { separator?: boolean };
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { styled } from '@rango-dev/ui';
|
|
1
|
+
import { Chip, styled, TextField } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const BaseContainer = styled('div', {
|
|
4
4
|
paddingTop: '$5',
|
|
5
|
-
|
|
5
|
+
padding: '$10 $5',
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export const SlippageChipsContainer = styled('div', {
|
|
9
9
|
display: 'flex',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
flexWrap: 'wrap',
|
|
11
|
+
gap: '$10',
|
|
12
|
+
[`& ${TextField}`]: {
|
|
13
|
+
flex: '1 1 0',
|
|
14
|
+
maxWidth: '127px',
|
|
15
|
+
minWidth: '85px',
|
|
16
|
+
},
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
export const Head = styled('div', {
|
|
@@ -19,6 +24,11 @@ export const Head = styled('div', {
|
|
|
19
24
|
});
|
|
20
25
|
|
|
21
26
|
export const SlippageTooltipContainer = styled('div', {
|
|
22
|
-
maxWidth: '
|
|
27
|
+
maxWidth: '280px',
|
|
23
28
|
padding: '$10',
|
|
24
29
|
});
|
|
30
|
+
|
|
31
|
+
export const SlippageChip = styled(Chip, {
|
|
32
|
+
width: '61px',
|
|
33
|
+
flexShrink: 0,
|
|
34
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { i18n } from '@lingui/core';
|
|
2
2
|
import {
|
|
3
|
-
Chip,
|
|
4
3
|
Divider,
|
|
5
4
|
InfoIcon,
|
|
6
5
|
TextField,
|
|
@@ -17,7 +16,12 @@ import {
|
|
|
17
16
|
import { useAppStore } from '../../store/AppStore';
|
|
18
17
|
import { getContainer } from '../../utils/common';
|
|
19
18
|
|
|
20
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
BaseContainer,
|
|
21
|
+
Head,
|
|
22
|
+
SlippageChip,
|
|
23
|
+
SlippageChipsContainer,
|
|
24
|
+
} from './Slippage.styles';
|
|
21
25
|
import { SlippageTooltipContent } from './SlippageTooltipContent';
|
|
22
26
|
|
|
23
27
|
export function Slippage() {
|
|
@@ -34,6 +38,7 @@ export function Slippage() {
|
|
|
34
38
|
<Tooltip
|
|
35
39
|
container={getContainer()}
|
|
36
40
|
side="top"
|
|
41
|
+
sideOffset={4}
|
|
37
42
|
content={<SlippageTooltipContent />}>
|
|
38
43
|
<InfoIcon color="gray" />
|
|
39
44
|
</Tooltip>
|
|
@@ -43,8 +48,7 @@ export function Slippage() {
|
|
|
43
48
|
const key = `slippage-${index}`;
|
|
44
49
|
return (
|
|
45
50
|
<>
|
|
46
|
-
<
|
|
47
|
-
style={{ width: '64px', flexShrink: 0 }}
|
|
51
|
+
<SlippageChip
|
|
48
52
|
key={key}
|
|
49
53
|
onClick={() => {
|
|
50
54
|
if (customSlippage) {
|
|
@@ -55,7 +59,6 @@ export function Slippage() {
|
|
|
55
59
|
selected={!customSlippage && slippageItem === slippage}
|
|
56
60
|
label={`${slippageItem.toString()}%`}
|
|
57
61
|
/>
|
|
58
|
-
<Divider direction="horizontal" size={8} />
|
|
59
62
|
</>
|
|
60
63
|
);
|
|
61
64
|
})}
|
|
@@ -18,7 +18,8 @@ export const tokenNameStyles = css({
|
|
|
18
18
|
export const descriptionStyles = css({
|
|
19
19
|
position: 'relative',
|
|
20
20
|
height: 12,
|
|
21
|
-
width:
|
|
21
|
+
width: '30%',
|
|
22
|
+
maxWidth: '150px',
|
|
22
23
|
});
|
|
23
24
|
export const tokenTitleStyles = css({
|
|
24
25
|
position: 'absolute',
|
|
@@ -30,6 +31,9 @@ export const tokenAddressStyles = css({
|
|
|
30
31
|
transform: 'translateY(12px)',
|
|
31
32
|
visibility: 'hidden',
|
|
32
33
|
'& a': {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
alignItems: 'center',
|
|
33
37
|
fontSize: '$12',
|
|
34
38
|
lineHeight: '$16',
|
|
35
39
|
$$color: '$colors$neutral600',
|
|
@@ -106,6 +110,10 @@ export const TagTitle = styled(Typography, {});
|
|
|
106
110
|
|
|
107
111
|
export const BalanceContainer = styled('div', {
|
|
108
112
|
textAlign: 'right',
|
|
113
|
+
width: '100%',
|
|
114
|
+
overflow: 'hidden',
|
|
115
|
+
textOverflow: 'ellipsis',
|
|
116
|
+
whiteSpace: 'nowrap',
|
|
109
117
|
[`& .${usdValueStyles}`]: {
|
|
110
118
|
$$color: '$colors$neutral600',
|
|
111
119
|
[`.${darkTheme} &`]: {
|
|
@@ -115,7 +123,7 @@ export const BalanceContainer = styled('div', {
|
|
|
115
123
|
},
|
|
116
124
|
});
|
|
117
125
|
|
|
118
|
-
export const End = styled('
|
|
126
|
+
export const End = styled('div', {
|
|
119
127
|
display: 'flex',
|
|
120
128
|
alignItems: 'end',
|
|
121
129
|
flexDirection: 'column',
|
|
@@ -140,3 +148,10 @@ export const Pin = styled('div', {
|
|
|
140
148
|
bottom: -6,
|
|
141
149
|
right: -6,
|
|
142
150
|
});
|
|
151
|
+
|
|
152
|
+
export const TokenBalance = styled(Typography, {
|
|
153
|
+
width: '100%',
|
|
154
|
+
overflow: 'hidden',
|
|
155
|
+
textOverflow: 'ellipsis',
|
|
156
|
+
whiteSpace: 'nowrap',
|
|
157
|
+
});
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
TagTitle,
|
|
37
37
|
Title,
|
|
38
38
|
tokenAddressStyles,
|
|
39
|
+
TokenBalance,
|
|
39
40
|
tokenNameStyles,
|
|
40
41
|
tokenTitleStyles,
|
|
41
42
|
tokenWithoutNameStyles,
|
|
@@ -80,6 +81,7 @@ const renderDesc = (props: RenderDescProps) => {
|
|
|
80
81
|
{length > 10
|
|
81
82
|
? `${address.slice(0, 5)}...${address.slice(length - 6, length)}`
|
|
82
83
|
: address}{' '}
|
|
84
|
+
<Divider size={4} direction="horizontal" />
|
|
83
85
|
<ExternalLinkIcon color="gray" size={12} />
|
|
84
86
|
</a>
|
|
85
87
|
</div>
|
|
@@ -175,6 +177,8 @@ export function TokenList(props: PropTypes) {
|
|
|
175
177
|
<ListItemButton
|
|
176
178
|
style={{
|
|
177
179
|
height: style?.height,
|
|
180
|
+
width: '100%',
|
|
181
|
+
overflow: 'hidden',
|
|
178
182
|
}}
|
|
179
183
|
tab-index={index}
|
|
180
184
|
key={`${token.symbol}${token.address}`}
|
|
@@ -184,7 +188,7 @@ export function TokenList(props: PropTypes) {
|
|
|
184
188
|
start={
|
|
185
189
|
<ImageSection>
|
|
186
190
|
<Image src={token.image} size={30} />
|
|
187
|
-
{isTokenPinned(token) && (
|
|
191
|
+
{isTokenPinned(token, props.type) && (
|
|
188
192
|
<Pin>
|
|
189
193
|
<PinIcon size={12} color="gray" />
|
|
190
194
|
</Pin>
|
|
@@ -237,9 +241,9 @@ export function TokenList(props: PropTypes) {
|
|
|
237
241
|
) : (
|
|
238
242
|
tokenBalance && (
|
|
239
243
|
<BalanceContainer>
|
|
240
|
-
<
|
|
244
|
+
<TokenBalance variant="title" size="small">
|
|
241
245
|
{tokenBalance.amount}
|
|
242
|
-
</
|
|
246
|
+
</TokenBalance>
|
|
243
247
|
<div />
|
|
244
248
|
{tokenBalance.usdValue && (
|
|
245
249
|
<Typography
|
|
@@ -3,7 +3,8 @@ import type { PropTypes } from './QuoteInfo.types';
|
|
|
3
3
|
import { Divider } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
import { Quote
|
|
6
|
+
import { Quote } from '../../components/Quote';
|
|
7
|
+
import { QuoteSkeleton } from '../../components/QuoteSkeleton';
|
|
7
8
|
import { QuoteWarningsAndErrors } from '../../components/QuoteWarningsAndErrors';
|
|
8
9
|
import { useQuoteStore } from '../../store/quote';
|
|
9
10
|
import { QuoteErrorType } from '../../types';
|
package/src/pages/Home.tsx
CHANGED
|
@@ -25,7 +25,7 @@ import { useWalletsStore } from '../store/wallets';
|
|
|
25
25
|
import { numberToString } from '../utils/numbers';
|
|
26
26
|
import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
|
|
27
27
|
import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
|
|
28
|
-
import { formatBalance } from '../utils/wallets';
|
|
28
|
+
import { formatBalance, isFetchingBalance } from '../utils/wallets';
|
|
29
29
|
|
|
30
30
|
const Container = styled('div', {
|
|
31
31
|
display: 'flex',
|
|
@@ -75,6 +75,9 @@ export function Home() {
|
|
|
75
75
|
const setCurrentPage = useUiStore.use.setCurrentPage();
|
|
76
76
|
const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
|
|
77
77
|
const layoutRef = useRef<HTMLDivElement>(null);
|
|
78
|
+
const fetchingBalance =
|
|
79
|
+
!!fromBlockchain &&
|
|
80
|
+
isFetchingBalance(connectedWallets, fromBlockchain.name);
|
|
78
81
|
|
|
79
82
|
const needsToWarnEthOnPath = false;
|
|
80
83
|
|
|
@@ -195,6 +198,7 @@ export function Home() {
|
|
|
195
198
|
}}
|
|
196
199
|
disabled={fetchMetaStatus === 'failed'}
|
|
197
200
|
loading={fetchMetaStatus === 'loading'}
|
|
201
|
+
loadingBalance={fetchingBalance}
|
|
198
202
|
onSelectMaxBalance={() => {
|
|
199
203
|
if (fromTokenFormattedBalance !== '0') {
|
|
200
204
|
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
@@ -14,7 +14,7 @@ import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
|
14
14
|
import { useAppStore } from '../store/AppStore';
|
|
15
15
|
import { useQuoteStore } from '../store/quote';
|
|
16
16
|
import { useWalletsStore } from '../store/wallets';
|
|
17
|
-
import {
|
|
17
|
+
import { sortTokens } from '../utils/wallets';
|
|
18
18
|
|
|
19
19
|
interface PropTypes {
|
|
20
20
|
type: 'source' | 'destination';
|
|
@@ -34,22 +34,25 @@ export function SelectSwapItemsPage(props: PropTypes) {
|
|
|
34
34
|
} = useQuoteStore();
|
|
35
35
|
const getBalanceFor = useWalletsStore.use.getBalanceFor();
|
|
36
36
|
const [searchedFor, setSearchedFor] = useState<string>('');
|
|
37
|
+
const { isTokenPinned } = useAppStore();
|
|
37
38
|
|
|
38
39
|
const selectedBlockchain = type === 'source' ? fromBlockchain : toBlockchain;
|
|
39
40
|
const selectedBlockchainName = selectedBlockchain?.name ?? '';
|
|
40
41
|
|
|
41
42
|
// Tokens & Blockchains list
|
|
42
43
|
const blockchains = useAppStore().blockchains({
|
|
43
|
-
type
|
|
44
|
+
type,
|
|
44
45
|
});
|
|
45
46
|
const tokens = useAppStore().tokens({
|
|
46
47
|
type,
|
|
47
48
|
blockchain: selectedBlockchainName,
|
|
48
49
|
searchFor: searchedFor,
|
|
49
50
|
});
|
|
50
|
-
const tokensList = sortTokensByBalance(tokens, getBalanceFor);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
const checkIsTokenPinned = (token: Token) => isTokenPinned(token, type);
|
|
53
|
+
|
|
54
|
+
const tokensList = sortTokens(tokens, getBalanceFor, checkIsTokenPinned);
|
|
55
|
+
|
|
53
56
|
const updateBlockchain = (blockchain: BlockchainMeta) => {
|
|
54
57
|
if (type === 'source') {
|
|
55
58
|
setFromBlockchain(blockchain);
|
|
@@ -96,6 +99,7 @@ export function SelectSwapItemsPage(props: PropTypes) {
|
|
|
96
99
|
list={tokensList}
|
|
97
100
|
selectedBlockchain={selectedBlockchainName}
|
|
98
101
|
searchedFor={searchedFor}
|
|
102
|
+
type={type}
|
|
99
103
|
onChange={(token) => {
|
|
100
104
|
updateToken(token);
|
|
101
105
|
|
|
@@ -144,17 +144,18 @@ export function SettingsPage() {
|
|
|
144
144
|
title: (
|
|
145
145
|
<>
|
|
146
146
|
<Typography variant="title" size="xmedium">
|
|
147
|
-
{i18n.t('Infinite
|
|
147
|
+
{i18n.t('Infinite approval')}
|
|
148
148
|
</Typography>
|
|
149
149
|
<Divider direction="horizontal" size={4} />
|
|
150
150
|
<Tooltip
|
|
151
151
|
side="top"
|
|
152
|
+
sideOffset={4}
|
|
152
153
|
container={getContainer()}
|
|
153
154
|
content={
|
|
154
155
|
<TooltipContainer>
|
|
155
156
|
<Typography variant="label" size="medium" color="neutral700">
|
|
156
157
|
{i18n.t(
|
|
157
|
-
"Enabling the 'Infinite
|
|
158
|
+
"Enabling the 'Infinite approval' mode grants unrestricted access to smart contracts of DEXes/Bridges, allowing them to utilize the approved token amount without limitations."
|
|
158
159
|
)}
|
|
159
160
|
</Typography>
|
|
160
161
|
</TooltipContainer>
|
|
@@ -180,7 +181,7 @@ export function SettingsPage() {
|
|
|
180
181
|
return (
|
|
181
182
|
<Layout
|
|
182
183
|
header={{
|
|
183
|
-
title: i18n.t('
|
|
184
|
+
title: i18n.t('Settings'),
|
|
184
185
|
}}>
|
|
185
186
|
<SettingsContainer>
|
|
186
187
|
<Slippage />
|
|
@@ -11,11 +11,12 @@ import { useAppStore } from '../store/AppStore';
|
|
|
11
11
|
import { getContainer } from '../utils/common';
|
|
12
12
|
|
|
13
13
|
const ListContainer = styled('div', {
|
|
14
|
-
display: '
|
|
14
|
+
display: 'flex',
|
|
15
|
+
justifyContent: 'space-evenly',
|
|
16
|
+
alignItems: 'center',
|
|
15
17
|
gap: '$10',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
paddingTop: '$15',
|
|
18
|
+
flexWrap: 'wrap',
|
|
19
|
+
paddingTop: '$5',
|
|
19
20
|
height: '100%',
|
|
20
21
|
});
|
|
21
22
|
|
package/src/store/slices/data.ts
CHANGED
|
@@ -14,7 +14,7 @@ type BlockchainOptions = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
type TokenOptions = {
|
|
17
|
-
type
|
|
17
|
+
type: 'source' | 'destination';
|
|
18
18
|
// filter by an specific blockchain
|
|
19
19
|
blockchain?: string;
|
|
20
20
|
searchFor?: string;
|
|
@@ -29,7 +29,7 @@ export interface DataSlice {
|
|
|
29
29
|
blockchains: (options?: BlockchainOptions) => BlockchainMeta[];
|
|
30
30
|
tokens: (options?: TokenOptions) => Token[];
|
|
31
31
|
swappers: () => SwapperMeta[];
|
|
32
|
-
isTokenPinned: (token: Token) => boolean;
|
|
32
|
+
isTokenPinned: (token: Token, type: 'source' | 'destination') => boolean;
|
|
33
33
|
|
|
34
34
|
fetch: () => Promise<void>;
|
|
35
35
|
}
|
|
@@ -131,10 +131,10 @@ export const createDataSlice: StateCreator<
|
|
|
131
131
|
})
|
|
132
132
|
.sort((a, b) => {
|
|
133
133
|
// Check pinned tokens
|
|
134
|
-
if (get().isTokenPinned(a)) {
|
|
134
|
+
if (get().isTokenPinned(a, options.type)) {
|
|
135
135
|
return -1;
|
|
136
136
|
}
|
|
137
|
-
if (get().isTokenPinned(b)) {
|
|
137
|
+
if (get().isTokenPinned(b, options.type)) {
|
|
138
138
|
return 1;
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -159,8 +159,12 @@ export const createDataSlice: StateCreator<
|
|
|
159
159
|
|
|
160
160
|
return list;
|
|
161
161
|
},
|
|
162
|
-
isTokenPinned: (token) => {
|
|
163
|
-
const
|
|
162
|
+
isTokenPinned: (token, type) => {
|
|
163
|
+
const pinnedTokens =
|
|
164
|
+
type === 'source'
|
|
165
|
+
? get().config.from?.pinnedTokens
|
|
166
|
+
: get().config.to?.pinnedTokens;
|
|
167
|
+
const pinned = !!pinnedTokens?.some((pinnedToken) =>
|
|
164
168
|
tokensAreEqual(pinnedToken, token)
|
|
165
169
|
);
|
|
166
170
|
return pinned;
|
package/src/types/config.ts
CHANGED
|
@@ -77,12 +77,15 @@ export type WidgetAffiliate = {
|
|
|
77
77
|
* blockchains. e.g. ['BSC','ETHEREUM']
|
|
78
78
|
* @property {Asset[]} tokens - The `tokens` property is an optional array of `Asset` objects that
|
|
79
79
|
* you could use that to limit tokens to some limited ones.
|
|
80
|
+
* @property {Asset} pinnedTokens - The `pinnedTokens` property is an optional array of `Asset` objects that
|
|
81
|
+
* you could use to pin tokens of your choice to the top of the token list.
|
|
80
82
|
*/
|
|
81
83
|
export type BlockchainAndTokenConfig = {
|
|
82
84
|
blockchain?: string;
|
|
83
85
|
token?: Asset;
|
|
84
86
|
blockchains?: string[];
|
|
85
87
|
tokens?: Asset[];
|
|
88
|
+
pinnedTokens?: Asset[];
|
|
86
89
|
};
|
|
87
90
|
|
|
88
91
|
/**
|
|
@@ -153,8 +156,6 @@ export type Features = Partial<
|
|
|
153
156
|
* that defines the various properties of the theme, such as colors, fonts, and others.
|
|
154
157
|
* @property {boolean} externalWallets
|
|
155
158
|
* If `externalWallets` is `true`, you should add `WidgetWallets` to your app.
|
|
156
|
-
* @property {Asset} pinnedTokens - The `pinnedTokens` property is an optional array of `Asset` objects that
|
|
157
|
-
* you could use to pin tokens of your choice to the top of the token list.
|
|
158
159
|
* @property {boolean} enableNewLiquiditySources - The `enableNewLiquiditySources` property is a boolean value that when you
|
|
159
160
|
* set it to true, whenever a new liquidity source is added, it will be added to your list as well.
|
|
160
161
|
* @property {Features} features - An optional object for configuring the visibility or enablement of various features.
|
|
@@ -182,7 +183,6 @@ export type WidgetConfig = {
|
|
|
182
183
|
language?: Language;
|
|
183
184
|
theme?: WidgetTheme;
|
|
184
185
|
externalWallets?: boolean;
|
|
185
|
-
pinnedTokens?: Asset[];
|
|
186
186
|
enableNewLiquiditySources?: boolean;
|
|
187
187
|
features?: Features;
|
|
188
188
|
};
|