@dynamic-labs/sdk-react-core 4.50.4 → 4.51.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/CHANGELOG.md +25 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.cjs +1 -1
- package/src/lib/client/extension/hooks/useInitializeSdkClient/getApiHeaders/getApiHeaders.js +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -1
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.cjs +1 -1
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.js +1 -1
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +1 -1
- package/src/lib/components/IconWithStatus/IconWithStatus.js +1 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +88 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.js +88 -1
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.cjs +1 -1
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
- package/src/lib/context/DynamicContext/hooks/useAutoselectPrimaryWallet/useAutoselectPrimaryWallet.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useAutoselectPrimaryWallet/useAutoselectPrimaryWallet.js +1 -1
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +1 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +19 -0
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +20 -1
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.cjs +1 -1
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.js +1 -1
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.cjs +1 -1
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.js +1 -1
- package/src/lib/store/stateConfig.cjs +39 -35
- package/src/lib/store/stateConfig.js +39 -35
- package/src/lib/utils/functions/generateMessages/index.cjs +15 -1
- package/src/lib/utils/functions/generateMessages/index.js +15 -1
- package/src/lib/utils/functions/getEnabledEmbeddedWalletProviders/getEnabledEmbeddedWalletProviders.cjs +1 -1
- package/src/lib/utils/functions/getEnabledEmbeddedWalletProviders/getEnabledEmbeddedWalletProviders.js +1 -1
- package/src/lib/utils/functions/getUserIdentifier/getUserIdentifier.cjs +1 -1
- package/src/lib/utils/functions/getUserIdentifier/getUserIdentifier.js +1 -1
- package/src/lib/utils/functions/isAllowedToLinkWallet/isAllowedToLinkWallet.cjs +1 -1
- package/src/lib/utils/functions/isAllowedToLinkWallet/isAllowedToLinkWallet.js +1 -1
- package/src/lib/utils/functions/isPasskeyProviderEnabled/isPasskeyProviderEnabled.cjs +1 -1
- package/src/lib/utils/functions/isPasskeyProviderEnabled/isPasskeyProviderEnabled.js +1 -1
- package/src/lib/utils/functions/isPhoneNumberProviderEnabled/isPhoneNumberProviderEnabled.cjs +1 -1
- package/src/lib/utils/functions/isPhoneNumberProviderEnabled/isPhoneNumberProviderEnabled.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs +1 -32
- package/src/lib/utils/hooks/authenticationHooks/helpers/isConnectOnly.js +1 -32
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +1 -1
- package/src/lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.cjs +1 -1
- package/src/lib/utils/hooks/useSignInWithPasskey/useSignInWithPasskey.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -1
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs +1 -1
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.js +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +38 -15
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +8 -2
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +38 -15
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +1 -1
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +10 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +10 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.cjs +18 -18
- package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js +18 -18
|
@@ -37,6 +37,7 @@ require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
|
37
37
|
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
38
38
|
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
39
39
|
var useVerifyWallet = require('../../utils/hooks/useVerifyWallet/useVerifyWallet.cjs');
|
|
40
|
+
var isConnectOnly = require('../../utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs');
|
|
40
41
|
require('../VerificationContext/VerificationContext.cjs');
|
|
41
42
|
require('react-dom');
|
|
42
43
|
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
@@ -169,6 +170,24 @@ const useResponseHandlers = () => {
|
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
// Default behavior is to link a wallet
|
|
173
|
+
// In connect-only mode, skip verification and just handle the wallet connection
|
|
174
|
+
if (isConnectOnly.isConnectOnly()) {
|
|
175
|
+
logger.logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-only mode: skipping verification', {
|
|
176
|
+
authMode: 'connect-only',
|
|
177
|
+
connectResult,
|
|
178
|
+
});
|
|
179
|
+
if (connectResult === null || connectResult === void 0 ? void 0 : connectResult.address) {
|
|
180
|
+
// connectWallet already added the wallet to the store in connect-only mode
|
|
181
|
+
// Just set the last used wallet and close the auth flow
|
|
182
|
+
utils.StorageService.setItem(localStorage.LAST_USED_WALLET, phantomRedirectConnector.key);
|
|
183
|
+
setShowAuthFlow(false);
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
logger.logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-and-sign mode: proceeding to verification', {
|
|
188
|
+
authMode: 'connect-and-sign',
|
|
189
|
+
connectResult,
|
|
190
|
+
});
|
|
172
191
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
|
|
173
192
|
pushView('pending-signature');
|
|
174
193
|
setSelectedWalletConnectorKey('phantom');
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { StorageService, PHANTOM_REDIRECT_CONNECTION_TYPE_KEY } from '@dynamic-labs/utils';
|
|
5
5
|
import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { PHANTOM_SIGNATURE_STATE } from '../../utils/constants/localStorage.js';
|
|
6
|
+
import { LAST_USED_WALLET, PHANTOM_SIGNATURE_STATE } from '../../utils/constants/localStorage.js';
|
|
7
7
|
import { getSiweStatement } from '../../utils/functions/getSiweStatement/getSiweStatement.js';
|
|
8
8
|
import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
9
9
|
import '../DynamicContext/DynamicContext.js';
|
|
@@ -33,6 +33,7 @@ import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
|
33
33
|
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
34
34
|
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
35
35
|
import { useVerifyWallet } from '../../utils/hooks/useVerifyWallet/useVerifyWallet.js';
|
|
36
|
+
import { isConnectOnly } from '../../utils/hooks/authenticationHooks/helpers/isConnectOnly.js';
|
|
36
37
|
import '../VerificationContext/VerificationContext.js';
|
|
37
38
|
import 'react-dom';
|
|
38
39
|
import '../../utils/functions/compareChains/compareChains.js';
|
|
@@ -165,6 +166,24 @@ const useResponseHandlers = () => {
|
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
168
|
// Default behavior is to link a wallet
|
|
169
|
+
// In connect-only mode, skip verification and just handle the wallet connection
|
|
170
|
+
if (isConnectOnly()) {
|
|
171
|
+
logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-only mode: skipping verification', {
|
|
172
|
+
authMode: 'connect-only',
|
|
173
|
+
connectResult,
|
|
174
|
+
});
|
|
175
|
+
if (connectResult === null || connectResult === void 0 ? void 0 : connectResult.address) {
|
|
176
|
+
// connectWallet already added the wallet to the store in connect-only mode
|
|
177
|
+
// Just set the last used wallet and close the auth flow
|
|
178
|
+
StorageService.setItem(LAST_USED_WALLET, phantomRedirectConnector.key);
|
|
179
|
+
setShowAuthFlow(false);
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-and-sign mode: proceeding to verification', {
|
|
184
|
+
authMode: 'connect-and-sign',
|
|
185
|
+
connectResult,
|
|
186
|
+
});
|
|
168
187
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
|
|
169
188
|
pushView('pending-signature');
|
|
170
189
|
setSelectedWalletConnectorKey('phantom');
|
|
@@ -10,12 +10,12 @@ require('../../utils/constants/values.cjs');
|
|
|
10
10
|
require('@dynamic-labs/utils');
|
|
11
11
|
require('../../../../_virtual/_tslib.cjs');
|
|
12
12
|
require('@dynamic-labs/multi-wallet');
|
|
13
|
+
require('../../shared/logger.cjs');
|
|
13
14
|
require('react-international-phone');
|
|
14
15
|
require('../../utils/constants/colors.cjs');
|
|
15
16
|
require('@dynamic-labs/iconic');
|
|
16
17
|
require('@dynamic-labs/wallet-connector-core');
|
|
17
18
|
require('../ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../shared/logger.cjs');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
20
|
require('../../shared/consts/index.cjs');
|
|
21
21
|
require('../../store/state/nonce/nonce.cjs');
|
|
@@ -6,12 +6,12 @@ import '../../utils/constants/values.js';
|
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
7
7
|
import '../../../../_virtual/_tslib.js';
|
|
8
8
|
import '@dynamic-labs/multi-wallet';
|
|
9
|
+
import '../../shared/logger.js';
|
|
9
10
|
import 'react-international-phone';
|
|
10
11
|
import '../../utils/constants/colors.js';
|
|
11
12
|
import '@dynamic-labs/iconic';
|
|
12
13
|
import '@dynamic-labs/wallet-connector-core';
|
|
13
14
|
import '../ViewContext/ViewContext.js';
|
|
14
|
-
import '../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import '../../shared/consts/index.js';
|
|
17
17
|
import '../../store/state/nonce/nonce.js';
|
|
@@ -10,12 +10,12 @@ require('../../utils/constants/values.cjs');
|
|
|
10
10
|
require('@dynamic-labs/utils');
|
|
11
11
|
require('../../../../_virtual/_tslib.cjs');
|
|
12
12
|
require('@dynamic-labs/multi-wallet');
|
|
13
|
+
require('../../shared/logger.cjs');
|
|
13
14
|
require('react-international-phone');
|
|
14
15
|
require('../../utils/constants/colors.cjs');
|
|
15
16
|
require('@dynamic-labs/iconic');
|
|
16
17
|
require('@dynamic-labs/wallet-connector-core');
|
|
17
18
|
require('../ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../shared/logger.cjs');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
20
|
require('../../shared/consts/index.cjs');
|
|
21
21
|
require('../../store/state/nonce/nonce.cjs');
|
|
@@ -6,12 +6,12 @@ import '../../utils/constants/values.js';
|
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
7
7
|
import '../../../../_virtual/_tslib.js';
|
|
8
8
|
import '@dynamic-labs/multi-wallet';
|
|
9
|
+
import '../../shared/logger.js';
|
|
9
10
|
import 'react-international-phone';
|
|
10
11
|
import '../../utils/constants/colors.js';
|
|
11
12
|
import '@dynamic-labs/iconic';
|
|
12
13
|
import '@dynamic-labs/wallet-connector-core';
|
|
13
14
|
import '../ViewContext/ViewContext.js';
|
|
14
|
-
import '../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import '../../shared/consts/index.js';
|
|
17
17
|
import '../../store/state/nonce/nonce.js';
|
|
@@ -6,41 +6,45 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns the initial state for the SdkStore
|
|
8
8
|
*/
|
|
9
|
-
const createInitialState = (dynamicContextProps) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
9
|
+
const createInitialState = (dynamicContextProps) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const initialAuthMode = (_b = (_a = dynamicContextProps.settings) === null || _a === void 0 ? void 0 : _a.initialAuthenticationMode) !== null && _b !== void 0 ? _b : 'connect-and-sign';
|
|
12
|
+
return {
|
|
13
|
+
authMode: initialAuthMode,
|
|
14
|
+
connectedWalletsInfo: [],
|
|
15
|
+
connectorsInitializing: {},
|
|
16
|
+
dynamicContextProps,
|
|
17
|
+
loadingAndLifecycle: {
|
|
18
|
+
initialWalletVerificationInProgress: false,
|
|
19
|
+
sessionValidation: false,
|
|
20
|
+
},
|
|
21
|
+
multichainTokenBalancesState: {
|
|
22
|
+
error: undefined,
|
|
23
|
+
isError: false,
|
|
24
|
+
isLoading: false,
|
|
25
|
+
multichainTokenBalances: undefined,
|
|
26
|
+
requestsKey: undefined,
|
|
27
|
+
},
|
|
28
|
+
nonce: { expiresAt: undefined, nonce: undefined },
|
|
29
|
+
primaryWalletId: undefined,
|
|
30
|
+
sendBalanceState: {
|
|
31
|
+
amount: undefined,
|
|
32
|
+
chainName: undefined,
|
|
33
|
+
nativePrice: undefined,
|
|
34
|
+
},
|
|
35
|
+
tokenBalancesState: {
|
|
36
|
+
error: undefined,
|
|
37
|
+
isError: false,
|
|
38
|
+
isLoading: false,
|
|
39
|
+
tokenBalances: undefined,
|
|
40
|
+
},
|
|
41
|
+
user: undefined,
|
|
42
|
+
walletOptions: {
|
|
43
|
+
groups: {},
|
|
44
|
+
walletConnectorOptions: [],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
};
|
|
44
48
|
/**
|
|
45
49
|
* Filters out which variables should be stored to local storage.
|
|
46
50
|
* Also allows transforming them before storage.
|
|
@@ -2,41 +2,45 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the initial state for the SdkStore
|
|
4
4
|
*/
|
|
5
|
-
const createInitialState = (dynamicContextProps) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
5
|
+
const createInitialState = (dynamicContextProps) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const initialAuthMode = (_b = (_a = dynamicContextProps.settings) === null || _a === void 0 ? void 0 : _a.initialAuthenticationMode) !== null && _b !== void 0 ? _b : 'connect-and-sign';
|
|
8
|
+
return {
|
|
9
|
+
authMode: initialAuthMode,
|
|
10
|
+
connectedWalletsInfo: [],
|
|
11
|
+
connectorsInitializing: {},
|
|
12
|
+
dynamicContextProps,
|
|
13
|
+
loadingAndLifecycle: {
|
|
14
|
+
initialWalletVerificationInProgress: false,
|
|
15
|
+
sessionValidation: false,
|
|
16
|
+
},
|
|
17
|
+
multichainTokenBalancesState: {
|
|
18
|
+
error: undefined,
|
|
19
|
+
isError: false,
|
|
20
|
+
isLoading: false,
|
|
21
|
+
multichainTokenBalances: undefined,
|
|
22
|
+
requestsKey: undefined,
|
|
23
|
+
},
|
|
24
|
+
nonce: { expiresAt: undefined, nonce: undefined },
|
|
25
|
+
primaryWalletId: undefined,
|
|
26
|
+
sendBalanceState: {
|
|
27
|
+
amount: undefined,
|
|
28
|
+
chainName: undefined,
|
|
29
|
+
nativePrice: undefined,
|
|
30
|
+
},
|
|
31
|
+
tokenBalancesState: {
|
|
32
|
+
error: undefined,
|
|
33
|
+
isError: false,
|
|
34
|
+
isLoading: false,
|
|
35
|
+
tokenBalances: undefined,
|
|
36
|
+
},
|
|
37
|
+
user: undefined,
|
|
38
|
+
walletOptions: {
|
|
39
|
+
groups: {},
|
|
40
|
+
walletConnectorOptions: [],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
40
44
|
/**
|
|
41
45
|
* Filters out which variables should be stored to local storage.
|
|
42
46
|
* Also allows transforming them before storage.
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var multiWallet = require('@dynamic-labs/multi-wallet');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
var logger = require('../../../shared/logger.cjs');
|
|
9
10
|
|
|
10
11
|
const getChainIdForMessage = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
12
|
// If it's a Solana wallet, we should not specify a chainId
|
|
@@ -37,7 +38,17 @@ const generateMessages = (publicWalletAddress, walletConnector, nonce, projectEn
|
|
|
37
38
|
}
|
|
38
39
|
const chainId = yield getChainIdForMessage(walletConnector);
|
|
39
40
|
const parsedAddress = walletConnector.parseAddress(publicWalletAddress);
|
|
40
|
-
|
|
41
|
+
let currentUrl;
|
|
42
|
+
// For native mobile, getDisplayOrigin() returns the app's web origin (e.g., "https://demo.dynamic.xyz")
|
|
43
|
+
// which is needed for valid SIWE messages instead of the deep link scheme we get from getUrl()
|
|
44
|
+
const displayOrigin = utils.PlatformService.getDisplayOrigin();
|
|
45
|
+
if (utils.PlatformService.isNativeMobile && displayOrigin) {
|
|
46
|
+
currentUrl = new URL(displayOrigin);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// Fallback to currentUrl for non-native mobile (browser/web)
|
|
50
|
+
currentUrl = utils.PlatformService.getUrl();
|
|
51
|
+
}
|
|
41
52
|
const messageToSign = multiWallet.generateMessageToSign({
|
|
42
53
|
blockchain: walletConnector.connectedChain,
|
|
43
54
|
chainId: chainId,
|
|
@@ -54,6 +65,9 @@ const generateMessages = (publicWalletAddress, walletConnector, nonce, projectEn
|
|
|
54
65
|
: undefined,
|
|
55
66
|
uri: currentUrl.origin + currentUrl.pathname,
|
|
56
67
|
});
|
|
68
|
+
logger.logger.debug('[generateMessages] Generated SIWE message:', {
|
|
69
|
+
messageToSign,
|
|
70
|
+
});
|
|
57
71
|
const signedMessage = yield walletConnector.proveOwnership(parsedAddress, messageToSign);
|
|
58
72
|
if (!signedMessage) {
|
|
59
73
|
throw new utils.DynamicError('Unable to sign the message');
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { generateMessageToSign } from '@dynamic-labs/multi-wallet';
|
|
4
4
|
import { DynamicError, PlatformService } from '@dynamic-labs/utils';
|
|
5
|
+
import { logger } from '../../../shared/logger.js';
|
|
5
6
|
|
|
6
7
|
const getChainIdForMessage = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
8
|
// If it's a Solana wallet, we should not specify a chainId
|
|
@@ -33,7 +34,17 @@ const generateMessages = (publicWalletAddress, walletConnector, nonce, projectEn
|
|
|
33
34
|
}
|
|
34
35
|
const chainId = yield getChainIdForMessage(walletConnector);
|
|
35
36
|
const parsedAddress = walletConnector.parseAddress(publicWalletAddress);
|
|
36
|
-
|
|
37
|
+
let currentUrl;
|
|
38
|
+
// For native mobile, getDisplayOrigin() returns the app's web origin (e.g., "https://demo.dynamic.xyz")
|
|
39
|
+
// which is needed for valid SIWE messages instead of the deep link scheme we get from getUrl()
|
|
40
|
+
const displayOrigin = PlatformService.getDisplayOrigin();
|
|
41
|
+
if (PlatformService.isNativeMobile && displayOrigin) {
|
|
42
|
+
currentUrl = new URL(displayOrigin);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// Fallback to currentUrl for non-native mobile (browser/web)
|
|
46
|
+
currentUrl = PlatformService.getUrl();
|
|
47
|
+
}
|
|
37
48
|
const messageToSign = generateMessageToSign({
|
|
38
49
|
blockchain: walletConnector.connectedChain,
|
|
39
50
|
chainId: chainId,
|
|
@@ -50,6 +61,9 @@ const generateMessages = (publicWalletAddress, walletConnector, nonce, projectEn
|
|
|
50
61
|
: undefined,
|
|
51
62
|
uri: currentUrl.origin + currentUrl.pathname,
|
|
52
63
|
});
|
|
64
|
+
logger.debug('[generateMessages] Generated SIWE message:', {
|
|
65
|
+
messageToSign,
|
|
66
|
+
});
|
|
53
67
|
const signedMessage = yield walletConnector.proveOwnership(parsedAddress, messageToSign);
|
|
54
68
|
if (!signedMessage) {
|
|
55
69
|
throw new DynamicError('Unable to sign the message');
|
|
@@ -8,6 +8,7 @@ require('../../constants/values.cjs');
|
|
|
8
8
|
require('@dynamic-labs/utils');
|
|
9
9
|
require('../../../../../_virtual/_tslib.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
11
12
|
require('react-international-phone');
|
|
12
13
|
require('../../constants/colors.cjs');
|
|
13
14
|
require('@dynamic-labs/iconic');
|
|
@@ -15,7 +16,6 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
15
16
|
require('react');
|
|
16
17
|
require('react/jsx-runtime');
|
|
17
18
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../../shared/logger.cjs');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../store/state/nonce/nonce.cjs');
|
|
@@ -4,6 +4,7 @@ import '../../constants/values.js';
|
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
5
5
|
import '../../../../../_virtual/_tslib.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
7
8
|
import 'react-international-phone';
|
|
8
9
|
import '../../constants/colors.js';
|
|
9
10
|
import '@dynamic-labs/iconic';
|
|
@@ -11,7 +12,6 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
11
12
|
import 'react';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import '../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import '../../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import '../../../store/state/nonce/nonce.js';
|
|
@@ -8,6 +8,7 @@ require('../../constants/values.cjs');
|
|
|
8
8
|
require('@dynamic-labs/utils');
|
|
9
9
|
require('../../../../../_virtual/_tslib.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
11
12
|
var getActiveOauthCredential = require('../getActiveOauthCredential/getActiveOauthCredential.cjs');
|
|
12
13
|
require('react-international-phone');
|
|
13
14
|
require('../../constants/colors.cjs');
|
|
@@ -18,7 +19,6 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
18
19
|
require('react');
|
|
19
20
|
require('react/jsx-runtime');
|
|
20
21
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
21
|
-
require('../../../shared/logger.cjs');
|
|
22
22
|
require('@dynamic-labs/wallet-book');
|
|
23
23
|
require('../../../shared/consts/index.cjs');
|
|
24
24
|
require('../../../store/state/nonce/nonce.cjs');
|
|
@@ -4,6 +4,7 @@ import '../../constants/values.js';
|
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
5
5
|
import '../../../../../_virtual/_tslib.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
7
8
|
import { getActiveOauthCredential } from '../getActiveOauthCredential/getActiveOauthCredential.js';
|
|
8
9
|
import 'react-international-phone';
|
|
9
10
|
import '../../constants/colors.js';
|
|
@@ -14,7 +15,6 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
14
15
|
import 'react';
|
|
15
16
|
import 'react/jsx-runtime';
|
|
16
17
|
import '../../../context/ViewContext/ViewContext.js';
|
|
17
|
-
import '../../../shared/logger.js';
|
|
18
18
|
import '@dynamic-labs/wallet-book';
|
|
19
19
|
import '../../../shared/consts/index.js';
|
|
20
20
|
import '../../../store/state/nonce/nonce.js';
|
|
@@ -8,6 +8,7 @@ require('../../constants/values.cjs');
|
|
|
8
8
|
require('@dynamic-labs/utils');
|
|
9
9
|
require('../../../../../_virtual/_tslib.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
11
12
|
require('react-international-phone');
|
|
12
13
|
require('../../constants/colors.cjs');
|
|
13
14
|
require('@dynamic-labs/iconic');
|
|
@@ -15,7 +16,6 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
15
16
|
require('react');
|
|
16
17
|
require('react/jsx-runtime');
|
|
17
18
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../../shared/logger.cjs');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../store/state/nonce/nonce.cjs');
|
|
@@ -4,6 +4,7 @@ import '../../constants/values.js';
|
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
5
5
|
import '../../../../../_virtual/_tslib.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
7
8
|
import 'react-international-phone';
|
|
8
9
|
import '../../constants/colors.js';
|
|
9
10
|
import '@dynamic-labs/iconic';
|
|
@@ -11,7 +12,6 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
11
12
|
import 'react';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import '../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import '../../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import '../../../store/state/nonce/nonce.js';
|
|
@@ -8,6 +8,7 @@ require('../../constants/values.cjs');
|
|
|
8
8
|
require('@dynamic-labs/utils');
|
|
9
9
|
require('../../../../../_virtual/_tslib.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
11
12
|
require('react-international-phone');
|
|
12
13
|
require('../../constants/colors.cjs');
|
|
13
14
|
require('@dynamic-labs/iconic');
|
|
@@ -15,7 +16,6 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
15
16
|
require('react');
|
|
16
17
|
require('react/jsx-runtime');
|
|
17
18
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../../shared/logger.cjs');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../store/state/nonce/nonce.cjs');
|
|
@@ -4,6 +4,7 @@ import '../../constants/values.js';
|
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
5
5
|
import '../../../../../_virtual/_tslib.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
7
8
|
import 'react-international-phone';
|
|
8
9
|
import '../../constants/colors.js';
|
|
9
10
|
import '@dynamic-labs/iconic';
|
|
@@ -11,7 +12,6 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
11
12
|
import 'react';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import '../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import '../../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import '../../../store/state/nonce/nonce.js';
|
package/src/lib/utils/functions/isPhoneNumberProviderEnabled/isPhoneNumberProviderEnabled.cjs
CHANGED
|
@@ -8,6 +8,7 @@ require('../../constants/values.cjs');
|
|
|
8
8
|
require('@dynamic-labs/utils');
|
|
9
9
|
require('../../../../../_virtual/_tslib.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
|
+
require('../../../shared/logger.cjs');
|
|
11
12
|
require('react-international-phone');
|
|
12
13
|
require('../../constants/colors.cjs');
|
|
13
14
|
require('@dynamic-labs/iconic');
|
|
@@ -15,7 +16,6 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
15
16
|
require('react');
|
|
16
17
|
require('react/jsx-runtime');
|
|
17
18
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
require('../../../shared/logger.cjs');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../store/state/nonce/nonce.cjs');
|
package/src/lib/utils/functions/isPhoneNumberProviderEnabled/isPhoneNumberProviderEnabled.js
CHANGED
|
@@ -4,6 +4,7 @@ import '../../constants/values.js';
|
|
|
4
4
|
import '@dynamic-labs/utils';
|
|
5
5
|
import '../../../../../_virtual/_tslib.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
|
+
import '../../../shared/logger.js';
|
|
7
8
|
import 'react-international-phone';
|
|
8
9
|
import '../../constants/colors.js';
|
|
9
10
|
import '@dynamic-labs/iconic';
|
|
@@ -11,7 +12,6 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
11
12
|
import 'react';
|
|
12
13
|
import 'react/jsx-runtime';
|
|
13
14
|
import '../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import '../../../shared/logger.js';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import '../../../store/state/nonce/nonce.js';
|
|
@@ -3,42 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
require('@dynamic-labs-sdk/client/core');
|
|
7
|
-
require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
require('../../../../client/client.cjs');
|
|
9
|
-
require('react');
|
|
10
|
-
require('@dynamic-labs-sdk/client');
|
|
11
|
-
require('../../../../config/ApiEndpoint.cjs');
|
|
12
|
-
require('@dynamic-labs/iconic');
|
|
13
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
-
require('react/jsx-runtime');
|
|
15
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
-
require('../../../../shared/logger.cjs');
|
|
17
|
-
require('@dynamic-labs/wallet-book');
|
|
18
|
-
require('@dynamic-labs/utils');
|
|
19
|
-
require('../../../constants/colors.cjs');
|
|
20
|
-
require('../../../constants/values.cjs');
|
|
21
|
-
require('../../../../shared/consts/index.cjs');
|
|
22
|
-
require('../../../../../../_virtual/_tslib.cjs');
|
|
23
|
-
require('@dynamic-labs/multi-wallet');
|
|
24
|
-
require('react-international-phone');
|
|
25
|
-
require('../../../../store/state/nonce/nonce.cjs');
|
|
26
|
-
require('@dynamic-labs/locale');
|
|
27
|
-
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
|
-
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
|
-
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
-
require('../../../../events/dynamicEvents.cjs');
|
|
31
|
-
var getUserProfile = require('../../../../client/extension/user/getUserProfile/getUserProfile.cjs');
|
|
32
6
|
var authMode = require('../../../../store/state/authMode/authMode.cjs');
|
|
33
7
|
|
|
34
8
|
const isConnectOnly = () => {
|
|
35
9
|
const authMode$1 = authMode.getAuthMode();
|
|
36
|
-
|
|
37
|
-
// we need to check for user because of connect-only (authenticated)
|
|
38
|
-
// and linking a new wallet in mutliwallet
|
|
39
|
-
const linking = user !== undefined;
|
|
40
|
-
const connectOnly = authMode$1 === 'connect-only' && !linking;
|
|
41
|
-
return connectOnly;
|
|
10
|
+
return authMode$1 === 'connect-only';
|
|
42
11
|
};
|
|
43
12
|
|
|
44
13
|
exports.isConnectOnly = isConnectOnly;
|
|
@@ -1,40 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import '@dynamic-labs-sdk/client/core';
|
|
3
|
-
import '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import '../../../../client/client.js';
|
|
5
|
-
import 'react';
|
|
6
|
-
import '@dynamic-labs-sdk/client';
|
|
7
|
-
import '../../../../config/ApiEndpoint.js';
|
|
8
|
-
import '@dynamic-labs/iconic';
|
|
9
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
-
import 'react/jsx-runtime';
|
|
11
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
-
import '../../../../shared/logger.js';
|
|
13
|
-
import '@dynamic-labs/wallet-book';
|
|
14
|
-
import '@dynamic-labs/utils';
|
|
15
|
-
import '../../../constants/colors.js';
|
|
16
|
-
import '../../../constants/values.js';
|
|
17
|
-
import '../../../../shared/consts/index.js';
|
|
18
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
19
|
-
import '@dynamic-labs/multi-wallet';
|
|
20
|
-
import 'react-international-phone';
|
|
21
|
-
import '../../../../store/state/nonce/nonce.js';
|
|
22
|
-
import '@dynamic-labs/locale';
|
|
23
|
-
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
|
-
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
|
-
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
-
import '../../../../events/dynamicEvents.js';
|
|
27
|
-
import { getUserProfile } from '../../../../client/extension/user/getUserProfile/getUserProfile.js';
|
|
28
2
|
import { getAuthMode } from '../../../../store/state/authMode/authMode.js';
|
|
29
3
|
|
|
30
4
|
const isConnectOnly = () => {
|
|
31
5
|
const authMode = getAuthMode();
|
|
32
|
-
|
|
33
|
-
// we need to check for user because of connect-only (authenticated)
|
|
34
|
-
// and linking a new wallet in mutliwallet
|
|
35
|
-
const linking = user !== undefined;
|
|
36
|
-
const connectOnly = authMode === 'connect-only' && !linking;
|
|
37
|
-
return connectOnly;
|
|
6
|
+
return authMode === 'connect-only';
|
|
38
7
|
};
|
|
39
8
|
|
|
40
9
|
export { isConnectOnly };
|