@rango-dev/widget-embedded 0.12.1-next.26 → 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.
Files changed (64) hide show
  1. package/dist/Widget.d.ts.map +1 -1
  2. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
  3. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  4. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +4 -2
  5. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  6. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  8. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +4 -2
  9. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  10. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  11. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  12. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.js.map +4 -4
  15. package/dist/pages/Home.d.ts.map +1 -1
  16. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  17. package/dist/pages/SettingsPage.d.ts.map +1 -1
  18. package/dist/pages/WalletsPage.d.ts.map +1 -1
  19. package/dist/utils/numbers.d.ts +3 -1
  20. package/dist/utils/numbers.d.ts.map +1 -1
  21. package/package.json +2 -2
  22. package/src/Widget.tsx +4 -0
  23. package/src/components/BlockchainList/BlockchainList.helpers.ts +1 -1
  24. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -2
  25. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +5 -3
  26. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +13 -1
  27. package/src/components/ConfirmWalletsModal/WalletList.tsx +25 -13
  28. package/src/components/Layout/Layout.styles.ts +3 -0
  29. package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
  30. package/src/components/SwapDetails/SwapDetails.styles.ts +1 -2
  31. package/src/components/SwapDetails/SwapDetails.tsx +7 -15
  32. package/src/pages/ConfirmSwapPage.tsx +4 -4
  33. package/src/pages/Home.tsx +5 -1
  34. package/src/pages/SelectBlockchainPage.tsx +7 -3
  35. package/src/pages/SettingsPage.tsx +24 -3
  36. package/src/pages/WalletsPage.tsx +9 -5
  37. package/src/utils/numbers.ts +3 -2
  38. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +0 -5
  39. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +0 -1
  40. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +0 -156
  41. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +0 -1
  42. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +0 -6
  43. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +0 -1
  44. package/dist/components/BlockchainsChip/index.d.ts +0 -2
  45. package/dist/components/BlockchainsChip/index.d.ts.map +0 -1
  46. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +0 -4
  47. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +0 -1
  48. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +0 -4
  49. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +0 -1
  50. package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +0 -460
  51. package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +0 -1
  52. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +0 -12
  53. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +0 -1
  54. package/dist/components/SelectableCategoryList/index.d.ts +0 -2
  55. package/dist/components/SelectableCategoryList/index.d.ts.map +0 -1
  56. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +0 -42
  57. package/src/components/BlockchainsChip/BlockchainsChip.tsx +0 -15
  58. package/src/components/BlockchainsChip/BlockchainsChip.types.ts +0 -4
  59. package/src/components/BlockchainsChip/index.ts +0 -1
  60. package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +0 -20
  61. package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +0 -21
  62. package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +0 -79
  63. package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +0 -12
  64. package/src/components/SelectableCategoryList/index.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA6E3D,wBAAgB,IAAI,sBAsYnB"}
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":"SelectBlockchainPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectBlockchainPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,qBA0DpD"}
1
+ {"version":3,"file":"SelectBlockchainPage.d.ts","sourceRoot":"","sources":["../../src/pages/SelectBlockchainPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,qBA+DpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,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,qBAyIzE"}
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,qBAiEhD"}
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"}
@@ -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: BestRouteResponse | null) => number;
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,SAAU,iBAAiB,GAAG,IAAI,WACc,CAAC;AAE9E,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"}
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.26",
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.17",
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
@@ -30,6 +30,10 @@ const MainContainer = styled('div', {
30
30
  boxSizing: 'inherit',
31
31
  listStyleType: 'none',
32
32
  },
33
+ '& *:focus-visible': {
34
+ outline: '1px $info500 solid',
35
+ transition: 'none',
36
+ },
33
37
  });
34
38
 
35
39
  export type WidgetProps = {
@@ -1,7 +1,7 @@
1
+ import { BlockchainCategories } from '@rango-dev/ui';
1
2
  import { type BlockchainMeta, TransactionType } from 'rango-sdk';
2
3
 
3
4
  import { containsText } from '../../utils/common';
4
- import { BlockchainCategories } from '../SelectableCategoryList/SelectableCategoryList.types';
5
5
 
6
6
  export const filterByType = (
7
7
  blockchain: BlockchainMeta,
@@ -2,13 +2,18 @@
2
2
  import type { PropTypes } from './BlockchainsSection.types';
3
3
 
4
4
  import { i18n } from '@lingui/core';
5
- import { Divider, Image, Skeleton, Typography } from '@rango-dev/ui';
5
+ import {
6
+ BlockchainsChip,
7
+ Divider,
8
+ Image,
9
+ Skeleton,
10
+ Typography,
11
+ } from '@rango-dev/ui';
6
12
  import { type BlockchainMeta } from 'rango-sdk';
7
13
  import React, { useEffect, useState } from 'react';
8
14
 
9
15
  import { useBestRouteStore } from '../../store/bestRoute';
10
16
  import { useMetaStore } from '../../store/meta';
11
- import { BlockchainsChip } from '../BlockchainsChip';
12
17
 
13
18
  import { sortBlockchains } from './BlockchainSection.helpers';
14
19
  import { Container } from './BlockchainsSection.styles';
@@ -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: 'all 300ms ease',
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} 300ms ease-out`,
200
+ animation: `${slideDown} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
199
201
  },
