@rango-dev/ui 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -86
- package/dist/index.js +6 -6
- package/dist/index.js.map +4 -4
- package/dist/translations/en.d.ts.map +1 -1
- package/dist/translations/es.d.ts.map +1 -1
- package/dist/translations/fr.d.ts.map +1 -1
- package/dist/translations/ja.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts +0 -157
- package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts +4 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts +7 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts +1429 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts +34 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts +4 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts +319 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts +6 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts +12 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts +158 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/index.d.ts +5 -0
- package/dist/widget/ui/src/components/BestRoute/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/mock.d.ts +3 -0
- package/dist/widget/ui/src/components/BestRoute/mock.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Button/Button.d.ts +54 -54
- package/dist/widget/ui/src/components/Button/Button.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Checkbox/Checkbox.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/ListItemButton/ListItemButton.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts +0 -158
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Radio/Radio.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts +4 -0
- package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts.map +1 -0
- package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts +158 -0
- package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/{QuoteCost/QuoteCost.types.d.ts → RouteCost/RouteCost.types.d.ts} +1 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/RouteCost/index.d.ts +2 -0
- package/dist/widget/ui/src/components/RouteCost/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/RoutesOverview/RoutesOverview.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +2 -16
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts +0 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Skeleton/Skeleton.types.d.ts +1 -1
- package/dist/widget/ui/src/components/Skeleton/Skeleton.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +1 -7
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +2 -16
- package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/index.d.ts +1 -1
- package/dist/widget/ui/src/components/StepDetails/index.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/mock.d.ts +1 -1
- package/dist/widget/ui/src/components/StepDetails/mock.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SwapListItem/mock.d.ts +1 -1
- package/dist/widget/ui/src/components/SwapListItem/mock.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Switch/Switch.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TextField/TextField.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +1 -471
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +2 -2
- package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Wallet/Wallet.types.d.ts +17 -3
- package/dist/widget/ui/src/components/Wallet/Wallet.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/common/Image.d.ts +0 -157
- package/dist/widget/ui/src/components/common/Image.d.ts.map +1 -1
- package/dist/widget/ui/src/components/common/index.d.ts +1 -1
- package/dist/widget/ui/src/components/common/index.d.ts.map +1 -1
- package/dist/widget/ui/src/components/index.d.ts +2 -1
- package/dist/widget/ui/src/components/index.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts +3 -3
- package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/History/types.d.ts +2 -0
- package/dist/widget/ui/src/containers/History/types.d.ts.map +1 -0
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts +2 -2
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +54 -1313
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts +0 -2
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +54 -525
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts +2 -2
- package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts.map +1 -1
- package/dist/widget/ui/src/{utils → helper}/index.d.ts +3 -0
- package/dist/widget/ui/src/helper/index.d.ts.map +1 -0
- package/dist/widget/ui/src/icons/Icons.stories.d.ts +1 -1
- package/dist/widget/ui/src/icons/index.d.ts +0 -5
- package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
- package/dist/widget/ui/src/index.d.ts +1 -0
- package/dist/widget/ui/src/index.d.ts.map +1 -1
- package/dist/widget/ui/src/types/index.d.ts +1 -0
- package/dist/widget/ui/src/types/index.d.ts.map +1 -1
- package/dist/widget/ui/src/types/swaps.d.ts +27 -1
- package/dist/widget/ui/src/types/swaps.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/components/Alert/Alert.styles.ts +12 -9
- package/src/components/Alert/Alert.tsx +2 -2
- package/src/components/BestRoute/BestRoute.stories.tsx +17 -0
- package/src/components/BestRoute/BestRoute.styles.ts +213 -0
- package/src/components/BestRoute/BestRoute.tsx +176 -0
- package/src/components/BestRoute/BestRoute.types.ts +32 -0
- package/src/components/BestRoute/BestRouteSkeleton.styles.ts +110 -0
- package/src/components/BestRoute/BestRouteSkeleton.tsx +112 -0
- package/src/components/BestRoute/BestRouteSkeleton.types.ts +5 -0
- package/src/components/BestRoute/RouteSummary.styles.ts +15 -0
- package/src/components/BestRoute/RouteSummary.tsx +48 -0
- package/src/components/BestRoute/index.ts +4 -0
- package/src/components/BestRoute/mock.ts +142 -0
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +1 -2
- package/src/components/Button/Button.styles.tsx +0 -1
- package/src/components/Checkbox/Checkbox.styles.ts +1 -5
- package/src/components/ListItem/ListItem.styles.ts +0 -9
- package/src/components/ListItem/ListItem.tsx +1 -1
- package/src/components/ListItemButton/ListItemButton.styles.ts +0 -1
- package/src/components/PriceImpact/PriceImpact.styles.ts +1 -9
- package/src/components/PriceImpact/PriceImpact.tsx +5 -5
- package/src/components/Radio/Radio.styles.tsx +2 -5
- package/src/components/RouteCost/RouteCost.styles.ts +20 -0
- package/src/components/{QuoteCost/QuoteCost.tsx → RouteCost/RouteCost.tsx} +10 -14
- package/src/components/RouteCost/index.ts +1 -0
- package/src/components/RoutesOverview/RoutesOverview.tsx +2 -6
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +13 -40
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +46 -47
- package/src/components/SelectableCategoryList/index.ts +0 -1
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +2 -3
- package/src/components/Skeleton/Skeleton.types.ts +1 -1
- package/src/components/StepDetails/StepDetails.stories.tsx +1 -1
- package/src/components/StepDetails/StepDetails.styles.ts +28 -36
- package/src/components/StepDetails/StepDetails.tsx +7 -11
- package/src/components/StepDetails/StepDetails.types.ts +2 -17
- package/src/components/StepDetails/index.ts +1 -1
- package/src/components/StepDetails/mock.ts +1 -1
- package/src/components/SvgIcon/SvgIcon.style.ts +1 -1
- package/src/components/SwapListItem/mock.ts +6 -21
- package/src/components/Switch/Switch.styles.tsx +6 -8
- package/src/components/TextField/TextField.tsx +5 -3
- package/src/components/TokenAmount/TokenAmount.styles.ts +10 -12
- package/src/components/TokenAmount/TokenAmount.tsx +17 -23
- package/src/components/Tooltip/Tooltip.styles.ts +5 -8
- package/src/components/Tooltip/Tooltip.tsx +3 -2
- package/src/components/Wallet/Wallet.styles.ts +1 -1
- package/src/components/Wallet/Wallet.types.ts +23 -3
- package/src/components/common/Image.tsx +2 -1
- package/src/components/common/index.ts +1 -1
- package/src/components/index.ts +2 -1
- package/src/containers/BlockchainSelector/BlockchainSelector.tsx +8 -9
- package/src/containers/History/types.tsx +1 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +2 -5
- package/src/containers/SwapHistory/SwapHistory.tsx +1 -1
- package/src/containers/SwapHistory/mock.ts +8 -24
- package/src/containers/SwapInput/SwapInput.styles.ts +27 -78
- package/src/containers/SwapInput/SwapInput.tsx +29 -37
- package/src/containers/SwapInput/SwapInput.types.ts +0 -2
- package/src/containers/SwapInput/TokenSection.styles.ts +12 -27
- package/src/containers/SwapInput/TokenSection.tsx +6 -15
- package/src/containers/TokenSelector/TokenSelector.tsx +10 -8
- package/src/helper/index.ts +99 -0
- package/src/icons/index.ts +0 -5
- package/src/index.ts +1 -0
- package/src/theme.ts +4 -4
- package/src/types/index.ts +1 -0
- package/src/types/swaps.ts +38 -0
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts +0 -4
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts.map +0 -1
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts +0 -629
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +0 -1
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts.map +0 -1
- package/dist/widget/ui/src/components/QuoteCost/index.d.ts +0 -2
- package/dist/widget/ui/src/components/QuoteCost/index.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/CosmosCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/CosmosCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/EvmCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/EvmCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/Language.d.ts +0 -5
- package/dist/widget/ui/src/icons/Language.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/OtherCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/OtherCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/UtxoCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/UtxoCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/utils/index.d.ts.map +0 -1
- package/src/components/QuoteCost/QuoteCost.styles.ts +0 -29
- package/src/components/QuoteCost/index.ts +0 -1
- package/src/icons/CosmosCategory.tsx +0 -137
- package/src/icons/EvmCategory.tsx +0 -74
- package/src/icons/Language.tsx +0 -55
- package/src/icons/OtherCategory.tsx +0 -72
- package/src/icons/UtxoCategory.tsx +0 -44
- package/src/utils/index.ts +0 -23
- /package/src/components/{QuoteCost/QuoteCost.types.ts → RouteCost/RouteCost.types.ts} +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Button } from '../../components';
|
|
2
|
-
import {
|
|
2
|
+
import { darkTheme, styled } from '../../theme';
|
|
3
3
|
|
|
4
4
|
export const Container = styled(Button, {
|
|
5
|
-
maxWidth: '180px',
|
|
6
|
-
minWidth: '130px',
|
|
7
|
-
flexGrow: 1,
|
|
8
5
|
backgroundColor: 'transparent',
|
|
9
6
|
color: '$neutral700',
|
|
10
7
|
'&:disabled': {
|
|
@@ -30,35 +27,23 @@ export const Container = styled(Button, {
|
|
|
30
27
|
},
|
|
31
28
|
});
|
|
32
29
|
|
|
33
|
-
export const chainNameStyles = css();
|
|
34
|
-
|
|
35
30
|
export const TokenSectionContainer = styled('div', {
|
|
36
|
-
|
|
31
|
+
width: '10.625rem',
|
|
37
32
|
padding: '$2 $5',
|
|
38
33
|
display: 'flex',
|
|
39
34
|
borderRadius: '$xs',
|
|
40
35
|
justifyContent: 'start',
|
|
41
36
|
boxSizing: 'border-box',
|
|
42
37
|
alignItems: 'center',
|
|
43
|
-
[`& .${chainNameStyles}`]: {
|
|
44
|
-
$$color: '$colors$neutral600',
|
|
45
|
-
[`.${darkTheme} &`]: {
|
|
46
|
-
$$color: '$colors$neutral700',
|
|
47
|
-
},
|
|
48
|
-
color: '$$color',
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
38
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
width: '100%',
|
|
63
|
-
padding: '$5 $0',
|
|
39
|
+
'& .token-chain-name': {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
alignItems: 'start',
|
|
44
|
+
paddingLeft: '$10',
|
|
45
|
+
},
|
|
46
|
+
'& .token-chain-name__skeleton': {
|
|
47
|
+
padding: '$5 $0',
|
|
48
|
+
},
|
|
64
49
|
});
|
|
@@ -5,13 +5,7 @@ import React from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { ChainToken, Divider, Skeleton, Typography } from '../../components';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
chainNameStyles,
|
|
10
|
-
Container,
|
|
11
|
-
skeletonStyles,
|
|
12
|
-
tokenChainStyles,
|
|
13
|
-
TokenSectionContainer,
|
|
14
|
-
} from './TokenSection.styles';
|
|
8
|
+
import { Container, TokenSectionContainer } from './TokenSection.styles';
|
|
15
9
|
|
|
16
10
|
export function TokenSection(props: TokenSectionProps) {
|
|
17
11
|
const {
|
|
@@ -33,12 +27,12 @@ export function TokenSection(props: TokenSectionProps) {
|
|
|
33
27
|
tokenImage={tokenImage}
|
|
34
28
|
loading={loading}
|
|
35
29
|
/>
|
|
36
|
-
<div className=
|
|
30
|
+
<div className="token-chain-name">
|
|
37
31
|
{loading ? (
|
|
38
|
-
<div className=
|
|
39
|
-
<Skeleton variant="text" size="large" />
|
|
32
|
+
<div className="token-chain-name__skeleton">
|
|
33
|
+
<Skeleton variant="text" size="large" width={92} />
|
|
40
34
|
<Divider size={8} />
|
|
41
|
-
<Skeleton variant="text" size="medium" />
|
|
35
|
+
<Skeleton variant="text" size="medium" width={92} />
|
|
42
36
|
</div>
|
|
43
37
|
) : (
|
|
44
38
|
<>
|
|
@@ -47,10 +41,7 @@ export function TokenSection(props: TokenSectionProps) {
|
|
|
47
41
|
? i18n.t('Token')
|
|
48
42
|
: tokenSymbol}
|
|
49
43
|
</Typography>
|
|
50
|
-
<Typography
|
|
51
|
-
variant="body"
|
|
52
|
-
size="medium"
|
|
53
|
-
className={chainNameStyles()}>
|
|
44
|
+
<Typography variant="body" size="medium" color="$neutral600">
|
|
54
45
|
{error || (!loading && !chain) ? i18n.t('Chain') : chain}
|
|
55
46
|
</Typography>
|
|
56
47
|
</>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { TokenWithAmount } from '../../components/TokenList/TokenList';
|
|
2
|
-
import type { LoadingStatus } from '../../types/meta';
|
|
3
|
-
|
|
4
1
|
import React from 'react';
|
|
2
|
+
import { containsText } from '../../helper';
|
|
5
3
|
|
|
6
|
-
import {
|
|
7
|
-
import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
|
|
8
|
-
import { TokenList } from '../../components/TokenList/TokenList';
|
|
4
|
+
import { LoadingStatus } from '../../types/meta';
|
|
9
5
|
import { styled } from '../../theme';
|
|
10
|
-
import {
|
|
6
|
+
import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
|
|
7
|
+
import { LoadingFailedAlert, SecondaryPage, Spinner } from '../../components';
|
|
8
|
+
import {
|
|
9
|
+
TokenList,
|
|
10
|
+
TokenWithAmount,
|
|
11
|
+
} from '../../components/TokenList/TokenList';
|
|
11
12
|
|
|
12
13
|
export const LoaderContainer = styled('div', {
|
|
13
14
|
display: 'flex',
|
|
@@ -44,7 +45,8 @@ export function TokenSelector(props: PropTypes) {
|
|
|
44
45
|
hasHeader={hasHeader}
|
|
45
46
|
title={`Select ${type} token`}
|
|
46
47
|
onBack={onBack}
|
|
47
|
-
textFieldPlaceholder="Search tokens by name"
|
|
48
|
+
textFieldPlaceholder="Search tokens by name"
|
|
49
|
+
>
|
|
48
50
|
{(searchedFor) => {
|
|
49
51
|
const filteredTokens = filterTokens(list, searchedFor);
|
|
50
52
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
|
|
3
|
+
export function containsText(text: string, searchText: string): boolean {
|
|
4
|
+
return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getConciseAddress(
|
|
8
|
+
address: string | null,
|
|
9
|
+
maxChars = 8,
|
|
10
|
+
ellipsisLength = 3
|
|
11
|
+
): string | null {
|
|
12
|
+
if (!address) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (address.length < 2 * maxChars + ellipsisLength) {
|
|
16
|
+
return address;
|
|
17
|
+
}
|
|
18
|
+
const start = Math.ceil((address.length - maxChars) / 2);
|
|
19
|
+
const end = address.length - maxChars;
|
|
20
|
+
return `${address.substr(start, maxChars)}${'.'.repeat(
|
|
21
|
+
ellipsisLength
|
|
22
|
+
)}${address.substr(end)}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const hexToRgb = (hex: string) =>
|
|
26
|
+
((value) =>
|
|
27
|
+
value.length === 3
|
|
28
|
+
? value.split('').map((c) => parseInt(c.repeat(2), 16))
|
|
29
|
+
: (value.match(/.{1,2}/g) || []).map((v) => parseInt(v, 16)))(
|
|
30
|
+
hex.replace('#', '')
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const isHexTooDark = (hexColor: string) =>
|
|
34
|
+
(([r, g, b]) => 0.2126 * r + 0.7152 * g + 0.0722 * b < 40)(
|
|
35
|
+
hexToRgb(hexColor)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const isHexTooLight = (hexColor: string) =>
|
|
39
|
+
(([r, g, b]) => (r * 299 + g * 587 + b * 114) / 1000 > 155)(
|
|
40
|
+
hexToRgb(hexColor)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const colorShade = (col: string, amt: number) => {
|
|
44
|
+
col = col.replace(/^#/, '');
|
|
45
|
+
if (col.length === 3) {
|
|
46
|
+
col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
|
|
47
|
+
}
|
|
48
|
+
let [r, g, b]: any = col.match(/.{2}/g);
|
|
49
|
+
[r, g, b] = [
|
|
50
|
+
parseInt(r, 16) + amt,
|
|
51
|
+
parseInt(g, 16) + amt,
|
|
52
|
+
parseInt(b, 16) + amt,
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
r = Math.max(Math.min(255, r), 0).toString(16);
|
|
56
|
+
g = Math.max(Math.min(255, g), 0).toString(16);
|
|
57
|
+
b = Math.max(Math.min(255, b), 0).toString(16);
|
|
58
|
+
|
|
59
|
+
const rr = (r.length < 2 ? '0' : '') + r;
|
|
60
|
+
const gg = (g.length < 2 ? '0' : '') + g;
|
|
61
|
+
const bb = (b.length < 2 ? '0' : '') + b;
|
|
62
|
+
|
|
63
|
+
return `#${rr}${gg}${bb}`;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const generateRangeColors = (
|
|
67
|
+
name: string,
|
|
68
|
+
mode: 'light' | 'dark',
|
|
69
|
+
color?: string
|
|
70
|
+
) => {
|
|
71
|
+
let colors = { [name]: color };
|
|
72
|
+
if (color) {
|
|
73
|
+
let c = color;
|
|
74
|
+
if (isHexTooDark(color) || mode === 'dark') {
|
|
75
|
+
for (let i = 1; i < 10; i++) {
|
|
76
|
+
colors = {
|
|
77
|
+
...colors,
|
|
78
|
+
[name + i * 100]:
|
|
79
|
+
name === 'neutral'
|
|
80
|
+
? colorShade(c, i * 15)
|
|
81
|
+
: colorShade(color, i * 5),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (isHexTooLight(color) || mode === 'light') {
|
|
86
|
+
for (let i = 1; i < 10; i++) {
|
|
87
|
+
c = colorShade(c, -(i * 5));
|
|
88
|
+
colors = {
|
|
89
|
+
...colors,
|
|
90
|
+
[name + i * 100]:
|
|
91
|
+
name === 'neutral'
|
|
92
|
+
? colorShade(c, -(i * 5))
|
|
93
|
+
: colorShade(color, -(i * 5)),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return colors;
|
|
99
|
+
};
|
package/src/icons/index.ts
CHANGED
|
@@ -7,13 +7,11 @@ export { default as ChevronUpIcon } from './ChevronUp';
|
|
|
7
7
|
export { default as CloseIcon } from './Close';
|
|
8
8
|
export { default as CompleteIcon } from './Complete';
|
|
9
9
|
export { default as CopyIcon } from './Copy';
|
|
10
|
-
export { default as CosmosCategoryIcon } from './CosmosCategory';
|
|
11
10
|
export { default as CustomColorsIcon } from './CustomColors';
|
|
12
11
|
export { default as DarkModeIcon } from './DarkMode';
|
|
13
12
|
export { default as DeleteIcon } from './Delete';
|
|
14
13
|
export { default as DesktopIcon } from './Desktop';
|
|
15
14
|
export { default as DoneIcon } from './Done';
|
|
16
|
-
export { default as EvmCategoryIcon } from './EvmCategory';
|
|
17
15
|
export { default as ErrorIcon } from './Error';
|
|
18
16
|
export { default as ExternalLinkIcon } from './ExternalLink';
|
|
19
17
|
export { default as FontIcon } from './Font';
|
|
@@ -21,7 +19,6 @@ export { default as GasIcon } from './Gas';
|
|
|
21
19
|
export { default as InProgressIcon } from './InProgress';
|
|
22
20
|
export { default as InfoErrorIcon } from './InfoError';
|
|
23
21
|
export { default as InfoIcon } from './Info';
|
|
24
|
-
export { default as LanguageIcon } from './Language';
|
|
25
22
|
export { default as LightModeIcon } from './LightMode';
|
|
26
23
|
export { default as LinkIcon } from './Link';
|
|
27
24
|
export { default as LoadingIcon } from './Loading';
|
|
@@ -32,7 +29,6 @@ export { default as NoNotificationIcon } from './NoNotification';
|
|
|
32
29
|
export { default as NotificationNumberIcon } from './NotificationNumber';
|
|
33
30
|
export { default as NotificationsIcon } from './Notifications';
|
|
34
31
|
export { default as NumberIcon } from './Number';
|
|
35
|
-
export { default as OtherCategoryIcon } from './OtherCategory';
|
|
36
32
|
export { default as PinIcon } from './Pin';
|
|
37
33
|
export { default as RefreshIcon } from './Refresh';
|
|
38
34
|
export { default as ReverseIcon } from './Reverse';
|
|
@@ -40,7 +36,6 @@ export { default as RouteIcon } from './Route';
|
|
|
40
36
|
export { default as SearchIcon } from './Search';
|
|
41
37
|
export { default as TimeIcon } from './Time';
|
|
42
38
|
export { default as TransactionIcon } from './Transaction';
|
|
43
|
-
export { default as UtxoCategoryIcon } from './UtxoCategory';
|
|
44
39
|
export { default as WalletIcon } from './Wallet';
|
|
45
40
|
export { default as WarningIcon } from './Warning';
|
|
46
41
|
export { default as ChainsIcon } from './Chains';
|
package/src/index.ts
CHANGED
package/src/theme.ts
CHANGED
|
@@ -185,10 +185,10 @@ export const darkColors = {
|
|
|
185
185
|
secondary600: '#2B3462',
|
|
186
186
|
|
|
187
187
|
neutral: '#222222',
|
|
188
|
-
neutral900: '#
|
|
189
|
-
neutral800: '#
|
|
190
|
-
neutral700: '#
|
|
191
|
-
neutral600: '#
|
|
188
|
+
neutral900: '#F2F2F2',
|
|
189
|
+
neutral800: '#EEEEEE',
|
|
190
|
+
neutral700: '#E9E9E9',
|
|
191
|
+
neutral600: '#B8B8B8',
|
|
192
192
|
neutral500: '#222222',
|
|
193
193
|
neutral400: '#1B1B1B',
|
|
194
194
|
neutral300: '#121212',
|
package/src/types/index.ts
CHANGED
package/src/types/swaps.ts
CHANGED
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
BestRouteResponse,
|
|
2
3
|
BlockchainValidationStatus,
|
|
4
|
+
SimulationResult,
|
|
5
|
+
SwapResult,
|
|
3
6
|
WalletRequiredAssets,
|
|
4
7
|
} from 'rango-sdk';
|
|
5
8
|
|
|
9
|
+
export type SwapStatus = 'running' | 'failed' | 'success';
|
|
10
|
+
export type MessageSeverity = 'error' | 'warning' | 'info' | 'success';
|
|
11
|
+
|
|
12
|
+
export type StepStatus =
|
|
13
|
+
| 'created'
|
|
14
|
+
| 'running'
|
|
15
|
+
| 'failed'
|
|
16
|
+
| 'success'
|
|
17
|
+
| 'waitingForApproval'
|
|
18
|
+
| 'approved';
|
|
19
|
+
|
|
20
|
+
export enum PendingSwapNetworkStatus {
|
|
21
|
+
WaitingForConnectingWallet = 'waitingForConnectingWallet',
|
|
22
|
+
WaitingForQueue = 'waitingForQueue',
|
|
23
|
+
WaitingForNetworkChange = 'waitingForNetworkChange',
|
|
24
|
+
NetworkChanged = 'networkChanged',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type WalletTypeAndAddress = {
|
|
28
|
+
walletType: string;
|
|
29
|
+
address: string;
|
|
30
|
+
};
|
|
31
|
+
export type SwapSavedSettings = {
|
|
32
|
+
slippage: string;
|
|
33
|
+
disabledSwappersIds: string[];
|
|
34
|
+
disabledSwappersGroups: string[];
|
|
35
|
+
};
|
|
36
|
+
|
|
6
37
|
export type SimulationAssetAndAmount = WalletRequiredAssets;
|
|
7
38
|
export type SimulationValidationStatus = BlockchainValidationStatus;
|
|
39
|
+
export type BestRouteType = BestRouteResponse;
|
|
40
|
+
|
|
41
|
+
export type BestRouteWithFee = Omit<BestRouteResponse, 'result'> & {
|
|
42
|
+
result: Omit<SimulationResult, 'swaps'> & {
|
|
43
|
+
swaps: (SwapResult & { feeInUsd?: string })[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteCost.d.ts","sourceRoot":"","sources":["../../../../../../src/components/QuoteCost/QuoteCost.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,qBAgCzC"}
|