@dynamic-labs/sdk-react-core 4.0.0-alpha.11 → 4.0.0-alpha.13
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 +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/Main.cjs +1 -1
- package/src/lib/Main.js +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +6 -6
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +7 -7
- package/src/lib/components/TransactionCard/TransactionCard.cjs +77 -5
- package/src/lib/components/TransactionCard/TransactionCard.js +78 -6
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
- package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
- package/src/lib/components/UserProfile/UserProfile.js +1 -1
- package/src/lib/components/UserProfileForm/UserProfileForm.cjs +1 -1
- package/src/lib/components/UserProfileForm/UserProfileForm.js +1 -1
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +127 -0
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.d.ts +1 -0
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +123 -0
- package/src/lib/components/WalletConnectorEvents/index.d.ts +1 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +14 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +6 -3
- package/src/lib/context/DynamicContext/hooks/useRegisterStorageService/useRegisterStorageService.cjs +8 -4
- package/src/lib/context/DynamicContext/hooks/useRegisterStorageService/useRegisterStorageService.js +9 -5
- package/src/lib/context/MockContext/MockContext.cjs +1 -1
- package/src/lib/context/MockContext/MockContext.js +1 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +1 -3
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +1 -3
- package/src/lib/data/api/oauth/oauth.cjs +19 -10
- package/src/lib/data/api/oauth/oauth.js +19 -10
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +1 -1
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +1 -1
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +1 -1
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +1 -1
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +1 -1
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +1 -1
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +1 -1
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +1 -1
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -1
- package/src/lib/store/internalImplementation/utils/syncLegacyStorage/syncLegacyStorage.cjs +1 -1
- package/src/lib/store/internalImplementation/utils/syncLegacyStorage/syncLegacyStorage.js +1 -1
- package/src/lib/utils/functions/getExpiresAt/getExpiresAt.d.ts +1 -1
- package/src/lib/utils/functions/networksAndChains/networksAndChains.cjs +15 -22
- package/src/lib/utils/functions/networksAndChains/networksAndChains.d.ts +2 -5
- package/src/lib/utils/functions/networksAndChains/networksAndChains.js +15 -20
- package/src/lib/utils/hooks/index.d.ts +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +2 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +2 -2
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/index.d.ts +1 -0
- package/src/lib/utils/hooks/{useWalletConnectorOptions/useWalletConnectorOptions.cjs → useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs} +2 -2
- package/src/lib/utils/hooks/{useWalletConnectorOptions/useWalletConnectorOptions.d.ts → useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.d.ts} +1 -1
- package/src/lib/utils/hooks/{useWalletConnectorOptions/useWalletConnectorOptions.js → useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js} +2 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +5 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +5 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +23 -11
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +23 -11
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +4 -7
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +1 -4
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +4 -7
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +4 -4
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +1 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +4 -4
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs +1 -3
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.js +1 -3
- package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +1 -1
- package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
- package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.cjs +1 -1
- package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.js +1 -1
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +1 -1
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +3 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +3 -1
- package/src/lib/views/EnterPasswordView/EnterPasswordView.cjs +1 -1
- package/src/lib/views/EnterPasswordView/EnterPasswordView.js +1 -1
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.cjs +0 -1
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.js +0 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +0 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +0 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +1 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +1 -1
- package/src/lib/views/Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +1 -1
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.cjs +1 -1
- package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.js +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -3
- package/src/lib/views/SendBalanceView/SendBalanceView.js +3 -4
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +7 -4
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +7 -4
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +1 -1
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +1 -1
- package/src/lib/views/WalletList/WalletList.cjs +2 -2
- package/src/lib/views/WalletList/WalletList.js +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.js +1 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/hooks/useFetchChain/useFetchChain.js +3 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/index.d.ts +0 -1
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/ConnectorSetupError.cjs +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/ConnectorSetupError.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/ConnectorSetupError.js +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/errors/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.js +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.d.ts +0 -0
- /package/src/lib/utils/hooks/{useWalletConnectorOptions → useCreateWalletConnectorOptions}/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +0 -0
|
@@ -26,11 +26,20 @@ const initAuth = (environmentId, providerType, oauthInitAuthRequest) => __awaite
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
catch (err) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
let data;
|
|
31
|
+
try {
|
|
32
|
+
data = yield err.json();
|
|
33
|
+
logger.error(data);
|
|
34
|
+
}
|
|
35
|
+
catch (_a) {
|
|
36
|
+
logger.error(err);
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
throw new Error(data.error);
|
|
31
40
|
}
|
|
32
41
|
});
|
|
33
|
-
const verifyOAuth = (environmentId_1, providerType_1,
|
|
42
|
+
const verifyOAuth = (environmentId_1, providerType_1, _b) => __awaiter(void 0, [environmentId_1, providerType_1, _b], void 0, function* (environmentId, providerType, { code, codeVerifier, state }) {
|
|
34
43
|
const oauthRequest = {
|
|
35
44
|
code,
|
|
36
45
|
codeVerifier,
|
|
@@ -49,7 +58,7 @@ const verifyOAuth = (environmentId_1, providerType_1, _a) => __awaiter(void 0, [
|
|
|
49
58
|
return handleVerifyError(e);
|
|
50
59
|
}
|
|
51
60
|
});
|
|
52
|
-
const unlinkOAuth = (
|
|
61
|
+
const unlinkOAuth = (_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, primaryWalletId, verifiedCrentialId, }) {
|
|
53
62
|
try {
|
|
54
63
|
const response = yield sdkApi().verifyUnlink({
|
|
55
64
|
environmentId,
|
|
@@ -65,7 +74,7 @@ const unlinkOAuth = (_b) => __awaiter(void 0, [_b], void 0, function* ({ environ
|
|
|
65
74
|
return undefined;
|
|
66
75
|
}
|
|
67
76
|
});
|
|
68
|
-
const signInOAuth = (environmentId_2, providerType_2,
|
|
77
|
+
const signInOAuth = (environmentId_2, providerType_2, _d) => __awaiter(void 0, [environmentId_2, providerType_2, _d], void 0, function* (environmentId, providerType, { code, codeVerifier, state, captchaToken, sessionPublicKey }) {
|
|
69
78
|
const oauthRequest = {
|
|
70
79
|
captchaToken,
|
|
71
80
|
code,
|
|
@@ -86,7 +95,7 @@ const signInOAuth = (environmentId_2, providerType_2, _c) => __awaiter(void 0, [
|
|
|
86
95
|
return handleSignInError(e);
|
|
87
96
|
}
|
|
88
97
|
});
|
|
89
|
-
const getOAuthResult = (environmentId_3, providerType_3,
|
|
98
|
+
const getOAuthResult = (environmentId_3, providerType_3, _e) => __awaiter(void 0, [environmentId_3, providerType_3, _e], void 0, function* (environmentId, providerType, { state }) {
|
|
90
99
|
const oauthResultRequest = {
|
|
91
100
|
state,
|
|
92
101
|
};
|
|
@@ -179,7 +188,7 @@ const handleVerifyError = (e) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
179
188
|
return undefined;
|
|
180
189
|
});
|
|
181
190
|
const handleSignInError = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
182
|
-
var
|
|
191
|
+
var _f, _g, _h;
|
|
183
192
|
logger.error(e);
|
|
184
193
|
const data = yield e.json();
|
|
185
194
|
if (data.error.code === 'gate_blocked') {
|
|
@@ -187,9 +196,9 @@ const handleSignInError = (e) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
187
196
|
}
|
|
188
197
|
if (data.error.code === 'missing_from_list') {
|
|
189
198
|
throw new NoAccessError({
|
|
190
|
-
socialProvider: (
|
|
191
|
-
socialUsername: (
|
|
192
|
-
walletPublicKey: (
|
|
199
|
+
socialProvider: (_f = data === null || data === void 0 ? void 0 : data.payload) === null || _f === void 0 ? void 0 : _f.socialProvider,
|
|
200
|
+
socialUsername: (_g = data === null || data === void 0 ? void 0 : data.payload) === null || _g === void 0 ? void 0 : _g.socialUsername,
|
|
201
|
+
walletPublicKey: (_h = data === null || data === void 0 ? void 0 : data.payload) === null || _h === void 0 ? void 0 : _h.walletPublicKey,
|
|
193
202
|
});
|
|
194
203
|
}
|
|
195
204
|
if (data.code === 'email_associated_with_different_provider') {
|
|
@@ -72,8 +72,8 @@ require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
|
72
72
|
var IconButton = require('../../../components/IconButton/IconButton.cjs');
|
|
73
73
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
74
74
|
require('formik');
|
|
75
|
-
require('../../../store/state/sendBalances.cjs');
|
|
76
75
|
var ModalHeader = require('../../../components/ModalHeader/ModalHeader.cjs');
|
|
76
|
+
require('../../../store/state/sendBalances.cjs');
|
|
77
77
|
require('../../../components/Input/Input.cjs');
|
|
78
78
|
require('../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
79
79
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -68,8 +68,8 @@ import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
|
68
68
|
import { IconButton } from '../../../components/IconButton/IconButton.js';
|
|
69
69
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
70
70
|
import 'formik';
|
|
71
|
-
import '../../../store/state/sendBalances.js';
|
|
72
71
|
import { ModalHeader } from '../../../components/ModalHeader/ModalHeader.js';
|
|
72
|
+
import '../../../store/state/sendBalances.js';
|
|
73
73
|
import '../../../components/Input/Input.js';
|
|
74
74
|
import '../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
75
75
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -68,8 +68,8 @@ require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
|
68
68
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
69
69
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
70
70
|
require('formik');
|
|
71
|
-
require('../../../../store/state/sendBalances.cjs');
|
|
72
71
|
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
72
|
+
require('../../../../store/state/sendBalances.cjs');
|
|
73
73
|
require('../../../../components/Input/Input.cjs');
|
|
74
74
|
require('../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
75
75
|
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -64,8 +64,8 @@ import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
|
64
64
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
65
65
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
66
66
|
import 'formik';
|
|
67
|
-
import '../../../../store/state/sendBalances.js';
|
|
68
67
|
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
68
|
+
import '../../../../store/state/sendBalances.js';
|
|
69
69
|
import '../../../../components/Input/Input.js';
|
|
70
70
|
import '../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
71
71
|
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -66,8 +66,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
|
|
|
66
66
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
67
67
|
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
68
68
|
require('formik');
|
|
69
|
-
require('../../store/state/sendBalances.cjs');
|
|
70
69
|
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
|
|
70
|
+
require('../../store/state/sendBalances.cjs');
|
|
71
71
|
require('../../components/Input/Input.cjs');
|
|
72
72
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
73
73
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -62,8 +62,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
|
|
|
62
62
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
63
63
|
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
64
64
|
import 'formik';
|
|
65
|
-
import '../../store/state/sendBalances.js';
|
|
66
65
|
import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
|
|
66
|
+
import '../../store/state/sendBalances.js';
|
|
67
67
|
import '../../components/Input/Input.js';
|
|
68
68
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
69
69
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -66,8 +66,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
|
|
|
66
66
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
67
67
|
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
68
68
|
require('formik');
|
|
69
|
-
require('../../store/state/sendBalances.cjs');
|
|
70
69
|
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
|
|
70
|
+
require('../../store/state/sendBalances.cjs');
|
|
71
71
|
require('../../components/Input/Input.cjs');
|
|
72
72
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
73
73
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -62,8 +62,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
|
|
|
62
62
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
63
63
|
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
64
64
|
import 'formik';
|
|
65
|
-
import '../../store/state/sendBalances.js';
|
|
66
65
|
import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
|
|
66
|
+
import '../../store/state/sendBalances.js';
|
|
67
67
|
import '../../components/Input/Input.js';
|
|
68
68
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
69
69
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -67,8 +67,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
|
|
|
67
67
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
68
68
|
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
69
69
|
require('formik');
|
|
70
|
-
require('../../store/state/sendBalances.cjs');
|
|
71
70
|
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
|
|
71
|
+
require('../../store/state/sendBalances.cjs');
|
|
72
72
|
require('../../components/Input/Input.cjs');
|
|
73
73
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
74
74
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -63,8 +63,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
|
|
|
63
63
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
64
64
|
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
65
65
|
import 'formik';
|
|
66
|
-
import '../../store/state/sendBalances.js';
|
|
67
66
|
import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
|
|
67
|
+
import '../../store/state/sendBalances.js';
|
|
68
68
|
import '../../components/Input/Input.js';
|
|
69
69
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
70
70
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -71,7 +71,6 @@ var SendBalanceView = require('../../views/SendBalanceView/SendBalanceView.cjs')
|
|
|
71
71
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
72
72
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
73
73
|
require('../../../index.cjs');
|
|
74
|
-
require('../../store/state/sendBalances.cjs');
|
|
75
74
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
76
75
|
require('../../store/state/tokenBalances.cjs');
|
|
77
76
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
@@ -85,6 +84,7 @@ require('qrcode');
|
|
|
85
84
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
86
85
|
require('@hcaptcha/react-hcaptcha');
|
|
87
86
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
87
|
+
require('../../store/state/sendBalances.cjs');
|
|
88
88
|
|
|
89
89
|
const SendBalanceModal = ({ initialRecipientAddress, initialValue, onReject, onSuccess, }) => {
|
|
90
90
|
usePreventPageScroll.usePreventPageScroll(true);
|
|
@@ -67,7 +67,6 @@ import { SendBalanceView } from '../../views/SendBalanceView/SendBalanceView.js'
|
|
|
67
67
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
68
68
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
69
69
|
import '../../../index.js';
|
|
70
|
-
import '../../store/state/sendBalances.js';
|
|
71
70
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
72
71
|
import '../../store/state/tokenBalances.js';
|
|
73
72
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
@@ -81,6 +80,7 @@ import 'qrcode';
|
|
|
81
80
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
82
81
|
import '@hcaptcha/react-hcaptcha';
|
|
83
82
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
83
|
+
import '../../store/state/sendBalances.js';
|
|
84
84
|
|
|
85
85
|
const SendBalanceModal = ({ initialRecipientAddress, initialValue, onReject, onSuccess, }) => {
|
|
86
86
|
usePreventPageScroll(true);
|
|
@@ -83,8 +83,8 @@ var IconButton = require('../../components/IconButton/IconButton.cjs');
|
|
|
83
83
|
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
84
84
|
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
85
85
|
require('formik');
|
|
86
|
-
require('../../store/state/sendBalances.cjs');
|
|
87
86
|
var ModalHeader = require('../../components/ModalHeader/ModalHeader.cjs');
|
|
87
|
+
require('../../store/state/sendBalances.cjs');
|
|
88
88
|
require('../../components/Input/Input.cjs');
|
|
89
89
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
90
90
|
var PasskeyContext = require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
@@ -79,8 +79,8 @@ import { IconButton } from '../../components/IconButton/IconButton.js';
|
|
|
79
79
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
80
80
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
81
81
|
import 'formik';
|
|
82
|
-
import '../../store/state/sendBalances.js';
|
|
83
82
|
import { ModalHeader } from '../../components/ModalHeader/ModalHeader.js';
|
|
83
|
+
import '../../store/state/sendBalances.js';
|
|
84
84
|
import '../../components/Input/Input.js';
|
|
85
85
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
86
86
|
import { usePasskeyContext } from '../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -9,7 +9,7 @@ const AUTH_USER = 'dynamic_authenticated_user';
|
|
|
9
9
|
const syncLegacyStorage = (store) => {
|
|
10
10
|
const legacyUser = utils.StorageService.getItem(AUTH_USER);
|
|
11
11
|
if (Boolean(legacyUser) && !store.getState().user) {
|
|
12
|
-
store.setState({ user: legacyUser });
|
|
12
|
+
store.setState({ user: legacyUser !== null && legacyUser !== void 0 ? legacyUser : undefined });
|
|
13
13
|
utils.StorageService.removeItem(AUTH_USER);
|
|
14
14
|
}
|
|
15
15
|
return store;
|
|
@@ -5,7 +5,7 @@ const AUTH_USER = 'dynamic_authenticated_user';
|
|
|
5
5
|
const syncLegacyStorage = (store) => {
|
|
6
6
|
const legacyUser = StorageService.getItem(AUTH_USER);
|
|
7
7
|
if (Boolean(legacyUser) && !store.getState().user) {
|
|
8
|
-
store.setState({ user: legacyUser });
|
|
8
|
+
store.setState({ user: legacyUser !== null && legacyUser !== void 0 ? legacyUser : undefined });
|
|
9
9
|
StorageService.removeItem(AUTH_USER);
|
|
10
10
|
}
|
|
11
11
|
return store;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getExpiresAt: () => number |
|
|
1
|
+
export declare const getExpiresAt: () => number | null;
|
|
@@ -3,25 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var values = require('../../constants/values.cjs');
|
|
7
|
+
|
|
8
|
+
const getNetworkInfoEntry = (chain, networkInfo) => {
|
|
9
|
+
if (!chain || !chain.symbol) {
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
|
-
const
|
|
12
|
+
const normalizedChainSymbol = chain.symbol === 'ETH' || chain.symbol === 'EVM'
|
|
13
|
+
? 'evm'
|
|
14
|
+
: chain.symbol.toLowerCase();
|
|
15
|
+
const networkData = networkInfo[normalizedChainSymbol] ||
|
|
16
|
+
networkInfo[values.ChainEnumToVerifiedCredentialName[normalizedChainSymbol.toUpperCase()]];
|
|
11
17
|
if (!networkData)
|
|
12
18
|
return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
base: 'base',
|
|
19
|
-
eth: 'eth',
|
|
20
|
-
'op mainnet': 'optimism',
|
|
21
|
-
optimism: 'optimism',
|
|
22
|
-
polygon: 'polygon',
|
|
23
|
-
sepolia: 'sepolia',
|
|
24
|
-
solana: 'solana',
|
|
19
|
+
if (normalizedChainSymbol === 'evm') {
|
|
20
|
+
return networkData.find((e) => e.chainId === (chain === null || chain === void 0 ? void 0 : chain.chainId));
|
|
21
|
+
}
|
|
22
|
+
// Solana, etc
|
|
23
|
+
return networkData[0];
|
|
25
24
|
};
|
|
26
25
|
const getEvmChainName = (chainId) => {
|
|
27
26
|
const map = {
|
|
@@ -35,12 +34,6 @@ const getEvmChainName = (chainId) => {
|
|
|
35
34
|
};
|
|
36
35
|
return map[chainId] || 'Unknown';
|
|
37
36
|
};
|
|
38
|
-
const getIconUrl = (chainName) => {
|
|
39
|
-
const chain = allowedChains[chainName === null || chainName === void 0 ? void 0 : chainName.toLowerCase()] || 'eth';
|
|
40
|
-
return `https://app.dynamic.xyz/assets/networks/${chain}.svg`;
|
|
41
|
-
};
|
|
42
37
|
|
|
43
|
-
exports.allowedChains = allowedChains;
|
|
44
38
|
exports.getEvmChainName = getEvmChainName;
|
|
45
|
-
exports.
|
|
46
|
-
exports.getNativeTokenInfo = getNativeTokenInfo;
|
|
39
|
+
exports.getNetworkInfoEntry = getNetworkInfoEntry;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChainWithIcon } from '../../../widgets/DynamicWidget/hooks/useFetchChain';
|
|
2
2
|
interface NativeCurrency {
|
|
3
3
|
decimals: number;
|
|
4
|
+
iconUrl?: string;
|
|
4
5
|
name: string;
|
|
5
6
|
symbol: string;
|
|
6
7
|
}
|
|
@@ -10,10 +11,6 @@ export interface NetworkInfoEntry {
|
|
|
10
11
|
iconUrls: string[];
|
|
11
12
|
name: string;
|
|
12
13
|
}
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const allowedChains: {
|
|
15
|
-
[key: string]: string;
|
|
16
|
-
};
|
|
14
|
+
export declare const getNetworkInfoEntry: (chain: ChainWithIcon | undefined, networkInfo: Record<string, NetworkInfoEntry[]>) => NetworkInfoEntry | undefined;
|
|
17
15
|
export declare const getEvmChainName: (chainId: number) => string;
|
|
18
|
-
export declare const getIconUrl: (chainName: string) => string;
|
|
19
16
|
export {};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { ChainEnumToVerifiedCredentialName } from '../../constants/values.js';
|
|
3
|
+
|
|
4
|
+
const getNetworkInfoEntry = (chain, networkInfo) => {
|
|
5
|
+
if (!chain || !chain.symbol) {
|
|
4
6
|
return;
|
|
5
7
|
}
|
|
6
|
-
const
|
|
8
|
+
const normalizedChainSymbol = chain.symbol === 'ETH' || chain.symbol === 'EVM'
|
|
9
|
+
? 'evm'
|
|
10
|
+
: chain.symbol.toLowerCase();
|
|
11
|
+
const networkData = networkInfo[normalizedChainSymbol] ||
|
|
12
|
+
networkInfo[ChainEnumToVerifiedCredentialName[normalizedChainSymbol.toUpperCase()]];
|
|
7
13
|
if (!networkData)
|
|
8
14
|
return;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
base: 'base',
|
|
15
|
-
eth: 'eth',
|
|
16
|
-
'op mainnet': 'optimism',
|
|
17
|
-
optimism: 'optimism',
|
|
18
|
-
polygon: 'polygon',
|
|
19
|
-
sepolia: 'sepolia',
|
|
20
|
-
solana: 'solana',
|
|
15
|
+
if (normalizedChainSymbol === 'evm') {
|
|
16
|
+
return networkData.find((e) => e.chainId === (chain === null || chain === void 0 ? void 0 : chain.chainId));
|
|
17
|
+
}
|
|
18
|
+
// Solana, etc
|
|
19
|
+
return networkData[0];
|
|
21
20
|
};
|
|
22
21
|
const getEvmChainName = (chainId) => {
|
|
23
22
|
const map = {
|
|
@@ -31,9 +30,5 @@ const getEvmChainName = (chainId) => {
|
|
|
31
30
|
};
|
|
32
31
|
return map[chainId] || 'Unknown';
|
|
33
32
|
};
|
|
34
|
-
const getIconUrl = (chainName) => {
|
|
35
|
-
const chain = allowedChains[chainName === null || chainName === void 0 ? void 0 : chainName.toLowerCase()] || 'eth';
|
|
36
|
-
return `https://app.dynamic.xyz/assets/networks/${chain}.svg`;
|
|
37
|
-
};
|
|
38
33
|
|
|
39
|
-
export {
|
|
34
|
+
export { getEvmChainName, getNetworkInfoEntry };
|
|
@@ -35,7 +35,7 @@ export * from './useUserUpdateRequest';
|
|
|
35
35
|
export * from './useRpcProviders';
|
|
36
36
|
export { useValidateSession } from './useValidateSession';
|
|
37
37
|
export { useVerifyWallet } from './useVerifyWallet';
|
|
38
|
-
export {
|
|
38
|
+
export { useCreateWalletConnectorOptions } from './useCreateWalletConnectorOptions';
|
|
39
39
|
export { useWalletConnectors } from './useWalletConnectors';
|
|
40
40
|
export { useWalletItemActions } from './useWalletItemActions';
|
|
41
41
|
export { useWalletUiUtils } from './useWalletUiUtils';
|
|
@@ -118,7 +118,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
118
118
|
const turnkeyVerifiedCredentials = (_d = updatedUser.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'));
|
|
119
119
|
/** It's not authenticated if it's a turnkey wallet that still hasn't created a passkey */
|
|
120
120
|
const isAuthenticated = Boolean((_e = turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.walletProperties) === null || _e === void 0 ? void 0 : _e.isAuthenticatorAttached);
|
|
121
|
-
const
|
|
121
|
+
const embeddedWallet = walletConnector.createWallet({
|
|
122
122
|
address: (yield walletConnector.getAddress()) || '',
|
|
123
123
|
chain: walletConnector.connectedChain,
|
|
124
124
|
connector: walletConnector,
|
|
@@ -138,7 +138,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
138
138
|
});
|
|
139
139
|
setPrimaryWalletId(smartWallet$1.id);
|
|
140
140
|
}
|
|
141
|
-
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated',
|
|
141
|
+
dynamicEvents.dynamicEvents.emit('embeddedWalletCreated', embeddedWallet, turnkeyVerifiedCredentials, updatedUser);
|
|
142
142
|
setShowAuthFlow(false, { performMultiWalletChecks: false });
|
|
143
143
|
}
|
|
144
144
|
catch (err) {
|
|
@@ -114,7 +114,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
114
114
|
const turnkeyVerifiedCredentials = (_d = updatedUser.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'));
|
|
115
115
|
/** It's not authenticated if it's a turnkey wallet that still hasn't created a passkey */
|
|
116
116
|
const isAuthenticated = Boolean((_e = turnkeyVerifiedCredentials === null || turnkeyVerifiedCredentials === void 0 ? void 0 : turnkeyVerifiedCredentials.walletProperties) === null || _e === void 0 ? void 0 : _e.isAuthenticatorAttached);
|
|
117
|
-
const
|
|
117
|
+
const embeddedWallet = walletConnector.createWallet({
|
|
118
118
|
address: (yield walletConnector.getAddress()) || '',
|
|
119
119
|
chain: walletConnector.connectedChain,
|
|
120
120
|
connector: walletConnector,
|
|
@@ -134,7 +134,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
134
134
|
});
|
|
135
135
|
setPrimaryWalletId(smartWallet.id);
|
|
136
136
|
}
|
|
137
|
-
dynamicEvents.emit('embeddedWalletCreated',
|
|
137
|
+
dynamicEvents.emit('embeddedWalletCreated', embeddedWallet, turnkeyVerifiedCredentials, updatedUser);
|
|
138
138
|
setShowAuthFlow(false, { performMultiWalletChecks: false });
|
|
139
139
|
}
|
|
140
140
|
catch (err) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useCreateWalletConnectorOptions } from './useCreateWalletConnectorOptions';
|
|
@@ -28,7 +28,7 @@ require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
|
28
28
|
var walletConnectorOptions = require('../../../store/state/walletConnectorOptions.cjs');
|
|
29
29
|
var verifyRequiredConnectorsAreSetup = require('./utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs');
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const useCreateWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }) => {
|
|
32
32
|
const walletConnectorsKey = React.useMemo(() => { var _a; return (_a = serializeWalletConnectors.serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
|
|
33
33
|
const walletBookLength = React.useMemo(() => Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length, [walletBook]);
|
|
34
34
|
const walletConnectorOptions$1 = React.useMemo(() => {
|
|
@@ -75,4 +75,4 @@ const useWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinb
|
|
|
75
75
|
return { walletConnectorOptions: walletConnectorOptions$1 };
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
exports.
|
|
78
|
+
exports.useCreateWalletConnectorOptions = useCreateWalletConnectorOptions;
|
|
@@ -17,7 +17,7 @@ type Props = {
|
|
|
17
17
|
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
18
18
|
walletConnectorExtensions?: WalletConnectorExtension[];
|
|
19
19
|
};
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const useCreateWalletConnectorOptions: ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }: Props) => {
|
|
21
21
|
walletConnectorOptions: import("../../../shared").WalletOption[];
|
|
22
22
|
};
|
|
23
23
|
export {};
|
|
@@ -24,7 +24,7 @@ import '../../../store/state/projectSettings/projectSettings.js';
|
|
|
24
24
|
import { setWalletConnectorOptions } from '../../../store/state/walletConnectorOptions.js';
|
|
25
25
|
import { verifyRequiredConnectorsAreSetup } from './utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.js';
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const useCreateWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinbaseWalletPreference, deepLinkPreference, flowNetwork, mobileExperience, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, walletConnectPreferredChains, walletConnectorExtensions, }) => {
|
|
28
28
|
const walletConnectorsKey = useMemo(() => { var _a; return (_a = serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
|
|
29
29
|
const walletBookLength = useMemo(() => Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length, [walletBook]);
|
|
30
30
|
const walletConnectorOptions = useMemo(() => {
|
|
@@ -71,4 +71,4 @@ const useWalletConnectorOptions = ({ projectSettings, appLogoUrl, appName, coinb
|
|
|
71
71
|
return { walletConnectorOptions };
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
export {
|
|
74
|
+
export { useCreateWalletConnectorOptions };
|
|
@@ -45,6 +45,7 @@ var errors = require('../../../constants/errors.cjs');
|
|
|
45
45
|
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
46
46
|
require('react-dom');
|
|
47
47
|
var useElementById = require('../../useElementById/useElementById.cjs');
|
|
48
|
+
var findPrimaryEmbeddedChain = require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
48
49
|
var WalletContext = require('../../../../context/WalletContext/WalletContext.cjs');
|
|
49
50
|
var useIsTurnkeyWallet = require('../../useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
50
51
|
var turnkeyExport = require('../../../../views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs');
|
|
@@ -154,7 +155,8 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
154
155
|
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
155
156
|
}
|
|
156
157
|
const userWalletsCredentials = getUserWalletsFromVerifiedCredentials.getUserWalletsFromVerifiedCredentials(user$1);
|
|
157
|
-
const
|
|
158
|
+
const primaryChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
|
|
159
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(user$1, chains !== null && chains !== void 0 ? chains : [primaryChain]);
|
|
158
160
|
const isManualMode = ((_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _f === void 0 ? void 0 : _f.automaticEmbeddedWalletCreation) === false;
|
|
159
161
|
// if user has a wallet and it's not embedded,
|
|
160
162
|
// throw error to follow another flow and set up the right wallet
|
|
@@ -180,7 +182,8 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
180
182
|
throw new Error(errors.USER_NOT_LOGGED_IN);
|
|
181
183
|
}
|
|
182
184
|
validateTurnkeyProviderEnabled.validateTurnkeyProviderEnabled(projectSettings);
|
|
183
|
-
const
|
|
185
|
+
const primaryChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
|
|
186
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(user$1, [primaryChain]);
|
|
184
187
|
const turnkeyWalletId = (_h = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _h === void 0 ? void 0 : _h.turnkeyHDWalletId;
|
|
185
188
|
if (!turnkeyWalletId) {
|
|
186
189
|
throw new utils.DynamicError('No HD wallet was found for this user to derive a wallet account. Use createEmbeddedWallet first', 'NoHdWalletFound');
|
|
@@ -41,6 +41,7 @@ import { USER_NOT_LOGGED_IN, ACTIVE_SESSION, SESSION_RESTORED, INVALID_REQUEST,
|
|
|
41
41
|
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
42
42
|
import 'react-dom';
|
|
43
43
|
import { useElementById } from '../../useElementById/useElementById.js';
|
|
44
|
+
import { findPrimaryEmbeddedChain } from '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
44
45
|
import { useWalletContext } from '../../../../context/WalletContext/WalletContext.js';
|
|
45
46
|
import { useIsTurnkeyWallet } from '../../useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
46
47
|
import { cleanupExport, initExport, exportCredential } from '../../../../views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js';
|
|
@@ -150,7 +151,8 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
150
151
|
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
151
152
|
}
|
|
152
153
|
const userWalletsCredentials = getUserWalletsFromVerifiedCredentials(user);
|
|
153
|
-
const
|
|
154
|
+
const primaryChain = findPrimaryEmbeddedChain(projectSettings);
|
|
155
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(user, chains !== null && chains !== void 0 ? chains : [primaryChain]);
|
|
154
156
|
const isManualMode = ((_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _f === void 0 ? void 0 : _f.automaticEmbeddedWalletCreation) === false;
|
|
155
157
|
// if user has a wallet and it's not embedded,
|
|
156
158
|
// throw error to follow another flow and set up the right wallet
|
|
@@ -176,7 +178,8 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
176
178
|
throw new Error(USER_NOT_LOGGED_IN);
|
|
177
179
|
}
|
|
178
180
|
validateTurnkeyProviderEnabled(projectSettings);
|
|
179
|
-
const
|
|
181
|
+
const primaryChain = findPrimaryEmbeddedChain(projectSettings);
|
|
182
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(user, [primaryChain]);
|
|
180
183
|
const turnkeyWalletId = (_h = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _h === void 0 ? void 0 : _h.turnkeyHDWalletId;
|
|
181
184
|
if (!turnkeyWalletId) {
|
|
182
185
|
throw new DynamicError('No HD wallet was found for this user to derive a wallet account. Use createEmbeddedWallet first', 'NoHdWalletFound');
|
|
@@ -99,17 +99,26 @@ const useTurnkey = () => {
|
|
|
99
99
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
100
100
|
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
101
101
|
const startHeadlessEmbeddedWalletCreationFlow = React.useCallback((chains, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
-
yield createDynamicEmbeddedWalletMutation({
|
|
103
|
-
chains,
|
|
104
|
-
environmentId,
|
|
105
|
-
options,
|
|
106
|
-
walletConnectorOptions,
|
|
107
|
-
withAuthenticator: false,
|
|
108
|
-
});
|
|
109
|
-
setShowAuthFlow(false, { performMultiWalletChecks: false }); // close email otp pin modal
|
|
110
102
|
return new Promise((resolve, reject) => {
|
|
111
|
-
|
|
103
|
+
// register the event listeners before calling create embedded wallet
|
|
104
|
+
// as the event might fire before the listeners are registered.
|
|
105
|
+
dynamicEvents.dynamicEvents.once('embeddedWalletCreated', (wallet) => {
|
|
106
|
+
resolve(wallet);
|
|
107
|
+
});
|
|
112
108
|
dynamicEvents.dynamicEvents.once('embeddedWalletFailed', (error) => reject(error));
|
|
109
|
+
createDynamicEmbeddedWalletMutation({
|
|
110
|
+
chains,
|
|
111
|
+
environmentId,
|
|
112
|
+
options,
|
|
113
|
+
walletConnectorOptions,
|
|
114
|
+
withAuthenticator: false,
|
|
115
|
+
})
|
|
116
|
+
.then(() => {
|
|
117
|
+
setShowAuthFlow(false, { performMultiWalletChecks: false }); // close email otp pin modal
|
|
118
|
+
})
|
|
119
|
+
.catch((error) => {
|
|
120
|
+
reject(error);
|
|
121
|
+
});
|
|
113
122
|
});
|
|
114
123
|
}), [
|
|
115
124
|
createDynamicEmbeddedWalletMutation,
|
|
@@ -185,7 +194,10 @@ const useTurnkey = () => {
|
|
|
185
194
|
const isManualMode = ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) === false;
|
|
186
195
|
const shouldCreateV2WalletsByDefault = ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _d === void 0 ? void 0 : _d.defaultWalletVersion) ===
|
|
187
196
|
sdkApiCore.EmbeddedWalletVersionEnum.V2;
|
|
188
|
-
const
|
|
197
|
+
const primaryChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
|
|
198
|
+
// if embedded wallet already exists
|
|
199
|
+
// get the one with the primary chain if `chains` is undefined
|
|
200
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(user, chains !== null && chains !== void 0 ? chains : [primaryChain]);
|
|
189
201
|
const userWalletsCredentials = getUserWalletsFromVerifiedCredentials.getUserWalletsFromVerifiedCredentials(user);
|
|
190
202
|
// If the user doesn't have a wallet, or if the customer is in Manual
|
|
191
203
|
// Mode, we should attempt to create a new wallet. Note that if in manual
|
|
@@ -212,7 +224,7 @@ const useTurnkey = () => {
|
|
|
212
224
|
if (embeddedWalletVerifiedCredential &&
|
|
213
225
|
user.newUser &&
|
|
214
226
|
((_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _f === void 0 ? void 0 : _f.automaticEmbeddedWalletCreation)) {
|
|
215
|
-
const walletConnector = findPasskeyEmailWalletConnector.findPasskeyEmailWalletConnector(walletConnectorOptions,
|
|
227
|
+
const walletConnector = findPasskeyEmailWalletConnector.findPasskeyEmailWalletConnector(walletConnectorOptions, primaryChain);
|
|
216
228
|
if (!walletConnector) {
|
|
217
229
|
throw new Error('Could not find the embedded wallet connector');
|
|
218
230
|
}
|