@rango-dev/widget-embedded 0.11.1-next.3 → 0.12.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Wallets.d.ts +1 -1
  3. package/dist/Wallets.d.ts.map +1 -1
  4. package/dist/components/Layout.d.ts.map +1 -1
  5. package/dist/components/PercentageChange.d.ts +9 -0
  6. package/dist/components/PercentageChange.d.ts.map +1 -0
  7. package/dist/components/RoutesOverview.d.ts +120 -0
  8. package/dist/components/RoutesOverview.d.ts.map +1 -0
  9. package/dist/components/SwapDetailsPlaceholder.d.ts +120 -0
  10. package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -0
  11. package/dist/components/SwitchFromAndTo.d.ts +3 -2
  12. package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
  13. package/dist/components/TokenInfo.d.ts +18 -0
  14. package/dist/components/TokenInfo.d.ts.map +1 -0
  15. package/dist/components/TokenPreview.d.ts +21 -0
  16. package/dist/components/TokenPreview.d.ts.map +1 -0
  17. package/dist/hooks/useWalletProviders.d.ts +1 -1
  18. package/dist/hooks/useWalletProviders.d.ts.map +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +4 -4
  23. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  24. package/dist/pages/Home.d.ts.map +1 -1
  25. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  26. package/dist/types/config.d.ts +1 -1
  27. package/dist/types/config.d.ts.map +1 -1
  28. package/dist/utils/numbers.d.ts.map +1 -1
  29. package/dist/utils/providers.d.ts +1 -1
  30. package/dist/utils/providers.d.ts.map +1 -1
  31. package/package.json +8 -8
  32. package/src/QueueManager.tsx +1 -1
  33. package/src/Wallets.tsx +2 -2
  34. package/src/components/AppRouter.tsx +1 -1
  35. package/src/components/Layout.tsx +66 -13
  36. package/src/components/PercentageChange.tsx +33 -0
  37. package/src/components/RoutesOverview.tsx +57 -0
  38. package/src/components/SwapDetailsPlaceholder.tsx +47 -0
  39. package/src/components/SwitchFromAndTo.tsx +4 -34
  40. package/src/components/TokenInfo.tsx +329 -0
  41. package/src/components/TokenPreview.tsx +187 -0
  42. package/src/hooks/useWalletProviders.ts +1 -1
  43. package/src/index.ts +1 -1
  44. package/src/languages/en.json +14 -0
  45. package/src/languages/tr.json +11 -0
  46. package/src/pages/ConfirmSwapPage.tsx +10 -21
  47. package/src/pages/Home.tsx +144 -101
  48. package/src/pages/SwapDetailsPage.tsx +3 -6
  49. package/src/pages/WalletsPage.tsx +1 -1
  50. package/src/types/config.ts +1 -1
  51. package/src/utils/numbers.ts +0 -2
  52. package/src/utils/providers.ts +1 -1
  53. package/src/utils/wallets.ts +1 -1
