@web3auth/no-modal 8.0.0-alpha.8 → 8.0.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.
@@ -32,6 +32,7 @@ export declare class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Au
32
32
  cleanup: boolean;
33
33
  }): Promise<void>;
34
34
  getUserInfo(): Promise<Partial<UserInfo>>;
35
+ enableMFA<T>(loginParams?: T): Promise<void>;
35
36
  authenticateUser(): Promise<UserAuthInfo>;
36
37
  addPlugin(plugin: IPlugin): IWeb3Auth;
37
38
  protected subscribeToAdapterEvents(walletAdapter: IAdapter<unknown>): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web3auth/no-modal",
3
- "version": "8.0.0-alpha.8",
3
+ "version": "8.0.0",
4
4
  "description": "Multi chain wallet aggregator for web3Auth",
5
5
  "keywords": [
6
6
  "web3Auth/no-modal",
@@ -37,16 +37,16 @@
37
37
  "@web3auth/wallet-connect-v2-adapter": "^8.x"
38
38
  },
39
39
  "dependencies": {
40
- "@toruslabs/openlogin": "^6.2.5",
41
- "@toruslabs/openlogin-jrpc": "^6.2.8",
42
- "@toruslabs/openlogin-utils": "^6.2.5",
43
- "@web3auth/base": "^8.0.0-alpha.8",
44
- "@web3auth/base-plugin": "^8.0.0-alpha.8",
45
- "@web3auth/base-provider": "^8.0.0-alpha.8"
40
+ "@toruslabs/openlogin": "^7.0.4",
41
+ "@toruslabs/openlogin-jrpc": "^7.0.0",
42
+ "@toruslabs/openlogin-utils": "^7.0.4",
43
+ "@web3auth/base": "^8.0.0",
44
+ "@web3auth/base-plugin": "^8.0.0",
45
+ "@web3auth/base-provider": "^8.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@web3auth/openlogin-adapter": "^8.0.0-alpha.8",
49
- "@web3auth/wallet-connect-v2-adapter": "^8.0.0-alpha.8"
48
+ "@web3auth/openlogin-adapter": "^8.0.0",
49
+ "@web3auth/wallet-connect-v2-adapter": "^8.0.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@web3auth/openlogin-adapter": {
@@ -76,5 +76,5 @@
76
76
  "node": ">=18.x",
77
77
  "npm": ">=9.x"
78
78
  },
79
- "gitHead": "6ca3c8fee49b28687d8294dad0c32523eae9bc32"
79
+ "gitHead": "0428ae575ef36e3ad783f37d14a10a78e66e2909"
80
80
  }
package/src/noModal.ts CHANGED
@@ -51,6 +51,10 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
51
51
  if (!options.clientId) throw WalletInitializationError.invalidParams("Please provide a valid clientId in constructor");
52
52
  if (options.enableLogging) log.enableAll();
53
53
  else log.setLevel("error");
54
+ if (!options.privateKeyProvider && !options.chainConfig) {
55
+ throw WalletInitializationError.invalidParams("Please provide chainConfig or privateKeyProvider");
56
+ }
57
+ options.chainConfig = options.chainConfig || options.privateKeyProvider.currentChainConfig;
54
58
  if (!options.chainConfig?.chainNamespace || !Object.values(CHAIN_NAMESPACES).includes(options.chainConfig?.chainNamespace))
55
59
  throw WalletInitializationError.invalidParams("Please provide a valid chainNamespace in chainConfig");
56
60
  if (options.storageKey === "session") this.storage = "sessionStorage";
@@ -176,9 +180,6 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
176
180
  }
177
181
 
178
182
  public async addChain(chainConfig: CustomChainConfig): Promise<void> {
179
- if (this.status === ADAPTER_STATUS.CONNECTED && this.connectedAdapterName)
180
- return this.walletAdapters[this.connectedAdapterName].addChain(chainConfig);
181
-
182
183
  if (this.commonJRPCProvider) {
183
184
  return this.commonJRPCProvider.addChain(chainConfig);
184
185
  }
@@ -186,9 +187,6 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
186
187
  }
187
188
 
188
189
  public async switchChain(params: { chainId: string }): Promise<void> {
189
- if (this.status === ADAPTER_STATUS.CONNECTED && this.connectedAdapterName)
190
- return this.walletAdapters[this.connectedAdapterName].switchChain(params);
191
-
192
190
  if (this.commonJRPCProvider) {
193
191
  return this.commonJRPCProvider.switchChain(params);
194
192
  }
@@ -218,6 +216,13 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
218
216
  return this.walletAdapters[this.connectedAdapterName].getUserInfo();
219
217
  }
220
218
 
219
+ async enableMFA<T>(loginParams?: T): Promise<void> {
220
+ if (this.status !== ADAPTER_STATUS.CONNECTED || !this.connectedAdapterName) throw WalletLoginError.notConnectedError(`No wallet is connected`);
221
+ if (this.connectedAdapterName !== WALLET_ADAPTERS.OPENLOGIN)
222
+ throw WalletLoginError.unsupportedOperation(`EnableMFA is not supported for this adapter.`);
223
+ return this.walletAdapters[this.connectedAdapterName].enableMFA(loginParams);
224
+ }
225
+
221
226
  async authenticateUser(): Promise<UserAuthInfo> {
222
227
  if (this.status !== ADAPTER_STATUS.CONNECTED || !this.connectedAdapterName) throw WalletLoginError.notConnectedError(`No wallet is connected`);
223
228
  return this.walletAdapters[this.connectedAdapterName].authenticateUser();