@dynamic-labs/sdk-react-core 0.19.3 → 1.0.0-alpha.1
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/CHANGELOG.md +41 -24
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +3 -2
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +3 -3
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +3 -3
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +27 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.d.ts +14 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.js +28 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -11
- package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +20 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +10 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +16 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +2 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +6 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +6 -4
- package/src/lib/data/api.cjs +6 -3
- package/src/lib/data/api.d.ts +5 -3
- package/src/lib/data/api.js +6 -3
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +5 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +5 -2
- package/src/lib/utils/hooks/index.d.ts +0 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +4 -4
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +4 -4
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +39 -5
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +1 -2
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +40 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +13 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +13 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +10 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +8 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +9 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +4 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +5 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +4 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +0 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +0 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +9 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.d.ts +3 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +5 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +36 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +10 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +29 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -4
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +8 -7
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +8 -7
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +0 -1
- package/src/lib/utils/hooks/useWallets/useWallets.js +0 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +9 -41
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.d.ts +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +9 -41
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +38 -34
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +38 -34
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +17 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +17 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +15 -3
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +15 -3
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs +1 -2
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.d.ts +1 -1
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js +1 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +16 -8
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +16 -8
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +5 -2
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +5 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +6 -7
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +6 -7
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +4 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +3 -5
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +2 -4
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +2 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +3 -5
- package/src/lib/utils/hooks/useMultiWalletFlag/index.d.ts +0 -1
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs +0 -36
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.d.ts +0 -2
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js +0 -31
|
@@ -69,7 +69,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
69
69
|
return true;
|
|
70
70
|
};
|
|
71
71
|
const linkSocialAccount = (provider) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
connectSocialAccount(provider, checkValidOAuthLinking);
|
|
72
|
+
connectSocialAccount({ provider, validator: checkValidOAuthLinking });
|
|
73
73
|
});
|
|
74
74
|
const unlinkSocialAccount = (provider) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
75
75
|
var _b;
|
|
@@ -65,7 +65,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
65
65
|
return true;
|
|
66
66
|
};
|
|
67
67
|
const linkSocialAccount = (provider) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
connectSocialAccount(provider, checkValidOAuthLinking);
|
|
68
|
+
connectSocialAccount({ provider, validator: checkValidOAuthLinking });
|
|
69
69
|
});
|
|
70
70
|
const unlinkSocialAccount = (provider) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
71
|
var _b;
|
|
@@ -125,10 +125,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
const signInAccount = (provider, code, verifier, state) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
const signInAccount = (provider, code, verifier, state, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
129
129
|
var _b;
|
|
130
130
|
try {
|
|
131
131
|
const jwt = yield api.signInOAuth(environmentId, provider, {
|
|
132
|
+
captchaToken,
|
|
132
133
|
code,
|
|
133
134
|
codeVerifier: verifier,
|
|
134
135
|
state,
|
|
@@ -170,7 +171,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
170
171
|
handleError(types.SocialOAuthErrorCode.GENERAL_ERROR, error);
|
|
171
172
|
}
|
|
172
173
|
});
|
|
173
|
-
const connectSocialAccount = (provider, validator) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
174
|
+
const connectSocialAccount = ({ provider, validator, captchaToken, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
174
175
|
var _c, _d;
|
|
175
176
|
clearInterval(authWindowInterval.current);
|
|
176
177
|
clearError();
|
|
@@ -253,7 +254,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
256
|
if (authMode === 'signin') {
|
|
256
|
-
yield signInAccount(provider, code, verifier, state);
|
|
257
|
+
yield signInAccount(provider, code, verifier, state, captchaToken);
|
|
257
258
|
}
|
|
258
259
|
else {
|
|
259
260
|
yield linkAccount(provider, code, verifier, state);
|
|
@@ -10,7 +10,11 @@ type UseSocialAuthProps = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const useSocialAuth: ({ sessionTimeout, authMode, onSettled, onError, }: UseSocialAuthProps) => {
|
|
12
12
|
readonly checkValidProvider: (provider: ProviderEnum) => boolean;
|
|
13
|
-
readonly connectSocialAccount: (provider
|
|
13
|
+
readonly connectSocialAccount: ({ provider, validator, captchaToken, }: {
|
|
14
|
+
provider: ProviderEnum;
|
|
15
|
+
validator?: ((provider: ProviderEnum) => boolean) | undefined;
|
|
16
|
+
captchaToken?: string | undefined;
|
|
17
|
+
}) => Promise<void>;
|
|
14
18
|
readonly error: SocialOAuthError | undefined;
|
|
15
19
|
readonly handleError: (code: SocialOAuthErrorCode, message: string) => void;
|
|
16
20
|
readonly isProcessing: boolean;
|
|
@@ -121,10 +121,11 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const signInAccount = (provider, code, verifier, state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
+
const signInAccount = (provider, code, verifier, state, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
125
|
var _b;
|
|
126
126
|
try {
|
|
127
127
|
const jwt = yield signInOAuth(environmentId, provider, {
|
|
128
|
+
captchaToken,
|
|
128
129
|
code,
|
|
129
130
|
codeVerifier: verifier,
|
|
130
131
|
state,
|
|
@@ -166,7 +167,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
166
167
|
handleError(SocialOAuthErrorCode.GENERAL_ERROR, error);
|
|
167
168
|
}
|
|
168
169
|
});
|
|
169
|
-
const connectSocialAccount = (provider, validator) => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
+
const connectSocialAccount = ({ provider, validator, captchaToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
171
|
var _c, _d;
|
|
171
172
|
clearInterval(authWindowInterval.current);
|
|
172
173
|
clearError();
|
|
@@ -249,7 +250,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
249
250
|
return;
|
|
250
251
|
}
|
|
251
252
|
if (authMode === 'signin') {
|
|
252
|
-
yield signInAccount(provider, code, verifier, state);
|
|
253
|
+
yield signInAccount(provider, code, verifier, state, captchaToken);
|
|
253
254
|
}
|
|
254
255
|
else {
|
|
255
256
|
yield linkAccount(provider, code, verifier, state);
|
|
@@ -61,7 +61,9 @@ const useValidateSession = ({ handleLogOut, user, authToken, walletConnectV1Brid
|
|
|
61
61
|
oldBridge: currentWalletConnectV1Bridge,
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
// Pera Wallet uses WC v1 and sets a 'walletconnect' key in localStorage
|
|
65
|
+
// so we can't just check for a key starting with 'walletconnect'
|
|
66
|
+
const hasWCV1Data = localStorage.LocalStorage.getKeys().some((key) => key.startsWith('walletconnect-') || key.startsWith('walletlink'));
|
|
65
67
|
const hasWCV2Data = localStorage.LocalStorage.getKeys().some((key) => key.startsWith('wc@2'));
|
|
66
68
|
const handleConnectorVersionOutOfSync = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
67
69
|
if (!wcVersion ||
|
|
@@ -57,7 +57,9 @@ const useValidateSession = ({ handleLogOut, user, authToken, walletConnectV1Brid
|
|
|
57
57
|
oldBridge: currentWalletConnectV1Bridge,
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
|
-
|
|
60
|
+
// Pera Wallet uses WC v1 and sets a 'walletconnect' key in localStorage
|
|
61
|
+
// so we can't just check for a key starting with 'walletconnect'
|
|
62
|
+
const hasWCV1Data = LocalStorage.getKeys().some((key) => key.startsWith('walletconnect-') || key.startsWith('walletlink'));
|
|
61
63
|
const hasWCV2Data = LocalStorage.getKeys().some((key) => key.startsWith('wc@2'));
|
|
62
64
|
const handleConnectorVersionOutOfSync = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
65
|
if (!wcVersion ||
|
|
@@ -30,7 +30,6 @@ const useWalletConnectorEvent = (eventEmitters, eventName, handler) => {
|
|
|
30
30
|
return () => emitter.off(eventName, callback);
|
|
31
31
|
});
|
|
32
32
|
return () => unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
|
|
33
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
33
|
}, [eventEmitters, eventName]);
|
|
35
34
|
};
|
|
36
35
|
|
|
@@ -26,7 +26,6 @@ const useWalletConnectorEvent = (eventEmitters, eventName, handler) => {
|
|
|
26
26
|
return () => emitter.off(eventName, callback);
|
|
27
27
|
});
|
|
28
28
|
return () => unsubscribeCallbacks.forEach((unsubscribe) => unsubscribe());
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
29
|
}, [eventEmitters, eventName]);
|
|
31
30
|
};
|
|
32
31
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
5
6
|
var decodeJwt = require('../../../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
6
7
|
require('@dynamic-labs/iconic');
|
|
7
8
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -15,10 +16,10 @@ require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
15
16
|
require('viem');
|
|
16
17
|
require('@dynamic-labs/utils');
|
|
17
18
|
require('../../../../../shared/consts/index.cjs');
|
|
18
|
-
var isSameWalletName = require('../../../../functions/isSameWalletName/isSameWalletName.cjs');
|
|
19
19
|
require('@dynamic-labs/multi-wallet');
|
|
20
|
-
require('@dynamic-labs/sdk-api');
|
|
21
20
|
var shouldManuallyReconnectOnRefresh = require('../../../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.cjs');
|
|
21
|
+
var findWallet = require('../findWallet/findWallet.cjs');
|
|
22
|
+
var smartWallet = require('../smartWallet/smartWallet.cjs');
|
|
22
23
|
|
|
23
24
|
const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primaryWalletId, }) => {
|
|
24
25
|
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
@@ -28,8 +29,7 @@ const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primar
|
|
|
28
29
|
}
|
|
29
30
|
return decodedJwt.verifiedCredentials
|
|
30
31
|
.map((account) => {
|
|
31
|
-
const wallet =
|
|
32
|
-
isSameWalletName.isSameWalletName(wallet.name, account.walletName));
|
|
32
|
+
const wallet = findWallet.findWallet(account, walletOptions);
|
|
33
33
|
// this probably shouldn't happen. this would mean that the user has an account linked
|
|
34
34
|
// with wallet W, but the customer has toggled off wallet W or the chain that
|
|
35
35
|
// supports wallet W
|
|
@@ -40,7 +40,18 @@ const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primar
|
|
|
40
40
|
shouldManuallyReconnectOnRefresh.shouldManuallyReconnectOnRefresh(wallet.walletConnector)) {
|
|
41
41
|
wallet.walletConnector.connect();
|
|
42
42
|
}
|
|
43
|
+
// this account is the owner of a smart wallet, and should not be surfaced
|
|
44
|
+
if (smartWallet.isOwnerOfASmartWallet(account, decodedJwt.verifiedCredentials)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
43
47
|
if (account.address && account.chain) {
|
|
48
|
+
if (account.walletProvider === sdkApi.WalletProviderEnum.SmartContractWallet) {
|
|
49
|
+
smartWallet.initializeSmartWallet({
|
|
50
|
+
account,
|
|
51
|
+
verifiedCredentials: decodedJwt.verifiedCredentials,
|
|
52
|
+
walletOptions,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
44
55
|
return {
|
|
45
56
|
address: account.address,
|
|
46
57
|
chain: account.chain,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WalletProviderEnum } from '@dynamic-labs/sdk-api';
|
|
1
2
|
import { decodeJwt } from '../../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
2
3
|
import '@dynamic-labs/iconic';
|
|
3
4
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -11,10 +12,10 @@ import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
|
11
12
|
import 'viem';
|
|
12
13
|
import '@dynamic-labs/utils';
|
|
13
14
|
import '../../../../../shared/consts/index.js';
|
|
14
|
-
import { isSameWalletName } from '../../../../functions/isSameWalletName/isSameWalletName.js';
|
|
15
15
|
import '@dynamic-labs/multi-wallet';
|
|
16
|
-
import '@dynamic-labs/sdk-api';
|
|
17
16
|
import { shouldManuallyReconnectOnRefresh } from '../../../../functions/shouldManuallyReconnectOnRefresh/shouldManuallyReconnectOnRefresh.js';
|
|
17
|
+
import { findWallet } from '../findWallet/findWallet.js';
|
|
18
|
+
import { isOwnerOfASmartWallet, initializeSmartWallet } from '../smartWallet/smartWallet.js';
|
|
18
19
|
|
|
19
20
|
const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primaryWalletId, }) => {
|
|
20
21
|
const decodedJwt = decodeJwt(authToken);
|
|
@@ -24,8 +25,7 @@ const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primar
|
|
|
24
25
|
}
|
|
25
26
|
return decodedJwt.verifiedCredentials
|
|
26
27
|
.map((account) => {
|
|
27
|
-
const wallet =
|
|
28
|
-
isSameWalletName(wallet.name, account.walletName));
|
|
28
|
+
const wallet = findWallet(account, walletOptions);
|
|
29
29
|
// this probably shouldn't happen. this would mean that the user has an account linked
|
|
30
30
|
// with wallet W, but the customer has toggled off wallet W or the chain that
|
|
31
31
|
// supports wallet W
|
|
@@ -36,7 +36,18 @@ const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primar
|
|
|
36
36
|
shouldManuallyReconnectOnRefresh(wallet.walletConnector)) {
|
|
37
37
|
wallet.walletConnector.connect();
|
|
38
38
|
}
|
|
39
|
+
// this account is the owner of a smart wallet, and should not be surfaced
|
|
40
|
+
if (isOwnerOfASmartWallet(account, decodedJwt.verifiedCredentials)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
39
43
|
if (account.address && account.chain) {
|
|
44
|
+
if (account.walletProvider === WalletProviderEnum.SmartContractWallet) {
|
|
45
|
+
initializeSmartWallet({
|
|
46
|
+
account,
|
|
47
|
+
verifiedCredentials: decodedJwt.verifiedCredentials,
|
|
48
|
+
walletOptions,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
40
51
|
return {
|
|
41
52
|
address: account.address,
|
|
42
53
|
chain: account.chain,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var isSameWalletName = require('../../../../functions/isSameWalletName/isSameWalletName.cjs');
|
|
6
|
+
|
|
7
|
+
const findWallet = (account, walletOptions) => walletOptions.find((wallet) => account.walletName && isSameWalletName.isSameWalletName(wallet.name, account.walletName));
|
|
8
|
+
|
|
9
|
+
exports.findWallet = findWallet;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { isSameWalletName } from '../../../../functions/isSameWalletName/isSameWalletName.js';
|
|
2
|
+
|
|
3
|
+
const findWallet = (account, walletOptions) => walletOptions.find((wallet) => account.walletName && isSameWalletName(wallet.name, account.walletName));
|
|
4
|
+
|
|
5
|
+
export { findWallet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './findWallet';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './smartWallet';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
|
+
var findWallet = require('../findWallet/findWallet.cjs');
|
|
7
|
+
|
|
8
|
+
// assumes `account` input is a smart wallet (has a signerRefId) and attempts to find
|
|
9
|
+
// the associated eoa account
|
|
10
|
+
const findOwner = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.id === account.signerRefId);
|
|
11
|
+
const findSmartWallet = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.signerRefId === account.id);
|
|
12
|
+
const isOwnerOfASmartWallet = (account, verifiedCredentials) => Boolean(findSmartWallet(account, verifiedCredentials));
|
|
13
|
+
const initializeSmartWallet = ({ account, verifiedCredentials, walletOptions, }) => {
|
|
14
|
+
const owner = findOwner(account, verifiedCredentials);
|
|
15
|
+
if (!owner) {
|
|
16
|
+
throw new Error('could not find associated eoa account for smart wallet');
|
|
17
|
+
}
|
|
18
|
+
const ownerWallet = findWallet.findWallet(owner, walletOptions);
|
|
19
|
+
if (!ownerWallet) {
|
|
20
|
+
throw new Error('could not find owner wallet from wallet options');
|
|
21
|
+
}
|
|
22
|
+
const smartWallet = findWallet.findWallet(account, walletOptions);
|
|
23
|
+
if (!smartWallet) {
|
|
24
|
+
throw new Error('could not find smart wallet from wallet options');
|
|
25
|
+
}
|
|
26
|
+
const connector = smartWallet.walletConnector;
|
|
27
|
+
if (!walletConnectorCore.isSmartWalletConnector(connector)) {
|
|
28
|
+
throw new Error('could not initialize smart wallet');
|
|
29
|
+
}
|
|
30
|
+
connector.setEoaConnector(ownerWallet.walletConnector);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.findOwner = findOwner;
|
|
34
|
+
exports.findSmartWallet = findSmartWallet;
|
|
35
|
+
exports.initializeSmartWallet = initializeSmartWallet;
|
|
36
|
+
exports.isOwnerOfASmartWallet = isOwnerOfASmartWallet;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { WalletOption } from '../../../../../shared';
|
|
3
|
+
export declare const findOwner: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => JwtVerifiedCredential | undefined;
|
|
4
|
+
export declare const findSmartWallet: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => JwtVerifiedCredential | undefined;
|
|
5
|
+
export declare const isOwnerOfASmartWallet: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => boolean;
|
|
6
|
+
export declare const initializeSmartWallet: ({ account, verifiedCredentials, walletOptions, }: {
|
|
7
|
+
account: JwtVerifiedCredential;
|
|
8
|
+
verifiedCredentials: JwtVerifiedCredential[];
|
|
9
|
+
walletOptions: WalletOption[];
|
|
10
|
+
}) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isSmartWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { findWallet } from '../findWallet/findWallet.js';
|
|
3
|
+
|
|
4
|
+
// assumes `account` input is a smart wallet (has a signerRefId) and attempts to find
|
|
5
|
+
// the associated eoa account
|
|
6
|
+
const findOwner = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.id === account.signerRefId);
|
|
7
|
+
const findSmartWallet = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.signerRefId === account.id);
|
|
8
|
+
const isOwnerOfASmartWallet = (account, verifiedCredentials) => Boolean(findSmartWallet(account, verifiedCredentials));
|
|
9
|
+
const initializeSmartWallet = ({ account, verifiedCredentials, walletOptions, }) => {
|
|
10
|
+
const owner = findOwner(account, verifiedCredentials);
|
|
11
|
+
if (!owner) {
|
|
12
|
+
throw new Error('could not find associated eoa account for smart wallet');
|
|
13
|
+
}
|
|
14
|
+
const ownerWallet = findWallet(owner, walletOptions);
|
|
15
|
+
if (!ownerWallet) {
|
|
16
|
+
throw new Error('could not find owner wallet from wallet options');
|
|
17
|
+
}
|
|
18
|
+
const smartWallet = findWallet(account, walletOptions);
|
|
19
|
+
if (!smartWallet) {
|
|
20
|
+
throw new Error('could not find smart wallet from wallet options');
|
|
21
|
+
}
|
|
22
|
+
const connector = smartWallet.walletConnector;
|
|
23
|
+
if (!isSmartWalletConnector(connector)) {
|
|
24
|
+
throw new Error('could not initialize smart wallet');
|
|
25
|
+
}
|
|
26
|
+
connector.setEoaConnector(ownerWallet.walletConnector);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { findOwner, findSmartWallet, initializeSmartWallet, isOwnerOfASmartWallet };
|
|
@@ -18,7 +18,7 @@ require('@dynamic-labs/utils');
|
|
|
18
18
|
require('../../../shared/consts/index.cjs');
|
|
19
19
|
var useWalletConnectorEvent = require('../useWalletConnectorEvent/useWalletConnectorEvent.cjs');
|
|
20
20
|
|
|
21
|
-
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction,
|
|
21
|
+
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
22
22
|
const [loadingNetwork, setLoadingNetwork] = React.useState(true);
|
|
23
23
|
const [network, setNetwork] = React.useState(undefined);
|
|
24
24
|
React.useEffect(() => {
|
|
@@ -90,7 +90,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
90
90
|
else if (multiWalletWidgetState === 'idle' && !newWallet) {
|
|
91
91
|
if (user) {
|
|
92
92
|
setMultiWalletWidgetState('detected_new_wallet');
|
|
93
|
-
|
|
93
|
+
setSelectedWalletConnectorKey(primaryWallet.connector.key);
|
|
94
94
|
yield computeConnectedStateForWallets();
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -150,7 +150,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
150
150
|
if (!linkedSecondaryWallet) {
|
|
151
151
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
152
152
|
if (isPrimaryWallet && primaryWallet) {
|
|
153
|
-
|
|
153
|
+
setSelectedWalletConnectorKey(primaryWallet.connector.key);
|
|
154
154
|
}
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
@@ -162,7 +162,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
162
162
|
setMultiWalletWidgetState,
|
|
163
163
|
primaryWallet,
|
|
164
164
|
secondaryWallets,
|
|
165
|
-
|
|
165
|
+
setSelectedWalletConnectorKey,
|
|
166
166
|
setSelectedWalletWithAction,
|
|
167
167
|
setPrimaryWalletId,
|
|
168
168
|
]);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { AuthModeType, MultiWalletWidgetState, UserProfile, Wallet, WalletWithAction } from '../../../shared';
|
|
4
4
|
import { MultiWalletWidgetStateSetter } from '../multiWallet';
|
|
5
|
+
import { IDynamicContext } from '../../../context/DynamicContext/types';
|
|
5
6
|
export type UseWalletEventListenersArgs = {
|
|
6
7
|
computeConnectedStateForWallets(): Promise<void>;
|
|
7
8
|
handleLogOut(): Promise<void>;
|
|
@@ -13,13 +14,13 @@ export type UseWalletEventListenersArgs = {
|
|
|
13
14
|
selectedWalletWithAction: WalletWithAction | null;
|
|
14
15
|
setMultiWalletWidgetState: MultiWalletWidgetStateSetter;
|
|
15
16
|
setPrimaryWalletId(walletId: string): void;
|
|
16
|
-
|
|
17
|
+
setSelectedWalletConnectorKey: IDynamicContext['setSelectedWalletConnectorKey'];
|
|
17
18
|
setSelectedWalletWithAction(walletWithAction: WalletWithAction | null): void;
|
|
18
19
|
user: UserProfile | undefined;
|
|
19
20
|
authMode: AuthModeType;
|
|
20
21
|
refreshConnectedWallet: (walletId: string, walletConnector: WalletConnector, shouldCallCallback?: boolean) => Promise<void>;
|
|
21
22
|
};
|
|
22
|
-
export declare const useWalletEventListeners: ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction,
|
|
23
|
+
export declare const useWalletEventListeners: ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }: UseWalletEventListenersArgs) => {
|
|
23
24
|
loadingNetwork: boolean;
|
|
24
25
|
network: string | number | undefined;
|
|
25
26
|
setNetwork: import("react").Dispatch<import("react").SetStateAction<string | number | undefined>>;
|
|
@@ -14,7 +14,7 @@ import '@dynamic-labs/utils';
|
|
|
14
14
|
import '../../../shared/consts/index.js';
|
|
15
15
|
import { useWalletConnectorEvent } from '../useWalletConnectorEvent/useWalletConnectorEvent.js';
|
|
16
16
|
|
|
17
|
-
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction,
|
|
17
|
+
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
18
18
|
const [loadingNetwork, setLoadingNetwork] = useState(true);
|
|
19
19
|
const [network, setNetwork] = useState(undefined);
|
|
20
20
|
useEffect(() => {
|
|
@@ -86,7 +86,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
86
86
|
else if (multiWalletWidgetState === 'idle' && !newWallet) {
|
|
87
87
|
if (user) {
|
|
88
88
|
setMultiWalletWidgetState('detected_new_wallet');
|
|
89
|
-
|
|
89
|
+
setSelectedWalletConnectorKey(primaryWallet.connector.key);
|
|
90
90
|
yield computeConnectedStateForWallets();
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
@@ -146,7 +146,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
146
146
|
if (!linkedSecondaryWallet) {
|
|
147
147
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
148
148
|
if (isPrimaryWallet && primaryWallet) {
|
|
149
|
-
|
|
149
|
+
setSelectedWalletConnectorKey(primaryWallet.connector.key);
|
|
150
150
|
}
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
@@ -158,7 +158,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
158
158
|
setMultiWalletWidgetState,
|
|
159
159
|
primaryWallet,
|
|
160
160
|
secondaryWallets,
|
|
161
|
-
|
|
161
|
+
setSelectedWalletConnectorKey,
|
|
162
162
|
setSelectedWalletWithAction,
|
|
163
163
|
setPrimaryWalletId,
|
|
164
164
|
]);
|
|
@@ -26,11 +26,12 @@ var useConnectAndSign = require('../authenticationHooks/useConnectAndSign/useCon
|
|
|
26
26
|
require('../../../config/ApiEndpoint.cjs');
|
|
27
27
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
28
28
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
29
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
29
30
|
var useConnectAndSignSplitSteps = require('../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs');
|
|
30
31
|
require('../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
31
32
|
|
|
32
33
|
const useWalletItemActions = () => {
|
|
33
|
-
const { setMultiWalletWidgetState, setShowAuthFlow,
|
|
34
|
+
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnectorKey, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets, setLegacyIsVerifying, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
34
35
|
const { mockedSDK } = MockContext.useMockContext();
|
|
35
36
|
const { setError } = ErrorContext.useErrorContext();
|
|
36
37
|
const { setView } = ViewContext.useViewContext();
|
|
@@ -39,27 +40,27 @@ const useWalletItemActions = () => {
|
|
|
39
40
|
const handleCustodialWalletClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
40
41
|
const twoStepAuthentication = requiresTwoStepAuthentication.requiresTwoStepAuthentication(walletConnector);
|
|
41
42
|
if (twoStepAuthentication) {
|
|
42
|
-
|
|
43
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
43
44
|
yield onlyConnectUser({
|
|
44
45
|
walletConnector,
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
|
|
49
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
49
50
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
50
51
|
}
|
|
51
52
|
setView('pending-signature');
|
|
52
53
|
});
|
|
53
54
|
const handleMobileWalletClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
|
|
55
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
55
56
|
onlyConnectUser({ walletConnector });
|
|
56
57
|
});
|
|
57
58
|
const handleInstalledExtensionClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
|
|
59
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
59
60
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
60
61
|
});
|
|
61
62
|
const handleUninstalledClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
|
|
63
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
63
64
|
if (!walletConnector.canConnectViaQrCode) {
|
|
64
65
|
setView('no-qr-not-installed');
|
|
65
66
|
}
|
|
@@ -89,7 +90,7 @@ const useWalletItemActions = () => {
|
|
|
89
90
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
90
91
|
}
|
|
91
92
|
setShowAuthFlow(false);
|
|
92
|
-
|
|
93
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
93
94
|
});
|
|
94
95
|
const openWallet = (walletKey, handlers) => {
|
|
95
96
|
const { openMobileWallet = handleMobileWalletClick, openCustodialWallet = handleCustodialWalletClick, openExtensionWallet = handleInstalledExtensionClick, } = handlers || {};
|
|
@@ -22,11 +22,12 @@ import { useConnectAndSign } from '../authenticationHooks/useConnectAndSign/useC
|
|
|
22
22
|
import '../../../config/ApiEndpoint.js';
|
|
23
23
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
24
24
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
25
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
25
26
|
import { useConnectAndSignSplitSteps } from '../authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js';
|
|
26
27
|
import '../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
27
28
|
|
|
28
29
|
const useWalletItemActions = () => {
|
|
29
|
-
const { setMultiWalletWidgetState, setShowAuthFlow,
|
|
30
|
+
const { setMultiWalletWidgetState, setShowAuthFlow, setSelectedWalletConnectorKey, wallets, setQrcodeUri, setDesktopUri, user, linkedWallets, setLegacyIsVerifying, } = useInternalDynamicContext();
|
|
30
31
|
const { mockedSDK } = useMockContext();
|
|
31
32
|
const { setError } = useErrorContext();
|
|
32
33
|
const { setView } = useViewContext();
|
|
@@ -35,27 +36,27 @@ const useWalletItemActions = () => {
|
|
|
35
36
|
const handleCustodialWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
37
|
const twoStepAuthentication = requiresTwoStepAuthentication(walletConnector);
|
|
37
38
|
if (twoStepAuthentication) {
|
|
38
|
-
|
|
39
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
39
40
|
yield onlyConnectUser({
|
|
40
41
|
walletConnector,
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
44
|
-
|
|
45
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
45
46
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
46
47
|
}
|
|
47
48
|
setView('pending-signature');
|
|
48
49
|
});
|
|
49
50
|
const handleMobileWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
-
|
|
51
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
51
52
|
onlyConnectUser({ walletConnector });
|
|
52
53
|
});
|
|
53
54
|
const handleInstalledExtensionClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
|
|
55
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
55
56
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
56
57
|
});
|
|
57
58
|
const handleUninstalledClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
|
|
59
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
59
60
|
if (!walletConnector.canConnectViaQrCode) {
|
|
60
61
|
setView('no-qr-not-installed');
|
|
61
62
|
}
|
|
@@ -85,7 +86,7 @@ const useWalletItemActions = () => {
|
|
|
85
86
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
86
87
|
}
|
|
87
88
|
setShowAuthFlow(false);
|
|
88
|
-
|
|
89
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
89
90
|
});
|
|
90
91
|
const openWallet = (walletKey, handlers) => {
|
|
91
92
|
const { openMobileWallet = handleMobileWalletClick, openCustodialWallet = handleCustodialWalletClick, openExtensionWallet = handleInstalledExtensionClick, } = handlers || {};
|