@web3auth/no-modal 10.8.1 → 10.8.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.
@@ -145,7 +145,7 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
145
145
  ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig1 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig1 === void 0 ? void 0 : _walletServicesConfig1.defaultPortfolio
146
146
  };
147
147
  };
148
- const sdkVersion = "10.8.1";
148
+ const sdkVersion = "10.8.2";
149
149
  const getErrorAnalyticsProperties = error => {
150
150
  try {
151
151
  const code = error instanceof index.Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
@@ -215,7 +215,7 @@ class MetaMaskConnector extends baseEvmConnector.BaseEvmConnector {
215
215
  } catch (error) {
216
216
  // If the error code is 4902, the network needs to be added
217
217
  if ((error === null || error === void 0 ? void 0 : error.code) === 4902) {
218
- const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [baseControllers.CHAIN_NAMESPACES.EIP155, baseControllers.CHAIN_NAMESPACES.SOLANA].includes(x.chainNamespace));
218
+ const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [baseControllers.CHAIN_NAMESPACES.EIP155].includes(x.chainNamespace));
219
219
  await this.addChain(chainConfig);
220
220
  await requestSwitchChain();
221
221
  } else {
@@ -597,9 +597,9 @@ class Web3AuthNoModal extends auth.SafeEventEmitter {
597
597
  const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
598
598
  const isMipdEnabled = isExternalWalletEnabled && ((_this$coreOptions$mul = this.coreOptions.multiInjectedProviderDiscovery) !== null && _this$coreOptions$mul !== void 0 ? _this$coreOptions$mul : true);
599
599
  const chainNamespaces = new Set(this.coreOptions.chains.map(chain => chain.chainNamespace));
600
- // it's safe to add it here as if there is a MetaMask injected provider, this won't override it
601
- // only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
602
- if (utils.isBrowser() && chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155) && !chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.SOLANA)) {
600
+ // prioritize using MM connector over injected connector for EVM chains
601
+ if (utils.isBrowser() && chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155)) {
602
+ // only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
603
603
  connectorFns.push(metamaskConnector.metaMaskConnector(modalMode ? {
604
604
  headless: true
605
605
  } : undefined));
@@ -635,13 +635,6 @@ class Web3AuthNoModal extends auth.SafeEventEmitter {
635
635
  connectorFns.push(...evmMipd.getProviders().map(injectedEvmConnector));
636
636
  }
637
637
  }
638
- // it's safe to add it here as if there is a MetaMask injected provider, this won't override it
639
- // only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
640
- if (utils.isBrowser() && (chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155))) {
641
- connectorFns.push(metamaskConnector.metaMaskConnector(modalMode ? {
642
- headless: true
643
- } : undefined));
644
- }
645
638
  // add WalletConnectV2 connector if external wallets are enabled
646
639
  if (utils.isBrowser() && isExternalWalletEnabled && (chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155))) {
647
640
  const {
@@ -145,7 +145,7 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
145
145
  ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig1 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig1 === void 0 ? void 0 : _walletServicesConfig1.defaultPortfolio
146
146
  };
147
147
  };
148
- const sdkVersion = "10.8.1";
148
+ const sdkVersion = "10.8.2";
149
149
  const getErrorAnalyticsProperties = error => {
150
150
  try {
151
151
  const code = error instanceof Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
@@ -215,7 +215,7 @@ class MetaMaskConnector extends BaseEvmConnector {
215
215
  } catch (error) {
216
216
  // If the error code is 4902, the network needs to be added
217
217
  if ((error === null || error === void 0 ? void 0 : error.code) === 4902) {
218
- const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [CHAIN_NAMESPACES.EIP155, CHAIN_NAMESPACES.SOLANA].includes(x.chainNamespace));
218
+ const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [CHAIN_NAMESPACES.EIP155].includes(x.chainNamespace));
219
219
  await this.addChain(chainConfig);
220
220
  await requestSwitchChain();
221
221
  } else {
@@ -11,9 +11,9 @@ import { Analytics, ANALYTICS_INTEGRATION_TYPE, ANALYTICS_SDK_TYPE, ANALYTICS_EV
11
11
  import { sdkVersion, fetchProjectConfig, withAbort, getErrorAnalyticsProperties, getCaipChainId, isHexStrict, getHostname, getWhitelabelAnalyticsProperties, getAaAnalyticsProperties, getWalletServicesAnalyticsProperties, isBrowser } from './base/utils.js';
12
12
  import { CommonJRPCProvider } from './providers/base-provider/CommonJRPCProvider.js';
13
13
  import { authConnector } from './connectors/auth-connector/authConnector.js';
14
- import { metaMaskConnector } from './connectors/metamask-connector/metamaskConnector.js';
15
14
  import { walletServicesPlugin } from './plugins/wallet-services-plugin/plugin.js';
16
15
  import { storageAvailable } from './base/connector/utils.js';
16
+ import { metaMaskConnector } from './connectors/metamask-connector/metamaskConnector.js';
17
17
  import { CONNECTOR_STATUS, CONNECTOR_EVENTS } from './base/connector/constants.js';
18
18
  import { WalletInitializationError, WalletLoginError } from './base/errors/index.js';
19
19
  import { log } from './base/loglevel.js';
@@ -609,9 +609,9 @@ class Web3AuthNoModal extends SafeEventEmitter {
609
609
  const isMipdEnabled = isExternalWalletEnabled && ((_this$coreOptions$mul = this.coreOptions.multiInjectedProviderDiscovery) !== null && _this$coreOptions$mul !== void 0 ? _this$coreOptions$mul : true);
610
610
  const chainNamespaces = new Set(this.coreOptions.chains.map(chain => chain.chainNamespace));
611
611
 
612
- // it's safe to add it here as if there is a MetaMask injected provider, this won't override it
613
- // only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
614
- if (isBrowser() && chainNamespaces.has(CHAIN_NAMESPACES.EIP155) && !chainNamespaces.has(CHAIN_NAMESPACES.SOLANA)) {
612
+ // prioritize using MM connector over injected connector for EVM chains
613
+ if (isBrowser() && chainNamespaces.has(CHAIN_NAMESPACES.EIP155)) {
614
+ // only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
615
615
  connectorFns.push(metaMaskConnector(modalMode ? {
616
616
  headless: true
617
617
  } : undefined));
@@ -648,14 +648,6 @@ class Web3AuthNoModal extends SafeEventEmitter {
648
648
  }
649
649
  }
650
650
 
651
- // it's safe to add it here as if there is a MetaMask injected provider, this won't override it
652
- // only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
653
- if (isBrowser() && (chainNamespaces.has(CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(CHAIN_NAMESPACES.EIP155))) {
654
- connectorFns.push(metaMaskConnector(modalMode ? {
655
- headless: true
656
- } : undefined));
657
- }
658
-
659
651
  // add WalletConnectV2 connector if external wallets are enabled
660
652
  if (isBrowser() && isExternalWalletEnabled && (chainNamespaces.has(CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(CHAIN_NAMESPACES.EIP155))) {
661
653
  const {