@web3auth/no-modal 8.6.3-alpha.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]);
@@ -273,10 +274,9 @@ class Web3AuthNoModal extends openlogin_jrpc_namespaceObject.SafeEventEmitter {
273
274
  this.commonJRPCProvider.updateProviderEngineProxy(provider.provider || provider);
274
275
  return this.provider;
275
276
  }
276
- async logout() {
277
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
278
- cleanup: false
279
- };
277
+ async logout(options = {
278
+ cleanup: false
279
+ }) {
280
280
  if (this.status !== base_namespaceObject.ADAPTER_STATUS.CONNECTED || !this.connectedAdapterName) throw base_namespaceObject.WalletLoginError.notConnectedError(`No wallet is connected`);
281
281
  await this.walletAdapters[this.connectedAdapterName].disconnect(options);
282
282
  }
@@ -295,8 +295,8 @@ class Web3AuthNoModal extends openlogin_jrpc_namespaceObject.SafeEventEmitter {
295
295
  return this.walletAdapters[this.connectedAdapterName].authenticateUser();
296
296
  }
297
297
  addPlugin(plugin) {
298
- if (this.plugins[plugin.name]) throw new Error(`Plugin ${plugin.name} already exist`);
299
- 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}`);
300
300
  this.plugins[plugin.name] = plugin;
301
301
  return this;
302
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]);
@@ -197,10 +198,9 @@ class Web3AuthNoModal extends SafeEventEmitter {
197
198
  this.commonJRPCProvider.updateProviderEngineProxy(provider.provider || provider);
198
199
  return this.provider;
199
200
  }
200
- async logout() {
201
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
202
- cleanup: false
203
- };
201
+ async logout(options = {
202
+ cleanup: false
203
+ }) {
204
204
  if (this.status !== ADAPTER_STATUS.CONNECTED || !this.connectedAdapterName) throw WalletLoginError.notConnectedError(`No wallet is connected`);
205
205
  await this.walletAdapters[this.connectedAdapterName].disconnect(options);
206
206
  }
@@ -219,8 +219,8 @@ class Web3AuthNoModal extends SafeEventEmitter {
219
219
  return this.walletAdapters[this.connectedAdapterName].authenticateUser();
220
220
  }
221
221
  addPlugin(plugin) {
222
- if (this.plugins[plugin.name]) throw new Error(`Plugin ${plugin.name} already exist`);
223
- 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}`);
224
224
  this.plugins[plugin.name] = plugin;
225
225
  return this;
226
226
  }