@rango-dev/widget-embedded 0.44.2-next.0 → 0.44.2-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.44.2-next.0",
3
+ "version": "0.44.2-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -54,4 +54,4 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  }
57
- }
57
+ }
@@ -7,10 +7,7 @@ import { WalletState } from '@rango-dev/ui';
7
7
  import { useWallets } from '@rango-dev/wallets-react';
8
8
  import { useReducer } from 'react';
9
9
 
10
- import {
11
- checkIsWalletPartiallyConnected,
12
- type ExtendedModalWalletInfo,
13
- } from '../../utils/wallets';
10
+ import { type ExtendedModalWalletInfo } from '../../utils/wallets';
14
11
 
15
12
  import {
16
13
  isStateOnDerivationPathStep,
@@ -148,14 +145,12 @@ export function useStatefulConnect(): UseStatefulConnect {
148
145
  }
149
146
  }
150
147
 
148
+ // If the wallet is a hub wallet and it is connected (fully or partially) and it contains more than one namespace, we should display detached modal
151
149
  if (!!wallet.isHub) {
152
- const walletState = state(wallet.type);
153
- const namespacesState = walletState.namespaces;
154
- const isPartiallyConnected = checkIsWalletPartiallyConnected(
155
- wallet,
156
- namespacesState
157
- );
158
- if (isPartiallyConnected) {
150
+ const needsNamespace = wallet.properties?.find(
151
+ (item) => item.name === 'namespaces'
152
+ )?.value;
153
+ if (needsNamespace?.data.length && needsNamespace.data.length > 1) {
159
154
  dispatch({
160
155
  type: 'detached',
161
156
  payload: {
@@ -13,6 +13,7 @@ import { SameTokensWarning } from '../components/SameTokensWarning';
13
13
  import { SlippageWarningsAndErrors } from '../components/SlippageWarningsAndErrors/SlippageWarningsAndErrors';
14
14
  import { SwapMetrics } from '../components/SwapMetrics';
15
15
  import { navigationRoutes } from '../constants/navigationRoutes';
16
+ import { SLIPPAGES } from '../constants/swapSettings';
16
17
  import { ExpandedQuotes } from '../containers/ExpandedQuotes';
17
18
  import { Inputs } from '../containers/Inputs';
18
19
  import { QuoteInfo } from '../containers/QuoteInfo';
@@ -136,10 +137,15 @@ export function Home() {
136
137
  };
137
138
 
138
139
  const onChangeSlippage = (slippage: number | null) => {
139
- if (slippage) {
140
+ if (!slippage) {
141
+ return;
142
+ }
143
+ if (SLIPPAGES.includes(slippage)) {
140
144
  setSlippage(slippage);
141
145
  setCustomSlippage(null);
146
+ return;
142
147
  }
148
+ setCustomSlippage(slippage);
143
149
  };
144
150
 
145
151
  useEffect(() => {