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

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.
@@ -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,sBAmU9B"}
1
+ {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBAuU9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.23.1-next.25",
3
+ "version": "0.23.1-next.27",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "@lingui/core": "4.2.1",
23
23
  "@lingui/react": "4.2.1",
24
+ "@rango-dev/logging-core": "^0.1.1-next.0",
24
25
  "@rango-dev/provider-all": "^0.28.1-next.2",
25
26
  "@rango-dev/queue-manager-core": "^0.26.0",
26
27
  "@rango-dev/queue-manager-rango-preset": "^0.28.1-next.3",
@@ -109,6 +109,8 @@ export function SwapDetails(props: SwapDetailsProps) {
109
109
  if (swap.status === 'success' || swap.status === 'failed') {
110
110
  setShowCompletedModal(swap.status);
111
111
  setAsRead(swap.requestId);
112
+ } else if (showCompletedModal) {
113
+ setShowCompletedModal(null);
112
114
  }
113
115
  }
114
116
  }, [swap.status, swap.requestId]);
@@ -1,5 +1,6 @@
1
1
  import type { WalletStateContentProps } from './SwapDetailsModal.types';
2
2
 
3
+ import { debug } from '@rango-dev/logging-core';
3
4
  import { MessageBox, Wallet } from '@rango-dev/ui';
4
5
  import { useWallets } from '@rango-dev/wallets-react';
5
6
  import React from 'react';
@@ -39,7 +40,10 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
39
40
  state={walletState}
40
41
  link={walletInfo.installLink}
41
42
  disabled={walletButtonDisabled}
42
- onClick={async () => connect(walletType)}
43
+ // TODO we need to show an error modal when user reject the connection
44
+ onClick={async () =>
45
+ connect(walletType).catch((error) => debug(error))
46
+ }
43
47
  />
44
48
  </WalletContainer>
45
49
  )}
@@ -2,7 +2,7 @@ import { UI_ID } from '@rango-dev/ui';
2
2
 
3
3
  export const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
4
4
  export const DEFAULT_BASE_URL = 'https://api.rango.exchange';
5
- export const SCANNER_BASE_URL = 'https://scan.rango.exchange';
5
+ export const SCANNER_BASE_URL = 'https://explorer.rango.exchange';
6
6
 
7
7
  export const WIDGET_UI_ID = {
8
8
  SWAP_BOX_ID: 'rango-swap-box',
@@ -109,6 +109,18 @@ export function useWalletList(params: Params) {
109
109
  * but we have ethereum injected
110
110
  */
111
111
  const shouldShowDefaultInjectedWallet = (wallets: WalletInfo[]) => {
112
+ // don't show default injected wallet when it's not installed
113
+ const defaultWallet = wallets.find(
114
+ (wallet) => wallet.type === WalletTypes.DEFAULT
115
+ );
116
+ if (!defaultWallet || defaultWallet.state === WalletState.NOT_INSTALLED) {
117
+ return false;
118
+ }
119
+
120
+ /*
121
+ * if we have another evm wallet installed (except wallet connect),
122
+ * there is no need to show default injected wallet anymore
123
+ */
112
124
  const isEvmWalletInstalledExceptDefault = wallets.filter(
113
125
  (wallet) =>
114
126
  wallet.state != WalletState.NOT_INSTALLED &&
@@ -87,6 +87,7 @@ export function ConfirmSwapPage() {
87
87
  const { connectedWallets } = useWalletsStore();
88
88
  const showWalletsOnInit = !quoteWalletsConfirmed;
89
89
  const [showWallets, setShowWallets] = useState(false);
90
+ const [isConfirming, setIsConfirming] = useState(false);
90
91
  const { isActiveTab } = useUiStore();
91
92
  const disabledLiquiditySources = useAppStore().getDisabledLiquiditySources();
92
93
  const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
@@ -137,7 +138,9 @@ export function ConfirmSwapPage() {
137
138
  };
138
139
 
139
140
  const onConfirm = async () => {
141
+ setIsConfirming(true);
140
142
  await addNewSwap();
143
+ setIsConfirming(false);
141
144
  };
142
145
 
143
146
  const onStartConfirmSwap = async () => {
@@ -326,7 +329,7 @@ export function ConfirmSwapPage() {
326
329
  type="primary"
327
330
  size="large"
328
331
  fullWidth
329
- loading={fetchingConfirmationQuote}
332
+ loading={fetchingConfirmationQuote || isConfirming}
330
333
  disabled={!!confirmSwapResult.error || !isActiveTab}
331
334
  onClick={onStartConfirmSwap}>
332
335
  {i18n.t('Start Swap')}
@@ -336,7 +339,8 @@ export function ConfirmSwapPage() {
336
339
  variant="contained"
337
340
  type="primary"
338
341
  size="large"
339
- loading={fetchingConfirmationQuote}
342
+ loading={fetchingConfirmationQuote || isConfirming}
343
+ disabled={!isActiveTab}
340
344
  onClick={setShowWallets.bind(null, true)}>
341
345
  <WalletIcon size={24} />
342
346
  </IconButton>