@rango-dev/widget-embedded 0.23.1-next.23 → 0.23.1-next.25

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 (45) hide show
  1. package/dist/components/AppRouter.d.ts +1 -6
  2. package/dist/components/AppRouter.d.ts.map +1 -1
  3. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +1 -0
  4. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  5. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
  6. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +3 -1
  7. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  8. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
  9. package/dist/components/Quotes/Quotes.d.ts.map +1 -1
  10. package/dist/containers/App/App.d.ts.map +1 -1
  11. package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
  12. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  13. package/dist/containers/Wallets/Wallets.types.d.ts +13 -2
  14. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -1
  15. package/dist/containers/Widget/Widget.d.ts.map +1 -1
  16. package/dist/hooks/useBootstrap/index.d.ts +2 -0
  17. package/dist/hooks/useBootstrap/index.d.ts.map +1 -0
  18. package/dist/hooks/useBootstrap/useBootstrap.d.ts +2 -0
  19. package/dist/hooks/useBootstrap/useBootstrap.d.ts.map +1 -0
  20. package/dist/index.js +2 -2
  21. package/dist/index.js.map +4 -4
  22. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  23. package/dist/utils/swap.d.ts.map +1 -1
  24. package/package.json +2 -2
  25. package/src/components/AppRouter.tsx +1 -29
  26. package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +9 -1
  27. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
  28. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +2 -2
  29. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +5 -4
  30. package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +7 -0
  31. package/src/components/QuoteSkeleton/StepSkeleton.tsx +1 -1
  32. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +1 -1
  33. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +1 -0
  34. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +1 -1
  35. package/src/components/Quotes/Quotes.tsx +12 -11
  36. package/src/constants/errors.ts +1 -1
  37. package/src/containers/App/App.tsx +4 -25
  38. package/src/containers/Inputs/Inputs.tsx +7 -1
  39. package/src/containers/Wallets/Wallets.tsx +27 -10
  40. package/src/containers/Wallets/Wallets.types.ts +13 -2
  41. package/src/containers/Widget/Widget.tsx +1 -7
  42. package/src/hooks/useBootstrap/index.ts +1 -0
  43. package/src/hooks/useBootstrap/useBootstrap.ts +72 -0
  44. package/src/pages/ConfirmSwapPage.tsx +2 -1
  45. package/src/utils/swap.ts +1 -5
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBAkU9B"}
1
+ {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBAmU9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,M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AAE,cAAc,EAAE,YAsD9B;AAED,wBAAgB,kBAAkB,CAChC,YAAY,CAAC,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,aAK3B;AAED,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,eAAe,GAAG,IAAI,GACtC,OAAO,CAMT;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD,CAyCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAEvD;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,qBAAqB,EAAE,OAAO,EAC9B,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,KAAK,EAAE,aAAa,GAAG,IAAI,EAC3B,eAAe,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACxD,oBAAoB,CAAC,EAAE,cAAc,uBActC;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,WAM7D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.23.1-next.23",
3
+ "version": "0.23.1-next.25",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -48,4 +48,4 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  }
51
- }
51
+ }
@@ -1,39 +1,11 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
2
1
  import type { PropsWithChildren } from 'react';
3
2
 
4
- import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
5
- import { useWallets } from '@rango-dev/wallets-react';
6
- import { isEvmBlockchain } from 'rango-types';
7
3
  import React, { Fragment } from 'react';
8
4
  import { MemoryRouter, useInRouterContext } from 'react-router';
9
5
 
