@rango-dev/widget-embedded 0.20.1-next.0 → 0.20.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/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +157 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +1 -0
- package/dist/constants/routing.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +1 -5
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +4 -1
- package/src/components/ConfirmWalletsModal/WalletList.tsx +4 -1
- package/src/components/Layout/Layout.styles.ts +3 -3
- package/src/components/Layout/Layout.tsx +9 -2
- package/src/components/Quote/Quote.styles.ts +5 -1
- package/src/components/Quote/Quote.tsx +53 -15
- package/src/components/Quote/QuoteSummary.tsx +17 -2
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +7 -1
- package/src/components/SwapDetails/SwapDetails.tsx +21 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +9 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +3 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -0
- package/src/components/SwapsGroup/SwapsGroup.tsx +13 -7
- package/src/components/WalletModal/WalletModal.tsx +3 -1
- package/src/constants/index.ts +1 -0
- package/src/constants/routing.ts +2 -0
- package/src/containers/App/App.styles.ts +1 -2
- package/src/pages/Home.tsx +11 -1
- package/src/utils/common.ts +3 -1
- package/src/utils/date.ts +22 -8
- package/src/utils/numbers.ts +8 -58
- package/src/utils/time.ts +25 -69
package/dist/pages/Home.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA+C3D,wBAAgB,IAAI,sBAyOnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,mBACkC,CAAC"}
|
package/dist/utils/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAKzE,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAKzE,eAAO,MAAM,gBAAgB,EAAE,OAmE9B,CAAC"}
|
package/dist/utils/numbers.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { BestRouteResponse } from 'rango-sdk';
|
|
2
2
|
import { BigNumber } from 'bignumber.js';
|
|
3
|
-
export declare const percentToString: (p: number, fractions?: number) => string;
|
|
4
3
|
export declare const secondsToString: (s: number) => string;
|
|
5
4
|
export declare const numberToString: (number: BigNumber | string | number | null | undefined, minDecimals?: number | null, maxDecimals?: number | null) => string;
|
|
6
|
-
export declare const convertBigNumberToHex: (value: BigNumber, decimals: number) => string;
|
|
7
5
|
export declare const uint8ArrayToHex: (buffer: Uint8Array) => string;
|
|
8
|
-
export declare function dollarToConciseString(num: number | undefined): string;
|
|
9
|
-
export declare function removeExtraDecimals(num: string, maxDecimals: number): string;
|
|
10
6
|
export declare const totalArrivalTime: (data: {
|
|
11
7
|
estimatedTimeInSeconds: number | null;
|
|
12
8
|
}[] | undefined) => number;
|
|
13
9
|
export declare const rawFees: (data: BestRouteResponse) => string;
|
|
14
10
|
export declare const containsText: (text: string, searchText: string) => boolean;
|
|
15
11
|
export declare const isPositiveNumber: (text?: string) => boolean;
|
|
16
|
-
export declare function
|
|
12
|
+
export declare function formatTooltipNumbers(number: BigNumber | string | number | null | undefined): string;
|
|
17
13
|
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,eAAO,MAAM,eAAe,MAAO,MAAM,KAAG,MAM3C,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,gBACzC,MAAM,GAAG,IAAI,gBACb,MAAM,GAAG,IAAI,KACzB,MA2EF,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,KAAG,MAKpD,CAAC;AAEF,eAAO,MAAM,gBAAgB,SACrB;IAAE,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,GAAG,SAAS,WACS,CAAC;AAEzE,eAAO,MAAM,OAAO,SAAU,iBAAiB,KAAG,MAOnC,CAAC;AAEhB,eAAO,MAAM,YAAY,SAAU,MAAM,cAAc,MAAM,YACF,CAAC;AAE5D,eAAO,MAAM,gBAAgB,UAAW,MAAM,YACd,CAAC;AAGjC,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,UAMvD"}
|
package/dist/utils/time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc/C,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,UAW5C;AAED,wBAAgB,WAAW,CAAC,WAAW,EAAE,WAAW,UAKnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.20.1-next.
|
|
3
|
+
"version": "0.20.1-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@rango-dev/queue-manager-core": "^0.25.0",
|
|
26
26
|
"@rango-dev/queue-manager-rango-preset": "^0.25.1-next.0",
|
|
27
27
|
"@rango-dev/queue-manager-react": "^0.24.0",
|
|
28
|
-
"@rango-dev/ui": "^0.26.1-next.
|
|
28
|
+
"@rango-dev/ui": "^0.26.1-next.1",
|
|
29
29
|
"@rango-dev/wallets-react": "^0.11.1-next.0",
|
|
30
30
|
"@rango-dev/wallets-shared": "^0.25.1-next.0",
|
|
31
31
|
"bignumber.js": "^9.1.1",
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
19
19
|
import { useNavigate } from 'react-router-dom';
|
|
20
20
|
|
|
21
|
+
import { RANGO_SWAP_BOX_ID } from '../../constants';
|
|
21
22
|
import { getQuoteErrorMessage } from '../../constants/errors';
|
|
22
23
|
import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
|
|
23
24
|
import { useAppStore } from '../../store/AppStore';
|
|
@@ -238,7 +239,9 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
238
239
|
}
|
|
239
240
|
}, [showCustomDestination]);
|
|
240
241
|
|
|
241
|
-
const modalContainer = document.
|
|
242
|
+
const modalContainer = document.getElementById(
|
|
243
|
+
RANGO_SWAP_BOX_ID
|
|
244
|
+
) as HTMLDivElement;
|
|
242
245
|
|
|
243
246
|
const navigate = useNavigate();
|
|
244
247
|
return (
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import React, { useEffect, useState } from 'react';
|
|
19
19
|
|
|
20
20
|
import { useWallets } from '../..';
|
|
21
|
+
import { RANGO_SWAP_BOX_ID } from '../../constants';
|
|
21
22
|
import { useWalletList } from '../../hooks/useWalletList';
|
|
22
23
|
import {
|
|
23
24
|
TIME_TO_CLOSE_MODAL,
|
|
@@ -107,7 +108,9 @@ export function WalletList(props: PropTypes) {
|
|
|
107
108
|
});
|
|
108
109
|
}, [JSON.stringify(list)]);
|
|
109
110
|
|
|
110
|
-
const modalContainer = document.
|
|
111
|
+
const modalContainer = document.getElementById(
|
|
112
|
+
RANGO_SWAP_BOX_ID
|
|
113
|
+
) as HTMLDivElement;
|
|
111
114
|
|
|
112
115
|
useEffect(() => {
|
|
113
116
|
let timeout: ReturnType<typeof setTimeout> | null = null;
|
|
@@ -7,7 +7,7 @@ export const Container = styled('div', {
|
|
|
7
7
|
borderRadius: '$primary',
|
|
8
8
|
overflow: 'hidden !important',
|
|
9
9
|
boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
|
|
10
|
-
width: '
|
|
10
|
+
width: '100vw',
|
|
11
11
|
minWidth: '300px',
|
|
12
12
|
maxWidth: '390px',
|
|
13
13
|
maxHeight: '700px',
|
|
@@ -20,10 +20,10 @@ export const Container = styled('div', {
|
|
|
20
20
|
variants: {
|
|
21
21
|
fixedHeight: {
|
|
22
22
|
true: {
|
|
23
|
-
height: '
|
|
23
|
+
height: '100vh',
|
|
24
24
|
},
|
|
25
25
|
false: {
|
|
26
|
-
height: 'auto',
|
|
26
|
+
height: 'auto !important',
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
},
|
|
@@ -4,7 +4,9 @@ import type { PropsWithChildren } from 'react';
|
|
|
4
4
|
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
+
import { RANGO_SWAP_BOX_ID } from '../../constants';
|
|
7
8
|
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
9
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
8
10
|
import { useAppStore } from '../../store/AppStore';
|
|
9
11
|
import { useUiStore } from '../../store/ui';
|
|
10
12
|
import { useWalletsStore } from '../../store/wallets';
|
|
@@ -25,8 +27,9 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
25
27
|
} = props;
|
|
26
28
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
27
29
|
const {
|
|
28
|
-
config: { features },
|
|
30
|
+
config: { features, theme },
|
|
29
31
|
} = useAppStore();
|
|
32
|
+
const { activeTheme } = useTheme(theme || {});
|
|
30
33
|
|
|
31
34
|
const isConnectWalletHidden = isFeatureHidden(
|
|
32
35
|
'connectWalletButton',
|
|
@@ -47,7 +50,11 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
|
|
|
47
50
|
typeof header.hasBackButton === 'undefined' || header.hasBackButton;
|
|
48
51
|
|
|
49
52
|
return (
|
|
50
|
-
<Container
|
|
53
|
+
<Container
|
|
54
|
+
ref={ref}
|
|
55
|
+
fixedHeight={fixedHeight}
|
|
56
|
+
id={RANGO_SWAP_BOX_ID}
|
|
57
|
+
className={activeTheme()}>
|
|
51
58
|
<Header
|
|
52
59
|
prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
|
|
53
60
|
title={header.title}
|
|
@@ -243,8 +243,12 @@ export const FrameIcon = styled('div', {
|
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
export const BasicInfoOutput = styled(Typography, {
|
|
246
|
-
width: '100%',
|
|
247
246
|
overflow: 'hidden',
|
|
248
247
|
textOverflow: 'ellipsis',
|
|
249
248
|
letterSpacing: 0.4,
|
|
250
249
|
});
|
|
250
|
+
|
|
251
|
+
export const ContainerInfoOutput = styled('div', {
|
|
252
|
+
display: 'flex',
|
|
253
|
+
flexWrap: 'wrap',
|
|
254
|
+
});
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
Tooltip,
|
|
17
17
|
Typography,
|
|
18
18
|
} from '@rango-dev/ui';
|
|
19
|
+
import BigNumber from 'bignumber.js';
|
|
19
20
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
20
21
|
|
|
21
22
|
import {
|
|
@@ -40,6 +41,7 @@ import {
|
|
|
40
41
|
getSwapperDisplayName,
|
|
41
42
|
} from '../../utils/meta';
|
|
42
43
|
import {
|
|
44
|
+
formatTooltipNumbers,
|
|
43
45
|
numberToString,
|
|
44
46
|
secondsToString,
|
|
45
47
|
totalArrivalTime,
|
|
@@ -52,6 +54,7 @@ import {
|
|
|
52
54
|
basicInfoStyles,
|
|
53
55
|
ChainImageContainer,
|
|
54
56
|
Chains,
|
|
57
|
+
ContainerInfoOutput,
|
|
55
58
|
Content,
|
|
56
59
|
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
57
60
|
FrameIcon,
|
|
@@ -162,6 +165,14 @@ export function Quote(props: QuoteProps) {
|
|
|
162
165
|
USD_VALUE_MIN_DECIMALS,
|
|
163
166
|
USD_VALUE_MAX_DECIMALS
|
|
164
167
|
),
|
|
168
|
+
realValue: formatTooltipNumbers(
|
|
169
|
+
index === 0 ? input.value : swap.fromAmount
|
|
170
|
+
),
|
|
171
|
+
realUsdValue: formatTooltipNumbers(
|
|
172
|
+
new BigNumber(swap.from.usdPrice ?? 0).multipliedBy(
|
|
173
|
+
swap.fromAmount
|
|
174
|
+
)
|
|
175
|
+
),
|
|
165
176
|
},
|
|
166
177
|
},
|
|
167
178
|
to: {
|
|
@@ -184,6 +195,10 @@ export function Quote(props: QuoteProps) {
|
|
|
184
195
|
USD_VALUE_MIN_DECIMALS,
|
|
185
196
|
USD_VALUE_MAX_DECIMALS
|
|
186
197
|
),
|
|
198
|
+
realValue: formatTooltipNumbers(swap.toAmount),
|
|
199
|
+
realUsdValue: formatTooltipNumbers(
|
|
200
|
+
new BigNumber(swap.to.usdPrice ?? 0).multipliedBy(swap.toAmount)
|
|
201
|
+
),
|
|
187
202
|
},
|
|
188
203
|
},
|
|
189
204
|
state: stepState,
|
|
@@ -291,27 +306,49 @@ export function Quote(props: QuoteProps) {
|
|
|
291
306
|
<FrameIcon>
|
|
292
307
|
<InfoIcon size={12} color="gray" />
|
|
293
308
|
</FrameIcon>
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
steps[0].from.token.displayName
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
309
|
+
<ContainerInfoOutput>
|
|
310
|
+
<BasicInfoOutput size="small" variant="body">
|
|
311
|
+
{`${roundedInput} ${steps[0].from.token.displayName} = `}
|
|
312
|
+
</BasicInfoOutput>
|
|
313
|
+
<Tooltip
|
|
314
|
+
content={formatTooltipNumbers(output.value)}
|
|
315
|
+
container={tooltipContainer}
|
|
316
|
+
open={!output.value ? false : undefined}>
|
|
317
|
+
<BasicInfoOutput size="small" variant="body">
|
|
318
|
+
|
|
319
|
+
{`${roundedOutput} ${
|
|
320
|
+
steps[steps.length - 1].to.token.displayName
|
|
321
|
+
}`}
|
|
322
|
+
</BasicInfoOutput>
|
|
323
|
+
</Tooltip>
|
|
324
|
+
</ContainerInfoOutput>
|
|
325
|
+
<Tooltip
|
|
326
|
+
content={formatTooltipNumbers(output.usdValue)}
|
|
327
|
+
container={tooltipContainer}
|
|
328
|
+
style={{
|
|
329
|
+
display: 'flex',
|
|
330
|
+
}}>
|
|
331
|
+
<Typography
|
|
332
|
+
color="$neutral600"
|
|
333
|
+
ml={2}
|
|
334
|
+
size="xsmall"
|
|
335
|
+
variant="body">
|
|
336
|
+
{`($${roundedOutputUsdValue})`}
|
|
337
|
+
</Typography>
|
|
338
|
+
</Tooltip>
|
|
308
339
|
</div>
|
|
309
340
|
)}
|
|
310
341
|
{type === 'list-item' && (
|
|
311
342
|
<TokenAmount
|
|
312
343
|
type="output"
|
|
313
344
|
direction="vertical"
|
|
314
|
-
|
|
345
|
+
tooltipContainer={tooltipContainer}
|
|
346
|
+
price={{
|
|
347
|
+
value: roundedOutput,
|
|
348
|
+
usdValue: roundedOutputUsdValue,
|
|
349
|
+
realValue: formatTooltipNumbers(output.value),
|
|
350
|
+
realUsdValue: formatTooltipNumbers(output.usdValue),
|
|
351
|
+
}}
|
|
315
352
|
token={{
|
|
316
353
|
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
317
354
|
image: steps[numberOfSteps - 1].to.token.image,
|
|
@@ -402,6 +439,7 @@ export function Quote(props: QuoteProps) {
|
|
|
402
439
|
step={step}
|
|
403
440
|
hasSeparator={index !== steps.length - 1}
|
|
404
441
|
state={step.state}
|
|
442
|
+
tooltipContainer={tooltipContainer}
|
|
405
443
|
/>
|
|
406
444
|
);
|
|
407
445
|
})}
|
|
@@ -3,6 +3,8 @@ import type { PriceImpactWarningLevel, Step } from '@rango-dev/ui';
|
|
|
3
3
|
import { TokenAmount } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
+
import { getContainer } from '../../utils/common';
|
|
7
|
+
|
|
6
8
|
import { Container, separatorStyles } from './QuoteSummary.styles';
|
|
7
9
|
|
|
8
10
|
type PropTypes = {
|
|
@@ -14,13 +16,20 @@ type PropTypes = {
|
|
|
14
16
|
|
|
15
17
|
export function QuoteSummary(props: PropTypes) {
|
|
16
18
|
const { from, to, percentageChange, warningLevel } = props;
|
|
19
|
+
|
|
17
20
|
return (
|
|
18
21
|
<Container>
|
|
19
22
|
<TokenAmount
|
|
20
23
|
direction="horizontal"
|
|
21
24
|
label="Swap input"
|
|
22
25
|
type="input"
|
|
23
|
-
|
|
26
|
+
tooltipContainer={getContainer()}
|
|
27
|
+
price={{
|
|
28
|
+
value: from.price.value,
|
|
29
|
+
usdValue: from.price.usdValue,
|
|
30
|
+
realValue: from.price.realValue,
|
|
31
|
+
realUsdValue: from.price.realUsdValue,
|
|
32
|
+
}}
|
|
24
33
|
token={{
|
|
25
34
|
displayName: from.token.displayName,
|
|
26
35
|
image: from.token.image,
|
|
@@ -31,8 +40,14 @@ export function QuoteSummary(props: PropTypes) {
|
|
|
31
40
|
<TokenAmount
|
|
32
41
|
direction="horizontal"
|
|
33
42
|
label="Estimated output"
|
|
43
|
+
tooltipContainer={getContainer()}
|
|
34
44
|
type="output"
|
|
35
|
-
price={{
|
|
45
|
+
price={{
|
|
46
|
+
value: to.price.value,
|
|
47
|
+
usdValue: to.price.usdValue,
|
|
48
|
+
realValue: to.price.realValue,
|
|
49
|
+
realUsdValue: to.price.realUsdValue,
|
|
50
|
+
}}
|
|
36
51
|
token={{
|
|
37
52
|
displayName: to.token.displayName,
|
|
38
53
|
image: to.token.image,
|
|
@@ -20,7 +20,10 @@ export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
|
|
|
20
20
|
const hasAlreadyProceededToSign = swap.hasAlreadyProceededToSign !== false;
|
|
21
21
|
return swap.steps.map((step, index) => {
|
|
22
22
|
const amountToConvert =
|
|
23
|
-
index === 0
|
|
23
|
+
index === 0
|
|
24
|
+
? swap.inputAmount
|
|
25
|
+
: swap.steps[index - 1].outputAmount ||
|
|
26
|
+
swap.steps[index - 1].expectedOutputAmountHumanReadable;
|
|
24
27
|
return {
|
|
25
28
|
from: {
|
|
26
29
|
token: { displayName: step.fromSymbol, image: step.fromLogo ?? '' },
|
|
@@ -35,6 +38,7 @@ export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
|
|
|
35
38
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
36
39
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
37
40
|
),
|
|
41
|
+
realValue: amountToConvert,
|
|
38
42
|
},
|
|
39
43
|
},
|
|
40
44
|
to: {
|
|
@@ -50,6 +54,8 @@ export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
|
|
|
50
54
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
51
55
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
52
56
|
),
|
|
57
|
+
realValue:
|
|
58
|
+
step.outputAmount || step.expectedOutputAmountHumanReadable,
|
|
53
59
|
},
|
|
54
60
|
},
|
|
55
61
|
swapper: { displayName: step.swapperId, image: step.swapperLogo ?? '' },
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
useCopyToClipboard,
|
|
19
19
|
} from '@rango-dev/ui';
|
|
20
20
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
21
|
+
import BigNumber from 'bignumber.js';
|
|
21
22
|
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
22
23
|
import React, { useEffect, useRef, useState } from 'react';
|
|
23
24
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -35,7 +36,9 @@ import {
|
|
|
35
36
|
import { useAppStore } from '../../store/AppStore';
|
|
36
37
|
import { useNotificationStore } from '../../store/notification';
|
|
37
38
|
import { useQuoteStore } from '../../store/quote';
|
|
39
|
+
import { getContainer } from '../../utils/common';
|
|
38
40
|
import {
|
|
41
|
+
formatTooltipNumbers,
|
|
39
42
|
numberToString,
|
|
40
43
|
secondsToString,
|
|
41
44
|
totalArrivalTime,
|
|
@@ -188,6 +191,16 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
188
191
|
USD_VALUE_MAX_DECIMALS
|
|
189
192
|
);
|
|
190
193
|
|
|
194
|
+
const realOutputUsdValue = outputAmount
|
|
195
|
+
? formatTooltipNumbers(
|
|
196
|
+
new BigNumber(outputAmount).multipliedBy(lastStep.toUsdPrice || 0)
|
|
197
|
+
)
|
|
198
|
+
: '';
|
|
199
|
+
|
|
200
|
+
const realInputUsdValue = formatTooltipNumbers(
|
|
201
|
+
new BigNumber(swap.inputAmount).multipliedBy(firstStep.fromUsdPrice || 0)
|
|
202
|
+
);
|
|
203
|
+
|
|
191
204
|
const percentageChange = getPriceImpact(inputUsdValue, outputUsdValue);
|
|
192
205
|
|
|
193
206
|
const completeModalDesc =
|
|
@@ -280,7 +293,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
280
293
|
</div>
|
|
281
294
|
<div className={rowStyles()}>
|
|
282
295
|
<Typography variant="label" size="large" color="neutral700">
|
|
283
|
-
{`${i18n.t('Created at')}:`}
|
|
296
|
+
{`${i18n.t(swap.finishTime ? 'Finished at' : 'Created at')}:`}
|
|
284
297
|
</Typography>
|
|
285
298
|
<Typography variant="label" size="small" color="neutral700">
|
|
286
299
|
{swapDate}
|
|
@@ -307,6 +320,8 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
307
320
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
308
321
|
),
|
|
309
322
|
usdValue: inputUsdValue,
|
|
323
|
+
realUsdValue: realInputUsdValue,
|
|
324
|
+
realValue: swap.inputAmount,
|
|
310
325
|
},
|
|
311
326
|
token: {
|
|
312
327
|
displayName: steps[0].from.token.displayName,
|
|
@@ -325,6 +340,8 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
325
340
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
326
341
|
),
|
|
327
342
|
usdValue: outputUsdValue,
|
|
343
|
+
realUsdValue: realOutputUsdValue,
|
|
344
|
+
realValue: outputAmount,
|
|
328
345
|
},
|
|
329
346
|
token: {
|
|
330
347
|
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
@@ -368,6 +385,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
368
385
|
hasSeparator={index !== 0}
|
|
369
386
|
tabIndex={key}
|
|
370
387
|
isFocused={isFocused}
|
|
388
|
+
tooltipContainer={getContainer()}
|
|
371
389
|
/>
|
|
372
390
|
);
|
|
373
391
|
})}
|
|
@@ -393,6 +411,8 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
393
411
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
394
412
|
)}
|
|
395
413
|
usdValue={outputUsdValue}
|
|
414
|
+
realUsdValue={realOutputUsdValue}
|
|
415
|
+
realValue={formatTooltipNumbers(outputAmount)}
|
|
396
416
|
percentageChange={numberToString(
|
|
397
417
|
percentageChange,
|
|
398
418
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { useNavigate } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
+
import { RANGO_SWAP_BOX_ID } from '../../constants';
|
|
16
|
+
import { getContainer } from '../../utils/common';
|
|
17
|
+
|
|
15
18
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
16
19
|
const {
|
|
17
20
|
open,
|
|
@@ -19,6 +22,8 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
19
22
|
status,
|
|
20
23
|
priceValue,
|
|
21
24
|
usdValue,
|
|
25
|
+
realUsdValue,
|
|
26
|
+
realValue,
|
|
22
27
|
token,
|
|
23
28
|
chain,
|
|
24
29
|
percentageChange,
|
|
@@ -31,16 +36,19 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
31
36
|
<Modal
|
|
32
37
|
open={open}
|
|
33
38
|
onClose={onClose}
|
|
34
|
-
container={document.getElementById(
|
|
39
|
+
container={document.getElementById(RANGO_SWAP_BOX_ID) || document.body}>
|
|
35
40
|
{status === 'success' ? (
|
|
36
41
|
<MessageBox type="success" title={i18n.t('Swap Successful')}>
|
|
37
42
|
<TokenAmount
|
|
38
43
|
direction="vertical"
|
|
44
|
+
tooltipContainer={getContainer()}
|
|
39
45
|
type="output"
|
|
40
46
|
centerAlign={true}
|
|
41
47
|
price={{
|
|
42
48
|
value: priceValue,
|
|
43
49
|
usdValue,
|
|
50
|
+
realUsdValue,
|
|
51
|
+
realValue,
|
|
44
52
|
}}
|
|
45
53
|
token={token}
|
|
46
54
|
chain={chain}
|
|
@@ -4,6 +4,8 @@ import { Modal } from '@rango-dev/ui';
|
|
|
4
4
|
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
+
import { RANGO_SWAP_BOX_ID } from '../../constants';
|
|
8
|
+
|
|
7
9
|
import { CancelContent } from './SwapDetailsModal.Cancel';
|
|
8
10
|
import { DeleteContent } from './SwapDetailsModal.Delete';
|
|
9
11
|
import { modalNetworkValues } from './SwapDetailsModal.helpers';
|
|
@@ -22,7 +24,7 @@ export function SwapDetailsModal(props: ModalPropTypes) {
|
|
|
22
24
|
<Modal
|
|
23
25
|
open={!!state}
|
|
24
26
|
onClose={onClose}
|
|
25
|
-
container={document.getElementById(
|
|
27
|
+
container={document.getElementById(RANGO_SWAP_BOX_ID) || document.body}>
|
|
26
28
|
{showWalletStateContent && (
|
|
27
29
|
<WalletStateContent
|
|
28
30
|
type={modalNetworkValues[state].type}
|
|
@@ -4,7 +4,8 @@ import { i18n } from '@lingui/core';
|
|
|
4
4
|
import { Divider, SwapListItem, Typography } from '@rango-dev/ui';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { getContainer } from '../../utils/common';
|
|
8
|
+
import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
|
|
8
9
|
|
|
9
10
|
import { Group, groupStyles, SwapList, Time } from './SwapsGroup.styles';
|
|
10
11
|
|
|
@@ -21,7 +22,7 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
21
22
|
swaps,
|
|
22
23
|
},
|
|
23
24
|
{
|
|
24
|
-
title: '
|
|
25
|
+
title: 'This month',
|
|
25
26
|
swaps,
|
|
26
27
|
},
|
|
27
28
|
];
|
|
@@ -75,6 +76,7 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
75
76
|
<SwapList>
|
|
76
77
|
{group.swaps.map((swap) => {
|
|
77
78
|
const firstStep = swap.steps[0];
|
|
79
|
+
|
|
78
80
|
const lastStep = swap.steps[swap.steps.length - 1];
|
|
79
81
|
return (
|
|
80
82
|
<React.Fragment key={swap.requestId}>
|
|
@@ -84,6 +86,7 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
84
86
|
status={swap.status}
|
|
85
87
|
onClick={onSwapClick}
|
|
86
88
|
onlyShowTime={group.title === 'Today'}
|
|
89
|
+
tooltipContainer={getContainer()}
|
|
87
90
|
swapTokenData={{
|
|
88
91
|
from: {
|
|
89
92
|
token: {
|
|
@@ -93,7 +96,7 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
93
96
|
blockchain: {
|
|
94
97
|
image: firstStep.fromBlockchainLogo || '',
|
|
95
98
|
},
|
|
96
|
-
amount:
|
|
99
|
+
amount: swap.inputAmount,
|
|
97
100
|
},
|
|
98
101
|
to: {
|
|
99
102
|
token: {
|
|
@@ -103,11 +106,14 @@ export function SwapsGroup(props: PropTypes) {
|
|
|
103
106
|
blockchain: {
|
|
104
107
|
image: lastStep.toBlockchainLogo || '',
|
|
105
108
|
},
|
|
106
|
-
amount:
|
|
107
|
-
lastStep.outputAmount ||
|
|
109
|
+
amount: numberToString(
|
|
110
|
+
lastStep.outputAmount ||
|
|
111
|
+
lastStep.expectedOutputAmountHumanReadable ||
|
|
112
|
+
''
|
|
108
113
|
),
|
|
109
|
-
|
|
110
|
-
lastStep.
|
|
114
|
+
realAmount: formatTooltipNumbers(
|
|
115
|
+
lastStep.outputAmount ||
|
|
116
|
+
lastStep.expectedOutputAmountHumanReadable
|
|
111
117
|
),
|
|
112
118
|
},
|
|
113
119
|
}}
|
|
@@ -3,6 +3,8 @@ import type { PropTypes } from './WalletModal.types';
|
|
|
3
3
|
import { Divider, Modal } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
+
import { RANGO_SWAP_BOX_ID } from '../../constants';
|
|
7
|
+
|
|
6
8
|
import { ModalContent } from './WalletModalContent';
|
|
7
9
|
|
|
8
10
|
export function WalletModal(props: PropTypes) {
|
|
@@ -12,7 +14,7 @@ export function WalletModal(props: PropTypes) {
|
|
|
12
14
|
<Modal
|
|
13
15
|
open={open}
|
|
14
16
|
onClose={onClose}
|
|
15
|
-
container={document.getElementById(
|
|
17
|
+
container={document.getElementById(RANGO_SWAP_BOX_ID) || document.body}>
|
|
16
18
|
<ModalContent {...otherProps} />
|
|
17
19
|
<Divider direction="vertical" size={32} />
|
|
18
20
|
</Modal>
|
package/src/constants/index.ts
CHANGED
package/src/constants/routing.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const MainContainer = styled('div', {
|
|
4
|
-
width: '100%',
|
|
5
4
|
display: 'flex',
|
|
6
5
|
justifyContent: 'center',
|
|
7
6
|
alignItems: 'center',
|
|
@@ -9,10 +8,10 @@ export const MainContainer = styled('div', {
|
|
|
9
8
|
boxSizing: 'border-box',
|
|
10
9
|
'& *, *::before, *::after': {
|
|
11
10
|
boxSizing: 'inherit',
|
|
12
|
-
listStyleType: 'none',
|
|
13
11
|
},
|
|
14
12
|
'& *:focus-visible': {
|
|
15
13
|
outlineColor: '$info500',
|
|
16
14
|
transition: 'none',
|
|
17
15
|
},
|
|
16
|
+
'& ul, ol, li': { listStyleType: 'none' },
|
|
18
17
|
});
|