@rango-dev/ui 0.1.10-next.78 → 0.1.10-next.81
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/Alert/Alert.d.ts +2 -2
- package/dist/components/Alert/Alert.stories.d.ts +2 -1
- package/dist/components/BestRoute/BestRoute.d.ts +4 -1
- package/dist/components/SecondaryPage/SecondaryPage.d.ts +3 -5
- package/dist/components/SelectableWalletList/SelectableWalletList.d.ts +1 -1
- package/dist/components/Settings/Settings.d.ts +2 -0
- package/dist/components/TextField/TextField.stories.d.ts +1 -1
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +8 -4
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +4 -2
- package/dist/containers/History/types.d.ts +1 -0
- package/dist/helper/index.d.ts +0 -5
- package/dist/types/wallet.d.ts +8 -0
- package/dist/ui.cjs.development.js +301 -263
- 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 +301 -263
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Alert/Alert.tsx +5 -9
- package/src/components/BestRoute/BestRoute.tsx +55 -21
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -11
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +21 -20
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +3 -2
- package/src/components/Radio/Radio.tsx +1 -0
- package/src/components/SecondaryPage/SecondaryPage.tsx +5 -6
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
- package/src/components/Settings/Settings.tsx +26 -13
- package/src/components/SwapContainer/SwapContainer.tsx +1 -0
- package/src/components/Switch/Switch.tsx +1 -0
- package/src/components/TokenSelector/TokenSelector.tsx +3 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +92 -54
- package/src/containers/ConfirmWallets/ConfirmWallets.tsx +66 -62
- package/src/containers/History/History.tsx +3 -2
- package/src/containers/History/types.tsx +10 -1
- package/src/containers/SwapHistory/SwapHistory.tsx +87 -95
- package/src/helper/index.ts +1 -22
- package/src/types/wallet.ts +9 -0
- package/dist/containers/ConfirmWallets/types.d.ts +0 -9
- package/src/containers/ConfirmWallets/types.ts +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BestRouteResponse } from 'rango-sdk';
|
|
2
|
-
import React, { Fragment, PropsWithChildren } from 'react';
|
|
2
|
+
import React, { Fragment, PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
import { Alert } from '../../components/Alert';
|
|
4
4
|
import { Button } from '../../components/Button';
|
|
5
5
|
import { RetryIcon, GasIcon } from '../../components/Icon';
|
|
@@ -8,6 +8,10 @@ import { StepDetail } from '../../components/StepDetail';
|
|
|
8
8
|
import { Typography } from '../../components/Typography';
|
|
9
9
|
import { styled } from '../../theme';
|
|
10
10
|
|
|
11
|
+
const MainContainer = styled('div', {
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
});
|
|
14
|
+
|
|
11
15
|
export const Line = styled('div', {
|
|
12
16
|
width: '0',
|
|
13
17
|
marginLeft: '$12',
|
|
@@ -68,24 +72,38 @@ export const StyledUpdateIcon = styled(UpdateIcon, {
|
|
|
68
72
|
cursor: 'pointer',
|
|
69
73
|
});
|
|
70
74
|
|
|
75
|
+
const BestRouteContainer = styled('div', {
|
|
76
|
+
overflow: 'auto',
|
|
77
|
+
});
|
|
78
|
+
|
|
71
79
|
const Alerts = styled('div', { paddingBottom: '$16' });
|
|
72
80
|
|
|
73
81
|
export interface PropTypes {
|
|
74
82
|
bestRoute: BestRouteResponse | null;
|
|
83
|
+
onRefresh?: React.MouseEventHandler<SVGElement>;
|
|
84
|
+
confirmButtonTitle: string;
|
|
85
|
+
confirmButtonDisabled: boolean;
|
|
75
86
|
onBack: () => void;
|
|
76
87
|
onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
77
88
|
loading?: boolean;
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
errors?: ReactNode[];
|
|
90
|
+
warnings?: ReactNode[];
|
|
91
|
+
extraMessages?: ReactNode;
|
|
80
92
|
}
|
|
81
|
-
export function ConfirmSwap({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
|
|
94
|
+
const {
|
|
95
|
+
bestRoute,
|
|
96
|
+
onRefresh,
|
|
97
|
+
onBack,
|
|
98
|
+
onConfirm,
|
|
99
|
+
loading,
|
|
100
|
+
errors,
|
|
101
|
+
warnings,
|
|
102
|
+
extraMessages,
|
|
103
|
+
confirmButtonTitle,
|
|
104
|
+
confirmButtonDisabled,
|
|
105
|
+
} = props;
|
|
106
|
+
|
|
89
107
|
return (
|
|
90
108
|
<SecondaryPage
|
|
91
109
|
textField={false}
|
|
@@ -99,56 +117,76 @@ export function ConfirmSwap({
|
|
|
99
117
|
loading={loading}
|
|
100
118
|
variant="contained"
|
|
101
119
|
onClick={onConfirm}
|
|
120
|
+
disabled={confirmButtonDisabled}
|
|
102
121
|
>
|
|
103
|
-
|
|
122
|
+
{confirmButtonTitle}
|
|
104
123
|
</Button>
|
|
105
124
|
</Footer>
|
|
106
125
|
}
|
|
107
|
-
|
|
108
|
-
|
|
126
|
+
TopButton={<StyledUpdateIcon size={24} onClick={onRefresh} />}
|
|
127
|
+
>
|
|
128
|
+
<MainContainer>
|
|
129
|
+
<div>
|
|
130
|
+
{extraMessages || null}
|
|
109
131
|
<Alerts>
|
|
110
|
-
{error
|
|
111
|
-
|
|
132
|
+
{errors?.map((error, index) => (
|
|
133
|
+
<Alert type="error" key={index}>
|
|
134
|
+
{error}
|
|
135
|
+
</Alert>
|
|
136
|
+
))}
|
|
137
|
+
{/* {error && warnings && <Spacer direction="vertical" size={16} />} */}
|
|
138
|
+
{warnings?.map((warning, index) => (
|
|
139
|
+
<Alert type="warning" key={index}>
|
|
140
|
+
{warning}
|
|
141
|
+
</Alert>
|
|
142
|
+
))}
|
|
112
143
|
</Alerts>
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
</div>
|
|
145
|
+
<BestRouteContainer>
|
|
146
|
+
{bestRoute?.result?.swaps.map((swap, index) => (
|
|
147
|
+
<Fragment key={index}>
|
|
148
|
+
{index === 0 && (
|
|
149
|
+
<RelativeContainer>
|
|
150
|
+
<StepDetail
|
|
151
|
+
logo={swap.from.logo}
|
|
152
|
+
symbol={swap.from.symbol}
|
|
153
|
+
chainLogo={swap.from.blockchainLogo}
|
|
154
|
+
blockchain={swap.from.blockchain}
|
|
155
|
+
amount={swap.fromAmount}
|
|
156
|
+
/>
|
|
157
|
+
<Dot />
|
|
158
|
+
</RelativeContainer>
|
|
159
|
+
)}
|
|
160
|
+
<Line />
|
|
161
|
+
<SwapperContainer>
|
|
162
|
+
<SwapperLogo src={swap.swapperLogo} alt={swap.swapperId} />
|
|
163
|
+
<div>
|
|
164
|
+
<Typography ml={4} variant="caption">
|
|
165
|
+
{swap.swapperType} from {swap.from.symbol} to{' '}
|
|
166
|
+
{swap.to.symbol} via {swap.swapperId}{' '}
|
|
167
|
+
</Typography>
|
|
168
|
+
<Fee>
|
|
169
|
+
<GasIcon />
|
|
170
|
+
<Typography ml={4} variant="caption">
|
|
171
|
+
{parseFloat(swap.fee[0].amount).toFixed(6)} estimated gas
|
|
172
|
+
fee
|
|
173
|
+
</Typography>
|
|
174
|
+
</Fee>
|
|
175
|
+
</div>
|
|
176
|
+
</SwapperContainer>
|
|
177
|
+
<Line />
|
|
178
|
+
{index + 1 === bestRoute.result?.swaps.length && <ArrowDown />}
|
|
115
179
|
<StepDetail
|
|
116
|
-
logo={swap.
|
|
117
|
-
symbol={swap.
|
|
118
|
-
chainLogo={swap.
|
|
119
|
-
blockchain={swap.
|
|
120
|
-
amount={swap.
|
|
180
|
+
logo={swap.to.logo}
|
|
181
|
+
symbol={swap.to.symbol}
|
|
182
|
+
chainLogo={swap.to.blockchainLogo}
|
|
183
|
+
blockchain={swap.to.blockchain}
|
|
184
|
+
amount={swap.toAmount}
|
|
121
185
|
/>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
<SwapperLogo src={swap.swapperLogo} alt={swap.swapperId} />
|
|
128
|
-
<div>
|
|
129
|
-
<Typography ml={4} variant="caption">
|
|
130
|
-
{swap.swapperType} from {swap.from.symbol} to {swap.to.symbol}{' '}
|
|
131
|
-
via {swap.swapperId}{' '}
|
|
132
|
-
</Typography>
|
|
133
|
-
<Fee>
|
|
134
|
-
<GasIcon />
|
|
135
|
-
<Typography ml={4} variant="caption">
|
|
136
|
-
{parseFloat(swap.fee[0].amount).toFixed(6)} estimated gas fee
|
|
137
|
-
</Typography>
|
|
138
|
-
</Fee>
|
|
139
|
-
</div>
|
|
140
|
-
</SwapperContainer>
|
|
141
|
-
<Line />
|
|
142
|
-
{index + 1 === bestRoute.result?.swaps.length && <ArrowDown />}
|
|
143
|
-
<StepDetail
|
|
144
|
-
logo={swap.to.logo}
|
|
145
|
-
symbol={swap.to.symbol}
|
|
146
|
-
chainLogo={swap.to.blockchainLogo}
|
|
147
|
-
blockchain={swap.to.blockchain}
|
|
148
|
-
amount={swap.toAmount}
|
|
149
|
-
/>
|
|
150
|
-
</Fragment>
|
|
151
|
-
))}
|
|
152
|
-
/>
|
|
186
|
+
</Fragment>
|
|
187
|
+
))}
|
|
188
|
+
</BestRouteContainer>
|
|
189
|
+
</MainContainer>
|
|
190
|
+
</SecondaryPage>
|
|
153
191
|
);
|
|
154
192
|
}
|
|
@@ -5,9 +5,8 @@ import { Button } from '../../components/Button';
|
|
|
5
5
|
import { SecondaryPage } from '../../components/SecondaryPage/SecondaryPage';
|
|
6
6
|
import { SelectableWalletList } from '../../components/SelectableWalletList';
|
|
7
7
|
import { Typography } from '../../components/Typography';
|
|
8
|
-
import { decimalNumber } from '../../helper';
|
|
9
8
|
import { styled } from '../../theme';
|
|
10
|
-
import { SelectableWallet } from '
|
|
9
|
+
import { SelectableWallet } from '../../types';
|
|
11
10
|
|
|
12
11
|
const Footer = styled('div', {
|
|
13
12
|
display: 'flex',
|
|
@@ -18,8 +17,14 @@ const AlertContainer = styled('div', {
|
|
|
18
17
|
padding: '$16 0',
|
|
19
18
|
});
|
|
20
19
|
|
|
20
|
+
const ConfirmButton = styled(Button, {
|
|
21
|
+
marginTop: '$16',
|
|
22
|
+
});
|
|
23
|
+
|
|
21
24
|
export interface PropTypes {
|
|
22
25
|
swap: BestRouteResponse;
|
|
26
|
+
fromAmount: string;
|
|
27
|
+
toAmount: string;
|
|
23
28
|
onBack: () => void;
|
|
24
29
|
onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
25
30
|
confirmDisabled?: boolean;
|
|
@@ -30,24 +35,25 @@ export interface PropTypes {
|
|
|
30
35
|
isExperimentalChain?: (wallet: string) => boolean;
|
|
31
36
|
handleConnectChain?: (wallet: string) => void;
|
|
32
37
|
}
|
|
33
|
-
export function ConfirmWallets({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
export function ConfirmWallets(props: PropsWithChildren<PropTypes>) {
|
|
39
|
+
const {
|
|
40
|
+
onBack,
|
|
41
|
+
loading,
|
|
42
|
+
onConfirm,
|
|
43
|
+
swap,
|
|
44
|
+
requiredWallets,
|
|
45
|
+
selectableWallets,
|
|
46
|
+
onChange,
|
|
47
|
+
confirmDisabled,
|
|
48
|
+
isExperimentalChain,
|
|
49
|
+
handleConnectChain,
|
|
50
|
+
fromAmount,
|
|
51
|
+
toAmount,
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
45
54
|
const firstStep = swap.result?.swaps[0];
|
|
46
55
|
const lastStep = swap.result?.swaps[swap.result?.swaps.length - 1];
|
|
47
56
|
|
|
48
|
-
const fromAmount = decimalNumber(firstStep?.fromAmount, 3);
|
|
49
|
-
const toAmount = decimalNumber(lastStep?.toAmount, 3);
|
|
50
|
-
|
|
51
57
|
return (
|
|
52
58
|
<SecondaryPage
|
|
53
59
|
textField={false}
|
|
@@ -55,7 +61,7 @@ export function ConfirmWallets({
|
|
|
55
61
|
onBack={onBack}
|
|
56
62
|
Footer={
|
|
57
63
|
<Footer>
|
|
58
|
-
<
|
|
64
|
+
<ConfirmButton
|
|
59
65
|
fullWidth
|
|
60
66
|
loading={loading}
|
|
61
67
|
type="primary"
|
|
@@ -64,51 +70,49 @@ export function ConfirmWallets({
|
|
|
64
70
|
disabled={confirmDisabled}
|
|
65
71
|
>
|
|
66
72
|
Confirm
|
|
67
|
-
</
|
|
73
|
+
</ConfirmButton>
|
|
68
74
|
</Footer>
|
|
69
75
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{list
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
/>
|
|
76
|
+
>
|
|
77
|
+
<>
|
|
78
|
+
<Typography variant="h6" mb={12}>
|
|
79
|
+
Confirm swap {fromAmount} {firstStep?.from.symbol} (
|
|
80
|
+
{firstStep?.from.blockchain}) to {toAmount} {lastStep?.to.symbol} (on
|
|
81
|
+
{lastStep?.to.blockchain})
|
|
82
|
+
</Typography>
|
|
83
|
+
{requiredWallets.map((wallet, index) => {
|
|
84
|
+
const list = selectableWallets.filter((w) => wallet === w.chain);
|
|
85
|
+
return (
|
|
86
|
+
<div key={index}>
|
|
87
|
+
<Typography variant="body2" mb={12} mt={12}>
|
|
88
|
+
{index + 1}) Your {wallet} Wallet
|
|
89
|
+
</Typography>
|
|
90
|
+
{list.length === 0 && (
|
|
91
|
+
<>
|
|
92
|
+
<AlertContainer>
|
|
93
|
+
<Alert type="error">
|
|
94
|
+
<Typography variant="body2">{`You should connect a ${wallet} supported wallet`}</Typography>
|
|
95
|
+
</Alert>
|
|
96
|
+
</AlertContainer>
|
|
97
|
+
{isExperimentalChain?.(wallet) && (
|
|
98
|
+
<Button
|
|
99
|
+
variant="contained"
|
|
100
|
+
type="primary"
|
|
101
|
+
align="grow"
|
|
102
|
+
onClick={() => handleConnectChain?.(wallet)}
|
|
103
|
+
>
|
|
104
|
+
{`Add ${wallet} chain to Cosmos wallets`}
|
|
105
|
+
</Button>
|
|
106
|
+
)}
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
109
|
+
{list.length != 0 && (
|
|
110
|
+
<SelectableWalletList list={list} onChange={onChange} />
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
})}
|
|
115
|
+
</>
|
|
116
|
+
</SecondaryPage>
|
|
113
117
|
);
|
|
114
118
|
}
|
|
@@ -79,7 +79,8 @@ export function History({
|
|
|
79
79
|
textField={true}
|
|
80
80
|
textFieldPlaceholder="Search By Blockchain Or Token"
|
|
81
81
|
title="History"
|
|
82
|
-
|
|
82
|
+
>
|
|
83
|
+
{(searchedFor) => {
|
|
83
84
|
const filterSwaps = filteredHistory(list, searchedFor);
|
|
84
85
|
return filterSwaps.length ? (
|
|
85
86
|
<SwapsGroup list={filterSwaps} onSwapClick={onSwapClick} />
|
|
@@ -89,6 +90,6 @@ export function History({
|
|
|
89
90
|
</BodyError>
|
|
90
91
|
);
|
|
91
92
|
}}
|
|
92
|
-
|
|
93
|
+
</SecondaryPage>
|
|
93
94
|
);
|
|
94
95
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CosmosTransaction,
|
|
3
|
+
EvmTransaction,
|
|
4
|
+
SimulationResult,
|
|
5
|
+
SolanaTransaction,
|
|
6
|
+
SwapExplorerUrl,
|
|
7
|
+
SwapperStatusStep,
|
|
8
|
+
Transfer,
|
|
9
|
+
} from 'rango-sdk';
|
|
2
10
|
import {
|
|
3
11
|
MessageSeverity,
|
|
4
12
|
PendingSwapNetworkStatus,
|
|
@@ -28,6 +36,7 @@ export type PendingSwapStep = {
|
|
|
28
36
|
swapperId: string;
|
|
29
37
|
swapperLogo: string;
|
|
30
38
|
swapperType: string;
|
|
39
|
+
feeInUsd: string;
|
|
31
40
|
expectedOutputAmountHumanReadable: string | null;
|
|
32
41
|
startTransactionTime: number;
|
|
33
42
|
outputAmount: string;
|
|
@@ -63,103 +63,95 @@ export function SwapHistory(props: PropTypes) {
|
|
|
63
63
|
const { pendingSwap, onBack } = props;
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
|
-
<SecondaryPage
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
<SecondaryPage title="History" textField={false} onBack={onBack}>
|
|
67
|
+
<>
|
|
68
|
+
{pendingSwap?.steps.map((step, index) => (
|
|
69
|
+
<Fragment key={index}>
|
|
70
|
+
{index === 0 && (
|
|
71
|
+
<RelativeContainer>
|
|
72
|
+
<StepDetail
|
|
73
|
+
logo={step.fromLogo}
|
|
74
|
+
symbol={step.fromSymbol}
|
|
75
|
+
chainLogo={step.fromBlockchainLogo}
|
|
76
|
+
blockchain={step.fromBlockchain}
|
|
77
|
+
amount={pendingSwap.inputAmount}
|
|
78
|
+
/>
|
|
79
|
+
<Dot />
|
|
80
|
+
</RelativeContainer>
|
|
81
|
+
)}
|
|
82
|
+
<Line />
|
|
83
|
+
<SwapperContainer>
|
|
84
|
+
<SwapperLogo src={step.swapperLogo} alt={step.swapperId} />
|
|
85
|
+
<div>
|
|
86
|
+
<Typography ml={4} variant="caption">
|
|
87
|
+
{step.swapperType} from {step.fromSymbol} to {step.toSymbol}
|
|
88
|
+
via {step.swapperId}
|
|
89
|
+
</Typography>
|
|
90
|
+
<Fee>
|
|
91
|
+
<GasIcon />
|
|
90
92
|
<Typography ml={4} variant="caption">
|
|
91
|
-
{step.
|
|
92
|
-
via {step.swapperId}
|
|
93
|
+
{step.feeInUsd} estimated gas fee
|
|
93
94
|
</Typography>
|
|
94
|
-
|
|
95
|
-
<GasIcon />
|
|
96
|
-
<Typography ml={4} variant="caption">
|
|
97
|
-
{/* {parseFloat(step.fee[0].amount).toFixed(6)} estimated gas */}
|
|
98
|
-
fee
|
|
99
|
-
</Typography>
|
|
100
|
-
</Fee>
|
|
101
|
-
</div>
|
|
102
|
-
</SwapperContainer>
|
|
103
|
-
<div
|
|
104
|
-
style={{
|
|
105
|
-
display: 'flex',
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
<InternalDetailsContainer>
|
|
109
|
-
<Line />
|
|
110
|
-
{!!step.explorerUrl && (
|
|
111
|
-
<div>
|
|
112
|
-
{step.explorerUrl.map((item, index) => (
|
|
113
|
-
<InternalDetail key={index}>
|
|
114
|
-
<DescriptionContainer>
|
|
115
|
-
<CheckCircleIcon color="success" />
|
|
116
|
-
<Description variant="body2">
|
|
117
|
-
{!item.description ? (
|
|
118
|
-
<b>View transaction</b>
|
|
119
|
-
) : (
|
|
120
|
-
<b>
|
|
121
|
-
{item.description
|
|
122
|
-
.substring(0, 1)
|
|
123
|
-
.toUpperCase()}
|
|
124
|
-
{item.description.substring(1)}
|
|
125
|
-
</b>
|
|
126
|
-
)}
|
|
127
|
-
</Description>
|
|
128
|
-
</DescriptionContainer>
|
|
129
|
-
<StyledAnchor
|
|
130
|
-
href={item.url}
|
|
131
|
-
target="_blank"
|
|
132
|
-
rel="noreferrer"
|
|
133
|
-
key={index}
|
|
134
|
-
>
|
|
135
|
-
TX-Link
|
|
136
|
-
</StyledAnchor>
|
|
137
|
-
</InternalDetail>
|
|
138
|
-
))}
|
|
139
|
-
{step.status === 'failed' && (
|
|
140
|
-
<InternalDetail>
|
|
141
|
-
<DescriptionContainer>
|
|
142
|
-
<InfoCircleIcon color="error" />
|
|
143
|
-
<Error variant="body2">Step failed</Error>
|
|
144
|
-
</DescriptionContainer>
|
|
145
|
-
</InternalDetail>
|
|
146
|
-
)}
|
|
147
|
-
</div>
|
|
148
|
-
)}
|
|
149
|
-
</InternalDetailsContainer>
|
|
95
|
+
</Fee>
|
|
150
96
|
</div>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
97
|
+
</SwapperContainer>
|
|
98
|
+
<div
|
|
99
|
+
style={{
|
|
100
|
+
display: 'flex',
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<InternalDetailsContainer>
|
|
104
|
+
<Line />
|
|
105
|
+
{!!step.explorerUrl && (
|
|
106
|
+
<div>
|
|
107
|
+
{step.explorerUrl.map((item, index) => (
|
|
108
|
+
<InternalDetail key={index}>
|
|
109
|
+
<DescriptionContainer>
|
|
110
|
+
<CheckCircleIcon color="success" />
|
|
111
|
+
<Description variant="body2">
|
|
112
|
+
{!item.description ? (
|
|
113
|
+
<b>View transaction</b>
|
|
114
|
+
) : (
|
|
115
|
+
<b>
|
|
116
|
+
{item.description.substring(0, 1).toUpperCase()}
|
|
117
|
+
{item.description.substring(1)}
|
|
118
|
+
</b>
|
|
119
|
+
)}
|
|
120
|
+
</Description>
|
|
121
|
+
</DescriptionContainer>
|
|
122
|
+
<StyledAnchor
|
|
123
|
+
href={item.url}
|
|
124
|
+
target="_blank"
|
|
125
|
+
rel="noreferrer"
|
|
126
|
+
key={index}
|
|
127
|
+
>
|
|
128
|
+
TX-Link
|
|
129
|
+
</StyledAnchor>
|
|
130
|
+
</InternalDetail>
|
|
131
|
+
))}
|
|
132
|
+
{step.status === 'failed' && (
|
|
133
|
+
<InternalDetail>
|
|
134
|
+
<DescriptionContainer>
|
|
135
|
+
<InfoCircleIcon color="error" />
|
|
136
|
+
<Error variant="body2">Step failed</Error>
|
|
137
|
+
</DescriptionContainer>
|
|
138
|
+
</InternalDetail>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
</InternalDetailsContainer>
|
|
143
|
+
</div>
|
|
144
|
+
{index + 1 === pendingSwap.steps.length && <ArrowDown />}
|
|
145
|
+
<StepDetail
|
|
146
|
+
logo={step.toLogo}
|
|
147
|
+
symbol={step.toSymbol}
|
|
148
|
+
chainLogo={step.toBlockchainLogo}
|
|
149
|
+
blockchain={step.toBlockchain}
|
|
150
|
+
amount={step.outputAmount}
|
|
151
|
+
/>
|
|
152
|
+
</Fragment>
|
|
153
|
+
))}
|
|
154
|
+
</>
|
|
155
|
+
</SecondaryPage>
|
|
164
156
|
);
|
|
165
157
|
}
|
package/src/helper/index.ts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import { BestRouteResponse } from 'rango-sdk';
|
|
2
|
-
|
|
3
|
-
export const secondsToString = (s: number): string => {
|
|
4
|
-
const minutes = parseInt((s / 60).toString()).toString();
|
|
5
|
-
return `${minutes}`;
|
|
6
|
-
};
|
|
7
|
-
export const totalArrivalTime = (data: BestRouteResponse) =>
|
|
8
|
-
data?.result?.swaps?.reduce((a, b) => a + b.estimatedTimeInSeconds, 0) || 0;
|
|
9
|
-
|
|
10
|
-
export const rawFees = (data: BestRouteResponse): string =>
|
|
11
|
-
(
|
|
12
|
-
data?.result?.swaps?.flatMap((s) =>
|
|
13
|
-
s.fee.map((f) => ({ swapperId: s.swapperId, fee: f }))
|
|
14
|
-
) || []
|
|
15
|
-
)
|
|
16
|
-
.reduce((partialSum, a) => partialSum + parseFloat(a.fee.amount), 0)
|
|
17
|
-
.toFixed(3);
|
|
18
|
-
|
|
19
|
-
export const decimalNumber = (number = '0', toFixed: number) =>
|
|
20
|
-
parseFloat(number).toFixed(toFixed);
|
|
21
|
-
|
|
22
1
|
export const containsText = (text: string, searchText: string) =>
|
|
23
|
-
text.toLowerCase().
|
|
2
|
+
text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
|
package/src/types/wallet.ts
CHANGED