@rango-dev/widget-embedded 0.20.0 → 0.20.1-next.0

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.20.0",
3
+ "version": "0.20.1-next.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -21,13 +21,13 @@
21
21
  "dependencies": {
22
22
  "@lingui/core": "4.2.1",
23
23
  "@lingui/react": "4.2.1",
24
- "@rango-dev/provider-all": "^0.25.0",
24
+ "@rango-dev/provider-all": "^0.25.1-next.0",
25
25
  "@rango-dev/queue-manager-core": "^0.25.0",
26
- "@rango-dev/queue-manager-rango-preset": "^0.25.0",
26
+ "@rango-dev/queue-manager-rango-preset": "^0.25.1-next.0",
27
27
  "@rango-dev/queue-manager-react": "^0.24.0",
28
- "@rango-dev/ui": "^0.26.0",
29
- "@rango-dev/wallets-react": "^0.11.0",
30
- "@rango-dev/wallets-shared": "^0.25.0",
28
+ "@rango-dev/ui": "^0.26.1-next.0",
29
+ "@rango-dev/wallets-react": "^0.11.1-next.0",
30
+ "@rango-dev/wallets-shared": "^0.25.1-next.0",
31
31
  "bignumber.js": "^9.1.1",
32
32
  "copy-to-clipboard": "^3.3.3",
33
33
  "dayjs": "^1.11.7",
@@ -1,4 +1,5 @@
1
1
  import type { WidgetConfig } from '../types';
2
+ import type { WalletInfo } from '@rango-dev/ui';
2
3
  import type { BlockchainMeta } from 'rango-sdk';
3
4
 
4
5
  import { WalletState } from '@rango-dev/ui';
@@ -101,15 +102,36 @@ export function useWalletList(params: Params) {
101
102
  };
102
103
  }, []);
103
104
 
105
+ /*
106
+ * Atm, we only support default injected wallet for the EVM
107
+ * so we show default wallet when there is no other evm wallet installed
108
+ * but we have ethereum injected
109
+ */
110
+ const shouldShowDefaultInjectedWallet = (wallets: WalletInfo[]) => {
111
+ const isEvmWalletInstalledExceptDefault = wallets.filter(
112
+ (wallet) =>
113
+ wallet.state != WalletState.NOT_INSTALLED &&
114
+ ![WalletTypes.DEFAULT, WalletTypes.WALLET_CONNECT_2].includes(
115
+ wallet.type as WalletTypes
116
+ ) &&
117
+ getWalletInfo(wallet.type).supportedChains.filter(
118
+ (blockchain) => blockchain.type == 'EVM'
119
+ ).length > 0
120
+ );
121
+ return isEvmWalletInstalledExceptDefault.length == 0;
122
+ };
123
+
104
124
  const shouldExcludeWallet = (
105
125
  walletType: string,
106
126
  chain: string,
107
127
  blockchains: BlockchainMeta[]
108
128
  ) => {
109
129
  return (
110
- isExperimentalChain(blockchains, chain) &&
111
- isExperimentalChainNotAdded(walletType) &&
112
- !KEPLR_COMPATIBLE_WALLETS.includes(walletType)
130
+ (isExperimentalChain(blockchains, chain) &&
131
+ isExperimentalChainNotAdded(walletType) &&
132
+ !KEPLR_COMPATIBLE_WALLETS.includes(walletType)) ||
133
+ (walletType == WalletTypes.DEFAULT &&
134
+ !shouldShowDefaultInjectedWallet(wallets))
113
135
  );
114
136
  };
115
137