@web3auth/no-modal 8.7.0 → 8.8.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.
@@ -130,7 +130,8 @@ class Web3AuthNoModal extends openlogin_jrpc_namespaceObject.SafeEventEmitter {
130
130
  try {
131
131
  projectConfig = await (0,base_namespaceObject.fetchProjectConfig)(this.coreOptions.clientId, this.coreOptions.web3AuthNetwork);
132
132
  } catch (e) {
133
- throw base_namespaceObject.WalletInitializationError.notReady("failed to fetch project configurations");
133
+ base_namespaceObject.log.error("Failed to fetch project configurations", e);
134
+ throw base_namespaceObject.WalletInitializationError.notReady("failed to fetch project configurations", e);
134
135
  }
135
136
  const initPromises = Object.keys(this.walletAdapters).map(async adapterName => {
136
137
  this.subscribeToAdapterEvents(this.walletAdapters[adapterName]);
@@ -294,8 +295,8 @@ class Web3AuthNoModal extends openlogin_jrpc_namespaceObject.SafeEventEmitter {
294
295
  return this.walletAdapters[this.connectedAdapterName].authenticateUser();
295
296
  }
296
297
  addPlugin(plugin) {
297
- if (this.plugins[plugin.name]) throw new Error(`Plugin ${plugin.name} already exist`);
298
- if (plugin.pluginNamespace !== base_namespaceObject.PLUGIN_NAMESPACES.MULTICHAIN && plugin.pluginNamespace !== this.coreOptions.chainConfig.chainNamespace) throw new Error(`This plugin belongs to ${plugin.pluginNamespace} namespace which is incompatible with currently used namespace: ${this.coreOptions.chainConfig.chainNamespace}`);
298
+ if (this.plugins[plugin.name]) throw base_namespaceObject.WalletInitializationError.duplicateAdapterError(`Plugin ${plugin.name} already exist`);
299
+ if (plugin.pluginNamespace !== base_namespaceObject.PLUGIN_NAMESPACES.MULTICHAIN && plugin.pluginNamespace !== this.coreOptions.chainConfig.chainNamespace) throw base_namespaceObject.WalletInitializationError.incompatibleChainNameSpace(`This plugin belongs to ${plugin.pluginNamespace} namespace which is incompatible with currently used namespace: ${this.coreOptions.chainConfig.chainNamespace}`);
299
300
  this.plugins[plugin.name] = plugin;
300
301
  return this;
301
302
  }
@@ -54,7 +54,8 @@ class Web3AuthNoModal extends SafeEventEmitter {
54
54
  try {
55
55
  projectConfig = await fetchProjectConfig(this.coreOptions.clientId, this.coreOptions.web3AuthNetwork);
56
56
  } catch (e) {
57
- throw WalletInitializationError.notReady("failed to fetch project configurations");
57
+ log.error("Failed to fetch project configurations", e);
58
+ throw WalletInitializationError.notReady("failed to fetch project configurations", e);
58
59
  }
59
60
  const initPromises = Object.keys(this.walletAdapters).map(async adapterName => {
60
61
  this.subscribeToAdapterEvents(this.walletAdapters[adapterName]);
@@ -218,8 +219,8 @@ class Web3AuthNoModal extends SafeEventEmitter {
218
219
  return this.walletAdapters[this.connectedAdapterName].authenticateUser();
219
220
  }
220
221
  addPlugin(plugin) {
221
- if (this.plugins[plugin.name]) throw new Error(`Plugin ${plugin.name} already exist`);
222
- if (plugin.pluginNamespace !== PLUGIN_NAMESPACES.MULTICHAIN && plugin.pluginNamespace !== this.coreOptions.chainConfig.chainNamespace) throw new Error(`This plugin belongs to ${plugin.pluginNamespace} namespace which is incompatible with currently used namespace: ${this.coreOptions.chainConfig.chainNamespace}`);
222
+ if (this.plugins[plugin.name]) throw WalletInitializationError.duplicateAdapterError(`Plugin ${plugin.name} already exist`);
223
+ if (plugin.pluginNamespace !== PLUGIN_NAMESPACES.MULTICHAIN && plugin.pluginNamespace !== this.coreOptions.chainConfig.chainNamespace) throw WalletInitializationError.incompatibleChainNameSpace(`This plugin belongs to ${plugin.pluginNamespace} namespace which is incompatible with currently used namespace: ${this.coreOptions.chainConfig.chainNamespace}`);
223
224
  this.plugins[plugin.name] = plugin;
224
225
  return this;
225
226
  }