@rango-dev/ui 0.1.10-next.92 → 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/README.md +1 -181
- package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
- package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Header/Header.d.ts +9 -0
- package/dist/components/Header/index.d.ts +1 -0
- package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
- package/dist/components/SelectableWalletList/mock.d.ts +1 -1
- package/dist/components/Settings/Settings.d.ts +2 -1
- package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
- package/dist/containers/History/History.d.ts +6 -1
- package/dist/containers/History/index.d.ts +1 -1
- package/dist/containers/History/types.d.ts +3 -24
- package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
- package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
- package/dist/containers/index.d.ts +0 -1
- package/dist/helper/index.d.ts +1 -0
- package/dist/types/meta.d.ts +1 -0
- package/dist/ui.cjs.development.js +1062 -838
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +1061 -840
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Alert/Alert.tsx +33 -12
- package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
- package/src/components/Alert/NotFoundAlert.tsx +19 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +10 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -19
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/ConnectWalletsModal/mockData.ts +16 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Header/Header.tsx +39 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Icon/ArrowRightIcon.tsx +31 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +72 -22
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +15 -10
- package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -0
- package/src/components/SelectableWalletList/mock.ts +4 -3
- package/src/components/Settings/Settings.tsx +30 -11
- package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
- package/src/components/StepDetail/StepDetail.tsx +1 -0
- package/src/components/SwapContainer/SwapContainer.tsx +21 -16
- package/src/components/SwapDetail/SwapDetail.tsx +77 -115
- package/src/components/SwapDetail/Token.tsx +68 -0
- package/src/components/SwapDetail/mock.ts +1 -0
- package/src/components/TextField/TextField.tsx +1 -0
- package/src/components/TokenList/TokenItem.tsx +4 -1
- package/src/components/TokenList/TokenList.tsx +16 -18
- package/src/components/TokenSelector/TokenSelector.tsx +47 -10
- package/src/components/Wallet/Wallet.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -117
- package/src/containers/ConfirmSwap/mock.ts +79 -2
- package/src/containers/History/History.tsx +57 -38
- package/src/containers/History/index.ts +1 -1
- package/src/containers/History/mock.ts +1 -0
- package/src/containers/History/types.tsx +2 -30
- package/src/containers/SwapHistory/SwapHistory.tsx +309 -165
- package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
- package/src/containers/SwapHistory/mock.ts +1 -0
- package/src/containers/index.ts +0 -1
- package/src/helper/index.ts +14 -0
- package/src/types/meta.ts +2 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -16
- package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
- package/dist/containers/ConfirmWallets/index.d.ts +0 -1
- package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
- package/dist/helper/swaps.d.ts +0 -5
- package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
- package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -143
- package/src/containers/ConfirmWallets/index.ts +0 -1
- package/src/containers/ConfirmWallets/mock.ts +0 -222
- package/src/helper/swaps.ts +0 -23
|
@@ -53,7 +53,7 @@ export function TokenList(props: PropTypes) {
|
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
setTokens(list.slice(0, PAGE_SIZE));
|
|
56
|
-
}, [searchedText]);
|
|
56
|
+
}, [searchedText, list]);
|
|
57
57
|
|
|
58
58
|
useEffect(() => {
|
|
59
59
|
setHasNextPage(list.length > tokens.length);
|
|
@@ -76,22 +76,20 @@ export function TokenList(props: PropTypes) {
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
79
|
+
<VirtualizedList
|
|
80
|
+
Item={({ index, style }) => (
|
|
81
|
+
<TokenItem
|
|
82
|
+
token={tokens[index]}
|
|
83
|
+
style={style}
|
|
84
|
+
onClick={changeSelected}
|
|
85
|
+
selected={isSelected(tokens[index])}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
hasNextPage={hasNextPage}
|
|
89
|
+
itemCount={tokens.length}
|
|
90
|
+
loadNextPage={loadNextPage}
|
|
91
|
+
innerElementType={innerElementType}
|
|
92
|
+
size={56}
|
|
93
|
+
/>
|
|
96
94
|
);
|
|
97
95
|
}
|
|
@@ -3,7 +3,23 @@ import { containsText } from '../../helper';
|
|
|
3
3
|
import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
|
|
4
4
|
import { TokenList } from '../TokenList';
|
|
5
5
|
import { TokenWithAmount } from '../TokenList/TokenList';
|
|
6
|
+
import { LoadingStatus } from '../../types/meta';
|
|
7
|
+
import { Spinner } from '../Spinner';
|
|
8
|
+
import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
|
|
9
|
+
import { NotFoundAlert } from '../Alert/NotFoundAlert';
|
|
10
|
+
import { styled } from '../../theme';
|
|
6
11
|
|
|
12
|
+
const Container = styled('div', {
|
|
13
|
+
flex: '1',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const LoaderContainer = styled('div', {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
width: '100%',
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: '50%',
|
|
22
|
+
});
|
|
7
23
|
export interface PropTypes {
|
|
8
24
|
list: TokenWithAmount[];
|
|
9
25
|
type?: 'Source' | 'Destination';
|
|
@@ -13,6 +29,7 @@ export interface PropTypes {
|
|
|
13
29
|
multiSelect?: boolean;
|
|
14
30
|
onBack?: () => void;
|
|
15
31
|
selectedList?: TokenWithAmount[] | 'all';
|
|
32
|
+
loadingStatus: LoadingStatus;
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
const filterTokens = (list: TokenWithAmount[], searchedFor: string) =>
|
|
@@ -33,6 +50,7 @@ export function TokenSelector(props: PropTypes) {
|
|
|
33
50
|
multiSelect,
|
|
34
51
|
selectedList,
|
|
35
52
|
onBack,
|
|
53
|
+
loadingStatus,
|
|
36
54
|
} = props;
|
|
37
55
|
|
|
38
56
|
return (
|
|
@@ -43,16 +61,35 @@ export function TokenSelector(props: PropTypes) {
|
|
|
43
61
|
hasHeader={hasHeader}
|
|
44
62
|
onBack={onBack}
|
|
45
63
|
>
|
|
46
|
-
{(searchedFor) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
{(searchedFor) => {
|
|
65
|
+
const filteredTokens = filterTokens(list, searchedFor);
|
|
66
|
+
return (
|
|
67
|
+
<Container>
|
|
68
|
+
{loadingStatus === 'loading' && (
|
|
69
|
+
<LoaderContainer>
|
|
70
|
+
<Spinner size={24} />
|
|
71
|
+
</LoaderContainer>
|
|
72
|
+
)}
|
|
73
|
+
{loadingStatus === 'failed' && <LoadingFailedAlert />}
|
|
74
|
+
{loadingStatus === 'success' && (
|
|
75
|
+
<>
|
|
76
|
+
{filteredTokens.length ? (
|
|
77
|
+
<TokenList
|
|
78
|
+
searchedText={searchedFor}
|
|
79
|
+
list={filteredTokens}
|
|
80
|
+
selected={selected}
|
|
81
|
+
selectedList={selectedList}
|
|
82
|
+
multiSelect={multiSelect}
|
|
83
|
+
onChange={onChange}
|
|
84
|
+
/>
|
|
85
|
+
) : (
|
|
86
|
+
<NotFoundAlert catergory="Token" searchedFor={searchedFor} />
|
|
87
|
+
)}
|
|
88
|
+
</>
|
|
89
|
+
)}
|
|
90
|
+
</Container>
|
|
91
|
+
);
|
|
92
|
+
}}
|
|
56
93
|
</SecondaryPage>
|
|
57
94
|
);
|
|
58
95
|
}
|
|
@@ -42,7 +42,7 @@ export function Wallet(props: PropTypes) {
|
|
|
42
42
|
return (
|
|
43
43
|
<ExtendedButton
|
|
44
44
|
type={state === WalletState.CONNECTED ? 'primary' : undefined}
|
|
45
|
-
disabled={
|
|
45
|
+
disabled={state == WalletState.CONNECTING}
|
|
46
46
|
onClick={() => {
|
|
47
47
|
if (state === WalletState.NOT_INSTALLED) {
|
|
48
48
|
window.open(detectInstallLink(installLink), '_blank');
|
package/src/components/index.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentMeta } from '@storybook/react';
|
|
3
3
|
import { ConfirmSwap, PropTypes } from './ConfirmSwap';
|
|
4
|
-
import {
|
|
4
|
+
import { exampleFor5Wallets, wallets } from './mock';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: 'Containers/ConfirmSwap',
|
|
8
8
|
component: ConfirmSwap,
|
|
9
|
+
argTypes: {
|
|
10
|
+
requiredWallets: {
|
|
11
|
+
defaultValue: ['BSC', 'OSMOSIS'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
9
14
|
} as ComponentMeta<typeof ConfirmSwap>;
|
|
10
15
|
|
|
11
16
|
export const Main = (props: PropTypes) => (
|
|
12
|
-
<ConfirmSwap {...props}
|
|
17
|
+
<ConfirmSwap {...props} selectableWallets={wallets} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const With5Wallets = (props: PropTypes) => (
|
|
21
|
+
<ConfirmSwap {...props} selectableWallets={exampleFor5Wallets} />
|
|
13
22
|
);
|
|
@@ -1,125 +1,110 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Spacer } from '../../components';
|
|
3
|
-
import { Alert } from '../../components/Alert';
|
|
1
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { Alert, Spacer } from '../../components';
|
|
4
3
|
import { Button } from '../../components/Button';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { StepDetail } from '../../components/StepDetail';
|
|
4
|
+
import { SecondaryPage } from '../../components/SecondaryPage/SecondaryPage';
|
|
5
|
+
import { SelectableWalletList } from '../../components/SelectableWalletList';
|
|
8
6
|
import { Typography } from '../../components/Typography';
|
|
9
7
|
import { styled } from '../../theme';
|
|
10
|
-
import {
|
|
8
|
+
import { SelectableWallet } from '../../types';
|
|
11
9
|
|
|
12
10
|
const MainContainer = styled('div', {
|
|
13
|
-
|
|
11
|
+
overflowY: 'auto',
|
|
14
12
|
});
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
border: '1px dashed $foreground',
|
|
21
|
-
borderRadius: 'inherit',
|
|
22
|
-
});
|
|
23
|
-
export const SwapperContainer = styled('div', {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
marginLeft: '6px',
|
|
27
|
-
});
|
|
28
|
-
export const BodyError = styled('div', {
|
|
29
|
-
height: '100%',
|
|
30
|
-
display: 'flex',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
});
|
|
34
|
-
export const ErrorMsg = styled(Typography, {
|
|
35
|
-
color: '$error',
|
|
36
|
-
});
|
|
37
|
-
export const Fee = styled('div', {
|
|
38
|
-
display: 'flex',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
});
|
|
41
|
-
export const SwapperLogo = styled('img', {
|
|
42
|
-
width: '$16',
|
|
43
|
-
height: '$16',
|
|
44
|
-
});
|
|
45
|
-
export const RelativeContainer = styled('div', {
|
|
46
|
-
position: 'relative',
|
|
14
|
+
const Section = styled('div', {
|
|
15
|
+
paddingBottom: '$32',
|
|
16
|
+
marginBottom: '$32',
|
|
17
|
+
borderBottom: '1px solid $neutrals400',
|
|
47
18
|
});
|
|
48
19
|
|
|
49
|
-
|
|
20
|
+
const Footer = styled('div', {
|
|
50
21
|
display: 'flex',
|
|
51
22
|
alignItems: 'center',
|
|
52
23
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
backgroundColor: '$foreground',
|
|
57
|
-
borderRadius: '4px',
|
|
58
|
-
marginLeft: '$8',
|
|
59
|
-
});
|
|
60
|
-
export const ArrowDown = styled('div', {
|
|
61
|
-
width: '0px',
|
|
62
|
-
height: '0px',
|
|
63
|
-
borderLeft: '5px solid transparent',
|
|
64
|
-
borderRight: '5px solid transparent',
|
|
65
|
-
borderTop: '5px solid $foreground',
|
|
66
|
-
marginLeft: '$8',
|
|
67
|
-
});
|
|
68
|
-
export const UpdateIcon = styled(RetryIcon, {
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
right: '0',
|
|
24
|
+
|
|
25
|
+
const AlertContainer = styled('div', {
|
|
26
|
+
padding: '$16 0',
|
|
71
27
|
});
|
|
72
|
-
|
|
73
|
-
|
|
28
|
+
|
|
29
|
+
const ConfirmButton = styled(Button, {
|
|
30
|
+
marginTop: '$16',
|
|
74
31
|
});
|
|
75
32
|
|
|
76
|
-
const
|
|
77
|
-
|
|
33
|
+
const Container = styled('div', {
|
|
34
|
+
paddingBottom: '$24',
|
|
35
|
+
|
|
36
|
+
'.title': {
|
|
37
|
+
paddingBottom: '$8',
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
},
|
|
41
|
+
'.num': {
|
|
42
|
+
backgroundColor: '$neutrals300',
|
|
43
|
+
display: 'inline-flex',
|
|
44
|
+
width: '24px',
|
|
45
|
+
height: '24px',
|
|
46
|
+
color: '$neutrals800',
|
|
47
|
+
borderRadius: '50%',
|
|
48
|
+
fontSize: '$14',
|
|
49
|
+
border: '1px solid $neutrals400',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
},
|
|
78
53
|
});
|
|
79
54
|
|
|
80
55
|
const Alerts = styled('div', { paddingBottom: '$16' });
|
|
56
|
+
|
|
81
57
|
export interface PropTypes {
|
|
82
|
-
bestRoute: BestRouteWithFee | null;
|
|
83
|
-
onRefresh?: React.MouseEventHandler<SVGElement>;
|
|
84
|
-
confirmButtonTitle: string;
|
|
85
|
-
confirmButtonDisabled: boolean;
|
|
86
58
|
onBack: () => void;
|
|
87
59
|
onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
60
|
+
confirmDisabled?: boolean;
|
|
88
61
|
loading?: boolean;
|
|
62
|
+
requiredWallets: string[];
|
|
63
|
+
selectableWallets: SelectableWallet[];
|
|
64
|
+
onChange: (w: SelectableWallet) => void;
|
|
65
|
+
isExperimentalChain?: (wallet: string) => boolean;
|
|
66
|
+
handleConnectChain?: (wallet: string) => void;
|
|
67
|
+
previewInputs?: ReactNode;
|
|
68
|
+
previewRoutes?: ReactNode;
|
|
69
|
+
confirmButtonTitle: string;
|
|
89
70
|
errors?: ReactNode[];
|
|
90
71
|
warnings?: ReactNode[];
|
|
91
72
|
extraMessages?: ReactNode;
|
|
92
73
|
}
|
|
93
74
|
export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
|
|
94
75
|
const {
|
|
95
|
-
bestRoute,
|
|
96
76
|
onBack,
|
|
97
|
-
onConfirm,
|
|
98
77
|
loading,
|
|
78
|
+
onConfirm,
|
|
79
|
+
requiredWallets,
|
|
80
|
+
selectableWallets,
|
|
81
|
+
onChange,
|
|
82
|
+
confirmDisabled,
|
|
83
|
+
isExperimentalChain,
|
|
84
|
+
handleConnectChain,
|
|
85
|
+
confirmButtonTitle,
|
|
99
86
|
errors,
|
|
100
87
|
warnings,
|
|
101
88
|
extraMessages,
|
|
102
|
-
confirmButtonTitle,
|
|
103
|
-
confirmButtonDisabled,
|
|
104
89
|
} = props;
|
|
105
90
|
|
|
106
91
|
return (
|
|
107
92
|
<SecondaryPage
|
|
108
93
|
textField={false}
|
|
109
|
-
title="Swap"
|
|
94
|
+
title="Confirm Swap"
|
|
110
95
|
onBack={onBack}
|
|
111
96
|
Footer={
|
|
112
97
|
<Footer>
|
|
113
|
-
<
|
|
114
|
-
type="primary"
|
|
98
|
+
<ConfirmButton
|
|
115
99
|
fullWidth
|
|
116
100
|
loading={loading}
|
|
101
|
+
type="primary"
|
|
117
102
|
variant="contained"
|
|
118
103
|
onClick={onConfirm}
|
|
119
|
-
disabled={
|
|
104
|
+
disabled={confirmDisabled}
|
|
120
105
|
>
|
|
121
106
|
{confirmButtonTitle}
|
|
122
|
-
</
|
|
107
|
+
</ConfirmButton>
|
|
123
108
|
</Footer>
|
|
124
109
|
}
|
|
125
110
|
>
|
|
@@ -145,49 +130,50 @@ export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
|
|
|
145
130
|
))}
|
|
146
131
|
</Alerts>
|
|
147
132
|
</div>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
{props.previewInputs || props.previewRoutes ? (
|
|
134
|
+
<Section>
|
|
135
|
+
{props.previewInputs}
|
|
136
|
+
{!!props.previewRoutes ? (
|
|
137
|
+
<Spacer size={16} direction="vertical" />
|
|
138
|
+
) : null}
|
|
139
|
+
{props.previewRoutes}
|
|
140
|
+
</Section>
|
|
141
|
+
) : null}
|
|
142
|
+
|
|
143
|
+
{requiredWallets.map((wallet, index) => {
|
|
144
|
+
const list = selectableWallets.filter((w) => wallet === w.chain);
|
|
145
|
+
return (
|
|
146
|
+
<Container key={index}>
|
|
147
|
+
<div className="title">
|
|
148
|
+
<div className="num">{index + 1}</div>
|
|
149
|
+
<Spacer size={8} />
|
|
150
|
+
<Typography variant="body2">Your {wallet} Wallet</Typography>
|
|
151
|
+
</div>
|
|
152
|
+
{list.length === 0 && (
|
|
153
|
+
<>
|
|
154
|
+
<AlertContainer>
|
|
155
|
+
<Alert type="error">
|
|
156
|
+
You need to connect a compatible wallet with {wallet}
|
|
157
|
+
</Alert>
|
|
158
|
+
</AlertContainer>
|
|
159
|
+
{isExperimentalChain?.(wallet) && (
|
|
160
|
+
<Button
|
|
161
|
+
variant="contained"
|
|
162
|
+
type="primary"
|
|
163
|
+
align="grow"
|
|
164
|
+
onClick={() => handleConnectChain?.(wallet)}
|
|
165
|
+
>
|
|
166
|
+
{`Add ${wallet} chain to Cosmos wallets`}
|
|
167
|
+
</Button>
|
|
168
|
+
)}
|
|
169
|
+
</>
|
|
170
|
+
)}
|
|
171
|
+
{list.length != 0 && (
|
|
172
|
+
<SelectableWalletList list={list} onChange={onChange} />
|
|
162
173
|
)}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<div>
|
|
167
|
-
<Typography ml={4} variant="caption">
|
|
168
|
-
{swap.swapperType} from {swap.from.symbol} to{' '}
|
|
169
|
-
{swap.to.symbol} via {swap.swapperId}{' '}
|
|
170
|
-
</Typography>
|
|
171
|
-
<Fee>
|
|
172
|
-
<GasIcon />
|
|
173
|
-
<Typography ml={4} variant="caption">
|
|
174
|
-
${swap.feeInUsd} estimated gas fee
|
|
175
|
-
</Typography>
|
|
176
|
-
</Fee>
|
|
177
|
-
</div>
|
|
178
|
-
</SwapperContainer>
|
|
179
|
-
<Line />
|
|
180
|
-
{index + 1 === bestRoute.result?.swaps.length && <ArrowDown />}
|
|
181
|
-
<StepDetail
|
|
182
|
-
logo={swap.to.logo}
|
|
183
|
-
symbol={swap.to.symbol}
|
|
184
|
-
chainLogo={swap.to.blockchainLogo}
|
|
185
|
-
blockchain={swap.to.blockchain}
|
|
186
|
-
amount={swap.toAmount}
|
|
187
|
-
/>
|
|
188
|
-
</Fragment>
|
|
189
|
-
))}
|
|
190
|
-
</BestRouteContainer>
|
|
174
|
+
</Container>
|
|
175
|
+
);
|
|
176
|
+
})}
|
|
191
177
|
</MainContainer>
|
|
192
178
|
</SecondaryPage>
|
|
193
179
|
);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { WalletType } from '@rango-dev/wallets-shared';
|
|
1
3
|
import { RoutingResultType } from 'rango-sdk';
|
|
2
4
|
import { BestRouteType } from '../../types/swaps';
|
|
5
|
+
import { SelectableWallet } from '../../types';
|
|
3
6
|
|
|
4
7
|
export const bestRoute: BestRouteType = {
|
|
5
8
|
from: { blockchain: 'BSC', symbol: 'BNB', address: null },
|
|
@@ -14,10 +17,12 @@ export const bestRoute: BestRouteType = {
|
|
|
14
17
|
swapperId: 'AnySwap Aggregator',
|
|
15
18
|
swapperType: 'AGGREGATOR',
|
|
16
19
|
swapperLogo: 'https://api.rango.exchange/swappers/multichain.png',
|
|
20
|
+
|
|
17
21
|
from: {
|
|
18
22
|
symbol: 'BNB',
|
|
19
23
|
logo: 'https://api.rango.exchange/i/Y3v1KW',
|
|
20
24
|
blockchainLogo: 'https://api.rango.exchange/blockchains/binance.svg',
|
|
25
|
+
|
|
21
26
|
address: null,
|
|
22
27
|
blockchain: 'BSC',
|
|
23
28
|
decimals: 18,
|
|
@@ -28,6 +33,7 @@ export const bestRoute: BestRouteType = {
|
|
|
28
33
|
logo: 'https://api.rango.exchange/i/j9xgdC',
|
|
29
34
|
blockchainLogo:
|
|
30
35
|
'https://api.rango.exchange/blockchains/avax_cchain.svg',
|
|
36
|
+
|
|
31
37
|
address: '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab',
|
|
32
38
|
blockchain: 'AVAX_CCHAIN',
|
|
33
39
|
decimals: 18,
|
|
@@ -93,8 +99,8 @@ export const bestRoute: BestRouteType = {
|
|
|
93
99
|
symbol: 'WETH.E',
|
|
94
100
|
address: '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab',
|
|
95
101
|
},
|
|
96
|
-
expenseType: 'DECREASE_FROM_OUTPUT',
|
|
97
102
|
name: 'Network Fee',
|
|
103
|
+
expenseType: 'DECREASE_FROM_OUTPUT',
|
|
98
104
|
amount:
|
|
99
105
|
'0.00018619291780292721387591870688029381530892436558133340440690517425537109375',
|
|
100
106
|
},
|
|
@@ -141,6 +147,77 @@ export const bestRoute: BestRouteType = {
|
|
|
141
147
|
validationStatus: null,
|
|
142
148
|
missingBlockchains: [],
|
|
143
149
|
diagnosisMessages: [],
|
|
144
|
-
processingLimitReached: false,
|
|
145
150
|
walletNotSupportingFromBlockchain: false,
|
|
151
|
+
processingLimitReached: false,
|
|
146
152
|
};
|
|
153
|
+
|
|
154
|
+
export const wallets: SelectableWallet[] = [
|
|
155
|
+
{
|
|
156
|
+
walletType: WalletType.META_MASK,
|
|
157
|
+
address: '0x5423e28219d6d568dcf62a8134d623e6f4a1c2df',
|
|
158
|
+
image: 'https://app.rango.exchange/wallets/metamask.svg',
|
|
159
|
+
chain: 'BSC',
|
|
160
|
+
selected: false,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
walletType: WalletType.OKX,
|
|
164
|
+
address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
|
|
165
|
+
image: 'https://app.rango.exchange/wallets/okx.png',
|
|
166
|
+
chain: 'BSC',
|
|
167
|
+
selected: false,
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
{
|
|
171
|
+
walletType: WalletType.KEPLR,
|
|
172
|
+
address: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
173
|
+
image: 'https://app.rango.exchange/wallets/keplr.png',
|
|
174
|
+
chain: 'OSMOSIS',
|
|
175
|
+
selected: false,
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
export const exampleFor5Wallets: SelectableWallet[] = [
|
|
180
|
+
{
|
|
181
|
+
walletType: WalletType.META_MASK,
|
|
182
|
+
address: '0x5423e28219d6d568dcf62a8134d623e6f4a1c2df',
|
|
183
|
+
image: 'https://app.rango.exchange/wallets/metamask.svg',
|
|
184
|
+
selected: false,
|
|
185
|
+
chain: 'BSC',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
walletType: WalletType.OKX,
|
|
189
|
+
address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
|
|
190
|
+
image: 'https://app.rango.exchange/wallets/okx.png',
|
|
191
|
+
selected: false,
|
|
192
|
+
chain: 'BSC',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
walletType: WalletType.EXODUS,
|
|
196
|
+
address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
|
|
197
|
+
image: 'https://app.rango.exchange/wallets/exodus.png',
|
|
198
|
+
selected: false,
|
|
199
|
+
chain: 'BSC',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
walletType: WalletType.MATH,
|
|
203
|
+
address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
|
|
204
|
+
image: 'https://app.rango.exchange/wallets/math-wallet.png',
|
|
205
|
+
selected: false,
|
|
206
|
+
chain: 'BSC',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
walletType: WalletType.CLOVER,
|
|
210
|
+
address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
|
|
211
|
+
image: 'https://app.rango.exchange/wallets/clover.jpeg',
|
|
212
|
+
selected: false,
|
|
213
|
+
chain: 'BSC',
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
{
|
|
217
|
+
walletType: WalletType.KEPLR,
|
|
218
|
+
address: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
219
|
+
image: 'https://app.rango.exchange/wallets/keplr.png',
|
|
220
|
+
selected: false,
|
|
221
|
+
chain: 'OSMOSIS',
|
|
222
|
+
},
|
|
223
|
+
];
|