@web3auth/modal 10.9.0 → 10.10.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/dist/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/modalManager.js +26 -8
- package/dist/lib.cjs/packages/modal/src/react/context/WalletServicesInnerContext.js +1 -1
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +17 -2
- package/dist/lib.cjs/packages/modal/src/react/hooks/useIdentityToken.js +7 -3
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3Auth.js +2 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +5 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/CircularLoader/CircularLoader.js +88 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +5 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +67 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +4 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +25 -13
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +18 -5
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +3 -0
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +3 -1
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +26 -2
- package/dist/lib.cjs/packages/modal/src/vue/WalletServicesInnerProvider.js +1 -1
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +13 -3
- package/dist/lib.cjs/packages/modal/src/vue/composables/useCheckout.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useEnableMFA.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useFunding.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useIdentityToken.js +10 -3
- package/dist/lib.cjs/packages/modal/src/vue/composables/useManageMFA.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useReceive.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useSwap.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useSwitchChain.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWalletConnectScanner.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWalletUI.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthConnect.js +2 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthDisconnect.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthUser.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignAndSendTransaction.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignMessage.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSignTransaction.js +1 -0
- package/dist/lib.cjs/types/modalManager.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.type.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/CircularLoader/CircularLoader.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/CircularLoader/CircularLoader.type.d.ts +19 -0
- package/dist/lib.cjs/types/ui/components/CircularLoader/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWallet.type.d.ts +1 -1
- package/dist/lib.cjs/types/ui/components/Loader/Loader.type.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Login/Login.type.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/Root/Root.type.d.ts +5 -1
- package/dist/lib.cjs/types/ui/components/Widget/Widget.type.d.ts +5 -1
- package/dist/lib.cjs/types/ui/interfaces.d.ts +7 -1
- package/dist/lib.cjs/types/ui/loginModal.d.ts +1 -0
- package/dist/lib.cjs/types/vue/interfaces.d.ts +1 -0
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +27 -9
- package/dist/lib.esm/packages/modal/src/react/context/WalletServicesInnerContext.js +2 -2
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +17 -2
- package/dist/lib.esm/packages/modal/src/react/hooks/useIdentityToken.js +7 -3
- package/dist/lib.esm/packages/modal/src/react/hooks/useWeb3Auth.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +5 -3
- package/dist/lib.esm/packages/modal/src/ui/components/CircularLoader/CircularLoader.js +86 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +5 -5
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js +2 -2
- package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +68 -6
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +4 -3
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +25 -13
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +19 -6
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +3 -0
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +3 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +28 -4
- package/dist/lib.esm/packages/modal/src/vue/WalletServicesInnerProvider.js +1 -1
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +14 -4
- package/dist/lib.esm/packages/modal/src/vue/composables/useCheckout.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useEnableMFA.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useFunding.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useIdentityToken.js +11 -4
- package/dist/lib.esm/packages/modal/src/vue/composables/useManageMFA.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useReceive.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useSwap.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useSwitchChain.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWalletConnectScanner.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWalletUI.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthConnect.js +3 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthDisconnect.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthUser.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignAndSendTransaction.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignMessage.js +2 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSignTransaction.js +2 -1
- package/dist/modal.umd.min.js +1 -1
- package/package.json +3 -3
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import './css/index.css.js';
|
|
5
|
-
import { LANGUAGES, applyWhiteLabelTheme, SafeEventEmitter } from '@web3auth/auth';
|
|
6
|
-
import { log, WIDGET_TYPE, WalletInitializationError, WALLET_CONNECTORS, ANALYTICS_EVENTS, getWhitelabelAnalyticsProperties, CONNECTOR_EVENTS, LOGIN_MODE } from '@web3auth/no-modal';
|
|
5
|
+
import { LANGUAGES, applyWhiteLabelTheme, THEME_MODES, SafeEventEmitter } from '@web3auth/auth';
|
|
6
|
+
import { log, WIDGET_TYPE, WalletInitializationError, WALLET_CONNECTORS, ANALYTICS_EVENTS, getWhitelabelAnalyticsProperties, CONNECTOR_EVENTS, LOGIN_MODE, CONNECTOR_INITIAL_AUTHENTICATION_MODE } from '@web3auth/no-modal';
|
|
7
7
|
import Bowser from 'bowser';
|
|
8
8
|
import { createRoot } from 'react-dom/client';
|
|
9
9
|
import { getLoginModalAnalyticsProperties } from '../utils.js';
|
|
@@ -163,9 +163,11 @@ class LoginModal {
|
|
|
163
163
|
deviceDetails: this.deviceDetails,
|
|
164
164
|
handleShowExternalWallets: this.handleShowExternalWallets,
|
|
165
165
|
handleExternalWalletClick: this.handleExternalWalletClick,
|
|
166
|
+
handleMobileVerifyConnect: this.handleMobileVerifyConnect,
|
|
166
167
|
handleSocialLoginClick: this.handleSocialLoginClick,
|
|
167
168
|
closeModal: this.closeModal,
|
|
168
|
-
uiConfig: this.uiConfig
|
|
169
|
+
uiConfig: this.uiConfig,
|
|
170
|
+
initialAuthenticationMode: this.uiConfig.initialAuthenticationMode
|
|
169
171
|
})
|
|
170
172
|
})
|
|
171
173
|
}));
|
|
@@ -256,6 +258,17 @@ class LoginModal {
|
|
|
256
258
|
});
|
|
257
259
|
}
|
|
258
260
|
});
|
|
261
|
+
_defineProperty(this, "handleMobileVerifyConnect", params => {
|
|
262
|
+
log.info("mobile verify connect clicked", params);
|
|
263
|
+
const {
|
|
264
|
+
connector
|
|
265
|
+
} = params;
|
|
266
|
+
if (this.callbacks.onMobileVerifyConnect) {
|
|
267
|
+
this.callbacks.onMobileVerifyConnect({
|
|
268
|
+
connector
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
});
|
|
259
272
|
_defineProperty(this, "handleSocialLoginClick", params => {
|
|
260
273
|
var _this$analytics3;
|
|
261
274
|
log.info("social login clicked", params);
|
|
@@ -356,11 +369,21 @@ class LoginModal {
|
|
|
356
369
|
listener.on(CONNECTOR_EVENTS.CONNECTOR_DATA_UPDATED, connectorData => {
|
|
357
370
|
this.handleConnectorData(connectorData);
|
|
358
371
|
});
|
|
372
|
+
listener.on(CONNECTOR_EVENTS.AUTHORIZING, () => {
|
|
373
|
+
this.setState({
|
|
374
|
+
status: MODAL_STATUS.AUTHORIZING
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
listener.on(CONNECTOR_EVENTS.AUTHORIZED, () => {
|
|
378
|
+
this.setState({
|
|
379
|
+
status: MODAL_STATUS.AUTHORIZED
|
|
380
|
+
});
|
|
381
|
+
});
|
|
359
382
|
});
|
|
360
383
|
this.uiConfig = _uiConfig;
|
|
361
384
|
if (!_uiConfig.logoDark) this.uiConfig.logoDark = DEFAULT_LOGO_DARK;
|
|
362
385
|
if (!_uiConfig.logoLight) this.uiConfig.logoLight = DEFAULT_LOGO_LIGHT;
|
|
363
|
-
if (!_uiConfig.mode) this.uiConfig.mode =
|
|
386
|
+
if (!_uiConfig.mode) this.uiConfig.mode = THEME_MODES.light;
|
|
364
387
|
if (!_uiConfig.modalZIndex) this.uiConfig.modalZIndex = "99998";
|
|
365
388
|
if (typeof _uiConfig.displayErrorsOnModal === "undefined") this.uiConfig.displayErrorsOnModal = true;
|
|
366
389
|
if (!_uiConfig.appName) this.uiConfig.appName = "Web3Auth";
|
|
@@ -368,6 +391,7 @@ class LoginModal {
|
|
|
368
391
|
if (!_uiConfig.primaryButton) this.uiConfig.primaryButton = "socialLogin";
|
|
369
392
|
if (!_uiConfig.defaultLanguage) this.uiConfig.defaultLanguage = getUserLanguage(_uiConfig.defaultLanguage);
|
|
370
393
|
if (!_uiConfig.widgetType) this.uiConfig.widgetType = WIDGET_TYPE.MODAL;
|
|
394
|
+
if (!_uiConfig.initialAuthenticationMode) this.uiConfig.initialAuthenticationMode = CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_ONLY;
|
|
371
395
|
if (_uiConfig.widgetType === WIDGET_TYPE.EMBED && !_uiConfig.targetId) {
|
|
372
396
|
log.error("targetId is required for embed widget");
|
|
373
397
|
throw WalletInitializationError.invalidParams("targetId is required for embed widget");
|
|
@@ -26,7 +26,7 @@ const WalletServicesInnerProvider = defineComponent({
|
|
|
26
26
|
if (newIsConnected) {
|
|
27
27
|
var _walletServicesPlugin;
|
|
28
28
|
const plugin = getPlugin(EVM_PLUGINS.WALLET_SERVICES);
|
|
29
|
-
|
|
29
|
+
walletServicesPlugin.value = plugin;
|
|
30
30
|
// when rehydrating, the connectedListener may be registered after the connected event is emitted, we need to check the status here
|
|
31
31
|
if (((_walletServicesPlugin = walletServicesPlugin.value) === null || _walletServicesPlugin === void 0 ? void 0 : _walletServicesPlugin.status) === CONNECTOR_STATUS.CONNECTED) ready.value = true;
|
|
32
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ANALYTICS_INTEGRATION_TYPE, CONNECTOR_EVENTS, Web3AuthContextKey, CONNECTOR_STATUS, WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { ANALYTICS_INTEGRATION_TYPE, log, CONNECTOR_EVENTS, Web3AuthContextKey, CONNECTOR_STATUS, WalletInitializationError } from '@web3auth/no-modal';
|
|
2
2
|
import { defineComponent, h, shallowRef, ref, watch, provide } from 'vue';
|
|
3
3
|
import { Web3Auth } from '../modalManager.js';
|
|
4
4
|
import { WalletServicesInnerProvider } from './WalletServicesInnerProvider.js';
|
|
@@ -16,6 +16,7 @@ const Web3AuthProvider = defineComponent({
|
|
|
16
16
|
const provider = ref(null);
|
|
17
17
|
const isMFAEnabled = ref(false);
|
|
18
18
|
const status = ref(null);
|
|
19
|
+
const isAuthorized = ref(false);
|
|
19
20
|
const isInitializing = ref(false);
|
|
20
21
|
const initError = ref(null);
|
|
21
22
|
const isInitialized = ref(false);
|
|
@@ -32,6 +33,7 @@ const Web3AuthProvider = defineComponent({
|
|
|
32
33
|
provider.value = null;
|
|
33
34
|
isMFAEnabled.value = false;
|
|
34
35
|
isConnected.value = false;
|
|
36
|
+
isAuthorized.value = false;
|
|
35
37
|
status.value = null;
|
|
36
38
|
};
|
|
37
39
|
onInvalidate(() => {
|
|
@@ -66,6 +68,7 @@ const Web3AuthProvider = defineComponent({
|
|
|
66
68
|
signal: controller.signal
|
|
67
69
|
});
|
|
68
70
|
} catch (error) {
|
|
71
|
+
log.error("Error initializing web3auth", error);
|
|
69
72
|
initError.value = error;
|
|
70
73
|
} finally {
|
|
71
74
|
isInitializing.value = false;
|
|
@@ -96,15 +99,19 @@ const Web3AuthProvider = defineComponent({
|
|
|
96
99
|
isConnected.value = false;
|
|
97
100
|
provider.value = null;
|
|
98
101
|
isMFAEnabled.value = false;
|
|
102
|
+
isAuthorized.value = false;
|
|
99
103
|
};
|
|
100
104
|
const connectingListener = () => {
|
|
101
105
|
status.value = web3Auth.value.status;
|
|
102
106
|
};
|
|
103
107
|
const errorListener = () => {
|
|
104
108
|
status.value = web3Auth.value.status;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
};
|
|
110
|
+
const authorizedListener = () => {
|
|
111
|
+
status.value = web3Auth.value.status;
|
|
112
|
+
if (web3Auth.value.status === CONNECTOR_STATUS.AUTHORIZED) {
|
|
113
|
+
isConnected.value = true;
|
|
114
|
+
isAuthorized.value = true;
|
|
108
115
|
}
|
|
109
116
|
};
|
|
110
117
|
const mfaEnabledListener = () => {
|
|
@@ -116,6 +123,7 @@ const Web3AuthProvider = defineComponent({
|
|
|
116
123
|
prevWeb3Auth.off(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
117
124
|
prevWeb3Auth.off(CONNECTOR_EVENTS.READY, readyListener);
|
|
118
125
|
prevWeb3Auth.off(CONNECTOR_EVENTS.CONNECTED, connectedListener);
|
|
126
|
+
prevWeb3Auth.off(CONNECTOR_EVENTS.AUTHORIZED, authorizedListener);
|
|
119
127
|
prevWeb3Auth.off(CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
120
128
|
prevWeb3Auth.off(CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
121
129
|
prevWeb3Auth.off(CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
@@ -128,6 +136,7 @@ const Web3AuthProvider = defineComponent({
|
|
|
128
136
|
newWeb3Auth.on(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
129
137
|
newWeb3Auth.on(CONNECTOR_EVENTS.READY, readyListener);
|
|
130
138
|
newWeb3Auth.on(CONNECTOR_EVENTS.CONNECTED, connectedListener);
|
|
139
|
+
newWeb3Auth.on(CONNECTOR_EVENTS.AUTHORIZED, authorizedListener);
|
|
131
140
|
newWeb3Auth.on(CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
132
141
|
newWeb3Auth.on(CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
133
142
|
newWeb3Auth.on(CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
@@ -140,6 +149,7 @@ const Web3AuthProvider = defineComponent({
|
|
|
140
149
|
provide(Web3AuthContextKey, {
|
|
141
150
|
web3Auth,
|
|
142
151
|
isConnected,
|
|
152
|
+
isAuthorized,
|
|
143
153
|
isInitialized,
|
|
144
154
|
provider,
|
|
145
155
|
status,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ const useCheckout = () => {
|
|
|
17
17
|
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
18
|
await plugin.value.showCheckout(showCheckoutParams);
|
|
19
19
|
} catch (err) {
|
|
20
|
+
log.error("Error showing checkout", err);
|
|
20
21
|
error.value = err;
|
|
21
22
|
} finally {
|
|
22
23
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ const useEnableMFA = () => {
|
|
|
15
15
|
loading.value = true;
|
|
16
16
|
await web3Auth.value.enableMFA();
|
|
17
17
|
} catch (err) {
|
|
18
|
+
log.error("Error enabling MFA", err);
|
|
18
19
|
error.value = err;
|
|
19
20
|
} finally {
|
|
20
21
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ const useFunding = () => {
|
|
|
17
17
|
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
18
|
await plugin.value.showFunding(showFundingParams);
|
|
19
19
|
} catch (err) {
|
|
20
|
+
log.error("Error showing funding", err);
|
|
20
21
|
error.value = err;
|
|
21
22
|
} finally {
|
|
22
23
|
loading.value = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref, watch } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
5
5
|
const useIdentityToken = () => {
|
|
6
6
|
const {
|
|
7
7
|
web3Auth,
|
|
8
|
-
|
|
8
|
+
isAuthorized
|
|
9
9
|
} = useWeb3AuthInner();
|
|
10
10
|
const loading = ref(false);
|
|
11
11
|
const error = ref(null);
|
|
@@ -21,15 +21,22 @@ const useIdentityToken = () => {
|
|
|
21
21
|
}
|
|
22
22
|
return result === null || result === void 0 ? void 0 : result.idToken;
|
|
23
23
|
} catch (err) {
|
|
24
|
+
log.error("Error getting identity token", err);
|
|
24
25
|
error.value = err;
|
|
25
26
|
} finally {
|
|
26
27
|
loading.value = false;
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
watch(
|
|
30
|
-
if (!
|
|
30
|
+
watch(isAuthorized, newIsAuthorized => {
|
|
31
|
+
if (!web3Auth.value) return;
|
|
32
|
+
if (!newIsAuthorized && token.value) {
|
|
31
33
|
token.value = null;
|
|
32
34
|
}
|
|
35
|
+
if (newIsAuthorized && !token.value) {
|
|
36
|
+
token.value = web3Auth.value.idToken;
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
immediate: true
|
|
33
40
|
});
|
|
34
41
|
return {
|
|
35
42
|
loading,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ const useManageMFA = () => {
|
|
|
15
15
|
loading.value = true;
|
|
16
16
|
await web3Auth.value.manageMFA();
|
|
17
17
|
} catch (err) {
|
|
18
|
+
log.error("Error managing MFA", err);
|
|
18
19
|
error.value = err;
|
|
19
20
|
} finally {
|
|
20
21
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ const useReceive = () => {
|
|
|
17
17
|
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
18
|
await plugin.value.showReceive(showReceiveParams);
|
|
19
19
|
} catch (err) {
|
|
20
|
+
log.error("Error showing receive", err);
|
|
20
21
|
error.value = err;
|
|
21
22
|
} finally {
|
|
22
23
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ const useSwap = () => {
|
|
|
17
17
|
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
18
|
await plugin.value.showSwap(showSwapParams);
|
|
19
19
|
} catch (err) {
|
|
20
|
+
log.error("Error showing swap", err);
|
|
20
21
|
error.value = err;
|
|
21
22
|
} finally {
|
|
22
23
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ const useSwitchChain = () => {
|
|
|
15
15
|
loading.value = true;
|
|
16
16
|
await web3Auth.value.switchChain(chainParams);
|
|
17
17
|
} catch (err) {
|
|
18
|
+
log.error("Error switching chain", err);
|
|
18
19
|
error.value = err;
|
|
19
20
|
} finally {
|
|
20
21
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ const useWalletConnectScanner = () => {
|
|
|
17
17
|
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
18
|
await plugin.value.showWalletConnectScanner(showWalletConnectScannerParams);
|
|
19
19
|
} catch (err) {
|
|
20
|
+
log.error("Error showing wallet connect scanner", err);
|
|
20
21
|
error.value = err;
|
|
21
22
|
} finally {
|
|
22
23
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ const useWalletUI = () => {
|
|
|
17
17
|
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
18
|
await plugin.value.showWalletUi(showWalletUiParams);
|
|
19
19
|
} catch (err) {
|
|
20
|
+
log.error("Error showing wallet UI", err);
|
|
20
21
|
error.value = err;
|
|
21
22
|
} finally {
|
|
22
23
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref, watch } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
@@ -30,6 +30,7 @@ const useWeb3AuthConnect = () => {
|
|
|
30
30
|
connectorName.value = web3Auth.value.connectedConnectorName;
|
|
31
31
|
return localProvider;
|
|
32
32
|
} catch (err) {
|
|
33
|
+
log.error("Error connecting", err);
|
|
33
34
|
error.value = err;
|
|
34
35
|
return null;
|
|
35
36
|
} finally {
|
|
@@ -45,6 +46,7 @@ const useWeb3AuthConnect = () => {
|
|
|
45
46
|
connectorName.value = web3Auth.value.connectedConnectorName;
|
|
46
47
|
return localProvider;
|
|
47
48
|
} catch (err) {
|
|
49
|
+
log.error("Error connecting to", err);
|
|
48
50
|
error.value = err;
|
|
49
51
|
return null;
|
|
50
52
|
} finally {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
@@ -15,6 +15,7 @@ const useWeb3AuthDisconnect = () => {
|
|
|
15
15
|
loading.value = true;
|
|
16
16
|
await web3Auth.value.logout(options);
|
|
17
17
|
} catch (err) {
|
|
18
|
+
log.error("Error disconnecting", err);
|
|
18
19
|
error.value = err;
|
|
19
20
|
} finally {
|
|
20
21
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref, watch } from 'vue';
|
|
3
3
|
import { useWeb3AuthInner } from './useWeb3AuthInner.js';
|
|
4
4
|
|
|
@@ -21,6 +21,7 @@ const useWeb3AuthUser = () => {
|
|
|
21
21
|
userInfo.value = result;
|
|
22
22
|
return result;
|
|
23
23
|
} catch (err) {
|
|
24
|
+
log.error("Error getting user info", err);
|
|
24
25
|
error.value = err;
|
|
25
26
|
} finally {
|
|
26
27
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useSolanaWallet } from './useSolanaWallet.js';
|
|
4
4
|
|
|
@@ -18,6 +18,7 @@ const useSignAndSendTransaction = () => {
|
|
|
18
18
|
data.value = signature;
|
|
19
19
|
return signature;
|
|
20
20
|
} catch (err) {
|
|
21
|
+
log.error("Error signing and sending transaction", err);
|
|
21
22
|
error.value = err;
|
|
22
23
|
} finally {
|
|
23
24
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useSolanaWallet } from './useSolanaWallet.js';
|
|
4
4
|
|
|
@@ -20,6 +20,7 @@ const useSignMessage = () => {
|
|
|
20
20
|
data.value = signature;
|
|
21
21
|
return signature;
|
|
22
22
|
} catch (err) {
|
|
23
|
+
log.error("Error signing message", err);
|
|
23
24
|
error.value = err;
|
|
24
25
|
} finally {
|
|
25
26
|
loading.value = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletInitializationError } from '@web3auth/no-modal';
|
|
1
|
+
import { WalletInitializationError, log } from '@web3auth/no-modal';
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { useSolanaWallet } from './useSolanaWallet.js';
|
|
4
4
|
|
|
@@ -18,6 +18,7 @@ const useSignTransaction = () => {
|
|
|
18
18
|
data.value = signedTransaction;
|
|
19
19
|
return signedTransaction;
|
|
20
20
|
} catch (err) {
|
|
21
|
+
log.error("Error signing transaction", err);
|
|
21
22
|
error.value = err;
|
|
22
23
|
} finally {
|
|
23
24
|
loading.value = false;
|