@rango-dev/widget-embedded 0.12.1-next.27 → 0.12.1-next.28
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/Widget.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +4 -2
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +4 -2
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +3 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Widget.tsx +4 -0
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +5 -3
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +13 -1
- package/src/components/ConfirmWalletsModal/WalletList.tsx +25 -13
- package/src/components/Layout/Layout.styles.ts +3 -0
- package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.styles.ts +1 -2
- package/src/components/SwapDetails/SwapDetails.tsx +7 -15
- package/src/pages/ConfirmSwapPage.tsx +4 -4
- package/src/pages/Home.tsx +5 -1
- package/src/pages/SettingsPage.tsx +24 -3
- package/src/pages/WalletsPage.tsx +9 -5
- package/src/utils/numbers.ts +3 -2
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":"AAcA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA8E3D,wBAAgB,IAAI,sBAyYnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,UAAU,SAAS;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,SAAS,qBA0JzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7C,OAAO,KAA6B,MAAM,OAAO,CAAC;AAUlD,UAAU,SAAS;IACjB,gBAAgB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAeD,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7C,OAAO,KAA6B,MAAM,OAAO,CAAC;AAUlD,UAAU,SAAS;IACjB,gBAAgB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAeD,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,qBAqEhD"}
|
package/dist/utils/numbers.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export declare const convertBigNumberToHex: (value: BigNumber, decimals: number)
|
|
|
7
7
|
export declare const uint8ArrayToHex: (buffer: Uint8Array) => string;
|
|
8
8
|
export declare function dollarToConciseString(num: number | undefined): string;
|
|
9
9
|
export declare function removeExtraDecimals(num: string, maxDecimals: number): string;
|
|
10
|
-
export declare const totalArrivalTime: (data:
|
|
10
|
+
export declare const totalArrivalTime: (data: {
|
|
11
|
+
estimatedTimeInSeconds: number | null;
|
|
12
|
+
}[] | undefined) => number;
|
|
11
13
|
export declare const rawFees: (data: BestRouteResponse) => string;
|
|
12
14
|
export declare const containsText: (text: string, searchText: string) => boolean;
|
|
13
15
|
export declare const isPositiveNumber: (text?: string) => boolean;
|
|
@@ -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;AAEzC,eAAO,MAAM,eAAe,MAAO,MAAM,yBAAkB,MAC7B,CAAC;AAE/B,eAAO,MAAM,eAAe,MAAO,MAAM,KAAG,MAM3C,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,gBAChC,MAAM,GAAG,IAAI,gBACb,MAAM,GAAG,IAAI,KACzB,MA2EF,CAAC;AAEF,eAAO,MAAM,qBAAqB,UACzB,SAAS,YACN,MAAM,KACf,MAEF,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,KAAG,MAKpD,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBrE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAa5E;AAED,eAAO,MAAM,gBAAgB,
|
|
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;AAEzC,eAAO,MAAM,eAAe,MAAO,MAAM,yBAAkB,MAC7B,CAAC;AAE/B,eAAO,MAAM,eAAe,MAAO,MAAM,KAAG,MAM3C,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,gBAChC,MAAM,GAAG,IAAI,gBACb,MAAM,GAAG,IAAI,KACzB,MA2EF,CAAC;AAEF,eAAO,MAAM,qBAAqB,UACzB,SAAS,YACN,MAAM,KACf,MAEF,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,KAAG,MAKpD,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBrE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAa5E;AAED,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,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,gBAAgB,SAAI,GACnB,MAAM,CASR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.12.1-next.
|
|
3
|
+
"version": "0.12.1-next.28",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@rango-dev/queue-manager-core": "^0.15.1-next.2",
|
|
24
24
|
"@rango-dev/queue-manager-rango-preset": "^0.15.1-next.6",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.15.1-next.4",
|
|
26
|
-
"@rango-dev/ui": "^0.15.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.15.1-next.19",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.1.1-next.6",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.15.1-next.4",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
package/src/Widget.tsx
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
TextField,
|
|
9
9
|
} from '@rango-dev/ui';
|
|
10
10
|
|
|
11
|
+
export const EXPANDABLE_TRANSITION_DURATION = 300;
|
|
12
|
+
|
|
11
13
|
const slideDown = keyframes({
|
|
12
14
|
from: {
|
|
13
15
|
height: 0,
|
|
@@ -169,7 +171,7 @@ export const CustomDestination = styled('div', {
|
|
|
169
171
|
});
|
|
170
172
|
|
|
171
173
|
export const ExpandedIcon = styled('div', {
|
|
172
|
-
transition:
|
|
174
|
+
transition: `all ${EXPANDABLE_TRANSITION_DURATION}ms ease`,
|
|
173
175
|
variants: {
|
|
174
176
|
orientation: {
|
|
175
177
|
down: {
|
|
@@ -195,10 +197,10 @@ export const CollapsibleContent = styled(Collapsible.Content, {
|
|
|
195
197
|
variants: {
|
|
196
198
|
open: {
|
|
197
199
|
true: {
|
|
198
|
-
animation: `${slideDown}
|
|
200
|
+
animation: `${slideDown} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
|
|
199
201
|
},
|
|
200
202
|
false: {
|
|
201
|
-
animation: `${slideUp}
|
|
203
|
+
animation: `${slideUp} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
|
|
202
204
|
},
|
|
203
205
|
},
|
|
204
206
|
},
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
Typography,
|
|
16
16
|
WalletIcon,
|
|
17
17
|
} from '@rango-dev/ui';
|
|
18
|
-
import React, { useEffect, useState } from 'react';
|
|
18
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
19
19
|
import { useNavigate } from 'react-router-dom';
|
|
20
20
|
|
|
21
21
|
import { getConfirmSwapErrorMessage } from '../../constants/errors';
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
ConfirmButton,
|
|
34
34
|
CustomDestination,
|
|
35
35
|
CustomDestinationButton,
|
|
36
|
+
EXPANDABLE_TRANSITION_DURATION,
|
|
36
37
|
ExpandedIcon,
|
|
37
38
|
ListContainer,
|
|
38
39
|
NavigateBack,
|
|
@@ -71,6 +72,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
71
72
|
const [showCustomDestination, setShowCustomDestination] = useState(
|
|
72
73
|
!!customDestination
|
|
73
74
|
);
|
|
75
|
+
const customDestinationRef = useRef<HTMLDivElement | null>(null);
|
|
76
|
+
|
|
74
77
|
const requiredWallets = getRequiredWallets(bestRoute);
|
|
75
78
|
const customDestinationEnabled =
|
|
76
79
|
typeof config?.customDestination === 'undefined'
|
|
@@ -231,6 +234,14 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
231
234
|
);
|
|
232
235
|
}, [connectedWallets.length]);
|
|
233
236
|
|
|
237
|
+
useLayoutEffect(() => {
|
|
238
|
+
if (showCustomDestination && customDestinationRef.current) {
|
|
239
|
+
setTimeout(() => {
|
|
240
|
+
customDestinationRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
241
|
+
}, EXPANDABLE_TRANSITION_DURATION);
|
|
242
|
+
}
|
|
243
|
+
}, [showCustomDestination]);
|
|
244
|
+
|
|
234
245
|
const modalContainer = document.querySelector('#swap-box') as HTMLDivElement;
|
|
235
246
|
|
|
236
247
|
const navigate = useNavigate();
|
|
@@ -389,6 +400,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
389
400
|
{isLastWallet && customDestinationEnabled && (
|
|
390
401
|
<CustomDestination>
|
|
391
402
|
<CollapsibleRoot
|
|
403
|
+
ref={customDestinationRef}
|
|
392
404
|
selected={showCustomDestination}
|
|
393
405
|
open={showCustomDestination}
|
|
394
406
|
onOpenChange={(checked) => {
|
|
@@ -19,7 +19,10 @@ import React, { useEffect, useState } from 'react';
|
|
|
19
19
|
|
|
20
20
|
import { useWallets } from '../..';
|
|
21
21
|
import { useWalletList } from '../../hooks/useWalletList';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
TIME_TO_CLOSE_MODAL,
|
|
24
|
+
TIME_TO_IGNORE_MODAL,
|
|
25
|
+
} from '../../pages/WalletsPage';
|
|
23
26
|
import { useMetaStore } from '../../store/meta';
|
|
24
27
|
import { useWalletsStore } from '../../store/wallets';
|
|
25
28
|
import { getBlockchainDisplayNameFor } from '../../utils/meta';
|
|
@@ -51,12 +54,23 @@ export function WalletList(props: PropTypes) {
|
|
|
51
54
|
const [addingExperimentalChainStatus, setAddingExperimentalChainStatus] =
|
|
52
55
|
useState<'in-progress' | 'completed' | null>(null);
|
|
53
56
|
const { connect } = useWallets();
|
|
57
|
+
let modalTimerId: ReturnType<typeof setTimeout> | null = null;
|
|
54
58
|
const { list, error, handleClick } = useWalletList({
|
|
55
59
|
config,
|
|
56
60
|
chain,
|
|
57
|
-
onBeforeConnect:
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
onBeforeConnect: (type) => {
|
|
62
|
+
modalTimerId = setTimeout(() => {
|
|
63
|
+
setOpenWalletStateModal(type);
|
|
64
|
+
}, TIME_TO_IGNORE_MODAL);
|
|
65
|
+
},
|
|
66
|
+
onConnect: () => {
|
|
67
|
+
if (modalTimerId) {
|
|
68
|
+
clearTimeout(modalTimerId);
|
|
69
|
+
}
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
setOpenWalletStateModal('');
|
|
72
|
+
}, TIME_TO_CLOSE_MODAL);
|
|
73
|
+
},
|
|
60
74
|
});
|
|
61
75
|
const [sortedList, setSortedList] = useState<WalletInfo[]>(list);
|
|
62
76
|
const numberOfSupportedWallets = list.length;
|
|
@@ -165,15 +179,13 @@ export function WalletList(props: PropTypes) {
|
|
|
165
179
|
: undefined;
|
|
166
180
|
return (
|
|
167
181
|
<>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
/>
|
|
176
|
-
)}
|
|
182
|
+
<WalletModal
|
|
183
|
+
open={openWalletStateModal === wallet.type}
|
|
184
|
+
onClose={() => setOpenWalletStateModal('')}
|
|
185
|
+
image={wallet.image}
|
|
186
|
+
state={wallet.state}
|
|
187
|
+
error={error}
|
|
188
|
+
/>
|
|
177
189
|
{!!experimentalChainWallet && (
|
|
178
190
|
<Modal
|
|
179
191
|
open={!!experimentalChainWallet && showExperimentalChainModal}
|
|
@@ -10,6 +10,7 @@ export const Container = styled('div', {
|
|
|
10
10
|
width: '95vw',
|
|
11
11
|
maxWidth: '390px',
|
|
12
12
|
maxHeight: '700px',
|
|
13
|
+
backgroundColor: '$neutral100',
|
|
13
14
|
variants: {
|
|
14
15
|
fixedHeight: {
|
|
15
16
|
true: {
|
|
@@ -22,6 +23,8 @@ export const Container = styled('div', {
|
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
export const Content = styled('div', {
|
|
26
|
+
borderTopLeftRadius: '20px',
|
|
27
|
+
borderTopRightRadius: '20px',
|
|
25
28
|
display: 'flex',
|
|
26
29
|
flexDirection: 'column',
|
|
27
30
|
flex: 1,
|
|
@@ -7,7 +7,7 @@ import { SlippageTooltipContainer } from './Slippage.styles';
|
|
|
7
7
|
export function SlippageTooltipContent() {
|
|
8
8
|
return (
|
|
9
9
|
<SlippageTooltipContainer>
|
|
10
|
-
<Typography variant="label" size="
|
|
10
|
+
<Typography variant="label" size="medium" color="neutral900">
|
|
11
11
|
{i18n.t(
|
|
12
12
|
'Your transaction will be reverted if the price changes unfavorably by more than this percentage'
|
|
13
13
|
)}
|
|
@@ -12,7 +12,7 @@ export const Container = styled('div', {
|
|
|
12
12
|
width: '100%',
|
|
13
13
|
justifyContent: 'space-between',
|
|
14
14
|
alignItems: 'center',
|
|
15
|
-
padding: '$10 $
|
|
15
|
+
padding: '$10 $20',
|
|
16
16
|
borderBottom: '1px solid',
|
|
17
17
|
$$color: '$colors$neutral300',
|
|
18
18
|
[`.${darkTheme} &`]: {
|
|
@@ -43,7 +43,6 @@ export const Container = styled('div', {
|
|
|
43
43
|
|
|
44
44
|
export const HeaderDetails = styled('div', {
|
|
45
45
|
width: '100%',
|
|
46
|
-
padding: '0px 15px',
|
|
47
46
|
});
|
|
48
47
|
|
|
49
48
|
export const StepsList = styled('div', {
|
|
@@ -38,7 +38,11 @@ import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
|
38
38
|
import { useBestRouteStore } from '../../store/bestRoute';
|
|
39
39
|
import { useMetaStore } from '../../store/meta';
|
|
40
40
|
import { useNotificationStore } from '../../store/notification';
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
numberToString,
|
|
43
|
+
secondsToString,
|
|
44
|
+
totalArrivalTime,
|
|
45
|
+
} from '../../utils/numbers';
|
|
42
46
|
import { getPriceImpactLevel } from '../../utils/routing';
|
|
43
47
|
import {
|
|
44
48
|
getLastConvertedTokenInFailedSwap,
|
|
@@ -55,12 +59,7 @@ import {
|
|
|
55
59
|
SwapDetailsModal,
|
|
56
60
|
} from '../SwapDetailsModal';
|
|
57
61
|
|
|
58
|
-
import {
|
|
59
|
-
getSteps,
|
|
60
|
-
getStepState,
|
|
61
|
-
RESET_INTERVAL,
|
|
62
|
-
SECONDS,
|
|
63
|
-
} from './SwapDetails.helpers';
|
|
62
|
+
import { getSteps, getStepState, RESET_INTERVAL } from './SwapDetails.helpers';
|
|
64
63
|
import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
|
|
65
64
|
|
|
66
65
|
export function SwapDetails(props: SwapDetailsProps) {
|
|
@@ -163,13 +162,6 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
163
162
|
0
|
|
164
163
|
);
|
|
165
164
|
|
|
166
|
-
const totalTime = swap.steps.reduce(
|
|
167
|
-
(totalTime, step) => totalTime + (step.estimatedTimeInSeconds || 0),
|
|
168
|
-
0
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
const minutes = Math.floor(totalTime / SECONDS);
|
|
172
|
-
|
|
173
165
|
const diagnosisUrl = swap.steps.find(
|
|
174
166
|
(step) => step.diagnosisUrl
|
|
175
167
|
)?.diagnosisUrl;
|
|
@@ -319,7 +311,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
319
311
|
GAS_FEE_MIN_DECIMALS,
|
|
320
312
|
GAS_FEE_MAX_DECIMALS
|
|
321
313
|
)}
|
|
322
|
-
time={
|
|
314
|
+
time={secondsToString(totalArrivalTime(swap.steps))}
|
|
323
315
|
steps={numberOfSteps}
|
|
324
316
|
/>
|
|
325
317
|
<RouteSummary
|
|
@@ -462,9 +462,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
462
462
|
{showBestRoute && (
|
|
463
463
|
<BestRoute
|
|
464
464
|
expanded={true}
|
|
465
|
-
tooltipContainer={
|
|
466
|
-
document.getElementById('swap-box') as HTMLElement
|
|
467
|
-
}
|
|
465
|
+
tooltipContainer={getContainer()}
|
|
468
466
|
steps={formatBestRoute(bestRoute) ?? []}
|
|
469
467
|
input={{
|
|
470
468
|
value: numberToString(
|
|
@@ -495,7 +493,9 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
495
493
|
GAS_FEE_MIN_DECIMALS,
|
|
496
494
|
GAS_FEE_MAX_DECIMALS
|
|
497
495
|
)}
|
|
498
|
-
totalTime={secondsToString(
|
|
496
|
+
totalTime={secondsToString(
|
|
497
|
+
totalArrivalTime(bestRoute.result?.swaps)
|
|
498
|
+
)}
|
|
499
499
|
recommended={true}
|
|
500
500
|
type="swap-preview"
|
|
501
501
|
percentageChange={percentageChange}
|
package/src/pages/Home.tsx
CHANGED
|
@@ -40,6 +40,7 @@ import { useMetaStore } from '../store/meta';
|
|
|
40
40
|
import { useUiStore } from '../store/ui';
|
|
41
41
|
import { useWalletsStore } from '../store/wallets';
|
|
42
42
|
import { ButtonState } from '../types';
|
|
43
|
+
import { getContainer } from '../utils/common';
|
|
43
44
|
import {
|
|
44
45
|
numberToString,
|
|
45
46
|
secondsToString,
|
|
@@ -414,6 +415,7 @@ export function Home() {
|
|
|
414
415
|
<BestRoute
|
|
415
416
|
type="basic"
|
|
416
417
|
recommended={true}
|
|
418
|
+
tooltipContainer={getContainer()}
|
|
417
419
|
input={{
|
|
418
420
|
value: numberToString(
|
|
419
421
|
inputAmount,
|
|
@@ -449,7 +451,9 @@ export function Home() {
|
|
|
449
451
|
GAS_FEE_MIN_DECIMALS,
|
|
450
452
|
GAS_FEE_MAX_DECIMALS
|
|
451
453
|
)}
|
|
452
|
-
totalTime={secondsToString(
|
|
454
|
+
totalTime={secondsToString(
|
|
455
|
+
totalArrivalTime(bestRoute?.result?.swaps)
|
|
456
|
+
)}
|
|
453
457
|
/>
|
|
454
458
|
</BestRouteContainer>
|
|
455
459
|
) : showBestRoute && !fetchingBestRoute ? (
|
|
@@ -2,10 +2,12 @@ import { i18n } from '@lingui/core';
|
|
|
2
2
|
import {
|
|
3
3
|
ChevronRightIcon,
|
|
4
4
|
Divider,
|
|
5
|
+
InfoIcon,
|
|
5
6
|
List,
|
|
6
7
|
ListItemButton,
|
|
7
8
|
Skeleton,
|
|
8
9
|
Switch,
|
|
10
|
+
Tooltip,
|
|
9
11
|
Typography,
|
|
10
12
|
} from '@rango-dev/ui';
|
|
11
13
|
import React from 'react';
|
|
@@ -14,10 +16,12 @@ import { useNavigate } from 'react-router-dom';
|
|
|
14
16
|
import { Layout } from '../components/Layout';
|
|
15
17
|
import { SettingsContainer } from '../components/SettingsContainer';
|
|
16
18
|
import { Slippage } from '../components/Slippage';
|
|
19
|
+
import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
|
|
17
20
|
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
18
21
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
19
22
|
import { useMetaStore } from '../store/meta';
|
|
20
23
|
import { useSettingsStore } from '../store/settings';
|
|
24
|
+
import { getContainer } from '../utils/common';
|
|
21
25
|
import { getUniqueSwappersGroups } from '../utils/settings';
|
|
22
26
|
|
|
23
27
|
interface PropTypes {
|
|
@@ -131,9 +135,26 @@ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
|
131
135
|
const infiniteApprovalItem = {
|
|
132
136
|
id: 'infinite-approval-item',
|
|
133
137
|
title: (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
<>
|
|
139
|
+
<Typography variant="title" size="xmedium">
|
|
140
|
+
{i18n.t('Infinite Approval')}
|
|
141
|
+
</Typography>
|
|
142
|
+
<Divider direction="horizontal" size={4} />
|
|
143
|
+
<Tooltip
|
|
144
|
+
side="top"
|
|
145
|
+
container={getContainer()}
|
|
146
|
+
content={
|
|
147
|
+
<TooltipContainer>
|
|
148
|
+
<Typography variant="label" size="medium" color="neutral900">
|
|
149
|
+
{i18n.t(
|
|
150
|
+
"Enabling the 'Infinite Approval' mode grants unrestricted access to smart contracts of DEXes/Bridges, allowing them to utilize the approved token amount without limitations."
|
|
151
|
+
)}
|
|
152
|
+
</Typography>
|
|
153
|
+
</TooltipContainer>
|
|
154
|
+
}>
|
|
155
|
+
<InfoIcon color="gray" />
|
|
156
|
+
</Tooltip>
|
|
157
|
+
</>
|
|
137
158
|
),
|
|
138
159
|
end: <Switch checked={infiniteApprove} />,
|
|
139
160
|
onClick: toggleInfiniteApprove,
|
|
@@ -37,14 +37,16 @@ export const TIME_TO_IGNORE_MODAL = 300;
|
|
|
37
37
|
|
|
38
38
|
export function WalletsPage({ config }: PropTypes) {
|
|
39
39
|
const { navigateBackFrom } = useNavigateBack();
|
|
40
|
-
const [openModal, setOpenModal] = useState
|
|
40
|
+
const [openModal, setOpenModal] = useState(false);
|
|
41
|
+
const [selectedWalletType, setSelectedWalletType] = useState<WalletType>('');
|
|
41
42
|
let modalTimerId: ReturnType<typeof setTimeout> | null = null;
|
|
42
43
|
|
|
43
44
|
const { list, handleClick, error } = useWalletList({
|
|
44
45
|
config,
|
|
45
46
|
onBeforeConnect: (type) => {
|
|
46
47
|
modalTimerId = setTimeout(() => {
|
|
47
|
-
setOpenModal(
|
|
48
|
+
setOpenModal(true);
|
|
49
|
+
setSelectedWalletType(type);
|
|
48
50
|
}, TIME_TO_IGNORE_MODAL);
|
|
49
51
|
},
|
|
50
52
|
onConnect: () => {
|
|
@@ -52,13 +54,15 @@ export function WalletsPage({ config }: PropTypes) {
|
|
|
52
54
|
clearTimeout(modalTimerId);
|
|
53
55
|
}
|
|
54
56
|
setTimeout(() => {
|
|
55
|
-
setOpenModal(
|
|
57
|
+
setOpenModal(false);
|
|
56
58
|
}, TIME_TO_CLOSE_MODAL);
|
|
57
59
|
},
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
61
|
-
const selectedWallet = list.find(
|
|
63
|
+
const selectedWallet = list.find(
|
|
64
|
+
(wallet) => wallet.type === selectedWalletType
|
|
65
|
+
);
|
|
62
66
|
const selectedWalletImage = selectedWallet?.image || '';
|
|
63
67
|
const selectedWalletState =
|
|
64
68
|
selectedWallet?.state || WalletState.NOT_INSTALLED;
|
|
@@ -91,7 +95,7 @@ export function WalletsPage({ config }: PropTypes) {
|
|
|
91
95
|
})}
|
|
92
96
|
<WalletModal
|
|
93
97
|
open={!!openModal}
|
|
94
|
-
onClose={() => setOpenModal(
|
|
98
|
+
onClose={() => setOpenModal(false)}
|
|
95
99
|
image={selectedWalletImage}
|
|
96
100
|
state={selectedWalletState}
|
|
97
101
|
error={error}
|
package/src/utils/numbers.ts
CHANGED
|
@@ -147,8 +147,9 @@ export function removeExtraDecimals(num: string, maxDecimals: number): string {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
export const totalArrivalTime = (
|
|
151
|
-
data
|
|
150
|
+
export const totalArrivalTime = (
|
|
151
|
+
data: { estimatedTimeInSeconds: number | null }[] | undefined
|
|
152
|
+
) => data?.reduce((a, b) => a + (b.estimatedTimeInSeconds ?? 0), 0) || 0;
|
|
152
153
|
|
|
153
154
|
export const rawFees = (data: BestRouteResponse): string =>
|
|
154
155
|
(
|