200
202
  false: {
201
- animation: `${slideUp} 300ms ease-out`,
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 { TIME_TO_CLOSE_MODAL } from '../../pages/WalletsPage';
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: setOpenWalletStateModal,
58
- onConnect: () =>
59
- setTimeout(() => setOpenWalletStateModal(''), TIME_TO_CLOSE_MODAL),
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
- {openWalletStateModal === wallet.type && (
169
- <WalletModal
170
- open={openWalletStateModal === wallet.type}
171
- onClose={() => setOpenWalletStateModal('')}
172
- image={wallet.image}
173
- state={wallet.state}
174
- error={error}
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="small" color="neutral900">
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 $5',
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 { numberToString } from '../../utils/numbers';
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={minutes}
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(totalArrivalTime(bestRoute))}
496
+ totalTime={secondsToString(
497
+ totalArrivalTime(bestRoute.result?.swaps)
498
+ )}
499
499
  recommended={true}
500
500
  type="swap-preview"
501
501
  percentageChange={percentageChange}
@@ -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(totalArrivalTime(bestRoute))}
454
+ totalTime={secondsToString(
455
+ totalArrivalTime(bestRoute?.result?.swaps)
456
+ )}
453
457
  />
454
458
  </BestRouteContainer>
455
459
  ) : showBestRoute && !fetchingBestRoute ? (
@@ -1,11 +1,10 @@
1
1
  import { i18n } from '@lingui/core';
2
- import { Divider } from '@rango-dev/ui';
2
+ import { Divider, SelectableCategoryList } from '@rango-dev/ui';
3
3
  import React, { useState } from 'react';
4
4
 
5
5
  import { BlockchainList } from '../components/BlockchainList';
6
6
  import { Layout } from '../components/Layout';
7
7
  import { SearchInput } from '../components/SearchInput';
8
- import { SelectableCategoryList } from '../components/SelectableCategoryList';
9
8
  import { navigationRoutes } from '../constants/navigationRoutes';
10
9
  import { useNavigateBack } from '../hooks/useNavigateBack';
11
10
  import { useBestRouteStore } from '../store/bestRoute';
@@ -23,7 +22,10 @@ export function SelectBlockchainPage(props: PropTypes) {
23
22
  const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
24
23
  const setToBlockchain = useBestRouteStore.use.setToBlockchain();
25
24
  const setFromBlockchain = useBestRouteStore.use.setFromBlockchain();
26
-
25
+ const {
26
+ meta: { blockchains: allBlockchains },
27
+ loadingStatus,
28
+ } = useMetaStore();
27
29
  const blockchains = supportedBlockchains
28
30
  ? useMetaStore.use
29
31
  .meta()
@@ -45,6 +47,8 @@ export function SelectBlockchainPage(props: PropTypes) {
45
47
  <SelectableCategoryList
46
48
  setCategory={setBlockchainCategory}
47
49
  category={blockchainCategory}
50
+ blockchains={allBlockchains}
51
+ isLoading={loadingStatus === 'loading'}
48
52
  />
49
53
  <Divider size={24} />
50
54
  <SearchInput
@@ -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
- <Typography variant="title" size="xmedium">
135
- {i18n.t('Infinite Approval')}
136
- </Typography>
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<WalletType>('');
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(type);
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((wallet) => wallet.type === openModal);
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}
@@ -147,8 +147,9 @@ export function removeExtraDecimals(num: string, maxDecimals: number): string {
147
147
  }
148
148
  }
149
149
 
150
- export const totalArrivalTime = (data: BestRouteResponse | null) =>
151
- data?.result?.swaps?.reduce((a, b) => a + b.estimatedTimeInSeconds, 0) || 0;
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
  (
@@ -1,5 +0,0 @@
1
- import type { PropTypes } from './BlockchainsChip.types';
2
- import type { PropsWithChildren } from 'react';
3
- import React from 'react';
4
- export declare function BlockchainsChip(props: PropsWithChildren<PropTypes>): React.JSX.Element;
5
- //# sourceMappingURL=BlockchainsChip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockchainsChip.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsChip/BlockchainsChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,qBAOlE"}