@web3auth/modal 3.0.1 → 3.0.2
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.
- package/dist/modal.cjs.js +36 -193
- package/dist/modal.cjs.js.map +1 -1
- package/dist/modal.esm.js +33 -188
- package/dist/modal.esm.js.map +1 -1
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.LICENSE.txt +0 -15
- package/dist/modal.umd.min.js.map +1 -1
- package/dist/types/modalManager.d.ts +1 -1
- package/package.json +3 -3
- package/src/modalManager.ts +18 -36
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafeEventEmitterProvider, WALLET_ADAPTER_TYPE } from "@web3auth/base";
|
|
2
2
|
import { Web3AuthCore, Web3AuthCoreOptions } from "@web3auth/core";
|
|
3
|
-
import LoginModal from "@web3auth/ui";
|
|
3
|
+
import { LoginModal } from "@web3auth/ui";
|
|
4
4
|
import { ModalConfig } from "./interface";
|
|
5
5
|
export interface UIConfig {
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web3auth/modal",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"homepage": "https://github.com/Web3Auth/Web3Auth#readme",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/modal.cjs.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@web3auth/phantom-adapter": "^3.0.0",
|
|
27
27
|
"@web3auth/torus-evm-adapter": "^3.0.0",
|
|
28
28
|
"@web3auth/torus-solana-adapter": "^3.0.0",
|
|
29
|
-
"@web3auth/ui": "^3.0.
|
|
29
|
+
"@web3auth/ui": "^3.0.2",
|
|
30
30
|
"@web3auth/wallet-connect-v1-adapter": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "5f770a0ea28759581f32e6c85fe12c60cdae0677"
|
|
65
65
|
}
|
package/src/modalManager.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
WALLET_ADAPTERS,
|
|
13
13
|
} from "@web3auth/base";
|
|
14
14
|
import { Web3AuthCore, Web3AuthCoreOptions } from "@web3auth/core";
|
|
15
|
-
import
|
|
15
|
+
import { getAdapterSocialLogins, LOGIN_MODAL_EVENTS, LoginModal, OPENLOGIN_PROVIDERS } from "@web3auth/ui";
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
defaultEvmDappModalConfig,
|
|
@@ -261,44 +261,26 @@ export class Web3Auth extends Web3AuthCore {
|
|
|
261
261
|
private async initExternalWalletAdapters(externalWalletsInitialized: boolean, options?: { showExternalWalletsOnly: boolean }): Promise<void> {
|
|
262
262
|
if (externalWalletsInitialized) return;
|
|
263
263
|
const adaptersConfig: Record<string, BaseAdapterConfig> = {};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (this.cachedAdapter === adapterName) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (adapter.status === ADAPTER_STATUS.NOT_READY)
|
|
276
|
-
return await Promise.race([
|
|
277
|
-
adapter.init({ autoConnect: this.cachedAdapter === adapterName }).then(() => {
|
|
278
|
-
adaptersConfig[adapterName] = (this.modalConfig.adapters as Record<WALLET_ADAPTER_TYPE, ModalConfig>)[adapterName];
|
|
279
|
-
adaptersData[adapterName] = adapter.adapterData || {};
|
|
280
|
-
return adapterName;
|
|
281
|
-
}),
|
|
282
|
-
new Promise((resolve) => {
|
|
283
|
-
setTimeout(() => {
|
|
284
|
-
return resolve(null);
|
|
285
|
-
}, 5000);
|
|
286
|
-
}),
|
|
287
|
-
]);
|
|
264
|
+
Object.keys(this.walletAdapters).forEach(async (adapterName) => {
|
|
265
|
+
const adapter = this.walletAdapters[adapterName];
|
|
266
|
+
if (adapter?.type === ADAPTER_CATEGORY.EXTERNAL) {
|
|
267
|
+
log.debug("init external wallet", this.cachedAdapter, adapterName);
|
|
268
|
+
this.subscribeToAdapterEvents(adapter);
|
|
269
|
+
// we are not initializing cached adapter here as it is already being initialized in initModal before.
|
|
270
|
+
if (this.cachedAdapter === adapterName) {
|
|
271
|
+
return;
|
|
288
272
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
finalAdaptersConfig[result] = adaptersConfig[result];
|
|
273
|
+
if (adapter.status === ADAPTER_STATUS.NOT_READY)
|
|
274
|
+
await adapter
|
|
275
|
+
.init({ autoConnect: this.cachedAdapter === adapterName })
|
|
276
|
+
.then(() => {
|
|
277
|
+
adaptersConfig[adapterName] = (this.modalConfig.adapters as Record<WALLET_ADAPTER_TYPE, ModalConfig>)[adapterName];
|
|
278
|
+
this.loginModal.addWalletLogins(adaptersConfig, { showExternalWalletsOnly: !!options?.showExternalWalletsOnly });
|
|
279
|
+
return undefined;
|
|
280
|
+
})
|
|
281
|
+
.catch((error) => log.error(error, "error while initializing adapter"));
|
|
299
282
|
}
|
|
300
283
|
});
|
|
301
|
-
this.loginModal.addWalletLogins(finalAdaptersConfig, { showExternalWalletsOnly: !!options?.showExternalWalletsOnly });
|
|
302
284
|
}
|
|
303
285
|
|
|
304
286
|
private initializeInAppWallet(adapterName: string): void {
|