@@ -0,0 +1,329 @@
1
+ import React from 'react';
2
+ import {
3
+ AngleDownIcon,
4
+ Button,
5
+ InfoCircleIcon,
6
+ styled,
7
+ TextField,
8
+ Typography,
9
+ Image,
10
+ Divider,
11
+ } from '@rango-dev/ui';
12
+ import { useMetaStore } from '../store/meta';
13
+ import { BlockchainMeta, Token } from 'rango-sdk';
14
+ import { useNavigate } from 'react-router-dom';
15
+ import { useBestRouteStore } from '../store/bestRoute';
16
+ import { numberToString } from '../utils/numbers';
17
+ import BigNumber from 'bignumber.js';
18
+ import { getBalanceFromWallet } from '../utils/wallets';
19
+ import { useWalletsStore } from '../store/wallets';
20
+ import { Trans } from '@lingui/react';
21
+ import { i18n } from '@lingui/core';
22
+ import { PercentageChange } from './PercentageChange';
23
+
24
+ type PropTypes = (
25
+ | {
26
+ type: 'From';
27
+ inputAmount: string;
28
+ onAmountChange: (amount: string) => void;
29
+ }
30
+ | {
31
+ type: 'To';
32
+ outputAmount: BigNumber | null;
33
+ outputUsdValue: BigNumber | null;
34
+ }
35
+ ) & { chain: BlockchainMeta | null; token: Token | null };
36
+
37
+ const Box = styled('div', {
38
+ display: 'flex',
39
+ flexDirection: 'column',
40
+ width: '100%',
41
+ overflow: 'hidden',
42
+ });
43
+
44
+ const Container = styled('div', {
45
+ boxSizing: 'border-box',
46
+ borderRadius: '$5',
47
+ padding: '$8 $16 $16 $16',
48
+
49
+ variants: {
50
+ type: {
51
+ filled: {
52
+ backgroundColor: '$neutral100',
53
+ },
54
+ outlined: {
55
+ border: '1px solid $neutral100',
56
+ backgroundColor: '$surface',
57
+ },
58
+ },
59
+ },
60
+
61
+ defaultVariants: {
62
+ type: 'filled',
63
+ },
64
+
65
+ '.head': {
66
+ display: 'flex',
67
+ justifyContent: 'space-between',
68
+ alignItems: 'center',
69
+ minHeight: '32px',
70
+ },
71
+ '.form': {
72
+ display: 'flex',
73
+ width: '100%',
74
+ padding: '$2 0',
75
+ '.selectors': {
76
+ width: '35%',
77
+
78
+ '._text': {
79
+ whiteSpace: 'nowrap',
80
+ overflow: 'hidden',
81
+ textOverflow: 'ellipsis',
82
+ },
83
+ },
84
+ '.amount': {
85
+ width: '30%',
86
+ },
87
+ },
88
+ '.output-usd': {
89
+ display: 'flex',
90
+ div: {
91
+ display: 'flex',
92
+ paddingLeft: '$8',
93
+ },
94
+ },
95
+ });
96
+
97
+ const Options = styled('div', {
98
+ display: 'flex',
99
+ justifyContent: 'flex-end',
100
+
101
+ '.balance': {
102
+ display: 'flex',
103
+ alignItems: 'center',
104
+ },
105
+ });
106
+
107
+ const ImagePlaceholder = styled('span', {
108
+ width: '24px',
109
+ height: '24px',
110
+ backgroundColor: '$neutral100',
111
+ borderRadius: '99999px',
112
+ });
113
+
114
+ const OutputContainer = styled('div', {
115
+ windth: '100%',
116
+ height: '$48',
117
+ borderRadius: '$5',
118
+ backgroundColor: '$surface',
119
+ border: '1px solid transparent',
120
+ position: 'relative',
121
+ display: 'flex',
122
+ alignItems: 'center',
123
+ paddingLeft: '$8',
124
+ paddingRight: '$8',
125
+ });
126
+
127
+ export function TokenInfo(props: PropTypes) {
128
+ const { type, chain, token } = props;
129
+ const loadingStatus = useMetaStore.use.loadingStatus();
130
+ const fromChain = useBestRouteStore.use.fromChain();
131
+ const toChain = useBestRouteStore.use.toChain();
132
+ const inputUsdValue = useBestRouteStore.use.inputUsdValue();
133
+ const fromToken = useBestRouteStore.use.fromToken();
134
+ const setInputAmount = useBestRouteStore.use.setInputAmount();
135
+ const bestRoute = useBestRouteStore.use.bestRoute();
136
+ const inputAmount = useBestRouteStore.use.inputAmount();
137
+ const connectedWallets = useWalletsStore.use.connectedWallets();
138
+ const fetchingBestRoute = useBestRouteStore.use.loading();
139
+ const navigate = useNavigate();
140
+
141
+ const tokenBalance =
142
+ !!fromChain && !!fromToken
143
+ ? numberToString(
144
+ getBalanceFromWallet(
145
+ connectedWallets,
146
+ fromChain?.name,
147
+ fromToken?.symbol,
148
+ fromToken?.address
149
+ )?.amount || '0',
150
+ 8
151
+ )
152
+ : '0';
153
+
154
+ const tokenBalanceReal =
155
+ !!fromChain && !!fromToken
156
+ ? numberToString(
157
+ getBalanceFromWallet(
158
+ connectedWallets,
159
+ fromChain?.name,
160
+ fromToken?.symbol,
161
+ fromToken?.address
162
+ )?.amount || '0',
163
+ getBalanceFromWallet(
164
+ connectedWallets,
165
+ fromChain?.name,
166
+ fromToken?.symbol,
167
+ fromToken?.address
168
+ )?.decimal
169
+ )
170
+ : '0';
171
+
172
+ const ItemSuffix = (
173
+ <div
174
+ style={{
175
+ display: 'flex',
176
+ justifyContent: 'center',
177
+ alignItems: 'center',
178
+ }}>
179
+ {loadingStatus === 'failed' && <InfoCircleIcon color="error" size={24} />}
180
+ <AngleDownIcon />
181
+ </div>
182
+ );
183
+
184
+ return (
185
+ <Box>
186
+ <Container type={props.type === 'From' ? 'filled' : 'outlined'}>
187
+ <div className="head">
188
+ <Typography variant="body2" color="neutral800">
189
+ {type === 'From' ? (
190
+ <Trans id="swap from" message="From" />
191
+ ) : (
192
+ <Trans id="swap to" message="To" />
193
+ )}
194
+ </Typography>
195
+ {props.type === 'From' ? (
196
+ <Options>
197
+ <div
198
+ className="balance"
199
+ onClick={() => {
200
+ if (tokenBalance !== '0')
201
+ setInputAmount(tokenBalanceReal.split(',').join(''));
202
+ }}>
203
+ <Typography variant="body3" color="neutral600">
204
+ {i18n.t('Balance')}: {tokenBalance} {fromToken?.symbol || ''}
205
+ </Typography>
206
+ <Divider size={4} />
207
+ <Button type="primary" variant="ghost" size="compact">
208
+ <Trans id="maximum amount of asset" message="Max" />
209
+ </Button>
210
+ </div>
211
+ </Options>
212
+ ) : (
213
+ <div className="output-usd">
214
+ <PercentageChange
215
+ inputUsdValue={inputUsdValue}
216
+ outputUsdValue={props.outputUsdValue}
217
+ />
218
+ <div>
219
+ <Typography
220
+ variant="caption"
221
+ color="neutral600">{`$${numberToString(
222
+ props.outputUsdValue
223
+ )}`}</Typography>
224
+ </div>
225
+ </div>
226
+ )}
227
+ </div>
228
+ <div className="form">
229
+ <Button
230
+ className="selectors"
231
+ onClick={() => {
232
+ navigate(`${props.type.toLowerCase()}-chain`);
233
+ }}
234
+ variant="outlined"
235
+ disabled={loadingStatus === 'failed'}
236
+ loading={loadingStatus === 'loading'}
237
+ prefix={
238
+ loadingStatus === 'success' && chain ? (
239
+ <Image src={chain.logo} size={24} />
240
+ ) : (
241
+ <ImagePlaceholder />
242
+ )
243
+ }
244
+ suffix={ItemSuffix}
245
+ align="start"
246
+ size="large">
247
+ {loadingStatus === 'success' && chain
248
+ ? chain.displayName
249
+ : i18n.t('Chain')}
250
+ </Button>
251
+ <Divider size={12} direction="horizontal" />
252
+ <Button
253
+ className="selectors"
254
+ onClick={() => {
255
+ navigate(`${props.type.toLowerCase()}-token`);
256
+ }}
257
+ variant="outlined"
258
+ disabled={
259
+ loadingStatus === 'failed' ||
260
+ (type === 'From' && !fromChain) ||
261
+ (type === 'To' && !toChain)
262
+ }
263
+ loading={loadingStatus === 'loading'}
264
+ prefix={
265
+ loadingStatus === 'success' && token ? (
266
+ <Image src={token.image} size={24} />
267
+ ) : (
268
+ <ImagePlaceholder />
269
+ )
270
+ }
271
+ suffix={ItemSuffix}
272
+ size="large"
273
+ align="start">
274
+ {loadingStatus === 'success' && token
275
+ ? token.symbol
276
+ : i18n.t('Token')}
277
+ </Button>
278
+ <Divider size={12} direction="horizontal" />
279
+ <div className="amount">
280
+ {props.type === 'From' ? (
281
+ <TextField
282
+ type="number"
283
+ size="large"
284
+ autoFocus
285
+ placeholder="0"
286
+ style={{
287
+ position: 'relative',
288
+ backgroundColor: '$background !important',
289
+ }}
290
+ suffix={
291
+ <span
292
+ style={{
293
+ position: 'absolute',
294
+ right: '4px',
295
+ bottom: '2px',
296
+ }}>
297
+ <Typography
298
+ variant="caption"
299
+ color="neutral800">{`$${numberToString(
300
+ inputUsdValue
301
+ )}`}</Typography>
302
+ </span>
303
+ }
304
+ value={props.inputAmount || ''}
305
+ min={0}
306
+ onChange={
307
+ props.type === 'From'
308
+ ? (event) => {
309
+ props.onAmountChange(event.target.value);
310
+ }
311
+ : undefined
312
+ }
313
+ />
314
+ ) : (
315
+ <OutputContainer>
316
+ <Typography variant="h4">
317
+ {fetchingBestRoute && '?'}
318
+ {!!bestRoute?.result &&
319
+ `≈ ${numberToString(props.outputAmount)}`}
320
+ {(!inputAmount || inputAmount === '0') && '0'}
321
+ </Typography>
322
+ </OutputContainer>
323
+ )}
324
+ </div>
325
+ </div>
326
+ </Container>
327
+ </Box>
328
+ );
329
+ }
@@ -0,0 +1,187 @@
1
+ import React, { ReactNode } from 'react';
2
+ import {
3
+ Button,
4
+ InfoCircleIcon,
5
+ styled,
6
+ Typography,
7
+ Divider,
8
+ Image,
9
+ } from '@rango-dev/ui';
10
+ import { LoadingStatus } from '../store/meta';
11
+ import { i18n } from '@lingui/core';
12
+ import BigNumber from 'bignumber.js';
13
+ import { numberToString } from '../utils/numbers';
14
+
15
+ const Box = styled('div', {
16
+ display: 'flex',
17
+ flexDirection: 'column',
18
+ width: '100%',
19
+ overflow: 'hidden',
20
+ });
21
+
22
+ const Container = styled('div', {
23
+ boxSizing: 'border-box',
24
+ borderRadius: '$5',
25
+ padding: '$8 $16 $16 $16',
26
+
27
+ variants: {
28
+ type: {
29
+ filled: {
30
+ backgroundColor: '$neutral100',
31
+ },
32
+ outlined: {
33
+ border: '1px solid $neutral100',
34
+ },
35
+ },
36
+ },
37
+
38
+ defaultVariants: {
39
+ type: 'filled',
40
+ },
41
+
42
+ '.head': {
43
+ display: 'flex',
44
+ justifyContent: 'space-between',
45
+ alignItems: 'center',
46
+ minHeight: '32px',
47
+ '.usd-value': {
48
+ paddingLeft: '$8',
49
+ },
50
+ },
51
+ '.form': {
52
+ display: 'flex',
53
+ width: '100%',
54
+ padding: '$2 0',
55
+ '.selectors': {
56
+ width: '35%',
57
+
58
+ '._text': {
59
+ whiteSpace: 'nowrap',
60
+ overflow: 'hidden',
61
+ textOverflow: 'ellipsis',
62
+ },
63
+ },
64
+ '.amount': {
65
+ width: '30%',
66
+ },
67
+ },
68
+ });
69
+
70
+ const ImagePlaceholder = styled('span', {
71
+ width: '24px',
72
+ height: '24px',
73
+ backgroundColor: '$neutral100',
74
+ borderRadius: '99999px',
75
+ });
76
+
77
+ const OutputContainer = styled('div', {
78
+ windth: '100%',
79
+ height: '$48',
80
+ borderRadius: '$5',
81
+ backgroundColor: '$surface',
82
+ border: '1px solid transparent',
83
+ position: 'relative',
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ paddingLeft: '$8',
87
+ paddingRight: '$8',
88
+ });
89
+
90
+ interface PropTypes {
91
+ label: string;
92
+ amount: string;
93
+ usdValue: BigNumber | null;
94
+ loadingStatus: LoadingStatus;
95
+ chain: {
96
+ displayName: string;
97
+ logo: string;
98
+ };
99
+ token: {
100
+ symbol: string;
101
+ image: string;
102
+ };
103
+ percentageChange?: ReactNode;
104
+ }
105
+
106
+ export function TokenPreview(props: PropTypes) {
107
+ const { chain, token, loadingStatus, percentageChange } = props;
108
+
109
+ const ItemSuffix = (
110
+ <div
111
+ style={{
112
+ display: 'flex',
113
+ justifyContent: 'center',
114
+ alignItems: 'center',
115
+ }}>
116
+ {loadingStatus === 'failed' && <InfoCircleIcon color="error" size={24} />}
117
+ </div>
118
+ );
119
+
120
+ return (
121
+ <Box>
122
+ <Container type={'outlined'}>
123
+ <div className="head">
124
+ <Typography variant="body2" color="neutral800">
125
+ {props.label}
126
+ </Typography>
127
+ <div>
128
+ {percentageChange}
129
+ {props.usdValue && (
130
+ <Typography
131
+ variant="caption"
132
+ color="neutral600"
133
+ className="usd-value">{`$${numberToString(
134
+ props.usdValue
135
+ )}`}</Typography>
136
+ )}
137
+ </div>
138
+ </div>
139
+ <div className="form">
140
+ <Button
141
+ className="selectors"
142
+ variant="outlined"
143
+ loading={loadingStatus === 'loading'}
144
+ prefix={
145
+ loadingStatus === 'success' && chain ? (
146
+ <Image src={chain.logo} size={24} />
147
+ ) : (
148
+ <ImagePlaceholder />
149
+ )
150
+ }
151
+ suffix={ItemSuffix}
152
+ align="start"
153
+ size="large">
154
+ {loadingStatus === 'success' && chain
155
+ ? chain.displayName
156
+ : i18n.t('Chain')}
157
+ </Button>
158
+ <Divider size={12} direction="horizontal" />
159
+ <Button
160
+ className="selectors"
161
+ variant="outlined"
162
+ loading={loadingStatus === 'loading'}
163
+ prefix={
164
+ loadingStatus === 'success' && token ? (
165
+ <Image src={token.image} size={24} />
166
+ ) : (
167
+ <ImagePlaceholder />
168
+ )
169
+ }
170
+ suffix={ItemSuffix}
171
+ size="large"
172
+ align="start">
173
+ {loadingStatus === 'success' && token
174
+ ? token.symbol
175
+ : i18n.t('Token')}
176
+ </Button>
177
+ <Divider size={12} direction="horizontal" />
178
+ <div className="amount">
179
+ <OutputContainer>
180
+ <Typography variant="h4">{props.amount}</Typography>
181
+ </OutputContainer>
182
+ </div>
183
+ </div>
184
+ </Container>
185
+ </Box>
186
+ );
187
+ }
@@ -1,4 +1,4 @@
1
- import { ProviderInterface } from '@rango-dev/wallets-react';
1
+ import { ProviderInterface } from '@rango-dev/wallets-core';
2
2
  import { useEffect } from 'react';