10
- import { useForceAutoConnect } from '../hooks/useForceAutoConnect';
11
- import { useAppStore } from '../store/AppStore';
12
-
13
- export function AppRouter({
14
- children,
15
- ...props
16
- }: PropsWithChildren & {
17
- lastConnectedWallet: string;
18
- disconnectedWallet: WalletType | undefined;
19
- clearDisconnectedWallet: () => void;
20
- }) {
6
+ export function AppRouter({ children }: PropsWithChildren) {
21
7
  const isRouterInContext = useInRouterContext();
22
8
  const Router = isRouterInContext ? Fragment : MemoryRouter;
23
- const blockchains = useAppStore().blockchains();
24
- const { canSwitchNetworkTo } = useWallets();
25
-
26
- useForceAutoConnect();
27
-
28
- const evmChains = blockchains.filter(isEvmBlockchain);
29
-
30
- useQueueManager({
31
- lastConnectedWallet: props.lastConnectedWallet,
32
- clearDisconnectedWallet: props.clearDisconnectedWallet,
33
- disconnectedWallet: props.disconnectedWallet,
34
- evmChains,
35
- canSwitchNetworkTo,
36
- });
37
9
 
38
10
  return <Router>{children}</Router>;
39
11
  }
@@ -8,13 +8,21 @@ export const Container = styled('div', {
8
8
  backgroundColor: '$$color',
9
9
  borderBottomLeftRadius: '$xm',
10
10
  borderBottomRightRadius: '$xm',
11
- padding: '$15 ',
11
+ padding: '$15',
12
12
  variants: {
13
13
  rounded: {
14
14
  true: {
15
15
  borderRadius: '$xm',
16
16
  },
17
17
  },
18
+ expanded: {
19
+ true: {
20
+ paddingBottom: '3px',
21
+ },
22
+ false: {
23
+ paddingBottom: '$12',
24
+ },
25
+ },
18
26
  },
19
27
  });
20
28
 
@@ -11,7 +11,7 @@ export function QuoteSkeleton(props: PropTypes) {
11
11
  const { type, expanded, tagHidden = false } = props;
12
12
 
13
13
  return (
14
- <Container rounded={type !== 'basic'}>
14
+ <Container expanded={expanded} rounded={type !== 'basic'}>
15
15
  <QuoteSummarySkeleton type={type} tagHidden={tagHidden} />
16
16
  <Chains>
17
17
  <Skeleton height={15} variant="rounded" />
@@ -19,7 +19,7 @@ export function QuoteSkeleton(props: PropTypes) {
19
19
 
20
20
  {expanded && (
21
21
  <Steps>
22
- <Divider size={20} />
22
+ <Divider size={24} />
23
23
  <StepSkeleton />
24
24
  <StepSkeleton />
25
25
  <StepSkeleton separator={false} />
@@ -9,7 +9,7 @@ export const BasicSummary = styled('div', {
9
9
  });
10
10
 
11
11
  export const Output = styled('div', {
12
- padding: '$12 $0 $20 $0',
12
+ padding: '14px $0 $20 $0',
13
13
  display: 'flex',
14
14
  flexDirection: 'column',
15
15
  });
@@ -27,7 +27,7 @@ export const QuoteSummary = styled('div', {
27
27
  });
28
28
 
29
29
  export const QuoteSummarySeparator = styled('div', {
30
- height: '$28',
30
+ height: '$24',
31
31
  marginLeft: '13px',
32
32
  borderLeft: '1px solid $neutral700',
33
33
  });
@@ -41,11 +41,11 @@ export function QuoteSummarySkeleton(props: PropTypes) {
41
41
  {!tagHidden && (
42
42
  <>
43
43
  <FlexContent>
44
- <Skeleton width={65} height={14} variant="rounded" />
44
+ <Skeleton width={65} height={20} variant="rounded" />
45
45
  <Divider size={4} direction="horizontal" />
46
- <Skeleton width={65} height={14} variant="rounded" />
46
+ <Skeleton width={65} height={20} variant="rounded" />
47
47
  <Divider size={4} direction="horizontal" />
48
- <Skeleton width={65} height={14} variant="rounded" />
48
+ <Skeleton width={65} height={20} variant="rounded" />
49
49
  </FlexContent>
50
50
  <Line />
51
51
  {!showAllRoutesSkeleton && <Divider size={4} />}
@@ -60,7 +60,7 @@ export function QuoteSummarySkeleton(props: PropTypes) {
60
60
  <Skeleton width={60} height={10} variant="rounded" />
61
61
  </FlexContent>
62
62
  {showAllRoutesSkeleton && (
63
- <Skeleton width={100} height={22} variant="rounded" />
63
+ <Skeleton width={85} height={24} variant="rounded" />
64
64
  )}
65
65
  </div>
66
66
 
@@ -88,6 +88,7 @@ export function QuoteSummarySkeleton(props: PropTypes) {
88
88
  <QuoteSummarySeparator />
89
89
  {quotePreview}
90
90
  </SwapPreview>
91
+ <Divider size={12} />
91
92
  </>
92
93
  )}
93
94
  </div>
@@ -11,6 +11,13 @@ export const StepTokens = styled('div', {
11
11
  paddingBottom: '$10',
12
12
  display: 'flex',
13
13
  alignItems: 'center',
14
+ variants: {
15
+ extraSpace: {
16
+ true: {
17
+ paddingBottom: '$40',
18
+ },
19
+ },
20
+ },
14
21
  });
15
22
 
16
23
  export const StepTokenInfo = styled('div', {
@@ -23,7 +23,7 @@ export function StepSkeleton(props: PropTypes) {
23
23
  </StepTitle>
24
24
  <StepContent>
25
25
  <StepSeparator hideSeparator={!separator} />
26
- <StepTokens>
26
+ <StepTokens extraSpace={separator}>
27
27
  <StepTokenInfo>
28
28
  <ChainToken size="small" loading chainImage="" tokenImage="" />
29
29
  <Divider direction="horizontal" size={8} />
@@ -97,7 +97,7 @@ export function HighValueLossWarningModal(props: Props) {
97
97
  />
98
98
 
99
99
  <Flex>
100
- <Divider size={20} />
100
+ <Divider size="4" />
101
101
  <Typography size="small" variant="title">
102
102
  {i18n.t('Details')}
103
103
  </Typography>
@@ -66,6 +66,7 @@ export function makeAlerts(
66
66
  }
67
67
  if (warning.type === QuoteWarningType.HIGH_SLIPPAGE) {
68
68
  alertInfo.title = i18n.t('Caution, your slippage is high.');
69
+ alertInfo.action = 'change-settings';
69
70
  }
70
71
  return alertInfo;
71
72
  }
@@ -8,7 +8,7 @@ export const Flex = styled('div', {
8
8
  display: 'flex',
9
9
  flexDirection: 'column',
10
10
  alignItems: 'flex-start',
11
- gap: 10,
11
+ gap: '$5',
12
12
  width: '100%',
13
13
  });
14
14
 
@@ -67,6 +67,18 @@ export function Quotes(props: PropTypes) {
67
67
 
68
68
  return (
69
69
  <>
70
+ {hasSort && (
71
+ <>
72
+ <StrategyContent>
73
+ <Typography size="xmedium" variant="title">
74
+ {i18n.t('Sort by')}
75
+ </Typography>
76
+ <SelectStrategy container={getContainer()} />
77
+ </StrategyContent>
78
+ <Divider size="10" />
79
+ </>
80
+ )}
81
+
70
82
  {loading &&
71
83
  Array.from({ length: ITEM_SKELETON_COUNT }, (_, index) => (
72
84
  <React.Fragment key={index}>
@@ -85,17 +97,6 @@ export function Quotes(props: PropTypes) {
85
97
 
86
98
  {!loading && (
87
99
  <>
88
- {hasSort && (
89
- <>
90
- <StrategyContent>
91
- <Typography size="xmedium" variant="title">
92
- {i18n.t('Sort by')}
93
- </Typography>
94
- <SelectStrategy container={getContainer()} />
95
- </StrategyContent>
96
- <Divider size="10" />
97
- </>
98
- )}
99
100
  {hasQuotes
100
101
  ? sortQuotes.map((quote, index) => {
101
102
  const quoteWarning = getQuoteWarning(quote);
@@ -31,7 +31,7 @@ export const errorMessages = () => {
31
31
  impactTitle: i18n.t('High Price Impact'),
32
32
  title: i18n.t('Price impact is too high!'),
33
33
  description: i18n.t(
34
- 'The price impact is significantly higher than the allowed amount. If you are sure, continue, otherwise, change the swap.'
34
+ 'The price impact is significantly higher than the allowed amount.'
35
35
  ),
36
36
  confirmMessage: i18n.t('Confirm high price impact'),
37
37
  },
@@ -1,48 +1,27 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
2
-
3
1
  import { I18nManager } from '@rango-dev/ui';
4
- import React, { useContext, useEffect, useState } from 'react';
2
+ import React from 'react';
5
3
 
6
4
  import { AppRouter } from '../../components/AppRouter';
7
5
  import { AppRoutes } from '../../components/AppRoutes';
8
6
  import { WidgetEvents } from '../../components/WidgetEvents';
9
- import { globalFont } from '../../globalStyles';
10
- import { useFetchApiConfig } from '../../hooks/useFetchApiConfig';
7
+ import { useBootstrap } from '../../hooks/useBootstrap';
11
8
  import { useLanguage } from '../../hooks/useLanguage';
12
9
  import { useTheme } from '../../hooks/useTheme';
13
10
  import { useAppStore } from '../../store/AppStore';
14
- import { useNotificationStore } from '../../store/notification';
15
- import { WidgetContext } from '../Wallets';
16
11
 
17
12
  import { MainContainer } from './App.styles';
18
13
 
19
14
  export function Main() {
20
- globalFont();
21
-
15
+ useBootstrap();
22
16
  const { config } = useAppStore();
23
17
  const { activeTheme } = useTheme(config?.theme || {});
24
18
  const { activeLanguage } = useLanguage();
25
- const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
26
- useState<string>('');
27
- const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
28
- const widgetContext = useContext(WidgetContext);
29
- const { fetchApiConfig } = useFetchApiConfig();
30
- useEffect(() => {
31
- void useNotificationStore.persist.rehydrate();
32
- widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
33
- void fetchApiConfig().catch(console.log);
34
- }, []);
35
19
 
36
20
  return (
37
21
  <I18nManager language={activeLanguage}>
38
22
  <MainContainer id="swap-container" className={activeTheme()}>
39
23
  <WidgetEvents />
40
- <AppRouter
41
- lastConnectedWallet={lastConnectedWalletWithNetwork}
42
- disconnectedWallet={disconnectedWallet}
43
- clearDisconnectedWallet={() => {
44
- setDisconnectedWallet(undefined);
45
- }}>
24
+ <AppRouter>
46
25
  <AppRoutes />
47
26
  </AppRouter>
48
27
  </MainContainer>
@@ -14,6 +14,7 @@ import {
14
14
  USD_VALUE_MAX_DECIMALS,
15
15
  USD_VALUE_MIN_DECIMALS,
16
16
  } from '../../constants/routing';
17
+ import { useAppStore } from '../../store/AppStore';
17
18
  import { useQuoteStore } from '../../store/quote';
18
19
  import { useWalletsStore } from '../../store/wallets';
19
20
  import { getContainer } from '../../utils/common';
@@ -39,6 +40,9 @@ export function Inputs(props: PropTypes) {
39
40
  selectedQuote,
40
41
  } = useQuoteStore();
41
42
  const { connectedWallets, getBalanceFor } = useWalletsStore();
43
+ const {
44
+ config: { variant },
45
+ } = useAppStore();
42
46
 
43
47
  const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
44
48
 
@@ -116,7 +120,9 @@ export function Inputs(props: PropTypes) {
116
120
  <SwitchFromAndToButton />
117
121
  </FromContainer>
118
122
  <SwapInput
119
- sharpBottomStyle={!!selectedQuote || fetchingQuote}
123
+ sharpBottomStyle={
124
+ variant === 'default' && (!!selectedQuote || fetchingQuote)
125
+ }
120
126
  label={i18n.t('To')}
121
127
  mode="To"
122
128
  fetchingQuote={fetchingQuote}
@@ -1,5 +1,5 @@
1
1
  import type {
2
- OnConnectHandler,
2
+ OnWalletConnectionChange,
3
3
  PropTypes,
4
4
  WidgetContextInterface,
5
5
  } from './Wallets.types';
@@ -10,7 +10,7 @@ import type { PropsWithChildren } from 'react';
10
10
  import { Events, Provider } from '@rango-dev/wallets-react';
11
11
  import { type Network } from '@rango-dev/wallets-shared';
12
12
  import { isEvmBlockchain } from 'rango-sdk';
13
- import React, { createContext, useEffect, useRef } from 'react';
13
+ import React, { createContext, useEffect, useMemo, useRef } from 'react';
14
14
 
15
15
  import { useWalletProviders } from '../../hooks/useWalletProviders';
16
16
  import { AppStoreProvider, useAppStore } from '../../store/AppStore';
@@ -25,6 +25,9 @@ export const WidgetContext = createContext<WidgetContextInterface>({
25
25
  onConnectWallet: () => {
26
26
  return;
27
27
  },
28
+ onDisconnectWallet: () => {
29
+ return;
30
+ },
28
31
  });
29
32
 
30
33
  function Main(props: PropsWithChildren<PropTypes>) {
@@ -36,7 +39,8 @@ function Main(props: PropsWithChildren<PropTypes>) {
36
39
  };
37
40
  const { providers } = useWalletProviders(props.config.wallets, walletOptions);
38
41
  const { connectWallet, disconnectWallet } = useWalletsStore();
39
- const onConnectWalletHandler = useRef<OnConnectHandler>();
42
+ const onConnectWalletHandler = useRef<OnWalletConnectionChange>();
43
+ const onDisconnectWalletHandler = useRef<OnWalletConnectionChange>();
40
44
 
41
45
  useEffect(() => {
42
46
  void fetchMeta().catch(console.log);
@@ -70,6 +74,13 @@ function Main(props: PropsWithChildren<PropTypes>) {
70
74
  }
71
75
  } else {
72
76
  disconnectWallet(type);
77
+ if (!!onDisconnectWalletHandler.current) {
78
+ onDisconnectWalletHandler.current(type);
79
+ } else {
80
+ console.warn(
81
+ `onDisconnectWallet handler hasn't been set. Are you sure?`
82
+ );
83
+ }
73
84
  }
74
85
  }
75
86
  if (event === Events.ACCOUNTS && state.connected) {
@@ -102,14 +113,20 @@ function Main(props: PropsWithChildren<PropTypes>) {
102
113
  };
103
114
  const isActiveTab = useUiStore.use.isActiveTab();
104
115
 
116
+ const handlers = useMemo(
117
+ () => ({
118
+ onConnectWallet: (handler: OnWalletConnectionChange) => {
119
+ onConnectWalletHandler.current = handler;
120
+ },
121
+ onDisconnectWallet: (handler: OnWalletConnectionChange) => {
122
+ onDisconnectWalletHandler.current = handler;
123
+ },
124
+ }),
125
+ []
126
+ );
127
+
105
128
  return (
106
- <WidgetContext.Provider
107
- // eslint-disable-next-line react/jsx-no-constructed-context-values
108
- value={{
109
- onConnectWallet: (handler) => {
110
- onConnectWalletHandler.current = handler;
111
- },
112
- }}>
129
+ <WidgetContext.Provider value={handlers}>
113
130
  <Provider
114
131
  allBlockChains={blockchains}
115
132
  providers={providers}
@@ -1,9 +1,20 @@
1
1
  import type { WidgetConfig } from '../../types';
2
2
  import type { EventHandler } from '@rango-dev/wallets-react';
3
3
 
4
- export type OnConnectHandler = (key: string) => void;
4
+ export type OnWalletConnectionChange = (key: string) => void;
5
5
  export interface WidgetContextInterface {
6
- onConnectWallet(handler: OnConnectHandler): void;
6
+ /**
7
+ * A wallet connection handler, utilized within the wallet provider,
8
+ * is linked to the useBootstrap hook for synchronizing the state of the last connected wallet.
9
+ * It's important not to override this handler in other locations.
10
+ */
11
+ onConnectWallet(handler: OnWalletConnectionChange): void;
12
+ /**
13
+ * A wallet disconnection handler, utilized within the wallet provider,
14
+ * is linked to the useBootstrap hook for synchronizing the state of the last disconnected wallet.
15
+ * It's important not to override this handler in other locations.
16
+ */
17
+ onDisconnectWallet(handler: OnWalletConnectionChange): void;
7
18
  }
8
19
 
9
20
  export interface PropTypes {
@@ -1,19 +1,13 @@
1
1
  import type { WidgetProps } from './Widget.types';
2
2
  import type { PropsWithChildren } from 'react';
3
3
 
4
- import React, { useEffect } from 'react';
4
+ import React from 'react';
5
5
 
6
6
  import { DEFAULT_CONFIG } from '../../store/slices/config';
7
- import { tabManager } from '../../store/ui';
8
7
  import { Main } from '../App';
9
8
  import { WidgetProvider } from '../WidgetProvider';
10
9
 
11
10
  export function Widget(props: PropsWithChildren<WidgetProps>) {
12
- useEffect(() => {
13
- tabManager.init();
14
- return tabManager.destroy;
15
- }, []);
16
-
17
11
  if (!props.config?.externalWallets) {
18
12
  return (
19
13
  <WidgetProvider config={props.config ?? DEFAULT_CONFIG}>
@@ -0,0 +1 @@
1
+ export { useBootstrap } from './useBootstrap';
@@ -0,0 +1,72 @@
1
+ import type { WalletType } from '../..';
2
+
3
+ import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
4
+ import { splitWalletNetwork } from '@rango-dev/wallets-shared';
5
+ import { isEvmBlockchain } from 'rango-sdk';
6
+ import { useContext, useEffect, useState } from 'react';
7
+
8
+ import { useWallets } from '../..';
9
+ import { WidgetContext } from '../../containers/Wallets';
10
+ import { globalFont } from '../../globalStyles';
11
+ import { useAppStore } from '../../store/AppStore';
12
+ import { useNotificationStore } from '../../store/notification';
13
+ import { tabManager } from '../../store/ui';
14
+ import { useFetchApiConfig } from '../useFetchApiConfig';
15
+ import { useForceAutoConnect } from '../useForceAutoConnect';
16
+
17
+ export function useBootstrap() {
18
+ globalFont();
19
+ useForceAutoConnect();
20
+ const blockchains = useAppStore().blockchains();
21
+ const { canSwitchNetworkTo } = useWallets();
22
+ const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
23
+ useState('');
24
+ const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
25
+ const widgetContext = useContext(WidgetContext);
26
+
27
+ const evmChains = blockchains.filter(isEvmBlockchain);
28
+
29
+ const { fetchApiConfig } = useFetchApiConfig();
30
+
31
+ // At the moment, we only detect the disconnection of EVM wallets.
32
+ useQueueManager({
33
+ lastConnectedWallet: lastConnectedWalletWithNetwork,
34
+ clearDisconnectedWallet: () => {
35
+ setDisconnectedWallet(undefined);
36
+ },
37
+ disconnectedWallet: disconnectedWallet,
38
+ evmChains,
39
+ canSwitchNetworkTo,
40
+ });
41
+
42
+ useEffect(() => {
43
+ tabManager.init();
44
+
45
+ if (!useNotificationStore.persist.hasHydrated()) {
46
+ void useNotificationStore.persist.rehydrate();
47
+ }
48
+
49
+ /**
50
+ * Add handlers to the widget context for connecting and disconnecting wallets.
51
+ * We pass these handlers to the wallet provider to keep track of the last connected and last disconnected wallets.
52
+ * The 'queue-manager' uses these details to spot any changes in the connection status of the required wallet during the swap process.
53
+ *
54
+ * with this approch anyone who use the widget context can override these handlers and causes some bugs happens.
55
+ * it the future we should add a safer soloution like considering array of handlers .
56
+ * https://github.com/rango-exchange/rango-client/pull/630/files#r1518846728
57
+ */
58
+ widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
59
+ widgetContext.onDisconnectWallet((walletType) => {
60
+ setDisconnectedWallet(walletType);
61
+ if (
62
+ walletType === splitWalletNetwork(lastConnectedWalletWithNetwork)?.[0]
63
+ ) {
64
+ setLastConnectedWalletWithNetwork('');
65
+ }
66
+ });
67
+
68
+ void fetchApiConfig().catch(console.log);
69
+
70
+ return tabManager.destroy;
71
+ }, []);
72
+ }
@@ -383,7 +383,8 @@ export function ConfirmSwapPage() {
383
383
  <QuoteInfo
384
384
  quote={selectedQuote}
385
385
  type="swap-preview"
386
- expanded={true}
386
+ expanded
387
+ tagHidden
387
388
  error={confirmSwapResult.error}
388
389
  loading={fetchingConfirmationQuote}
389
390
  warning={confirmSwapResult.warnings?.quote ?? null}
package/src/utils/swap.ts CHANGED
@@ -750,11 +750,7 @@ export function getLastConvertedTokenInFailedSwap(
750
750
  }
751
751
 
752
752
  export function shouldRetrySwap(pendingSwap: PendingSwap) {
753
- return (
754
- pendingSwap.status === 'failed' &&
755
- !!pendingSwap.finishTime &&
756
- new Date().getTime() - parseInt(pendingSwap.finishTime) < 4 * 3600 * 1000
757
- );
753
+ return pendingSwap.status === 'failed';
758
754
  }
759
755
 
760
756
  export function confirmSwapDisabled(