@rango-dev/widget-embedded 0.56.0 → 0.56.1-next.1

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.56.0",
3
+ "version": "0.56.1-next.1",
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.12.1",
28
- "@rango-dev/provider-all": "^0.58.0",
28
+ "@rango-dev/provider-all": "^0.58.1-next.1",
29
29
  "@rango-dev/queue-manager-core": "^0.33.0",
30
- "@rango-dev/queue-manager-rango-preset": "^0.58.0",
30
+ "@rango-dev/queue-manager-rango-preset": "^0.58.1-next.0",
31
31
  "@rango-dev/queue-manager-react": "^0.33.0",
32
32
  "@rango-dev/signer-solana": "^0.46.1",
33
- "@rango-dev/ui": "^0.59.0",
34
- "@rango-dev/wallets-core": "^0.55.0",
35
- "@rango-dev/wallets-react": "^0.42.0",
36
- "@rango-dev/wallets-shared": "^0.56.0",
33
+ "@rango-dev/ui": "^0.59.1-next.0",
34
+ "@rango-dev/wallets-core": "^0.55.1-next.0",
35
+ "@rango-dev/wallets-react": "^0.42.1-next.1",
36
+ "@rango-dev/wallets-shared": "^0.56.1-next.0",
37
37
  "bignumber.js": "^9.1.1",
38
38
  "copy-to-clipboard": "^3.3.3",
39
39
  "dayjs": "^1.11.7",
@@ -61,7 +61,35 @@ export function WalletList(props: PropTypes) {
61
61
  setShowExperimentalChainModal(false);
62
62
  setAddingExperimentalChainStatus('in-progress');
63
63
  try {
64
- await suggestAndConnect(wallet.walletType, wallet.chain);
64
+ // 1. Finding wallet with namespaces info.
65
+ const walletWithNamespace = list.find(
66
+ (wallet) => wallet.type === wallet.type
67
+ );
68
+
69
+ /*
70
+ * 2. Getting namespaces info.
71
+ * Legacy and hub have different structure to handle each situation.
72
+ */
73
+ const needsNamespace = walletWithNamespace?.isHub
74
+ ? walletWithNamespace.properties?.find(
75
+ (item) => item.name === 'namespaces'
76
+ )?.value
77
+ : walletWithNamespace?.needsNamespace;
78
+
79
+ // 3. Finding target namespace.
80
+ const allBlockChains = blockchains();
81
+ const namespace = needsNamespace?.data.find((ns) =>
82
+ ns
83
+ .getSupportedChains(allBlockChains)
84
+ .some((chain) => chain.name === wallet.chain)
85
+ );
86
+ if (!namespace) {
87
+ throw new Error('Requested chain is not supported');
88
+ }
89
+ await suggestAndConnect(wallet.walletType, {
90
+ namespace: namespace.value,
91
+ network: wallet.chain,
92
+ });
65
93
  setAddingExperimentalChainStatus('completed');
66
94
  } catch {
67
95
  setAddingExperimentalChainStatus('rejected');
@@ -143,7 +171,11 @@ export function WalletList(props: PropTypes) {
143
171
  const onSelectableWalletClick = async () => {
144
172
  const isDisconnected = wallet.state === WalletState.DISCONNECTED;
145
173
 
146
- if (isDisconnected || isConnectedButDifferentThanTargetNamespace) {
174
+ if (
175
+ isDisconnected ||
176
+ (isConnectedButDifferentThanTargetNamespace &&
177
+ !couldAddExperimentalChain)
178
+ ) {
147
179
  setSelectedWalletToConnect(wallet);
148
180
  } else if (couldAddExperimentalChain) {
149
181
  setExperimentalChainWallet({