@web3auth/modal 10.4.0 → 10.5.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/react/hooks/useFunding.js +34 -0
- package/dist/lib.cjs/packages/modal/src/react/hooks/useReceive.js +34 -0
- package/dist/lib.cjs/packages/modal/src/react/index.js +4 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +4 -3
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +1 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useFunding.js +34 -0
- package/dist/lib.cjs/packages/modal/src/vue/composables/useReceive.js +34 -0
- package/dist/lib.cjs/packages/modal/src/vue/index.js +4 -0
- package/dist/lib.cjs/types/react/hooks/index.d.ts +2 -0
- package/dist/lib.cjs/types/react/hooks/useFunding.d.ts +8 -0
- package/dist/lib.cjs/types/react/hooks/useReceive.d.ts +8 -0
- package/dist/lib.cjs/types/vue/composables/index.d.ts +2 -0
- package/dist/lib.cjs/types/vue/composables/useFunding.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useReceive.d.ts +9 -0
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/react/hooks/useFunding.js +32 -0
- package/dist/lib.esm/packages/modal/src/react/hooks/useReceive.js +32 -0
- package/dist/lib.esm/packages/modal/src/react/index.js +2 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +5 -4
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +1 -0
- package/dist/lib.esm/packages/modal/src/vue/composables/useFunding.js +32 -0
- package/dist/lib.esm/packages/modal/src/vue/composables/useReceive.js +32 -0
- package/dist/lib.esm/packages/modal/src/vue/index.js +2 -0
- package/dist/modal.umd.min.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var useWalletServicesPlugin = require('./useWalletServicesPlugin.js');
|
|
6
|
+
|
|
7
|
+
const useFunding = () => {
|
|
8
|
+
const {
|
|
9
|
+
plugin,
|
|
10
|
+
ready
|
|
11
|
+
} = useWalletServicesPlugin.useWalletServicesPlugin();
|
|
12
|
+
const [loading, setLoading] = react.useState(false);
|
|
13
|
+
const [error, setError] = react.useState(null);
|
|
14
|
+
const showFunding = react.useCallback(async showFundingParams => {
|
|
15
|
+
setLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
try {
|
|
18
|
+
if (!plugin) throw noModal.WalletServicesPluginError.notInitialized();
|
|
19
|
+
if (!ready) throw noModal.WalletServicesPluginError.walletPluginNotConnected();
|
|
20
|
+
await plugin.showFunding(showFundingParams);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
setError(error);
|
|
23
|
+
} finally {
|
|
24
|
+
setLoading(false);
|
|
25
|
+
}
|
|
26
|
+
}, [plugin, ready]);
|
|
27
|
+
return {
|
|
28
|
+
loading,
|
|
29
|
+
error,
|
|
30
|
+
showFunding
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.useFunding = useFunding;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var useWalletServicesPlugin = require('./useWalletServicesPlugin.js');
|
|
6
|
+
|
|
7
|
+
const useReceive = () => {
|
|
8
|
+
const {
|
|
9
|
+
plugin,
|
|
10
|
+
ready
|
|
11
|
+
} = useWalletServicesPlugin.useWalletServicesPlugin();
|
|
12
|
+
const [loading, setLoading] = react.useState(false);
|
|
13
|
+
const [error, setError] = react.useState(null);
|
|
14
|
+
const showReceive = react.useCallback(async showReceiveParams => {
|
|
15
|
+
setLoading(true);
|
|
16
|
+
setError(null);
|
|
17
|
+
try {
|
|
18
|
+
if (!plugin) throw noModal.WalletServicesPluginError.notInitialized();
|
|
19
|
+
if (!ready) throw noModal.WalletServicesPluginError.walletPluginNotConnected();
|
|
20
|
+
await plugin.showReceive(showReceiveParams);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
setError(error);
|
|
23
|
+
} finally {
|
|
24
|
+
setLoading(false);
|
|
25
|
+
}
|
|
26
|
+
}, [plugin, ready]);
|
|
27
|
+
return {
|
|
28
|
+
loading,
|
|
29
|
+
error,
|
|
30
|
+
showReceive
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.useReceive = useReceive;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var useCheckout = require('./hooks/useCheckout.js');
|
|
4
4
|
var useEnableMFA = require('./hooks/useEnableMFA.js');
|
|
5
|
+
var useFunding = require('./hooks/useFunding.js');
|
|
5
6
|
var useIdentityToken = require('./hooks/useIdentityToken.js');
|
|
6
7
|
var useManageMFA = require('./hooks/useManageMFA.js');
|
|
8
|
+
var useReceive = require('./hooks/useReceive.js');
|
|
7
9
|
var useSwap = require('./hooks/useSwap.js');
|
|
8
10
|
var useSwitchChain = require('./hooks/useSwitchChain.js');
|
|
9
11
|
var useWalletConnectScanner = require('./hooks/useWalletConnectScanner.js');
|
|
@@ -19,8 +21,10 @@ var Web3AuthProvider = require('./Web3AuthProvider.js');
|
|
|
19
21
|
|
|
20
22
|
exports.useCheckout = useCheckout.useCheckout;
|
|
21
23
|
exports.useEnableMFA = useEnableMFA.useEnableMFA;
|
|
24
|
+
exports.useFunding = useFunding.useFunding;
|
|
22
25
|
exports.useIdentityToken = useIdentityToken.useIdentityToken;
|
|
23
26
|
exports.useManageMFA = useManageMFA.useManageMFA;
|
|
27
|
+
exports.useReceive = useReceive.useReceive;
|
|
24
28
|
exports.useSwap = useSwap.useSwap;
|
|
25
29
|
exports.useSwitchChain = useSwitchChain.useSwitchChain;
|
|
26
30
|
exports.useWalletConnectScanner = useWalletConnectScanner.useWalletConnectScanner;
|
|
@@ -75,12 +75,12 @@ function ConnectWallet(props) {
|
|
|
75
75
|
const buttons = [...allExternalButtons.filter(button => button.hasInjectedWallet && defaultButtonKeys.has(button.name)), ...customConnectorButtons, ...allExternalButtons.filter(button => !button.hasInjectedWallet && defaultButtonKeys.has(button.name))].sort((a, b) => {
|
|
76
76
|
// favor MetaMask over other wallets
|
|
77
77
|
if (a.name === noModal.WALLET_CONNECTORS.METAMASK && b.name === noModal.WALLET_CONNECTORS.METAMASK) {
|
|
78
|
-
// favor injected MetaMask over non-injected MetaMask
|
|
79
|
-
if (a.hasInjectedWallet) return -1;
|
|
80
|
-
if (b.hasInjectedWallet) return 1;
|
|
81
78
|
// favor installed MetaMask over non-installed MetaMask
|
|
82
79
|
if (a.isInstalled) return -1;
|
|
83
80
|
if (b.isInstalled) return 1;
|
|
81
|
+
// favor injected MetaMask over non-injected MetaMask
|
|
82
|
+
if (a.hasInjectedWallet) return -1;
|
|
83
|
+
if (b.hasInjectedWallet) return 1;
|
|
84
84
|
return 0;
|
|
85
85
|
}
|
|
86
86
|
if (a.name === noModal.WALLET_CONNECTORS.METAMASK) return -1;
|
|
@@ -159,6 +159,7 @@ function ConnectWallet(props) {
|
|
|
159
159
|
has_wallet_registry_item: !!button.walletRegistryItem,
|
|
160
160
|
total_external_wallets: allUniqueButtons.length
|
|
161
161
|
});
|
|
162
|
+
noModal.log.info("handleWalletClick", button);
|
|
162
163
|
// for installed wallets
|
|
163
164
|
if (button.isInstalled) {
|
|
164
165
|
var _button$chainNamespac2;
|
|
@@ -325,6 +325,7 @@ function Login(props) {
|
|
|
325
325
|
has_wallet_registry_item: !!wallet.walletRegistryItem,
|
|
326
326
|
total_external_wallets: totalExternalWallets
|
|
327
327
|
});
|
|
328
|
+
noModal.log.info("handleInstalledWalletClick", wallet);
|
|
328
329
|
// for non-injected Metamask on desktop, show QR code to connect
|
|
329
330
|
if (wallet.name === noModal.WALLET_CONNECTORS.METAMASK && !wallet.hasInjectedWallet && deviceDetails.platform === "desktop") {
|
|
330
331
|
handleExternalWalletClick({
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var vue = require('vue');
|
|
5
|
+
var useWalletServicesPlugin = require('./useWalletServicesPlugin.js');
|
|
6
|
+
|
|
7
|
+
const useFunding = () => {
|
|
8
|
+
const {
|
|
9
|
+
plugin,
|
|
10
|
+
ready
|
|
11
|
+
} = useWalletServicesPlugin.useWalletServicesPlugin();
|
|
12
|
+
const loading = vue.ref(false);
|
|
13
|
+
const error = vue.ref(null);
|
|
14
|
+
const showFunding = async showFundingParams => {
|
|
15
|
+
loading.value = true;
|
|
16
|
+
error.value = null;
|
|
17
|
+
try {
|
|
18
|
+
if (!plugin) throw noModal.WalletServicesPluginError.notInitialized();
|
|
19
|
+
if (!ready) throw noModal.WalletServicesPluginError.walletPluginNotConnected();
|
|
20
|
+
await plugin.value.showFunding(showFundingParams);
|
|
21
|
+
} catch (err) {
|
|
22
|
+
error.value = err;
|
|
23
|
+
} finally {
|
|
24
|
+
loading.value = false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
loading,
|
|
29
|
+
error,
|
|
30
|
+
showFunding
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.useFunding = useFunding;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var noModal = require('@web3auth/no-modal');
|
|
4
|
+
var vue = require('vue');
|
|
5
|
+
var useWalletServicesPlugin = require('./useWalletServicesPlugin.js');
|
|
6
|
+
|
|
7
|
+
const useReceive = () => {
|
|
8
|
+
const {
|
|
9
|
+
plugin,
|
|
10
|
+
ready
|
|
11
|
+
} = useWalletServicesPlugin.useWalletServicesPlugin();
|
|
12
|
+
const loading = vue.ref(false);
|
|
13
|
+
const error = vue.ref(null);
|
|
14
|
+
const showReceive = async showReceiveParams => {
|
|
15
|
+
loading.value = true;
|
|
16
|
+
error.value = null;
|
|
17
|
+
try {
|
|
18
|
+
if (!plugin) throw noModal.WalletServicesPluginError.notInitialized();
|
|
19
|
+
if (!ready) throw noModal.WalletServicesPluginError.walletPluginNotConnected();
|
|
20
|
+
await plugin.value.showReceive(showReceiveParams);
|
|
21
|
+
} catch (err) {
|
|
22
|
+
error.value = err;
|
|
23
|
+
} finally {
|
|
24
|
+
loading.value = false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
loading,
|
|
29
|
+
error,
|
|
30
|
+
showReceive
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.useReceive = useReceive;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var useCheckout = require('./composables/useCheckout.js');
|
|
4
4
|
var useEnableMFA = require('./composables/useEnableMFA.js');
|
|
5
|
+
var useFunding = require('./composables/useFunding.js');
|
|
5
6
|
var useIdentityToken = require('./composables/useIdentityToken.js');
|
|
6
7
|
var useManageMFA = require('./composables/useManageMFA.js');
|
|
8
|
+
var useReceive = require('./composables/useReceive.js');
|
|
7
9
|
var useSwap = require('./composables/useSwap.js');
|
|
8
10
|
var useSwitchChain = require('./composables/useSwitchChain.js');
|
|
9
11
|
var useWalletConnectScanner = require('./composables/useWalletConnectScanner.js');
|
|
@@ -19,8 +21,10 @@ var Web3AuthProvider = require('./Web3AuthProvider.js');
|
|
|
19
21
|
|
|
20
22
|
exports.useCheckout = useCheckout.useCheckout;
|
|
21
23
|
exports.useEnableMFA = useEnableMFA.useEnableMFA;
|
|
24
|
+
exports.useFunding = useFunding.useFunding;
|
|
22
25
|
exports.useIdentityToken = useIdentityToken.useIdentityToken;
|
|
23
26
|
exports.useManageMFA = useManageMFA.useManageMFA;
|
|
27
|
+
exports.useReceive = useReceive.useReceive;
|
|
24
28
|
exports.useSwap = useSwap.useSwap;
|
|
25
29
|
exports.useSwitchChain = useSwitchChain.useSwitchChain;
|
|
26
30
|
exports.useWalletConnectScanner = useWalletConnectScanner.useWalletConnectScanner;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "./useCheckout";
|
|
2
2
|
export * from "./useEnableMFA";
|
|
3
|
+
export * from "./useFunding";
|
|
3
4
|
export * from "./useIdentityToken";
|
|
4
5
|
export * from "./useManageMFA";
|
|
6
|
+
export * from "./useReceive";
|
|
5
7
|
export * from "./useSwap";
|
|
6
8
|
export * from "./useSwitchChain";
|
|
7
9
|
export * from "./useWalletConnectScanner";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseEmbedControllerState } from "@toruslabs/base-controllers";
|
|
2
|
+
import { Web3AuthError } from "@web3auth/no-modal";
|
|
3
|
+
export interface IUseFunding {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: Web3AuthError | null;
|
|
6
|
+
showFunding: (showFundingParams?: BaseEmbedControllerState["showFunding"]) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const useFunding: () => IUseFunding;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseEmbedControllerState } from "@toruslabs/base-controllers";
|
|
2
|
+
import { Web3AuthError } from "@web3auth/no-modal";
|
|
3
|
+
export interface IUseReceive {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: Web3AuthError | null;
|
|
6
|
+
showReceive: (showReceiveParams?: BaseEmbedControllerState["showReceive"]) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const useReceive: () => IUseReceive;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "./useCheckout";
|
|
2
2
|
export * from "./useEnableMFA";
|
|
3
|
+
export * from "./useFunding";
|
|
3
4
|
export * from "./useIdentityToken";
|
|
4
5
|
export * from "./useManageMFA";
|
|
6
|
+
export * from "./useReceive";
|
|
5
7
|
export * from "./useSwap";
|
|
6
8
|
export * from "./useSwitchChain";
|
|
7
9
|
export * from "./useWalletConnectScanner";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEmbedControllerState } from "@toruslabs/base-controllers";
|
|
2
|
+
import { Web3AuthError } from "@web3auth/no-modal";
|
|
3
|
+
import { Ref } from "vue";
|
|
4
|
+
export interface IUseFunding {
|
|
5
|
+
loading: Ref<boolean>;
|
|
6
|
+
error: Ref<Web3AuthError | null>;
|
|
7
|
+
showFunding: (showFundingParams?: BaseEmbedControllerState["showFunding"]) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useFunding: () => IUseFunding;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEmbedControllerState } from "@toruslabs/base-controllers";
|
|
2
|
+
import { Web3AuthError } from "@web3auth/no-modal";
|
|
3
|
+
import { Ref } from "vue";
|
|
4
|
+
export interface IUseReceive {
|
|
5
|
+
loading: Ref<boolean>;
|
|
6
|
+
error: Ref<Web3AuthError | null>;
|
|
7
|
+
showReceive: (showReceiveParams?: BaseEmbedControllerState["showReceive"]) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useReceive: () => IUseReceive;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
|
+
|
|
5
|
+
const useFunding = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
const showFunding = useCallback(async showFundingParams => {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
setError(null);
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.showFunding(showFundingParams);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setError(error);
|
|
21
|
+
} finally {
|
|
22
|
+
setLoading(false);
|
|
23
|
+
}
|
|
24
|
+
}, [plugin, ready]);
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showFunding
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useFunding };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
|
+
|
|
5
|
+
const useReceive = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
const showReceive = useCallback(async showReceiveParams => {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
setError(null);
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.showReceive(showReceiveParams);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setError(error);
|
|
21
|
+
} finally {
|
|
22
|
+
setLoading(false);
|
|
23
|
+
}
|
|
24
|
+
}, [plugin, ready]);
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showReceive
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useReceive };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { useCheckout } from './hooks/useCheckout.js';
|
|
2
2
|
export { useEnableMFA } from './hooks/useEnableMFA.js';
|
|
3
|
+
export { useFunding } from './hooks/useFunding.js';
|
|
3
4
|
export { useIdentityToken } from './hooks/useIdentityToken.js';
|
|
4
5
|
export { useManageMFA } from './hooks/useManageMFA.js';
|
|
6
|
+
export { useReceive } from './hooks/useReceive.js';
|
|
5
7
|
export { useSwap } from './hooks/useSwap.js';
|
|
6
8
|
export { useSwitchChain } from './hooks/useSwitchChain.js';
|
|
7
9
|
export { useWalletConnectScanner } from './hooks/useWalletConnectScanner.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import { WALLET_CONNECTORS, ANALYTICS_EVENTS } from '@web3auth/no-modal';
|
|
2
|
+
import { WALLET_CONNECTORS, ANALYTICS_EVENTS, log } from '@web3auth/no-modal';
|
|
3
3
|
import { useContext, useState, useMemo } from 'react';
|
|
4
4
|
import { CONNECT_WALLET_PAGES } from '../../constants.js';
|
|
5
5
|
import { AnalyticsContext } from '../../context/AnalyticsContext.js';
|
|
@@ -73,12 +73,12 @@ function ConnectWallet(props) {
|
|
|
73
73
|
const buttons = [...allExternalButtons.filter(button => button.hasInjectedWallet && defaultButtonKeys.has(button.name)), ...customConnectorButtons, ...allExternalButtons.filter(button => !button.hasInjectedWallet && defaultButtonKeys.has(button.name))].sort((a, b) => {
|
|
74
74
|
// favor MetaMask over other wallets
|
|
75
75
|
if (a.name === WALLET_CONNECTORS.METAMASK && b.name === WALLET_CONNECTORS.METAMASK) {
|
|
76
|
-
// favor injected MetaMask over non-injected MetaMask
|
|
77
|
-
if (a.hasInjectedWallet) return -1;
|
|
78
|
-
if (b.hasInjectedWallet) return 1;
|
|
79
76
|
// favor installed MetaMask over non-installed MetaMask
|
|
80
77
|
if (a.isInstalled) return -1;
|
|
81
78
|
if (b.isInstalled) return 1;
|
|
79
|
+
// favor injected MetaMask over non-injected MetaMask
|
|
80
|
+
if (a.hasInjectedWallet) return -1;
|
|
81
|
+
if (b.hasInjectedWallet) return 1;
|
|
82
82
|
return 0;
|
|
83
83
|
}
|
|
84
84
|
if (a.name === WALLET_CONNECTORS.METAMASK) return -1;
|
|
@@ -158,6 +158,7 @@ function ConnectWallet(props) {
|
|
|
158
158
|
has_wallet_registry_item: !!button.walletRegistryItem,
|
|
159
159
|
total_external_wallets: allUniqueButtons.length
|
|
160
160
|
});
|
|
161
|
+
log.info("handleWalletClick", button);
|
|
161
162
|
|
|
162
163
|
// for installed wallets
|
|
163
164
|
if (button.isInstalled) {
|
|
@@ -327,6 +327,7 @@ function Login(props) {
|
|
|
327
327
|
has_wallet_registry_item: !!wallet.walletRegistryItem,
|
|
328
328
|
total_external_wallets: totalExternalWallets
|
|
329
329
|
});
|
|
330
|
+
log.info("handleInstalledWalletClick", wallet);
|
|
330
331
|
// for non-injected Metamask on desktop, show QR code to connect
|
|
331
332
|
if (wallet.name === WALLET_CONNECTORS.METAMASK && !wallet.hasInjectedWallet && deviceDetails.platform === "desktop") {
|
|
332
333
|
handleExternalWalletClick({
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
|
+
|
|
5
|
+
const useFunding = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const loading = ref(false);
|
|
11
|
+
const error = ref(null);
|
|
12
|
+
const showFunding = async showFundingParams => {
|
|
13
|
+
loading.value = true;
|
|
14
|
+
error.value = null;
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.value.showFunding(showFundingParams);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
error.value = err;
|
|
21
|
+
} finally {
|
|
22
|
+
loading.value = false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showFunding
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useFunding };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WalletServicesPluginError } from '@web3auth/no-modal';
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
|
|
4
|
+
|
|
5
|
+
const useReceive = () => {
|
|
6
|
+
const {
|
|
7
|
+
plugin,
|
|
8
|
+
ready
|
|
9
|
+
} = useWalletServicesPlugin();
|
|
10
|
+
const loading = ref(false);
|
|
11
|
+
const error = ref(null);
|
|
12
|
+
const showReceive = async showReceiveParams => {
|
|
13
|
+
loading.value = true;
|
|
14
|
+
error.value = null;
|
|
15
|
+
try {
|
|
16
|
+
if (!plugin) throw WalletServicesPluginError.notInitialized();
|
|
17
|
+
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
18
|
+
await plugin.value.showReceive(showReceiveParams);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
error.value = err;
|
|
21
|
+
} finally {
|
|
22
|
+
loading.value = false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
showReceive
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { useReceive };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { useCheckout } from './composables/useCheckout.js';
|
|
2
2
|
export { useEnableMFA } from './composables/useEnableMFA.js';
|
|
3
|
+
export { useFunding } from './composables/useFunding.js';
|
|
3
4
|
export { useIdentityToken } from './composables/useIdentityToken.js';
|
|
4
5
|
export { useManageMFA } from './composables/useManageMFA.js';
|
|
6
|
+
export { useReceive } from './composables/useReceive.js';
|
|
5
7
|
export { useSwap } from './composables/useSwap.js';
|
|
6
8
|
export { useSwitchChain } from './composables/useSwitchChain.js';
|
|
7
9
|
export { useWalletConnectScanner } from './composables/useWalletConnectScanner.js';
|