@web3auth/no-modal 8.0.0-alpha.4 → 8.0.0-alpha.9

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.
@@ -16,6 +16,7 @@ export declare class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Au
16
16
  get provider(): IProvider | null;
17
17
  set provider(_: IProvider | null);
18
18
  init(): Promise<void>;
19
+ getAdapter(adapterName: WALLET_ADAPTER_TYPE): IAdapter<unknown> | null;
19
20
  configureAdapter(adapter: IAdapter<unknown>): Web3AuthNoModal;
20
21
  clearCache(): void;
21
22
  addChain(chainConfig: CustomChainConfig): Promise<void>;
@@ -32,7 +33,7 @@ export declare class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Au
32
33
  }): Promise<void>;
33
34
  getUserInfo(): Promise<Partial<UserInfo>>;
34
35
  authenticateUser(): Promise<UserAuthInfo>;
35
- addPlugin(plugin: IPlugin): Promise<IWeb3Auth>;
36
+ addPlugin(plugin: IPlugin): IWeb3Auth;
36
37
  protected subscribeToAdapterEvents(walletAdapter: IAdapter<unknown>): void;
37
38
  protected checkInitRequirements(): void;
38
39
  private cacheWallet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web3auth/no-modal",
3
- "version": "8.0.0-alpha.4",
3
+ "version": "8.0.0-alpha.9",
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.0",
44
- "@web3auth/base-plugin": "^8.0.0-alpha.0",
45
- "@web3auth/base-provider": "^8.0.0-alpha.0"
40
+ "@toruslabs/openlogin": "^6.2.9",
41
+ "@toruslabs/openlogin-jrpc": "^6.2.9",
42
+ "@toruslabs/openlogin-utils": "^6.2.9",
43
+ "@web3auth/base": "^8.0.0-alpha.9",
44
+ "@web3auth/base-plugin": "^8.0.0-alpha.9",
45
+ "@web3auth/base-provider": "^8.0.0-alpha.9"
46
46
  },
47
47
  "devDependencies": {
48
- "@web3auth/openlogin-adapter": "^8.0.0-alpha.0",
49
- "@web3auth/wallet-connect-v2-adapter": "^8.0.0-alpha.4"
48
+ "@web3auth/openlogin-adapter": "^8.0.0-alpha.9",
49
+ "@web3auth/wallet-connect-v2-adapter": "^8.0.0-alpha.9"
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": "ff56ea0b6b764dea252b55e6e4c8e420b2581b58"
79
+ "gitHead": "084a266a6fde78d48f80cb85e7673bcf11615d90"
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";
@@ -139,6 +143,10 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
139
143
  await Promise.all(initPromises);
140
144
  }
141
145
 
146
+ public getAdapter(adapterName: WALLET_ADAPTER_TYPE): IAdapter<unknown> | null {
147
+ return this.walletAdapters[adapterName] || null;
148
+ }
149
+
142
150
  public configureAdapter(adapter: IAdapter<unknown>): Web3AuthNoModal {
143
151
  this.checkInitRequirements();
144
152
  const providedChainConfig = this.coreOptions.chainConfig;
@@ -219,7 +227,7 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth {
219
227
  return this.walletAdapters[this.connectedAdapterName].authenticateUser();
220
228
  }
221
229
 
222
- public async addPlugin(plugin: IPlugin): Promise<IWeb3Auth> {
230
+ public addPlugin(plugin: IPlugin): IWeb3Auth {
223
231
  if (this.plugins[plugin.name]) throw new Error(`Plugin ${plugin.name} already exist`);
224
232
  if (plugin.pluginNamespace !== PLUGIN_NAMESPACES.MULTICHAIN && plugin.pluginNamespace !== this.coreOptions.chainConfig.chainNamespace)
225
233
  throw new Error(