3
3
  import { useWalletsStore } from '../store/wallets';
4
4
  import { WidgetConfig } from '../types';
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  useWallets,
12
12
  ProviderInterface,
13
13
  EventHandler as HandleWalletsUpdate,
14
- } from '@rango-dev/wallets-react';
14
+ } from '@rango-dev/wallets-core';
15
15
  import {
16
16
  useEvents as useWidgetEvents,
17
17
  MainEvents,
@@ -0,0 +1,14 @@
1
+ {
2
+ "swap": "SWAP",
3
+ "Connect Wallet": "Connect Wallet",
4
+ "Powered By": "Powered By",
5
+ "From": "You sell",
6
+ "To": "You receive",
7
+ "Balance": "Balance",
8
+ "Max": "Max",
9
+ "Chain": "Chain",
10
+ "Token": "Token",
11
+ "Source": "Source",
12
+ "Destination": "Destination",
13
+ "Select Wallet": "Connect Your Wallet"
14
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "swap": "TAKAS",
3
+ "Select Wallet":"Cüzdan Seç",
4
+ "Powered By" :"Tarafından desteklenmektedir",
5
+ "Connect Wallet":"Cüzdanı Bağla",
6
+ "From":"İtibaren",
7
+ "To":"İle",
8
+ "Max":"maks.",
9
+ "Chain": "Zincir",
10
+ "Token": "Jeton"
11
+ }
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
2
2
  import { useNavigate } from 'react-router-dom';
3
3
  import { useBestRouteStore } from '../store/bestRoute';
4
4
  import { useWalletsStore } from '../store/wallets';
5
- import { useWallets } from '@rango-dev/wallets-react';
5
+ import { useWallets } from '@rango-dev/wallets-core';
6
6
  import { i18n } from '@lingui/core';
7
7
  import { navigationRoutes } from '../constants/navigationRoutes';
8
8
  import {
@@ -13,7 +13,6 @@ import {
13
13
  } from '../utils/wallets';
14
14
  import {
15
15
  confirmSwapDisabled,
16
- getPercentageChange,
17
16
  getTotalFeeInUsd,
18
17
  isValidCustomDestination,
19
18
  } from '../utils/swap';
@@ -21,15 +20,14 @@ import { numberToString } from '../utils/numbers';
21
20
  import { useMetaStore } from '../store/meta';
22
21
  import { WalletType } from '@rango-dev/wallets-shared';
23
22
  import { useNavigateBack } from '../hooks/useNavigateBack';
23
+ import { TokenPreview } from '../components/TokenPreview';
24
24
  import {
25
25
  Divider,
26
26
  ConfirmSwap,
27
27
  LoadingFailedAlert,
28
28
  HighSlippageWarning,
29
- PercentageChange,
30
- RoutesOverview,
31
- TokenPreview,
32
29
  } from '@rango-dev/ui';
30
+ import RoutesOverview from '../components/RoutesOverview';
33
31
  import { useManager } from '@rango-dev/queue-manager-react';
34
32
  import { useConfirmSwap } from '../hooks/useConfirmSwap';
35
33
  import { useSettingsStore } from '../store/settings';
@@ -39,6 +37,7 @@ import { ConfirmSwapErrors } from '../components/ConfirmSwapErrors';
39
37
  import { ConfirmSwapWarnings } from '../components/ConfirmSwapWarnings';
40
38
  import { HIGH_SLIPPAGE } from '../constants/swapSettings';
41
39
  import { getBestRouteStatus } from '../utils/routing';
40
+ import { PercentageChange } from '../components/PercentageChange';
42
41
 
43
42
  export function ConfirmSwapPage({
44
43
  customDestinationEnabled,
@@ -121,14 +120,6 @@ export function ConfirmSwapPage({
121
120
 
122
121
  const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
123
122
 
124
- const percentageChange =
125
- !inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
126
- ? null
127
- : getPercentageChange(
128
- inputUsdValue.toNumber(),
129
- outputUsdValue.toNumber()
130
- );
131
-
132
123
  return (
133
124
  <ConfirmSwap
134
125
  requiredWallets={getRequiredChains(bestRoute)}
@@ -191,7 +182,7 @@ export function ConfirmSwapPage({
191
182
  symbol: firstStep?.from.symbol || '',
192
183
  image: firstStep?.from.logo || '',
193
184
  }}
194
- usdValue={inputUsdValue ? numberToString(inputUsdValue) : null}
185
+ usdValue={inputUsdValue}
195
186
  amount={fromAmount}
196
187
  label={i18n.t('From')}
197
188
  loadingStatus={
@@ -210,7 +201,7 @@ export function ConfirmSwapPage({
210
201
  symbol: lastStep?.to.symbol || '',
211
202
  image: lastStep?.to.logo || '',
212
203
  }}
213
- usdValue={outputUsdValue ? numberToString(outputUsdValue) : null}
204
+ usdValue={outputUsdValue}
214
205
  amount={toAmount}
215
206
  label={i18n.t('To')}
216
207
  loadingStatus={
@@ -219,12 +210,10 @@ export function ConfirmSwapPage({
219
210
  : bestRouteloadingStatus
220
211
  }
221
212
  percentageChange={
222
- !percentageChange ? null : (
223
- <PercentageChange
224
- percentageChange={numberToString(percentageChange, 0, 2)}
225
- showPercentageChange={!!percentageChange?.lt(0)}
226
- />
227
- )
213
+ <PercentageChange
214
+ inputUsdValue={inputUsdValue}
215
+ outputUsdValue={outputUsdValue}
216
+ />
228
217
  }
229
218
  />
230
219
  </>