@rango-dev/ui 0.22.1-next.0 → 0.22.1-next.2
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/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/QuoteCost/QuoteCost.d.ts +4 -0
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts.map +1 -0
- package/dist/widget/ui/src/components/{BestRoute/BestRouteSkeleton.styles.d.ts → QuoteCost/QuoteCost.styles.d.ts} +3 -7
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/{RouteCost/RouteCost.types.d.ts → QuoteCost/QuoteCost.types.d.ts} +1 -1
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/QuoteCost/index.d.ts +2 -0
- package/dist/widget/ui/src/components/QuoteCost/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +16 -2
- 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/index.d.ts +1 -2
- package/dist/widget/ui/src/components/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/PriceImpact/PriceImpact.tsx +2 -2
- package/src/components/{RouteCost/RouteCost.styles.ts → QuoteCost/QuoteCost.styles.ts} +7 -0
- package/src/components/{RouteCost/RouteCost.tsx → QuoteCost/QuoteCost.tsx} +3 -4
- package/src/components/QuoteCost/index.ts +1 -0
- package/src/components/StepDetails/StepDetails.stories.tsx +1 -1
- package/src/components/StepDetails/StepDetails.styles.ts +2 -2
- package/src/components/StepDetails/StepDetails.tsx +3 -3
- package/src/components/StepDetails/StepDetails.types.ts +17 -2
- package/src/components/StepDetails/index.ts +1 -1
- package/src/components/StepDetails/mock.ts +1 -1
- package/src/components/index.ts +1 -2
- package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts +0 -4
- package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts +0 -7
- package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts +0 -1429
- package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts +0 -34
- package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts +0 -4
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts +0 -6
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts +0 -12
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts +0 -158
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/index.d.ts +0 -5
- package/dist/widget/ui/src/components/BestRoute/index.d.ts.map +0 -1
- package/dist/widget/ui/src/components/BestRoute/mock.d.ts +0 -3
- package/dist/widget/ui/src/components/BestRoute/mock.d.ts.map +0 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts +0 -4
- package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts.map +0 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts +0 -158
- package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts.map +0 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.types.d.ts.map +0 -1
- package/dist/widget/ui/src/components/RouteCost/index.d.ts +0 -2
- package/dist/widget/ui/src/components/RouteCost/index.d.ts.map +0 -1
- package/src/components/BestRoute/BestRoute.stories.tsx +0 -17
- package/src/components/BestRoute/BestRoute.styles.ts +0 -213
- package/src/components/BestRoute/BestRoute.tsx +0 -176
- package/src/components/BestRoute/BestRoute.types.ts +0 -32
- package/src/components/BestRoute/BestRouteSkeleton.styles.ts +0 -110
- package/src/components/BestRoute/BestRouteSkeleton.tsx +0 -112
- package/src/components/BestRoute/BestRouteSkeleton.types.ts +0 -5
- package/src/components/BestRoute/RouteSummary.styles.ts +0 -15
- package/src/components/BestRoute/RouteSummary.tsx +0 -48
- package/src/components/BestRoute/index.ts +0 -4
- package/src/components/BestRoute/mock.ts +0 -142
- package/src/components/RouteCost/index.ts +0 -1
- /package/src/components/{RouteCost/RouteCost.types.ts → QuoteCost/QuoteCost.types.ts} +0 -0
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import type { BestRouteProps } from './BestRoute.types';
|
|
2
|
-
|
|
3
|
-
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
-
|
|
5
|
-
import { Typography } from '../../components/Typography';
|
|
6
|
-
import { ChevronDownIcon, ChevronRightIcon, InfoIcon } from '../../icons';
|
|
7
|
-
import { Image } from '../common';
|
|
8
|
-
import { Divider } from '../Divider';
|
|
9
|
-
import { RouteCost } from '../RouteCost';
|
|
10
|
-
import { StepDetails } from '../StepDetails';
|
|
11
|
-
import { TokenAmount } from '../TokenAmount/TokenAmount';
|
|
12
|
-
import { Tooltip } from '../Tooltip';
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
Chains,
|
|
16
|
-
Content,
|
|
17
|
-
EXPANDABLE_ROUTES_TRANSITION_DURATION,
|
|
18
|
-
FrameIcon,
|
|
19
|
-
HorizontalSeparator,
|
|
20
|
-
IconContainer,
|
|
21
|
-
RouteContainer,
|
|
22
|
-
SummaryContainer,
|
|
23
|
-
} from './BestRoute.styles';
|
|
24
|
-
import { RouteSummary } from './RouteSummary';
|
|
25
|
-
|
|
26
|
-
export function BestRoute(props: BestRouteProps) {
|
|
27
|
-
const {
|
|
28
|
-
steps,
|
|
29
|
-
totalFee,
|
|
30
|
-
totalTime,
|
|
31
|
-
input,
|
|
32
|
-
output,
|
|
33
|
-
percentageChange,
|
|
34
|
-
warningLevel,
|
|
35
|
-
type,
|
|
36
|
-
recommended = true,
|
|
37
|
-
} = props;
|
|
38
|
-
|
|
39
|
-
const numberOfSteps = steps.length;
|
|
40
|
-
|
|
41
|
-
const [expanded, setExpanded] = useState(props.expanded);
|
|
42
|
-
const routeRef = useRef<HTMLButtonElement | null>(null);
|
|
43
|
-
|
|
44
|
-
useLayoutEffect(() => {
|
|
45
|
-
if (expanded && routeRef.current) {
|
|
46
|
-
setTimeout(() => {
|
|
47
|
-
routeRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
48
|
-
}, EXPANDABLE_ROUTES_TRANSITION_DURATION);
|
|
49
|
-
}
|
|
50
|
-
}, [expanded]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
<SummaryContainer
|
|
55
|
-
recommended={recommended}
|
|
56
|
-
listItem={type === 'list-item'}
|
|
57
|
-
basic={type === 'basic'}>
|
|
58
|
-
<div className="summary">
|
|
59
|
-
<RouteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
|
|
60
|
-
{type === 'basic' && (
|
|
61
|
-
<div className="basic-info">
|
|
62
|
-
<FrameIcon>
|
|
63
|
-
<InfoIcon size={12} color="gray" />
|
|
64
|
-
</FrameIcon>
|
|
65
|
-
<Typography
|
|
66
|
-
size="small"
|
|
67
|
-
variant="body"
|
|
68
|
-
style={{ letterSpacing: 0.4 }}>
|
|
69
|
-
{`${input.value} ${steps[0].from.token.displayName} = ${
|
|
70
|
-
output.value
|
|
71
|
-
} ${steps[steps.length - 1].to.token.displayName}`}
|
|
72
|
-
</Typography>
|
|
73
|
-
<Typography
|
|
74
|
-
color="$neutral600"
|
|
75
|
-
ml={2}
|
|
76
|
-
size="xsmall"
|
|
77
|
-
variant="body">
|
|
78
|
-
{`($${output.usdValue})`}
|
|
79
|
-
</Typography>
|
|
80
|
-
</div>
|
|
81
|
-
)}
|
|
82
|
-
{type === 'list-item' && (
|
|
83
|
-
<TokenAmount
|
|
84
|
-
type="output"
|
|
85
|
-
direction="vertical"
|
|
86
|
-
price={{ value: output.value, usdValue: output.usdValue }}
|
|
87
|
-
token={{
|
|
88
|
-
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
89
|
-
image: steps[numberOfSteps - 1].to.token.image,
|
|
90
|
-
}}
|
|
91
|
-
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
92
|
-
percentageChange={percentageChange}
|
|
93
|
-
warningLevel={warningLevel}
|
|
94
|
-
/>
|
|
95
|
-
)}
|
|
96
|
-
{type === 'swap-preview' && (
|
|
97
|
-
<>
|
|
98
|
-
<RouteSummary
|
|
99
|
-
from={steps[0].from}
|
|
100
|
-
to={steps[numberOfSteps - 1].to}
|
|
101
|
-
percentageChange={percentageChange}
|
|
102
|
-
warningLevel={warningLevel}
|
|
103
|
-
/>
|
|
104
|
-
<Divider size={4} />
|
|
105
|
-
</>
|
|
106
|
-
)}
|
|
107
|
-
</div>
|
|
108
|
-
<RouteContainer
|
|
109
|
-
recommended={recommended}
|
|
110
|
-
open={expanded}
|
|
111
|
-
onOpenChange={setExpanded}>
|
|
112
|
-
<Chains
|
|
113
|
-
ref={(ref) => (routeRef.current = ref)}
|
|
114
|
-
recommended={recommended}
|
|
115
|
-
onClick={setExpanded.bind(null, (prevState) => !prevState)}>
|
|
116
|
-
<div>
|
|
117
|
-
{steps.map((step, index) => {
|
|
118
|
-
const key = `item-${index}`;
|
|
119
|
-
return (
|
|
120
|
-
<React.Fragment key={key}>
|
|
121
|
-
<Tooltip
|
|
122
|
-
container={props.tooltipContainer}
|
|
123
|
-
side="bottom"
|
|
124
|
-
sideOffset={4}
|
|
125
|
-
content={step.from.chain.displayName}>
|
|
126
|
-
<Image src={step.from.chain.image} size={16} />
|
|
127
|
-
</Tooltip>
|
|
128
|
-
{index === numberOfSteps - 1 && (
|
|
129
|
-
<>
|
|
130
|
-
<IconContainer>
|
|
131
|
-
<ChevronRightIcon size={12} color="black" />
|
|
132
|
-
</IconContainer>
|
|
133
|
-
<Tooltip
|
|
134
|
-
container={props.tooltipContainer}
|
|
135
|
-
side="bottom"
|
|
136
|
-
sideOffset={4}
|
|
137
|
-
content={step.to.chain.displayName}>
|
|
138
|
-
<Image src={step.to.chain.image} size={16} />
|
|
139
|
-
</Tooltip>
|
|
140
|
-
</>
|
|
141
|
-
)}
|
|
142
|
-
{index !== numberOfSteps - 1 && (
|
|
143
|
-
<IconContainer>
|
|
144
|
-
<ChevronRightIcon size={12} color="black" />
|
|
145
|
-
</IconContainer>
|
|
146
|
-
)}
|
|
147
|
-
</React.Fragment>
|
|
148
|
-
);
|
|
149
|
-
})}
|
|
150
|
-
</div>
|
|
151
|
-
<IconContainer orientation={expanded ? 'up' : 'down'}>
|
|
152
|
-
<ChevronDownIcon size={12} color="black" />
|
|
153
|
-
</IconContainer>
|
|
154
|
-
</Chains>
|
|
155
|
-
<Content open={expanded}>
|
|
156
|
-
<HorizontalSeparator />
|
|
157
|
-
<div className="steps-details">
|
|
158
|
-
{steps.map((step, index) => {
|
|
159
|
-
const key = `item-${index}`;
|
|
160
|
-
return (
|
|
161
|
-
<StepDetails
|
|
162
|
-
type="route-details"
|
|
163
|
-
key={key}
|
|
164
|
-
step={step}
|
|
165
|
-
hasSeparator={index !== steps.length - 1}
|
|
166
|
-
state={step.alerts ? 'error' : undefined}
|
|
167
|
-
/>
|
|
168
|
-
);
|
|
169
|
-
})}
|
|
170
|
-
</div>
|
|
171
|
-
</Content>
|
|
172
|
-
</RouteContainer>
|
|
173
|
-
</SummaryContainer>
|
|
174
|
-
</>
|
|
175
|
-
);
|
|
176
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { SwapInputProps } from '../../containers/SwapInput/SwapInput.types';
|
|
2
|
-
import type { PriceImpactProps } from '../PriceImpact/PriceImpact.types';
|
|
3
|
-
import type { ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
type BaseStep = Pick<SwapInputProps, 'chain' | 'token' | 'price'>;
|
|
6
|
-
|
|
7
|
-
export type Step = {
|
|
8
|
-
swapper: SwapInputProps['chain'];
|
|
9
|
-
from: BaseStep;
|
|
10
|
-
to: BaseStep;
|
|
11
|
-
error?: {
|
|
12
|
-
title?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
};
|
|
15
|
-
alerts?: ReactNode;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type BestRouteProps = Pick<
|
|
19
|
-
PriceImpactProps,
|
|
20
|
-
'percentageChange' | 'warningLevel'
|
|
21
|
-
> & {
|
|
22
|
-
type: 'basic' | 'list-item' | 'swap-preview';
|
|
23
|
-
recommended: boolean;
|
|
24
|
-
tag?: ReactNode;
|
|
25
|
-
input: { value: string; usdValue: string };
|
|
26
|
-
output: { value: string; usdValue?: string };
|
|
27
|
-
steps: Step[];
|
|
28
|
-
totalFee: string;
|
|
29
|
-
totalTime: string;
|
|
30
|
-
expanded?: boolean;
|
|
31
|
-
tooltipContainer?: HTMLElement;
|
|
32
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { darkTheme, styled } from '../../theme';
|
|
2
|
-
|
|
3
|
-
export const Container = styled('div', {
|
|
4
|
-
$$color: '$colors$neutral100',
|
|
5
|
-
[`.${darkTheme} &`]: {
|
|
6
|
-
$$color: '$colors$neutral300',
|
|
7
|
-
},
|
|
8
|
-
backgroundColor: '$$color',
|
|
9
|
-
borderBottomLeftRadius: '$xm',
|
|
10
|
-
borderBottomRightRadius: '$xm',
|
|
11
|
-
padding: '$15 ',
|
|
12
|
-
'& .cost-and-tag': {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
height: '22px',
|
|
17
|
-
},
|
|
18
|
-
variants: {
|
|
19
|
-
rounded: {
|
|
20
|
-
true: {
|
|
21
|
-
borderRadius: '$xm',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
'& .cost': {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
},
|
|
28
|
-
'& .basic-summary': {
|
|
29
|
-
padding: '$15 $0 14px $0',
|
|
30
|
-
},
|
|
31
|
-
'& .output': {
|
|
32
|
-
padding: '$6 $0 $15 $0',
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexDirection: 'column',
|
|
35
|
-
},
|
|
36
|
-
'& .output__token-info': {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
justifyContent: 'start',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
paddingBottom: '$5',
|
|
41
|
-
},
|
|
42
|
-
'& .route-summary': {
|
|
43
|
-
display: 'flex',
|
|
44
|
-
justifyContent: 'space-between',
|
|
45
|
-
alignItems: 'end',
|
|
46
|
-
},
|
|
47
|
-
'& .route-summary__separator': {
|
|
48
|
-
height: '$28',
|
|
49
|
-
marginLeft: '13px',
|
|
50
|
-
borderLeft: '1px solid $neutral700',
|
|
51
|
-
},
|
|
52
|
-
'& .token-amount': {
|
|
53
|
-
display: 'flex',
|
|
54
|
-
justifyContent: 'space-between',
|
|
55
|
-
},
|
|
56
|
-
'& .token-amount__label': {
|
|
57
|
-
display: 'flex',
|
|
58
|
-
flexDirection: 'column',
|
|
59
|
-
alignItems: 'start',
|
|
60
|
-
},
|
|
61
|
-
'& .chains': {
|
|
62
|
-
paddingTop: '$2',
|
|
63
|
-
},
|
|
64
|
-
'& .swap-preview': {
|
|
65
|
-
padding: '$15 $0 $15 $0',
|
|
66
|
-
},
|
|
67
|
-
'& .steps': {
|
|
68
|
-
paddingLeft: '$8',
|
|
69
|
-
},
|
|
70
|
-
'& .step__title': {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
},
|
|
74
|
-
'& .step__content': {
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'start',
|
|
77
|
-
},
|
|
78
|
-
'& .step__tokens': {
|
|
79
|
-
paddingTop: '$5',
|
|
80
|
-
paddingBottom: '$10',
|
|
81
|
-
display: 'flex',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
},
|
|
84
|
-
'& .step__token-info': {
|
|
85
|
-
display: 'flex',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
},
|
|
88
|
-
'& .step__icon-container': {
|
|
89
|
-
margin: '$0 $2',
|
|
90
|
-
padding: '$4',
|
|
91
|
-
display: 'flex',
|
|
92
|
-
justifyContent: 'center',
|
|
93
|
-
alignItems: 'center',
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
export const StepSeparator = styled('div', {
|
|
98
|
-
borderLeft: '1px dashed black',
|
|
99
|
-
minHeight: ' 64px',
|
|
100
|
-
margin: '0px 11.5px',
|
|
101
|
-
alignSelf: 'stretch',
|
|
102
|
-
variants: {
|
|
103
|
-
hideSeparator: {
|
|
104
|
-
true: {
|
|
105
|
-
minHeight: 'unset',
|
|
106
|
-
height: '0',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { PropTypes } from './BestRouteSkeleton.types';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import { NextIcon } from '../../icons';
|
|
6
|
-
import { ChainToken } from '../ChainToken';
|
|
7
|
-
import { Divider } from '../Divider';
|
|
8
|
-
import { Skeleton } from '../Skeleton';
|
|
9
|
-
|
|
10
|
-
import { Container, StepSeparator } from './BestRouteSkeleton.styles';
|
|
11
|
-
|
|
12
|
-
function StepSkeleton(props: { separator?: boolean }) {
|
|
13
|
-
const { separator = true } = props;
|
|
14
|
-
return (
|
|
15
|
-
<>
|
|
16
|
-
<div className="step__title">
|
|
17
|
-
<Skeleton height={22} width={22} variant="circular" />
|
|
18
|
-
<Divider direction="horizontal" size={8} />
|
|
19
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
20
|
-
</div>
|
|
21
|
-
<div className="step__content">
|
|
22
|
-
<StepSeparator hideSeparator={!separator} />
|
|
23
|
-
<div className="step__tokens">
|
|
24
|
-
<div className="step__token-info">
|
|
25
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
26
|
-
<Divider direction="horizontal" size={8} />
|
|
27
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
28
|
-
</div>
|
|
29
|
-
<div className="step__icon-container">
|
|
30
|
-
<NextIcon color="gray" size={16} />
|
|
31
|
-
</div>
|
|
32
|
-
<div className="step__token-info">
|
|
33
|
-
<ChainToken size="small" loading chainImage="" tokenImage="" />
|
|
34
|
-
<Divider direction="horizontal" size={8} />
|
|
35
|
-
<Skeleton height={12} width={76} variant="rounded" />
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function BestRouteSkeleton(props: PropTypes) {
|
|
44
|
-
const { type, expanded, tag = false } = props;
|
|
45
|
-
const routeSummary = (
|
|
46
|
-
<div className="route-summary">
|
|
47
|
-
<div className="token-amount">
|
|
48
|
-
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
49
|
-
<Divider size={8} direction="horizontal" />
|
|
50
|
-
<div className="token-amount__label">
|
|
51
|
-
<Skeleton height={10} width={60} variant="rounded" />
|
|
52
|
-
<Divider size={4} />
|
|
53
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<Skeleton height={12} width={64} variant="rounded" />
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<Container>
|
|
62
|
-
<div className="cost-and-tag">
|
|
63
|
-
<div className="cost">
|
|
64
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
65
|
-
<Divider size={4} direction="horizontal" />
|
|
66
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
67
|
-
<Divider size={4} direction="horizontal" />
|
|
68
|
-
<Skeleton width={60} height={10} variant="rounded" />
|
|
69
|
-
</div>
|
|
70
|
-
{tag && <Skeleton height={22} width={100} variant="rounded" />}
|
|
71
|
-
</div>
|
|
72
|
-
{type === 'basic' && (
|
|
73
|
-
<div className="basic-summary">
|
|
74
|
-
<Skeleton height={15} width={148} variant="rounded" />
|
|
75
|
-
</div>
|
|
76
|
-
)}
|
|
77
|
-
{type === 'list-item' && (
|
|
78
|
-
<div className="output">
|
|
79
|
-
<div className="output__token-info">
|
|
80
|
-
<ChainToken loading size="medium" chainImage="" tokenImage="" />
|
|
81
|
-
<Divider direction="horizontal" size={4} />
|
|
82
|
-
<Skeleton height={15} width={150} variant="rounded" />
|
|
83
|
-
</div>
|
|
84
|
-
<Divider size={4} />
|
|
85
|
-
<Skeleton height={10} width={184} variant="rounded" />
|
|
86
|
-
</div>
|
|
87
|
-
)}
|
|
88
|
-
{type === 'swap-preview' && (
|
|
89
|
-
<>
|
|
90
|
-
<Divider size={4} />
|
|
91
|
-
<div className="swap-preview">
|
|
92
|
-
{routeSummary}
|
|
93
|
-
<div className="route-summary__separator" />
|
|
94
|
-
{routeSummary}
|
|
95
|
-
</div>
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
98
|
-
<div className="chains">
|
|
99
|
-
<Skeleton height={15} width={321} variant="rounded" />
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
{expanded && (
|
|
103
|
-
<div className="steps">
|
|
104
|
-
<Divider size={20} />
|
|
105
|
-
<StepSkeleton />
|
|
106
|
-
<StepSkeleton />
|
|
107
|
-
<StepSkeleton separator={false} />
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
</Container>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { styled } from '../../theme';
|
|
2
|
-
|
|
3
|
-
export const Container = styled('div', {
|
|
4
|
-
position: 'relative',
|
|
5
|
-
display: 'flex',
|
|
6
|
-
flexDirection: 'column',
|
|
7
|
-
width: '100%',
|
|
8
|
-
'& .separator': {
|
|
9
|
-
height: '14px',
|
|
10
|
-
marginLeft: '14px',
|
|
11
|
-
position: 'absolute',
|
|
12
|
-
borderLeft: '1px solid $foreground',
|
|
13
|
-
top: '42%',
|
|
14
|
-
},
|
|
15
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Step } from './BestRoute.types';
|
|
2
|
-
import type { PriceImpactWarningLevel } from '../PriceImpact';
|
|
3
|
-
|
|
4
|
-
import React from 'react';
|
|
5
|
-
|
|
6
|
-
import { TokenAmount } from '../TokenAmount';
|
|
7
|
-
|
|
8
|
-
import { Container } from './RouteSummary.styles';
|
|
9
|
-
|
|
10
|
-
type PropTypes = {
|
|
11
|
-
from: Step['from'];
|
|
12
|
-
to: Step['to'];
|
|
13
|
-
percentageChange?: string | null;
|
|
14
|
-
warningLevel: PriceImpactWarningLevel;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function RouteSummary(props: PropTypes) {
|
|
18
|
-
const { from, to, percentageChange, warningLevel } = props;
|
|
19
|
-
return (
|
|
20
|
-
<Container>
|
|
21
|
-
<TokenAmount
|
|
22
|
-
direction="horizontal"
|
|
23
|
-
label="Swap input"
|
|
24
|
-
type="input"
|
|
25
|
-
price={{ value: from.price.value, usdValue: from.price.usdValue }}
|
|
26
|
-
token={{
|
|
27
|
-
displayName: from.token.displayName,
|
|
28
|
-
image: from.token.image,
|
|
29
|
-
}}
|
|
30
|
-
chain={{ image: from.chain.image }}
|
|
31
|
-
/>
|
|
32
|
-
<div className="separator" />
|
|
33
|
-
<TokenAmount
|
|
34
|
-
direction="horizontal"
|
|
35
|
-
label="Estimated output"
|
|
36
|
-
type="output"
|
|
37
|
-
price={{ value: to.price.value, usdValue: to.price.usdValue }}
|
|
38
|
-
token={{
|
|
39
|
-
displayName: to.token.displayName,
|
|
40
|
-
image: to.token.image,
|
|
41
|
-
}}
|
|
42
|
-
chain={{ image: to.chain.image }}
|
|
43
|
-
percentageChange={percentageChange}
|
|
44
|
-
warningLevel={warningLevel}
|
|
45
|
-
/>
|
|
46
|
-
</Container>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { BestRouteProps } from './BestRoute.types';
|
|
2
|
-
|
|
3
|
-
export const route1: BestRouteProps = {
|
|
4
|
-
type: 'list-item',
|
|
5
|
-
recommended: true,
|
|
6
|
-
input: { value: '1', usdValue: '30000' },
|
|
7
|
-
output: { value: '3161.441024', usdValue: '26.890' },
|
|
8
|
-
steps: [
|
|
9
|
-
{
|
|
10
|
-
swapper: {
|
|
11
|
-
displayName: 'MayaProtocol',
|
|
12
|
-
image: 'https://api.rango.exchange/swappers/maya.jpg',
|
|
13
|
-
},
|
|
14
|
-
from: {
|
|
15
|
-
token: {
|
|
16
|
-
displayName: 'BTC',
|
|
17
|
-
image: 'https://api.rango.exchange/tokens/BTC/BTC.png',
|
|
18
|
-
},
|
|
19
|
-
chain: {
|
|
20
|
-
displayName: 'BTC',
|
|
21
|
-
image: 'https://api.rango.exchange/tokens/BTC/BTC.png',
|
|
22
|
-
},
|
|
23
|
-
price: {
|
|
24
|
-
value: '1.00000000',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
to: {
|
|
28
|
-
chain: {
|
|
29
|
-
displayName: 'ETH',
|
|
30
|
-
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
31
|
-
},
|
|
32
|
-
token: {
|
|
33
|
-
displayName: 'ETH',
|
|
34
|
-
|
|
35
|
-
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
36
|
-
},
|
|
37
|
-
price: {
|
|
38
|
-
value: '14.863736725876758517',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
swapper: {
|
|
44
|
-
displayName: 'Satellite',
|
|
45
|
-
image: 'https://api.rango.exchange/swappers/satellite.png',
|
|
46
|
-
},
|
|
47
|
-
from: {
|
|
48
|
-
token: {
|
|
49
|
-
displayName: 'ETH',
|
|
50
|
-
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
51
|
-
},
|
|
52
|
-
chain: {
|
|
53
|
-
displayName: 'ETH',
|
|
54
|
-
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
55
|
-
},
|
|
56
|
-
price: { value: '14.863736725876758517' },
|
|
57
|
-
},
|
|
58
|
-
to: {
|
|
59
|
-
token: {
|
|
60
|
-
displayName: 'ETH',
|
|
61
|
-
image: 'https://api.rango.exchange/tokens/COSMOS/ETH.png',
|
|
62
|
-
},
|
|
63
|
-
chain: {
|
|
64
|
-
displayName: 'OSMOSIS',
|
|
65
|
-
image: 'https://api.rango.exchange/blockchains/osmosis.svg',
|
|
66
|
-
},
|
|
67
|
-
price: {
|
|
68
|
-
value: '14.825674725876758517',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
swapper: {
|
|
74
|
-
displayName: 'Osmosis',
|
|
75
|
-
image: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
76
|
-
},
|
|
77
|
-
from: {
|
|
78
|
-
token: {
|
|
79
|
-
displayName: 'ETH',
|
|
80
|
-
image: 'https://api.rango.exchange/tokens/COSMOS/ETH.png',
|
|
81
|
-
},
|
|
82
|
-
chain: {
|
|
83
|
-
displayName: 'OSMOSIS',
|
|
84
|
-
image: 'https://api.rango.exchange/blockchains/osmosis.svg',
|
|
85
|
-
},
|
|
86
|
-
price: {
|
|
87
|
-
value: '14.825674725876758517',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
to: {
|
|
91
|
-
token: {
|
|
92
|
-
displayName: 'ATOM',
|
|
93
|
-
image: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
94
|
-
},
|
|
95
|
-
chain: {
|
|
96
|
-
displayName: 'OSMOSIS',
|
|
97
|
-
image: 'https://api.rango.exchange/blockchains/osmosis.svg',
|
|
98
|
-
},
|
|
99
|
-
price: {
|
|
100
|
-
value: '3161.441024',
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
swapper: {
|
|
106
|
-
displayName: 'IBC',
|
|
107
|
-
image: 'https://api.rango.exchange/swappers/IBC.png',
|
|
108
|
-
},
|
|
109
|
-
from: {
|
|
110
|
-
token: {
|
|
111
|
-
displayName: 'ATOM',
|
|
112
|
-
image: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
113
|
-
},
|
|
114
|
-
chain: {
|
|
115
|
-
displayName: 'OSMOSIS',
|
|
116
|
-
image: 'https://api.rango.exchange/blockchains/osmosis.svg',
|
|
117
|
-
},
|
|
118
|
-
price: {
|
|
119
|
-
value: '3161.441024',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
to: {
|
|
123
|
-
token: {
|
|
124
|
-
displayName: 'ATOM',
|
|
125
|
-
image: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
126
|
-
},
|
|
127
|
-
chain: {
|
|
128
|
-
displayName: 'COSMOS',
|
|
129
|
-
image: 'https://api.rango.exchange/blockchains/cosmos.svg',
|
|
130
|
-
},
|
|
131
|
-
price: {
|
|
132
|
-
value: '3161.441024',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
|
|
138
|
-
percentageChange: '7.51',
|
|
139
|
-
warningLevel: 'high',
|
|
140
|
-
totalFee: '9.90',
|
|
141
|
-
totalTime: '23:00',
|
|
142
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { RouteCost } from './RouteCost';
|
|
File without changes
|