@rango-dev/widget-embedded 0.36.1-next.10 → 0.36.1-next.11

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.36.1-next.10",
3
+ "version": "0.36.1-next.11",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,15 +25,15 @@
25
25
  "@lingui/core": "4.2.1",
26
26
  "@lingui/react": "4.2.1",
27
27
  "@rango-dev/logging-core": "^0.6.0",
28
- "@rango-dev/provider-all": "^0.40.1-next.5",
28
+ "@rango-dev/provider-all": "^0.40.1-next.6",
29
29
  "@rango-dev/queue-manager-core": "^0.27.0",
30
- "@rango-dev/queue-manager-rango-preset": "^0.40.1-next.4",
30
+ "@rango-dev/queue-manager-rango-preset": "^0.40.1-next.5",
31
31
  "@rango-dev/queue-manager-react": "^0.27.0",
32
32
  "@rango-dev/signer-solana": "^0.35.1-next.0",
33
- "@rango-dev/ui": "^0.42.1-next.7",
34
- "@rango-dev/wallets-core": "^0.40.1-next.4",
35
- "@rango-dev/wallets-react": "^0.26.1-next.5",
36
- "@rango-dev/wallets-shared": "^0.40.1-next.4",
33
+ "@rango-dev/ui": "^0.42.1-next.8",
34
+ "@rango-dev/wallets-core": "^0.40.1-next.5",
35
+ "@rango-dev/wallets-react": "^0.26.1-next.6",
36
+ "@rango-dev/wallets-shared": "^0.40.1-next.5",
37
37
  "bignumber.js": "^9.1.1",
38
38
  "copy-to-clipboard": "^3.3.3",
39
39
  "dayjs": "^1.11.7",
@@ -1,5 +1,8 @@
1
- import type { SwapQueueContext } from '@rango-dev/queue-manager-rango-preset';
2
- import type { Network, WalletType } from '@rango-dev/wallets-shared';
1
+ import type {
2
+ SwapQueueContext,
3
+ TargetNamespace,
4
+ } from '@rango-dev/queue-manager-rango-preset';
5
+ import type { WalletType } from '@rango-dev/wallets-shared';
3
6
  import type { PropsWithChildren } from 'react';
4
7
 
5
8
  import {
@@ -48,16 +51,14 @@ function QueueManager(props: PropsWithChildren<{ apiKey?: string }>) {
48
51
  })),
49
52
  };
50
53
 
51
- const switchNetwork = async (wallet: WalletType, network: Network) => {
52
- if (!canSwitchNetworkTo(wallet, network)) {
54
+ const switchNetwork = async (
55
+ wallet: WalletType,
56
+ namespace: TargetNamespace
57
+ ) => {
58
+ if (!canSwitchNetworkTo(wallet, namespace.network)) {
53
59
  return undefined;
54
60
  }
55
- const result = await connect(wallet, [
56
- {
57
- namespace: 'DISCOVER_MODE',
58
- network,
59
- },
60
- ]);
61
+ const result = await connect(wallet, [namespace]);
61
62
 
62
63
  return result;
63
64
  };
@@ -3,7 +3,7 @@ import type { ModalState } from '../SwapDetailsModal';
3
3
 
4
4
  import { i18n } from '@lingui/core';
5
5
  import {
6
- getCurrentBlockchainOfOrNull,
6
+ getCurrentNamespaceOfOrNull,
7
7
  getCurrentStep,
8
8
  getRelatedWalletOrNull,
9
9
  } from '@rango-dev/queue-manager-rango-preset';
@@ -138,8 +138,8 @@ export function SwapDetails(props: SwapDetailsProps) {
138
138
  const lastConvertedTokenInFailedSwap =
139
139
  getLastConvertedTokenInFailedSwap(swap);
140
140
 
141
- const currentStepBlockchain = currentStep
142
- ? getCurrentBlockchainOfOrNull(swap, currentStep)
141
+ const currentStepNamespace = currentStep
142
+ ? getCurrentNamespaceOfOrNull(swap, currentStep)
143
143
  : null;
144
144
  const currentStepWallet = currentStep
145
145
  ? getRelatedWalletOrNull(swap, currentStep)
@@ -154,16 +154,19 @@ export function SwapDetails(props: SwapDetailsProps) {
154
154
  const showSwitchNetwork =
155
155
  currentStepNetworkStatus ===
156
156
  PendingSwapNetworkStatus.WaitingForNetworkChange &&
157
- !!currentStepBlockchain &&
157
+ !!currentStepNamespace &&
158
158
  !!currentStepWallet?.walletType &&
159
159
  (isMobileWallet(currentStepWallet.walletType) ||
160
- canSwitchNetworkTo(currentStepWallet.walletType, currentStepBlockchain));
160
+ canSwitchNetworkTo(
161
+ currentStepWallet.walletType,
162
+ currentStepNamespace.network
163
+ ));
161
164
 
162
165
  const switchNetwork = showSwitchNetwork
163
166
  ? connect.bind(null, currentStepWallet.walletType, [
164
167
  {
165
- namespace: 'DISCOVER_MODE',
166
- network: currentStepBlockchain,
168
+ namespace: currentStepNamespace.namespace,
169
+ network: currentStepNamespace.network,
167
170
  },
168
171
  ])
169
172
  : undefined;
@@ -5,7 +5,7 @@ import type { PendingSwap } from 'rango-types/lib';
5
5
 
6
6
  import {
7
7
  cancelSwap,
8
- getCurrentBlockchainOfOrNull,
8
+ getCurrentNamespaceOfOrNull,
9
9
  getCurrentStep,
10
10
  getRelatedWalletOrNull,
11
11
  } from '@rango-dev/queue-manager-rango-preset';
@@ -66,7 +66,7 @@ export class WidgetHistory {
66
66
  step: currentStep,
67
67
  wallet: currentStep ? getRelatedWalletOrNull(swap, currentStep) : null,
68
68
  network: currentStep
69
- ? getCurrentBlockchainOfOrNull(swap, currentStep)
69
+ ? getCurrentNamespaceOfOrNull(swap, currentStep)?.network
70
70
  : null,
71
71
  };
72
72
  }