@web3auth/modal 10.0.0-beta.8 → 10.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.
- package/README.md +2 -2
- package/dist/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/connectors/coinbase-connector/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/modalManager.js +152 -91
- package/dist/lib.cjs/packages/modal/src/providers/ethereum-mpc-provider/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/providers/xrpl-provider/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/react/Web3AuthProvider.js +3 -1
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +23 -19
- package/dist/lib.cjs/packages/modal/src/react/hooks/useIdentityToken.js +3 -3
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3AuthConnect.js +17 -1
- package/dist/lib.cjs/packages/modal/src/react/solana/hooks/useSolanaWallet.js +4 -0
- package/dist/lib.cjs/packages/modal/src/react/wagmi/constants.js +16 -0
- package/dist/lib.cjs/packages/modal/src/react/wagmi/provider.js +15 -10
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +17 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +8 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +1 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer/Footer.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +23 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +6 -1
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/context/AnalyticsContext.js +9 -0
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +42 -15
- package/dist/lib.cjs/packages/modal/src/utils.js +22 -0
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +11 -2
- package/dist/lib.cjs/packages/modal/src/vue/composables/useIdentityToken.js +3 -3
- package/dist/lib.cjs/packages/modal/src/vue/composables/useManageMFA.js +1 -1
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthConnect.js +17 -1
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSolanaWallet.js +19 -13
- package/dist/lib.cjs/packages/modal/src/vue/wagmi/constants.js +16 -0
- package/dist/lib.cjs/packages/modal/src/vue/wagmi/provider.js +35 -16
- package/dist/lib.cjs/types/connectors/coinbase-connector/index.d.ts +1 -0
- package/dist/lib.cjs/types/interface.d.ts +0 -3
- package/dist/lib.cjs/types/modalManager.d.ts +5 -4
- package/dist/lib.cjs/types/providers/ethereum-mpc-provider/index.d.ts +1 -0
- package/dist/lib.cjs/types/providers/xrpl-provider/index.d.ts +1 -0
- package/dist/lib.cjs/types/react/Web3AuthProvider.d.ts +1 -1
- package/dist/lib.cjs/types/react/hooks/useIdentityToken.d.ts +2 -2
- package/dist/lib.cjs/types/react/hooks/useWeb3AuthConnect.d.ts +2 -1
- package/dist/lib.cjs/types/react/interfaces.d.ts +2 -1
- package/dist/lib.cjs/types/react/wagmi/constants.d.ts +43 -0
- package/dist/lib.cjs/types/react/wagmi/provider.d.ts +1 -2
- package/dist/lib.cjs/types/ui/context/AnalyticsContext.d.ts +4 -0
- package/dist/lib.cjs/types/ui/interfaces.d.ts +3 -2
- package/dist/lib.cjs/types/ui/loginModal.d.ts +1 -0
- package/dist/lib.cjs/types/utils.d.ts +17 -0
- package/dist/lib.cjs/types/vue/composables/useIdentityToken.d.ts +1 -1
- package/dist/lib.cjs/types/vue/composables/useWeb3AuthConnect.d.ts +2 -1
- package/dist/lib.cjs/types/vue/wagmi/constants.d.ts +43 -0
- package/dist/lib.cjs/types/vue/wagmi/provider.d.ts +1 -0
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/connectors/coinbase-connector/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/modalManager.js +160 -97
- package/dist/lib.esm/packages/modal/src/providers/ethereum-mpc-provider/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/providers/xrpl-provider/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/react/Web3AuthProvider.js +3 -1
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +25 -21
- package/dist/lib.esm/packages/modal/src/react/hooks/useIdentityToken.js +3 -3
- package/dist/lib.esm/packages/modal/src/react/hooks/useWeb3AuthConnect.js +17 -1
- package/dist/lib.esm/packages/modal/src/react/solana/hooks/useSolanaWallet.js +5 -1
- package/dist/lib.esm/packages/modal/src/react/wagmi/constants.js +14 -0
- package/dist/lib.esm/packages/modal/src/react/wagmi/provider.js +18 -14
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +19 -2
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +8 -5
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +1 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Footer/Footer.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +24 -5
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +6 -1
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +2 -2
- package/dist/lib.esm/packages/modal/src/ui/context/AnalyticsContext.js +7 -0
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +41 -14
- package/dist/lib.esm/packages/modal/src/utils.js +20 -0
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +12 -3
- package/dist/lib.esm/packages/modal/src/vue/composables/useIdentityToken.js +3 -3
- package/dist/lib.esm/packages/modal/src/vue/composables/useManageMFA.js +1 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthConnect.js +17 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSolanaWallet.js +20 -14
- package/dist/lib.esm/packages/modal/src/vue/wagmi/constants.js +14 -0
- package/dist/lib.esm/packages/modal/src/vue/wagmi/provider.js +39 -20
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.LICENSE.txt +6 -8
- package/package.json +42 -33
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getLoginModalAnalyticsProperties = uiConfig => {
|
|
4
|
+
return {
|
|
5
|
+
ui_modal_login_methods_order: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.loginMethodsOrder,
|
|
6
|
+
ui_modal_z_index: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.modalZIndex,
|
|
7
|
+
ui_modal_display_errors_on_modal: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.displayErrorsOnModal,
|
|
8
|
+
ui_modal_login_grid_col: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.loginGridCol,
|
|
9
|
+
ui_modal_primary_button: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.primaryButton,
|
|
10
|
+
ui_modal_widget_type: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.widgetType,
|
|
11
|
+
ui_modal_target_id_used: Boolean(uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.targetId),
|
|
12
|
+
ui_modal_logo_alignment: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.logoAlignment,
|
|
13
|
+
ui_modal_border_radius_type: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.borderRadiusType,
|
|
14
|
+
ui_modal_button_radius_type: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.buttonRadiusType,
|
|
15
|
+
ui_modal_sign_in_methods: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.signInMethods,
|
|
16
|
+
ui_modal_add_previous_login_hint: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.addPreviousLoginHint,
|
|
17
|
+
ui_modal_display_installed_external_wallets: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.displayInstalledExternalWallets,
|
|
18
|
+
ui_modal_display_external_wallets_count: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.displayExternalWalletsCount
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.getLoginModalAnalyticsProperties = getLoginModalAnalyticsProperties;
|
|
@@ -46,6 +46,9 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
46
46
|
web3AuthOptions
|
|
47
47
|
} = newConfig;
|
|
48
48
|
const web3AuthInstance = new modalManager.Web3Auth(web3AuthOptions);
|
|
49
|
+
web3AuthInstance.setAnalyticsProperties({
|
|
50
|
+
integration_type: noModal.ANALYTICS_INTEGRATION_TYPE.VUE_COMPOSABLES
|
|
51
|
+
});
|
|
49
52
|
web3Auth.value = web3AuthInstance;
|
|
50
53
|
}, {
|
|
51
54
|
immediate: true
|
|
@@ -60,7 +63,7 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
60
63
|
try {
|
|
61
64
|
initError.value = null;
|
|
62
65
|
isInitializing.value = true;
|
|
63
|
-
await newWeb3Auth.
|
|
66
|
+
await newWeb3Auth.init({
|
|
64
67
|
signal: controller.signal
|
|
65
68
|
});
|
|
66
69
|
} catch (error) {
|
|
@@ -99,7 +102,11 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
99
102
|
status.value = web3Auth.value.status;
|
|
100
103
|
};
|
|
101
104
|
const errorListener = () => {
|
|
102
|
-
status.value =
|
|
105
|
+
status.value = web3Auth.value.status;
|
|
106
|
+
if (isConnected.value) {
|
|
107
|
+
isConnected.value = false;
|
|
108
|
+
provider.value = null;
|
|
109
|
+
}
|
|
103
110
|
};
|
|
104
111
|
const mfaEnabledListener = () => {
|
|
105
112
|
isMFAEnabled.value = true;
|
|
@@ -112,6 +119,7 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
112
119
|
prevWeb3Auth.off(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
113
120
|
prevWeb3Auth.off(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
114
121
|
prevWeb3Auth.off(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
122
|
+
prevWeb3Auth.off(noModal.CONNECTOR_EVENTS.REHYDRATION_ERROR, errorListener);
|
|
115
123
|
prevWeb3Auth.off(noModal.CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
|
|
116
124
|
}
|
|
117
125
|
if (newWeb3Auth && newWeb3Auth !== prevWeb3Auth) {
|
|
@@ -123,6 +131,7 @@ const Web3AuthProvider = vue.defineComponent({
|
|
|
123
131
|
newWeb3Auth.on(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
124
132
|
newWeb3Auth.on(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
125
133
|
newWeb3Auth.on(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
134
|
+
newWeb3Auth.on(noModal.CONNECTOR_EVENTS.REHYDRATION_ERROR, errorListener);
|
|
126
135
|
newWeb3Auth.on(noModal.CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
|
|
127
136
|
}
|
|
128
137
|
}, {
|
|
@@ -12,12 +12,12 @@ const useIdentityToken = () => {
|
|
|
12
12
|
const loading = vue.ref(false);
|
|
13
13
|
const error = vue.ref(null);
|
|
14
14
|
const token = vue.ref(null);
|
|
15
|
-
const
|
|
15
|
+
const getIdentityToken = async () => {
|
|
16
16
|
try {
|
|
17
17
|
if (!web3Auth.value) throw noModal.WalletInitializationError.notReady();
|
|
18
18
|
error.value = null;
|
|
19
19
|
loading.value = true;
|
|
20
|
-
const result = await web3Auth.value.
|
|
20
|
+
const result = await web3Auth.value.getIdentityToken();
|
|
21
21
|
if (result !== null && result !== void 0 && result.idToken) {
|
|
22
22
|
token.value = result.idToken;
|
|
23
23
|
}
|
|
@@ -37,7 +37,7 @@ const useIdentityToken = () => {
|
|
|
37
37
|
loading,
|
|
38
38
|
error,
|
|
39
39
|
token,
|
|
40
|
-
|
|
40
|
+
getIdentityToken
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -15,7 +15,7 @@ const useManageMFA = () => {
|
|
|
15
15
|
if (!web3Auth.value) throw noModal.WalletInitializationError.notReady();
|
|
16
16
|
error.value = null;
|
|
17
17
|
loading.value = true;
|
|
18
|
-
await web3Auth.value.
|
|
18
|
+
await web3Auth.value.manageMFA();
|
|
19
19
|
} catch (err) {
|
|
20
20
|
error.value = err;
|
|
21
21
|
} finally {
|
|
@@ -38,12 +38,28 @@ const useWeb3AuthConnect = () => {
|
|
|
38
38
|
loading.value = false;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
const connectTo = async (connectorType, loginParams) => {
|
|
42
|
+
try {
|
|
43
|
+
if (!web3Auth.value) throw noModal.WalletInitializationError.notReady();
|
|
44
|
+
error.value = null;
|
|
45
|
+
loading.value = true;
|
|
46
|
+
const localProvider = await web3Auth.value.connectTo(connectorType, loginParams);
|
|
47
|
+
connectorName.value = web3Auth.value.connectedConnectorName;
|
|
48
|
+
return localProvider;
|
|
49
|
+
} catch (err) {
|
|
50
|
+
error.value = err;
|
|
51
|
+
return null;
|
|
52
|
+
} finally {
|
|
53
|
+
loading.value = false;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
41
56
|
return {
|
|
42
57
|
isConnected,
|
|
43
58
|
loading,
|
|
44
59
|
error,
|
|
45
60
|
connectorName,
|
|
46
|
-
connect
|
|
61
|
+
connect,
|
|
62
|
+
connectTo
|
|
47
63
|
};
|
|
48
64
|
};
|
|
49
65
|
|
|
@@ -14,27 +14,33 @@ const useSolanaWallet = () => {
|
|
|
14
14
|
const accounts = vue.ref([]);
|
|
15
15
|
const solanaWallet = vue.shallowRef(null);
|
|
16
16
|
const connection = vue.shallowRef(null);
|
|
17
|
+
const setupWallet = async () => {
|
|
18
|
+
var _web3Auth$value, _web3Auth$value2;
|
|
19
|
+
if (!((_web3Auth$value = web3Auth.value) !== null && _web3Auth$value !== void 0 && (_web3Auth$value = _web3Auth$value.currentChain) !== null && _web3Auth$value !== void 0 && _web3Auth$value.chainNamespace) || web3Auth.value.currentChain.chainNamespace !== noModal.CHAIN_NAMESPACES.SOLANA) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
solanaWallet.value = new noModal.SolanaWallet(provider.value);
|
|
23
|
+
const result = await solanaWallet.value.requestAccounts();
|
|
24
|
+
if ((result === null || result === void 0 ? void 0 : result.length) > 0) {
|
|
25
|
+
accounts.value = result;
|
|
26
|
+
}
|
|
27
|
+
connection.value = new web3_js.Connection((_web3Auth$value2 = web3Auth.value) === null || _web3Auth$value2 === void 0 || (_web3Auth$value2 = _web3Auth$value2.currentChain) === null || _web3Auth$value2 === void 0 ? void 0 : _web3Auth$value2.rpcTarget);
|
|
28
|
+
};
|
|
29
|
+
if (provider.value && !solanaWallet.value) {
|
|
30
|
+
setupWallet();
|
|
31
|
+
}
|
|
17
32
|
vue.watch(provider, async newVal => {
|
|
18
|
-
var _accounts$value;
|
|
19
33
|
if (!newVal && solanaWallet.value) {
|
|
20
34
|
solanaWallet.value = null;
|
|
21
35
|
accounts.value = null;
|
|
22
36
|
connection.value = null;
|
|
23
37
|
return;
|
|
24
38
|
}
|
|
25
|
-
if (!solanaWallet.value) {
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
if (solanaWallet.value && ((_accounts$value = accounts.value) === null || _accounts$value === void 0 ? void 0 : _accounts$value.length) === 0) {
|
|
29
|
-
const result = await solanaWallet.value.requestAccounts();
|
|
30
|
-
if ((result === null || result === void 0 ? void 0 : result.length) > 0) {
|
|
31
|
-
accounts.value = result;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (solanaWallet.value && !connection.value) {
|
|
35
|
-
var _web3Auth$value;
|
|
36
|
-
connection.value = new web3_js.Connection((_web3Auth$value = web3Auth.value) === null || _web3Auth$value === void 0 || (_web3Auth$value = _web3Auth$value.currentChain) === null || _web3Auth$value === void 0 ? void 0 : _web3Auth$value.rpcTarget);
|
|
39
|
+
if (newVal && !solanaWallet.value) {
|
|
40
|
+
setupWallet();
|
|
37
41
|
}
|
|
42
|
+
}, {
|
|
43
|
+
immediate: true
|
|
38
44
|
});
|
|
39
45
|
return {
|
|
40
46
|
solanaWallet,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('@wagmi/vue');
|
|
4
|
+
var chains = require('@wagmi/vue/chains');
|
|
5
|
+
|
|
6
|
+
const defaultWagmiConfig = vue.createConfig({
|
|
7
|
+
chains: [chains.mainnet],
|
|
8
|
+
connectors: [],
|
|
9
|
+
// or your basic wallets
|
|
10
|
+
ssr: true,
|
|
11
|
+
transports: {
|
|
12
|
+
[chains.mainnet.id]: vue.http(chains.mainnet.rpcUrls.default.http[0])
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
exports.defaultWagmiConfig = defaultWagmiConfig;
|
|
@@ -4,12 +4,14 @@ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
|
4
4
|
var core = require('@wagmi/core');
|
|
5
5
|
var vue$1 = require('@wagmi/vue');
|
|
6
6
|
var connectors = require('@wagmi/vue/connectors');
|
|
7
|
+
var auth = require('@web3auth/auth');
|
|
7
8
|
var noModal = require('@web3auth/no-modal');
|
|
8
9
|
var viem = require('viem');
|
|
9
10
|
var vue = require('vue');
|
|
10
11
|
require('@web3auth/no-modal/vue');
|
|
11
12
|
var useWeb3Auth = require('../composables/useWeb3Auth.js');
|
|
12
13
|
var useWeb3AuthDisconnect = require('../composables/useWeb3AuthDisconnect.js');
|
|
14
|
+
var constants = require('./constants.js');
|
|
13
15
|
|
|
14
16
|
const WEB3AUTH_CONNECTOR_ID = "web3auth";
|
|
15
17
|
// Helper to initialize connectors for the given wallets
|
|
@@ -70,6 +72,9 @@ const Web3AuthWagmiProvider = vue.defineComponent({
|
|
|
70
72
|
disconnect
|
|
71
73
|
} = useWeb3AuthDisconnect.useWeb3AuthDisconnect();
|
|
72
74
|
const wagmiConfig = vue$1.useConfig();
|
|
75
|
+
const {
|
|
76
|
+
reconnect
|
|
77
|
+
} = vue$1.useReconnect();
|
|
73
78
|
vue$1.useAccountEffect({
|
|
74
79
|
onDisconnect: async () => {
|
|
75
80
|
noModal.log.info("Disconnected from wagmi");
|
|
@@ -84,6 +89,7 @@ const Web3AuthWagmiProvider = vue.defineComponent({
|
|
|
84
89
|
throw new Error("Failed to setup connector");
|
|
85
90
|
}
|
|
86
91
|
await connectWeb3AuthWithWagmi(connector, wagmiConfig);
|
|
92
|
+
reconnect();
|
|
87
93
|
} else if (!newIsConnected) {
|
|
88
94
|
if (wagmiConfig.state.status === "connected") {
|
|
89
95
|
await disconnectWeb3AuthFromWagmi(wagmiConfig);
|
|
@@ -126,6 +132,7 @@ const WagmiProvider = vue.defineComponent({
|
|
|
126
132
|
}
|
|
127
133
|
},
|
|
128
134
|
setup(props) {
|
|
135
|
+
var _web3Auth$value;
|
|
129
136
|
const {
|
|
130
137
|
config
|
|
131
138
|
} = props;
|
|
@@ -133,9 +140,13 @@ const WagmiProvider = vue.defineComponent({
|
|
|
133
140
|
web3Auth,
|
|
134
141
|
isInitialized
|
|
135
142
|
} = useWeb3Auth.useWeb3Auth();
|
|
136
|
-
const finalConfig = vue.shallowRef(
|
|
143
|
+
const finalConfig = vue.shallowRef(constants.defaultWagmiConfig);
|
|
144
|
+
const configKey = vue.ref(auth.randomId());
|
|
145
|
+
(_web3Auth$value = web3Auth.value) === null || _web3Auth$value === void 0 || _web3Auth$value.setAnalyticsProperties({
|
|
146
|
+
wagmi_enabled: true
|
|
147
|
+
});
|
|
137
148
|
const defineWagmiConfig = () => {
|
|
138
|
-
var _web3Auth$
|
|
149
|
+
var _web3Auth$value2;
|
|
139
150
|
const configParams = _objectSpread(_objectSpread({
|
|
140
151
|
ssr: true
|
|
141
152
|
}, config), {}, {
|
|
@@ -146,10 +157,11 @@ const WagmiProvider = vue.defineComponent({
|
|
|
146
157
|
client: undefined
|
|
147
158
|
});
|
|
148
159
|
const wagmiChains = [];
|
|
149
|
-
if (isInitialized.value && web3Auth !== null && web3Auth !== void 0 && (_web3Auth$
|
|
160
|
+
if (isInitialized.value && web3Auth !== null && web3Auth !== void 0 && (_web3Auth$value2 = web3Auth.value) !== null && _web3Auth$value2 !== void 0 && (_web3Auth$value2 = _web3Auth$value2.coreOptions) !== null && _web3Auth$value2 !== void 0 && _web3Auth$value2.chains) {
|
|
150
161
|
var _web3Auth$value$curre;
|
|
151
162
|
const defaultChainId = (_web3Auth$value$curre = web3Auth.value.currentChain) === null || _web3Auth$value$curre === void 0 ? void 0 : _web3Auth$value$curre.chainId;
|
|
152
|
-
const chains = web3Auth.value.coreOptions.chains;
|
|
163
|
+
const chains = web3Auth.value.coreOptions.chains.filter(chain => chain.chainNamespace === noModal.CHAIN_NAMESPACES.EIP155);
|
|
164
|
+
if (chains.length === 0) throw noModal.WalletInitializationError.invalidParams("No valid chains found in web3auth config for wagmi.");
|
|
153
165
|
chains.forEach(chain => {
|
|
154
166
|
const wagmiChain = viem.defineChain({
|
|
155
167
|
id: Number.parseInt(chain.chainId, 16),
|
|
@@ -179,33 +191,40 @@ const WagmiProvider = vue.defineComponent({
|
|
|
179
191
|
} else {
|
|
180
192
|
wagmiChains.push(wagmiChain);
|
|
181
193
|
}
|
|
182
|
-
configParams.transports[wagmiChain.id] = viem.http(chain.rpcTarget);
|
|
194
|
+
configParams.transports[wagmiChain.id] = chain.wsTarget ? viem.webSocket(chain.wsTarget) : viem.http(chain.rpcTarget);
|
|
183
195
|
});
|
|
184
196
|
configParams.chains = [wagmiChains[0], ...wagmiChains.slice(1)];
|
|
185
197
|
}
|
|
186
|
-
if (!configParams.chains) return;
|
|
187
198
|
return vue$1.createConfig(configParams);
|
|
188
199
|
};
|
|
189
|
-
|
|
190
|
-
if (
|
|
200
|
+
const hydrateWagmiConfig = () => {
|
|
201
|
+
if (finalConfig.value) {
|
|
202
|
+
core.hydrate(finalConfig.value, _objectSpread({
|
|
203
|
+
reconnectOnMount: false
|
|
204
|
+
}, props.config));
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
vue.watch(isInitialized, (newIsInitialized, prevIsInitialized) => {
|
|
208
|
+
if (newIsInitialized && !prevIsInitialized) {
|
|
191
209
|
finalConfig.value = defineWagmiConfig();
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
reconnectOnMount: false
|
|
195
|
-
}, props.config));
|
|
196
|
-
}
|
|
210
|
+
hydrateWagmiConfig();
|
|
211
|
+
configKey.value = auth.randomId();
|
|
197
212
|
}
|
|
198
213
|
}, {
|
|
199
214
|
immediate: true
|
|
200
215
|
});
|
|
216
|
+
if (!isInitialized.value) {
|
|
217
|
+
hydrateWagmiConfig();
|
|
218
|
+
}
|
|
201
219
|
return {
|
|
202
|
-
finalConfig
|
|
220
|
+
finalConfig,
|
|
221
|
+
configKey
|
|
203
222
|
};
|
|
204
223
|
},
|
|
205
224
|
render() {
|
|
206
|
-
if (!this.finalConfig) return null;
|
|
207
225
|
return vue.h(Web3AuthWagmiInnerProvider, {
|
|
208
|
-
config: this.finalConfig
|
|
226
|
+
config: this.finalConfig,
|
|
227
|
+
key: this.configKey
|
|
209
228
|
}, {
|
|
210
229
|
default: () => {
|
|
211
230
|
var _this$$slots$default3, _this$$slots;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@web3auth/no-modal/connectors/coinbase-connector";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IProvider, type IWeb3AuthCoreOptions, Web3AuthNoModal } from "@web3auth/no-modal";
|
|
1
|
+
import { type IProvider, type IWeb3AuthCoreOptions, IWeb3AuthState, type ProjectConfig, Web3AuthNoModal } from "@web3auth/no-modal";
|
|
2
2
|
import { type ConnectorsModalConfig, type IWeb3AuthModal } from "./interface";
|
|
3
3
|
import { LoginModal, type UIConfig } from "./ui";
|
|
4
4
|
export interface Web3AuthOptions extends IWeb3AuthCoreOptions {
|
|
@@ -15,14 +15,15 @@ export declare class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal
|
|
|
15
15
|
loginModal: LoginModal;
|
|
16
16
|
readonly options: Web3AuthOptions;
|
|
17
17
|
private modalConfig;
|
|
18
|
-
constructor(options: Web3AuthOptions);
|
|
19
|
-
|
|
18
|
+
constructor(options: Web3AuthOptions, initialState?: IWeb3AuthState);
|
|
19
|
+
init(options?: {
|
|
20
20
|
signal?: AbortSignal;
|
|
21
21
|
}): Promise<void>;
|
|
22
22
|
connect(): Promise<IProvider | null>;
|
|
23
|
+
protected initUIConfig(projectConfig: ProjectConfig): void;
|
|
24
|
+
protected getInitializationTrackData(): Record<string, unknown>;
|
|
23
25
|
private filterWalletRegistry;
|
|
24
26
|
private getProjectAndWalletConfig;
|
|
25
|
-
private initUIConfig;
|
|
26
27
|
private initConnectors;
|
|
27
28
|
private filterConnectors;
|
|
28
29
|
private checkConnectorAvailability;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@web3auth/no-modal/providers/ethereum-mpc-provider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@web3auth/no-modal/providers/xrpl-provider";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
2
|
import { Web3AuthProviderProps } from "./interfaces";
|
|
3
|
-
export declare function Web3AuthProvider({ config, children }: PropsWithChildren<Web3AuthProviderProps>): import("react").FunctionComponentElement<PropsWithChildren<Web3AuthProviderProps>>;
|
|
3
|
+
export declare function Web3AuthProvider({ config, initialState, children }: PropsWithChildren<Web3AuthProviderProps>): import("react").FunctionComponentElement<PropsWithChildren<Web3AuthProviderProps>>;
|
|
@@ -3,11 +3,11 @@ export interface IUseIdentityToken {
|
|
|
3
3
|
loading: boolean;
|
|
4
4
|
error: Web3AuthError | null;
|
|
5
5
|
token: string | null;
|
|
6
|
-
|
|
6
|
+
getIdentityToken: () => Promise<string | null>;
|
|
7
7
|
}
|
|
8
8
|
export declare const useIdentityToken: () => {
|
|
9
9
|
loading: boolean;
|
|
10
10
|
error: Web3AuthError;
|
|
11
11
|
token: string;
|
|
12
|
-
|
|
12
|
+
getIdentityToken: () => Promise<string>;
|
|
13
13
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IProvider, WALLET_CONNECTOR_TYPE, Web3AuthError } from "@web3auth/no-modal";
|
|
1
|
+
import type { IProvider, LoginParamMap, WALLET_CONNECTOR_TYPE, Web3AuthError } from "@web3auth/no-modal";
|
|
2
2
|
export interface IUseWeb3AuthConnect {
|
|
3
3
|
isConnected: boolean;
|
|
4
4
|
loading: boolean;
|
|
5
5
|
error: Web3AuthError | null;
|
|
6
6
|
connectorName: WALLET_CONNECTOR_TYPE | null;
|
|
7
7
|
connect(): Promise<IProvider | null>;
|
|
8
|
+
connectTo<T extends WALLET_CONNECTOR_TYPE>(connector: T, params?: LoginParamMap[T]): Promise<IProvider | null>;
|
|
8
9
|
}
|
|
9
10
|
export declare const useWeb3AuthConnect: () => IUseWeb3AuthConnect;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { IBaseWeb3AuthHookContext, WalletServicesPluginType } from "@web3auth/no-modal";
|
|
1
|
+
import type { IBaseWeb3AuthHookContext, IWeb3AuthState, WalletServicesPluginType } from "@web3auth/no-modal";
|
|
2
2
|
import type { Web3Auth, Web3AuthOptions } from "../modalManager";
|
|
3
3
|
export type Web3AuthContextConfig = {
|
|
4
4
|
web3AuthOptions: Web3AuthOptions;
|
|
5
5
|
};
|
|
6
6
|
export interface Web3AuthProviderProps {
|
|
7
7
|
config: Web3AuthContextConfig;
|
|
8
|
+
initialState?: IWeb3AuthState;
|
|
8
9
|
}
|
|
9
10
|
export interface IWeb3AuthInnerContext extends IBaseWeb3AuthHookContext {
|
|
10
11
|
web3Auth: Web3Auth | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const defaultWagmiConfig: import("wagmi").Config<readonly [{
|
|
2
|
+
blockExplorers: {
|
|
3
|
+
readonly default: {
|
|
4
|
+
readonly name: "Etherscan";
|
|
5
|
+
readonly url: "https://etherscan.io";
|
|
6
|
+
readonly apiUrl: "https://api.etherscan.io/api";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
contracts: {
|
|
10
|
+
readonly ensRegistry: {
|
|
11
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
12
|
+
};
|
|
13
|
+
readonly ensUniversalResolver: {
|
|
14
|
+
readonly address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67";
|
|
15
|
+
readonly blockCreated: 19258213;
|
|
16
|
+
};
|
|
17
|
+
readonly multicall3: {
|
|
18
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
19
|
+
readonly blockCreated: 14353601;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
ensTlds?: readonly string[] | undefined;
|
|
23
|
+
id: 1;
|
|
24
|
+
name: "Ethereum";
|
|
25
|
+
nativeCurrency: {
|
|
26
|
+
readonly name: "Ether";
|
|
27
|
+
readonly symbol: "ETH";
|
|
28
|
+
readonly decimals: 18;
|
|
29
|
+
};
|
|
30
|
+
rpcUrls: {
|
|
31
|
+
readonly default: {
|
|
32
|
+
readonly http: readonly ["https://eth.merkle.io"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
sourceId?: number | undefined | undefined;
|
|
36
|
+
testnet?: boolean | undefined | undefined;
|
|
37
|
+
custom?: Record<string, unknown> | undefined;
|
|
38
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
39
|
+
formatters?: undefined;
|
|
40
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
41
|
+
}], {
|
|
42
|
+
1: import("viem").HttpTransport<undefined, false>;
|
|
43
|
+
}, readonly []>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
import { WagmiProviderProps as WagmiProviderPropsBase } from "wagmi";
|
|
3
2
|
import { WagmiProviderProps } from "./interface";
|
|
4
|
-
export declare function WagmiProvider({ children, ...props }: PropsWithChildren<WagmiProviderProps>): import("react").FunctionComponentElement<PropsWithChildren<
|
|
3
|
+
export declare function WagmiProvider({ children, ...props }: PropsWithChildren<WagmiProviderProps>): import("react").FunctionComponentElement<PropsWithChildren<import("wagmi").WagmiProviderProps>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AUTH_CONNECTION_TYPE, BUILD_ENV_TYPE, EMAIL_FLOW_TYPE, ExtraLoginOptions, LANGUAGES, SafeEventEmitter, THEME_MODE_TYPE, WEB3AUTH_NETWORK_TYPE } from "@web3auth/auth";
|
|
2
|
-
import { type AuthLoginParams, type BaseConnectorConfig, type ChainNamespaceType, type LoginMethodConfig, type LoginModalConfig, type UIConfig as CoreUIConfig, type WALLET_CONNECTOR_TYPE, type WalletRegistry, type WalletRegistryItem, type Web3AuthNoModalEvents } from "@web3auth/no-modal";
|
|
2
|
+
import { type Analytics, type AuthLoginParams, type BaseConnectorConfig, type ChainNamespaceType, type LoginMethodConfig, type LoginModalConfig, type UIConfig as CoreUIConfig, type WALLET_CONNECTOR_TYPE, type WalletRegistry, type WalletRegistryItem, type Web3AuthNoModalEvents } from "@web3auth/no-modal";
|
|
3
3
|
export interface UIConfig extends CoreUIConfig, LoginModalConfig {
|
|
4
4
|
/**
|
|
5
5
|
* ID of the element to embed the widget into
|
|
@@ -38,7 +38,7 @@ export interface UIConfig extends CoreUIConfig, LoginModalConfig {
|
|
|
38
38
|
primaryButton?: "externalLogin" | "socialLogin" | "emailLogin";
|
|
39
39
|
connectorListener: SafeEventEmitter<Web3AuthNoModalEvents>;
|
|
40
40
|
}
|
|
41
|
-
export type ModalLoginParams = Pick<AuthLoginParams, "authConnection" | "authConnectionId" | "groupedAuthConnectionId" | "
|
|
41
|
+
export type ModalLoginParams = Pick<AuthLoginParams, "authConnection" | "authConnectionId" | "groupedAuthConnectionId" | "loginHint" | "extraLoginOptions"> & {
|
|
42
42
|
name: string;
|
|
43
43
|
};
|
|
44
44
|
export interface LoginModalProps extends UIConfig {
|
|
@@ -47,6 +47,7 @@ export interface LoginModalProps extends UIConfig {
|
|
|
47
47
|
web3authClientId: string;
|
|
48
48
|
web3authNetwork: WEB3AUTH_NETWORK_TYPE;
|
|
49
49
|
authBuildEnv: BUILD_ENV_TYPE;
|
|
50
|
+
analytics: Analytics;
|
|
50
51
|
}
|
|
51
52
|
export interface LoginModalCallbacks {
|
|
52
53
|
onInitExternalWallets: (params: {
|
|
@@ -8,6 +8,7 @@ export declare class LoginModal {
|
|
|
8
8
|
private walletRegistry;
|
|
9
9
|
private callbacks;
|
|
10
10
|
private externalWalletsConfig;
|
|
11
|
+
private analytics;
|
|
11
12
|
constructor(uiConfig: LoginModalProps, callbacks: LoginModalCallbacks);
|
|
12
13
|
get isDark(): boolean;
|
|
13
14
|
initModal: () => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type UIConfig } from "./ui";
|
|
2
|
+
export declare const getLoginModalAnalyticsProperties: (uiConfig?: UIConfig) => {
|
|
3
|
+
ui_modal_login_methods_order: string[];
|
|
4
|
+
ui_modal_z_index: string;
|
|
5
|
+
ui_modal_display_errors_on_modal: boolean;
|
|
6
|
+
ui_modal_login_grid_col: 2 | 3;
|
|
7
|
+
ui_modal_primary_button: "externalLogin" | "socialLogin" | "emailLogin";
|
|
8
|
+
ui_modal_widget_type: import("@web3auth/no-modal").WidgetType;
|
|
9
|
+
ui_modal_target_id_used: boolean;
|
|
10
|
+
ui_modal_logo_alignment: "left" | "center";
|
|
11
|
+
ui_modal_border_radius_type: "small" | "medium" | "large";
|
|
12
|
+
ui_modal_button_radius_type: "pill" | "rounded" | "square";
|
|
13
|
+
ui_modal_sign_in_methods: import("@web3auth/no-modal").ModalSignInMethodType[];
|
|
14
|
+
ui_modal_add_previous_login_hint: boolean;
|
|
15
|
+
ui_modal_display_installed_external_wallets: boolean;
|
|
16
|
+
ui_modal_display_external_wallets_count: boolean;
|
|
17
|
+
};
|
|
@@ -4,6 +4,6 @@ export interface IUseIdentityToken {
|
|
|
4
4
|
loading: Ref<boolean>;
|
|
5
5
|
error: Ref<Web3AuthError | null>;
|
|
6
6
|
token: Ref<string | null>;
|
|
7
|
-
|
|
7
|
+
getIdentityToken: () => Promise<string | null>;
|
|
8
8
|
}
|
|
9
9
|
export declare const useIdentityToken: () => IUseIdentityToken;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IProvider, WALLET_CONNECTOR_TYPE, Web3AuthError } from "@web3auth/no-modal";
|
|
1
|
+
import { IProvider, LoginParamMap, WALLET_CONNECTOR_TYPE, Web3AuthError } from "@web3auth/no-modal";
|
|
2
2
|
import { Ref } from "vue";
|
|
3
3
|
export interface IUseWeb3AuthConnect {
|
|
4
4
|
isConnected: Ref<boolean>;
|
|
@@ -6,5 +6,6 @@ export interface IUseWeb3AuthConnect {
|
|
|
6
6
|
error: Ref<Web3AuthError | null>;
|
|
7
7
|
connectorName: Ref<WALLET_CONNECTOR_TYPE | null>;
|
|
8
8
|
connect(): Promise<IProvider | null>;
|
|
9
|
+
connectTo<T extends WALLET_CONNECTOR_TYPE>(connector: T, params?: LoginParamMap[T]): Promise<IProvider | null>;
|
|
9
10
|
}
|
|
10
11
|
export declare const useWeb3AuthConnect: () => IUseWeb3AuthConnect;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const defaultWagmiConfig: import("wagmi").Config<readonly [{
|
|
2
|
+
blockExplorers: {
|
|
3
|
+
readonly default: {
|
|
4
|
+
readonly name: "Etherscan";
|
|
5
|
+
readonly url: "https://etherscan.io";
|
|
6
|
+
readonly apiUrl: "https://api.etherscan.io/api";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
contracts: {
|
|
10
|
+
readonly ensRegistry: {
|
|
11
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
12
|
+
};
|
|
13
|
+
readonly ensUniversalResolver: {
|
|
14
|
+
readonly address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67";
|
|
15
|
+
readonly blockCreated: 19258213;
|
|
16
|
+
};
|
|
17
|
+
readonly multicall3: {
|
|
18
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
19
|
+
readonly blockCreated: 14353601;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
ensTlds?: readonly string[] | undefined;
|
|
23
|
+
id: 1;
|
|
24
|
+
name: "Ethereum";
|
|
25
|
+
nativeCurrency: {
|
|
26
|
+
readonly name: "Ether";
|
|
27
|
+
readonly symbol: "ETH";
|
|
28
|
+
readonly decimals: 18;
|
|
29
|
+
};
|
|
30
|
+
rpcUrls: {
|
|
31
|
+
readonly default: {
|
|
32
|
+
readonly http: readonly ["https://eth.merkle.io"];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
sourceId?: number | undefined | undefined;
|
|
36
|
+
testnet?: boolean | undefined | undefined;
|
|
37
|
+
custom?: Record<string, unknown> | undefined;
|
|
38
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
39
|
+
formatters?: undefined;
|
|
40
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
41
|
+
}], {
|
|
42
|
+
1: import("viem").HttpTransport<undefined, false>;
|
|
43
|
+
}, readonly []>;
|
|
@@ -8,6 +8,7 @@ export declare const WagmiProvider: import("vue").DefineComponent<import("vue").
|
|
|
8
8
|
};
|
|
9
9
|
}>, {
|
|
10
10
|
finalConfig: import("vue").ShallowRef<Config, Config>;
|
|
11
|
+
configKey: import("vue").Ref<string, string>;
|
|
11
12
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
13
|
config: {
|
|
13
14
|
type: PropType<WagmiProviderProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@web3auth/no-modal/connectors/coinbase-connector';
|