@web3auth/modal 10.0.0-beta.4 → 10.0.0-beta.5

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  var noModal = require('@web3auth/no-modal');
4
4
 
5
- const version = "10.0.0-beta.4";
5
+ const version = "10.0.0-beta.5";
6
6
  const defaultConnectorsModalConfig = {
7
7
  hideWalletDiscovery: false,
8
8
  connectors: {
@@ -190,32 +190,30 @@ class Web3Auth extends noModal.Web3AuthNoModal {
190
190
  };
191
191
  }
192
192
  async getProjectAndWalletConfig() {
193
- var _this$modalConfig;
194
- // get project config
195
- let projectConfig;
196
- try {
197
- var _this$options$account;
198
- projectConfig = await noModal.fetchProjectConfig({
199
- clientId: this.options.clientId,
200
- web3AuthNetwork: this.options.web3AuthNetwork,
201
- aaProvider: (_this$options$account = this.options.accountAbstractionConfig) === null || _this$options$account === void 0 ? void 0 : _this$options$account.smartAccountType,
202
- authBuildEnv: this.options.authBuildEnv
203
- });
204
- } catch (e) {
205
- noModal.log.error("Failed to fetch project configurations", e);
206
- throw noModal.WalletInitializationError.notReady("failed to fetch project configurations", e);
193
+ var _this$options$account, _this$modalConfig;
194
+ const [projectConfigResult, walletRegistryResult] = await Promise.allSettled([noModal.fetchProjectConfig({
195
+ clientId: this.options.clientId,
196
+ web3AuthNetwork: this.options.web3AuthNetwork,
197
+ aaProvider: (_this$options$account = this.options.accountAbstractionConfig) === null || _this$options$account === void 0 ? void 0 : _this$options$account.smartAccountType,
198
+ authBuildEnv: this.options.authBuildEnv
199
+ }), noModal.fetchWalletRegistry(config.walletRegistryUrl)]);
200
+ // handle project config result
201
+ if (projectConfigResult.status === "rejected") {
202
+ noModal.log.error("Failed to fetch project configurations", projectConfigResult.reason);
203
+ throw noModal.WalletInitializationError.notReady("failed to fetch project configurations", projectConfigResult.reason);
207
204
  }
208
- // get wallet registry
205
+ const projectConfig = projectConfigResult.value;
206
+ // handle wallet registry result
209
207
  let walletRegistry = {
210
208
  others: {},
211
209
  default: {}
212
210
  };
213
211
  const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
214
212
  if (isExternalWalletEnabled && !((_this$modalConfig = this.modalConfig) !== null && _this$modalConfig !== void 0 && _this$modalConfig.hideWalletDiscovery)) {
215
- try {
216
- walletRegistry = await noModal.fetchWalletRegistry(config.walletRegistryUrl);
217
- } catch (e) {
218
- noModal.log.error("Failed to fetch wallet registry", e);
213
+ if (walletRegistryResult.status === "fulfilled") {
214
+ walletRegistry = walletRegistryResult.value;
215
+ } else {
216
+ noModal.log.error("Failed to fetch wallet registry", walletRegistryResult.reason);
219
217
  }
220
218
  }
221
219
  return {
@@ -1,6 +1,6 @@
1
1
  import { EVM_CONNECTORS } from '@web3auth/no-modal';
2
2
 
3
- const version = "10.0.0-beta.4";
3
+ const version = "10.0.0-beta.5";
4
4
  const defaultConnectorsModalConfig = {
5
5
  hideWalletDiscovery: false,
6
6
  connectors: {
@@ -196,32 +196,32 @@ class Web3Auth extends Web3AuthNoModal {
196
196
  };
197
197
  }
198
198
  async getProjectAndWalletConfig() {
199
- var _this$modalConfig;
200
- // get project config
201
- let projectConfig;
202
- try {
203
- var _this$options$account;
204
- projectConfig = await fetchProjectConfig({
205
- clientId: this.options.clientId,
206
- web3AuthNetwork: this.options.web3AuthNetwork,
207
- aaProvider: (_this$options$account = this.options.accountAbstractionConfig) === null || _this$options$account === void 0 ? void 0 : _this$options$account.smartAccountType,
208
- authBuildEnv: this.options.authBuildEnv
209
- });
210
- } catch (e) {
211
- log.error("Failed to fetch project configurations", e);
212
- throw WalletInitializationError.notReady("failed to fetch project configurations", e);
199
+ var _this$options$account, _this$modalConfig;
200
+ const [projectConfigResult, walletRegistryResult] = await Promise.allSettled([fetchProjectConfig({
201
+ clientId: this.options.clientId,
202
+ web3AuthNetwork: this.options.web3AuthNetwork,
203
+ aaProvider: (_this$options$account = this.options.accountAbstractionConfig) === null || _this$options$account === void 0 ? void 0 : _this$options$account.smartAccountType,
204
+ authBuildEnv: this.options.authBuildEnv
205
+ }), fetchWalletRegistry(walletRegistryUrl)]);
206
+
207
+ // handle project config result
208
+ if (projectConfigResult.status === "rejected") {
209
+ log.error("Failed to fetch project configurations", projectConfigResult.reason);
210
+ throw WalletInitializationError.notReady("failed to fetch project configurations", projectConfigResult.reason);
213
211
  }
214
- // get wallet registry
212
+ const projectConfig = projectConfigResult.value;
213
+
214
+ // handle wallet registry result
215
215
  let walletRegistry = {
216
216
  others: {},
217
217
  default: {}
218
218
  };
219
219
  const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
220
220
  if (isExternalWalletEnabled && !((_this$modalConfig = this.modalConfig) !== null && _this$modalConfig !== void 0 && _this$modalConfig.hideWalletDiscovery)) {
221
- try {
222
- walletRegistry = await fetchWalletRegistry(walletRegistryUrl);
223
- } catch (e) {
224
- log.error("Failed to fetch wallet registry", e);
221
+ if (walletRegistryResult.status === "fulfilled") {
222
+ walletRegistry = walletRegistryResult.value;
223
+ } else {
224
+ log.error("Failed to fetch wallet registry", walletRegistryResult.reason);
225
225
  }
226
226
  }
227
227
  return {