@dynamic-labs/sdk-react-core 3.0.0-alpha.52 → 3.0.0-alpha.53
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 +39 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/index.cjs +7 -5
- package/src/index.d.ts +1 -1
- package/src/index.js +4 -3
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +17 -16
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +18 -17
- package/src/lib/components/Divider/Divider.cjs +2 -2
- package/src/lib/components/Divider/Divider.d.ts +2 -2
- package/src/lib/components/Divider/Divider.js +3 -3
- 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/components/NeedHelpSection/NeedHelpSection.cjs +5 -4
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +6 -5
- package/src/lib/components/QrCodeWrapper/QrCodeWrapper.cjs +1 -1
- package/src/lib/components/QrCodeWrapper/QrCodeWrapper.js +1 -1
- package/src/lib/components/SecureEmbeddedWalletCard/SecureEmbeddedWalletCard.cjs +11 -10
- package/src/lib/components/SecureEmbeddedWalletCard/SecureEmbeddedWalletCard.js +12 -11
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +1 -1
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs +6 -1
- package/src/lib/components/SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js +6 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +0 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -12
- package/src/lib/context/DynamicContext/DynamicContext.js +6 -12
- 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/DynamicContext/hooks/useHandleLogout/types.d.ts +2 -2
- package/src/lib/context/DynamicContext/types/DynamicContextProps.d.ts +7 -0
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +4 -5
- package/src/lib/context/PhantomRedirectContext/PhantomRedirectContext.d.ts +2 -2
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.cjs +1 -1
- package/src/lib/context/ReinitializeContext/ReinitializeContextProvider.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +2 -2
- package/src/lib/context/UserWalletsContext/UserWalletsContext.d.ts +1 -1
- package/src/lib/context/WalletContext/WalletContext.cjs +1 -84
- package/src/lib/context/WalletContext/WalletContext.d.ts +1 -2
- package/src/lib/context/WalletContext/WalletContext.js +1 -84
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.cjs +1 -1
- package/src/lib/context/WidgetRegistry/WidgetRegistryContextProvider.js +1 -1
- package/src/lib/data/api/api.cjs +1 -1
- package/src/lib/data/api/api.js +1 -1
- package/src/lib/locale/en/translation.cjs +39 -5
- package/src/lib/locale/en/translation.d.ts +39 -5
- package/src/lib/locale/en/translation.js +39 -5
- 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 +10 -9
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +11 -10
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.cjs +4 -4
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.d.ts +1 -1
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.js +4 -4
- package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.types.d.ts +2 -0
- package/src/lib/shared/assets/arrow-circle-right.cjs +54 -0
- package/src/lib/shared/assets/arrow-circle-right.js +30 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/types/wallets.d.ts +2 -2
- package/src/lib/shared/utils/functions/usingSessionKeys/usingSessionKeys.cjs +1 -1
- package/src/lib/shared/utils/functions/usingSessionKeys/usingSessionKeys.js +2 -2
- package/src/lib/shared/utils/functions/wallet/createWallet.d.ts +2 -2
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.cjs +1 -1
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.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/constants/errors.cjs +0 -2
- package/src/lib/utils/constants/errors.js +1 -2
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.d.ts +2 -2
- package/src/lib/utils/{hooks/useWalletConnectors/utils/findWallet/findWallet.cjs → functions/findWalletOptionFor/findWalletOptionFor.cjs} +3 -3
- package/src/lib/utils/functions/findWalletOptionFor/findWalletOptionFor.d.ts +3 -0
- package/src/lib/utils/{hooks/useWalletConnectors/utils/findWallet/findWallet.js → functions/findWalletOptionFor/findWalletOptionFor.js} +3 -3
- package/src/lib/utils/functions/findWalletOptionFor/index.d.ts +1 -0
- package/src/lib/utils/functions/generateMessages/index.cjs +3 -2
- package/src/lib/utils/functions/generateMessages/index.js +3 -2
- package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.d.ts +2 -2
- 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/getVerifyArgs/getVerifyArgs.d.ts +1 -2
- package/src/lib/utils/functions/getWalletConnectorForWallet/getWalletConnectorForWallet.d.ts +2 -2
- package/src/lib/utils/functions/index.d.ts +0 -2
- package/src/lib/utils/functions/isAccountAbstractionWallet/isAccountAbstractionWallet.d.ts +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/isPhoneNumberProviderEnabled/isPhoneNumberProviderEnabled.cjs +1 -1
- package/src/lib/utils/functions/isPhoneNumberProviderEnabled/isPhoneNumberProviderEnabled.js +1 -1
- package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.cjs +1 -1
- package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.d.ts +2 -2
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/index.d.ts +0 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +8 -7
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +2 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +9 -8
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.d.ts +2 -2
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -4
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +3 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +4 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +5 -7
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +86 -61
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.d.ts +3 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +87 -63
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +32 -30
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +33 -31
- package/src/lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.d.ts +1 -1
- package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.cjs +7 -6
- package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.js +7 -6
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.cjs +11 -9
- package/src/lib/utils/hooks/useIsLoggedIn/useIsLoggedIn.js +12 -10
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs +8 -12
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js +8 -12
- package/src/lib/utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.cjs +1 -1
- package/src/lib/utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.js +1 -1
- package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.cjs +6 -5
- package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.js +6 -5
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +12 -11
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.d.ts +2 -2
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +12 -11
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +3 -3
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +3 -3
- package/src/lib/utils/hooks/useSmartWallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.cjs +159 -0
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.d.ts +18 -0
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.js +155 -0
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.cjs +1 -4
- package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.js +1 -4
- package/src/lib/utils/hooks/useWalletConnectorOptions/useWalletConnectorOptions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/useWalletConnectorOptions.d.ts +2 -2
- package/src/lib/utils/hooks/useWalletConnectorOptions/useWalletConnectorOptions.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.cjs +7 -87
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.d.ts +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.js +8 -88
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +9 -79
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +4 -10
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +10 -80
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +5 -89
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.d.ts +2 -3
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +5 -89
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +4 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +5 -5
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +26 -29
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +26 -29
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.d.ts +6 -6
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.types.d.ts +4 -4
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +16 -7
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +2 -2
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +16 -7
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.cjs +1 -1
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.js +1 -1
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +2 -2
- package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +2 -2
- package/src/lib/views/EmailVerification/EmailVerification.cjs +19 -18
- package/src/lib/views/EmailVerification/EmailVerification.js +20 -19
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +52 -52
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +53 -53
- 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/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +1 -1
- package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.cjs +35 -33
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.d.ts +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.js +35 -33
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.cjs +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.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/BundleValidation/PasskeyBundleRecovery.cjs +35 -33
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.d.ts +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +35 -33
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +33 -31
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +33 -31
- 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/SendBalanceView/SendBalanceView.cjs +7 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +7 -1
- package/src/lib/{utils/functions/getEOAWallet/getEOAWallet.cjs → views/SyncWalletView/AutoReconnectingView/AutoReconnectingView.cjs} +57 -50
- package/src/lib/views/SyncWalletView/AutoReconnectingView/AutoReconnectingView.d.ts +9 -0
- package/src/lib/{utils/functions/getEOAWallet/getEOAWallet.js → views/SyncWalletView/AutoReconnectingView/AutoReconnectingView.js} +57 -50
- package/src/lib/views/SyncWalletView/AutoReconnectingView/index.d.ts +1 -0
- package/src/lib/views/SyncWalletView/ReconnectWithQrCodeView/ReconnectWithQrCodeView.cjs +126 -0
- package/src/lib/views/SyncWalletView/ReconnectWithQrCodeView/ReconnectWithQrCodeView.d.ts +9 -0
- package/src/lib/views/SyncWalletView/ReconnectWithQrCodeView/ReconnectWithQrCodeView.js +122 -0
- package/src/lib/views/SyncWalletView/ReconnectWithQrCodeView/index.d.ts +1 -0
- package/src/lib/views/SyncWalletView/SwitchWalletView/SwitchWalletView.cjs +101 -0
- package/src/lib/views/SyncWalletView/SwitchWalletView/SwitchWalletView.d.ts +10 -0
- package/src/lib/views/SyncWalletView/SwitchWalletView/SwitchWalletView.js +97 -0
- package/src/lib/views/SyncWalletView/SwitchWalletView/index.d.ts +1 -0
- package/src/lib/views/SyncWalletView/SyncWalletView.cjs +74 -49
- package/src/lib/views/SyncWalletView/SyncWalletView.d.ts +2 -0
- package/src/lib/views/SyncWalletView/SyncWalletView.js +75 -50
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +2 -2
- package/src/lib/views/WalletGroupView/WalletGroupView.js +2 -2
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +1 -1
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +6 -5
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +6 -5
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
- 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/components/WidgetPortal/WidgetPortal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +7 -9
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +7 -9
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +46 -45
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +47 -46
- package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.cjs +0 -40
- package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.d.ts +0 -3
- package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.js +0 -36
- package/src/lib/utils/functions/createOwnerWallet/index.d.ts +0 -1
- package/src/lib/utils/functions/getEOAWallet/getEOAWallet.d.ts +0 -3
- package/src/lib/utils/functions/getEOAWallet/index.d.ts +0 -1
- package/src/lib/utils/functions/getWalletIdentifier/getWalletIdentifier.cjs +0 -8
- package/src/lib/utils/functions/getWalletIdentifier/getWalletIdentifier.js +0 -4
- package/src/lib/utils/functions/isWalletConnected/isWalletConnected.cjs +0 -14
- package/src/lib/utils/functions/isWalletConnected/isWalletConnected.js +0 -10
- package/src/lib/utils/hooks/events/useWindowEvent/useWindowEvent.cjs +0 -25
- package/src/lib/utils/hooks/events/useWindowEvent/useWindowEvent.js +0 -21
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/index.d.ts +0 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +0 -209
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +0 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +0 -205
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.d.ts +0 -3
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/index.d.ts +0 -1
- package/src/lib/utils/hooks/useWalletsConnectionState/index.d.ts +0 -1
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +0 -184
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.d.ts +0 -12
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +0 -180
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import {
|
|
5
|
+
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
6
7
|
import { logger } from '../../../../../shared/logger.js';
|
|
7
8
|
import '@dynamic-labs/iconic';
|
|
8
9
|
import 'react/jsx-runtime';
|
|
@@ -14,7 +15,6 @@ import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
|
14
15
|
import '../../../../../shared/utils/classes/storage/sessionStorage.js';
|
|
15
16
|
import '@dynamic-labs/utils';
|
|
16
17
|
import '../../../../../shared/consts/index.js';
|
|
17
|
-
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
18
18
|
import { dynamicEvents } from '../../../../../events/dynamicEvents.js';
|
|
19
19
|
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
20
20
|
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -35,10 +35,11 @@ import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
|
35
35
|
import 'react-dom';
|
|
36
36
|
import { useCreateDynamicEmbeddedWalletMutation } from '../../../useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js';
|
|
37
37
|
import '../../../../../context/WalletContext/WalletContext.js';
|
|
38
|
+
import { useSmartWallets } from '../../../useSmartWallets/useSmartWallets.js';
|
|
38
39
|
import { findPrimaryEmbeddedChain } from '../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
39
|
-
import { findSmartWallet, initializeSmartWallet } from '../../../useWalletConnectors/utils/smartWallet/smartWallet.js';
|
|
40
|
-
import { findPasskeyEmailWalletConnector } from '../../../../../views/Passkey/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.js';
|
|
41
40
|
import '../constants.js';
|
|
41
|
+
import { findPasskeyEmailWalletConnector } from '../../../../../views/Passkey/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.js';
|
|
42
|
+
import { findSmartWallet, initializeSmartWallet } from '../../../useWalletConnectors/utils/smartWallet/smartWallet.js';
|
|
42
43
|
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
43
44
|
import '../../../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
44
45
|
import '@dynamic-labs/types';
|
|
@@ -98,8 +99,8 @@ import { useInternalDynamicContext } from '../../../../../context/DynamicContext
|
|
|
98
99
|
const useTurnkey = () => {
|
|
99
100
|
const { projectSettings, setPrimaryWalletId, walletConnectorOptions, setShowAuthFlow, environmentId, user, primaryWallet, } = useInternalDynamicContext();
|
|
100
101
|
const { setView } = useViewContext();
|
|
101
|
-
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
102
102
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
|
|
103
|
+
const { getEOAWallet } = useSmartWallets();
|
|
103
104
|
const startHeadlessEmbeddedWalletCreationFlow = useCallback((chains, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
105
|
yield createDynamicEmbeddedWalletMutation({
|
|
105
106
|
chains,
|
|
@@ -141,7 +142,7 @@ const useTurnkey = () => {
|
|
|
141
142
|
});
|
|
142
143
|
}), [setShowAuthFlow, setView]);
|
|
143
144
|
const returnEmbeddedWallet = useCallback((embeddedWalletVerifiedCredential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
var _a, _b
|
|
145
|
+
var _a, _b;
|
|
145
146
|
const { chain } = embeddedWalletVerifiedCredential;
|
|
146
147
|
const turnkeyWallet = findTurnkeyWalletByChain(walletConnectorOptions, chain);
|
|
147
148
|
let newPrimaryWalletId = null;
|
|
@@ -165,28 +166,29 @@ const useTurnkey = () => {
|
|
|
165
166
|
setPrimaryWalletId(newPrimaryWalletId);
|
|
166
167
|
/** It's not authenticated if it still hasn't created a passkey */
|
|
167
168
|
const isAuthenticated = Boolean((_b = embeddedWalletVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
if (!(turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector)) {
|
|
170
|
+
throw new Error('Could not find the embedded wallet connector');
|
|
171
|
+
}
|
|
172
|
+
const connector = turnkeyWallet.walletConnector;
|
|
173
|
+
const passkeyWallet = connector.createWallet({
|
|
174
|
+
address: (yield connector.getAddress()) || '',
|
|
175
|
+
chain: connector.connectedChain,
|
|
176
|
+
connector,
|
|
172
177
|
id: embeddedWalletVerifiedCredential.id,
|
|
173
178
|
isAuthenticated,
|
|
174
|
-
|
|
175
|
-
key: embeddedWalletVerifiedCredential.walletName ||
|
|
176
|
-
(turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector.key) ||
|
|
177
|
-
'',
|
|
179
|
+
key: embeddedWalletVerifiedCredential.walletName || connector.key || '',
|
|
178
180
|
});
|
|
179
181
|
return Promise.resolve(passkeyWallet);
|
|
180
182
|
}), [setPrimaryWalletId, walletConnectorOptions, user]);
|
|
181
183
|
const createTurnkeyWallet = useCallback((chains, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
182
|
-
var
|
|
184
|
+
var _c, _d, _e, _f, _g;
|
|
183
185
|
if (!user) {
|
|
184
186
|
throw new Error(USER_NOT_LOGGED_IN);
|
|
185
187
|
}
|
|
186
|
-
const isManualMode = ((
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
const isManualMode = ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) === false;
|
|
189
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
190
|
+
const isSessionKeyCompatible = (primaryWallet && isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
191
|
+
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
190
192
|
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(user, chains);
|
|
191
193
|
const userWalletsCredentials = getUserWalletsFromVerifiedCredentials(user);
|
|
192
194
|
// If the user doesn't have a wallet, or if the customer is in Manual
|
|
@@ -196,10 +198,10 @@ const useTurnkey = () => {
|
|
|
196
198
|
if (!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) ||
|
|
197
199
|
(!embeddedWalletVerifiedCredential && isManualMode)) {
|
|
198
200
|
const hasEmailVC = getUserVerifiedCredentialType(user, JwtVerifiedCredentialFormatEnum.Email);
|
|
199
|
-
if ((!((
|
|
201
|
+
if ((!((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _d === void 0 ? void 0 : _d.forceAuthenticatorAtSignup) &&
|
|
200
202
|
hasEmailVC) ||
|
|
201
203
|
(options === null || options === void 0 ? void 0 : options.webAuthnAttestation) ||
|
|
202
|
-
|
|
204
|
+
isSessionKeyCompatible) {
|
|
203
205
|
// create embedded wallet fully headless
|
|
204
206
|
return startHeadlessEmbeddedWalletCreationFlow(chains, options);
|
|
205
207
|
}
|
|
@@ -213,19 +215,18 @@ const useTurnkey = () => {
|
|
|
213
215
|
// backend if this called as part of a new user sign up.
|
|
214
216
|
if (embeddedWalletVerifiedCredential &&
|
|
215
217
|
user.newUser &&
|
|
216
|
-
((
|
|
218
|
+
((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _e === void 0 ? void 0 : _e.automaticEmbeddedWalletCreation)) {
|
|
217
219
|
const walletConnector = findPasskeyEmailWalletConnector(walletConnectorOptions, findPrimaryEmbeddedChain(projectSettings));
|
|
218
220
|
if (!walletConnector) {
|
|
219
|
-
throw new Error('Could not find the
|
|
221
|
+
throw new Error('Could not find the embedded wallet connector');
|
|
220
222
|
}
|
|
221
|
-
const wallet =
|
|
223
|
+
const wallet = walletConnector.createWallet({
|
|
222
224
|
address: (yield walletConnector.getAddress()) || '',
|
|
223
|
-
chain: walletConnector.connectedChain
|
|
225
|
+
chain: walletConnector.connectedChain,
|
|
224
226
|
connector: walletConnector,
|
|
225
227
|
id: embeddedWalletVerifiedCredential.id,
|
|
226
|
-
isAuthenticated: Boolean((
|
|
227
|
-
|
|
228
|
-
key: (_j = embeddedWalletVerifiedCredential.walletName) !== null && _j !== void 0 ? _j : walletConnector.key,
|
|
228
|
+
isAuthenticated: Boolean((_f = embeddedWalletVerifiedCredential === null || embeddedWalletVerifiedCredential === void 0 ? void 0 : embeddedWalletVerifiedCredential.walletProperties) === null || _f === void 0 ? void 0 : _f.isAuthenticatorAttached),
|
|
229
|
+
key: (_g = embeddedWalletVerifiedCredential.walletName) !== null && _g !== void 0 ? _g : walletConnector.key,
|
|
229
230
|
});
|
|
230
231
|
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
231
232
|
dynamicEvents.emit('embeddedWalletCreated', wallet, embeddedWalletVerifiedCredential, user);
|
|
@@ -241,13 +242,14 @@ const useTurnkey = () => {
|
|
|
241
242
|
}), [
|
|
242
243
|
user,
|
|
243
244
|
projectSettings,
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
primaryWallet,
|
|
246
|
+
getEOAWallet,
|
|
246
247
|
setShowAuthFlow,
|
|
248
|
+
returnEmbeddedWallet,
|
|
247
249
|
startHeadlessEmbeddedWalletCreationFlow,
|
|
248
250
|
startPasskeyEmbeddedWalletCreationFlow,
|
|
249
251
|
walletConnectorOptions,
|
|
250
|
-
|
|
252
|
+
setPrimaryWalletId,
|
|
251
253
|
]);
|
|
252
254
|
return {
|
|
253
255
|
createTurnkeyWallet,
|
package/src/lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthenticatorType } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
export declare const useEmbeddedWalletAuthenticator: () => {
|
|
3
3
|
addEmbeddedWalletRecoveryEmail: () => Promise<void>;
|
|
4
|
-
createOrRefreshAuthenticatorSession: (authenticatorType?: AuthenticatorType) => Promise<import("@dynamic-labs/wallet-connector-core").Wallet | undefined>;
|
|
4
|
+
createOrRefreshAuthenticatorSession: (authenticatorType?: AuthenticatorType) => Promise<import("@dynamic-labs/wallet-connector-core").Wallet<import("@dynamic-labs/wallet-connector-core").WalletConnectorCore.WalletConnector> | undefined>;
|
|
5
5
|
};
|
package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.cjs
CHANGED
|
@@ -27,13 +27,13 @@ require('react-international-phone');
|
|
|
27
27
|
require('../../../config/ApiEndpoint.cjs');
|
|
28
28
|
require('@dynamic-labs/store');
|
|
29
29
|
require('../../../locale/locale.cjs');
|
|
30
|
-
var getEOAWallet = require('../../functions/getEOAWallet/getEOAWallet.cjs');
|
|
31
30
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
32
31
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
33
32
|
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
34
33
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
35
34
|
require('react-dom');
|
|
36
35
|
require('../../../context/WalletContext/WalletContext.cjs');
|
|
36
|
+
var useSmartWallets = require('../useSmartWallets/useSmartWallets.cjs');
|
|
37
37
|
var passkeyRecovery = require('../../../views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs');
|
|
38
38
|
var constants = require('../../../views/Passkey/PasskeyRecovery/constants.cjs');
|
|
39
39
|
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
@@ -98,12 +98,13 @@ const useInitEmbeddedWalletAuthMethod = () => {
|
|
|
98
98
|
const { setView } = ViewContext.useViewContext();
|
|
99
99
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
100
100
|
const [error, setError] = React.useState();
|
|
101
|
+
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
101
102
|
const initAuthMethod = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, currentAction, }) {
|
|
102
|
-
var _b, _c, _d, _e;
|
|
103
|
+
var _b, _c, _d, _e, _f;
|
|
103
104
|
setIsLoading(true);
|
|
104
|
-
const wallet =
|
|
105
|
-
const sessionExpiration = ((
|
|
106
|
-
const sessionExpirationUnit = ((
|
|
105
|
+
const wallet = (_b = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _b !== void 0 ? _b : primaryWallet;
|
|
106
|
+
const sessionExpiration = ((_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _c === void 0 ? void 0 : _c.sessionKeyDuration) === null || _d === void 0 ? void 0 : _d.amount) || 0;
|
|
107
|
+
const sessionExpirationUnit = ((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _e === void 0 ? void 0 : _e.sessionKeyDuration) === null || _f === void 0 ? void 0 : _f.unit) ===
|
|
107
108
|
'minutes'
|
|
108
109
|
? 60
|
|
109
110
|
: 3600;
|
|
@@ -119,7 +120,7 @@ const useInitEmbeddedWalletAuthMethod = () => {
|
|
|
119
120
|
iframeElementId: constants.iframeElementId,
|
|
120
121
|
sessionExpiration: sessionExpiration * sessionExpirationUnit || undefined,
|
|
121
122
|
user,
|
|
122
|
-
wallet,
|
|
123
|
+
wallet: wallet,
|
|
123
124
|
});
|
|
124
125
|
if (showEmailBundle) {
|
|
125
126
|
setView('passkey-recovery-bundle', {
|
package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.js
CHANGED
|
@@ -23,13 +23,13 @@ import 'react-international-phone';
|
|
|
23
23
|
import '../../../config/ApiEndpoint.js';
|
|
24
24
|
import '@dynamic-labs/store';
|
|
25
25
|
import '../../../locale/locale.js';
|
|
26
|
-
import { getEOAWallet } from '../../functions/getEOAWallet/getEOAWallet.js';
|
|
27
26
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
28
27
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
29
28
|
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
30
29
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
31
30
|
import 'react-dom';
|
|
32
31
|
import '../../../context/WalletContext/WalletContext.js';
|
|
32
|
+
import { useSmartWallets } from '../useSmartWallets/useSmartWallets.js';
|
|
33
33
|
import { initEmbeddedWalletSession } from '../../../views/Passkey/utils/passkeyRecovery/passkeyRecovery.js';
|
|
34
34
|
import { iframeElementId } from '../../../views/Passkey/PasskeyRecovery/constants.js';
|
|
35
35
|
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
@@ -94,12 +94,13 @@ const useInitEmbeddedWalletAuthMethod = () => {
|
|
|
94
94
|
const { setView } = useViewContext();
|
|
95
95
|
const [isLoading, setIsLoading] = useState(false);
|
|
96
96
|
const [error, setError] = useState();
|
|
97
|
+
const { getEOAWallet } = useSmartWallets();
|
|
97
98
|
const initAuthMethod = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, currentAction, }) {
|
|
98
|
-
var _b, _c, _d, _e;
|
|
99
|
+
var _b, _c, _d, _e, _f;
|
|
99
100
|
setIsLoading(true);
|
|
100
|
-
const wallet =
|
|
101
|
-
const sessionExpiration = ((
|
|
102
|
-
const sessionExpirationUnit = ((
|
|
101
|
+
const wallet = (_b = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _b !== void 0 ? _b : primaryWallet;
|
|
102
|
+
const sessionExpiration = ((_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _c === void 0 ? void 0 : _c.sessionKeyDuration) === null || _d === void 0 ? void 0 : _d.amount) || 0;
|
|
103
|
+
const sessionExpirationUnit = ((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _e === void 0 ? void 0 : _e.sessionKeyDuration) === null || _f === void 0 ? void 0 : _f.unit) ===
|
|
103
104
|
'minutes'
|
|
104
105
|
? 60
|
|
105
106
|
: 3600;
|
|
@@ -115,7 +116,7 @@ const useInitEmbeddedWalletAuthMethod = () => {
|
|
|
115
116
|
iframeElementId,
|
|
116
117
|
sessionExpiration: sessionExpiration * sessionExpirationUnit || undefined,
|
|
117
118
|
user,
|
|
118
|
-
wallet,
|
|
119
|
+
wallet: wallet,
|
|
119
120
|
});
|
|
120
121
|
if (showEmailBundle) {
|
|
121
122
|
setView('passkey-recovery-bundle', {
|
|
@@ -34,6 +34,7 @@ require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
|
34
34
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
35
35
|
require('react-dom');
|
|
36
36
|
require('../../../context/WalletContext/WalletContext.cjs');
|
|
37
|
+
var useSmartWallets = require('../useSmartWallets/useSmartWallets.cjs');
|
|
37
38
|
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
38
39
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
39
40
|
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
@@ -91,24 +92,25 @@ require('../../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
|
91
92
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
92
93
|
|
|
93
94
|
const useIsLoggedIn = () => {
|
|
94
|
-
var _a, _b, _c
|
|
95
|
+
var _a, _b, _c;
|
|
95
96
|
const { user, primaryWallet, authMode, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
98
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
99
|
+
const isSessionKeyCompatible = (primaryWallet && walletConnectorCore.isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
100
|
+
(eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
|
|
99
101
|
const isTurnkeyProviderEnabled = isTurnkeyEnabled.isTurnkeyEnabled(projectSettings);
|
|
100
102
|
// a user is set even when on connect-only mode if signing in with social,
|
|
101
103
|
// but it won't have a primaryWallet in this case
|
|
102
104
|
const isLoggedIn = Boolean(user) || (authMode === 'connect-only' && Boolean(primaryWallet));
|
|
103
|
-
const
|
|
104
|
-
const hasEmbeddedWalletVerifiedCredential = Boolean(
|
|
105
|
+
const userWalletsCredentials = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.filter(({ walletProvider }) => walletProvider);
|
|
106
|
+
const hasEmbeddedWalletVerifiedCredential = Boolean(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.find(({ walletProvider }) => walletProvider === 'embeddedWallet'));
|
|
105
107
|
const isTurnkeyPregen = isTurnkeyProviderEnabled &&
|
|
106
|
-
((
|
|
108
|
+
((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) &&
|
|
107
109
|
(!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets.forceAuthenticatorAtSignup) ||
|
|
108
|
-
|
|
110
|
+
isSessionKeyCompatible);
|
|
109
111
|
const shouldHaveTurnkeyWallet = isTurnkeyPregen &&
|
|
110
112
|
// if user doesn't have a branded wallet only
|
|
111
|
-
(!(
|
|
113
|
+
(!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) || hasEmbeddedWalletVerifiedCredential);
|
|
112
114
|
// if turnkey is enabled we need to check if the user that is logged/connected
|
|
113
115
|
// has a primaryWallet to not show the widget without secure
|
|
114
116
|
if (shouldHaveTurnkeyWallet) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
2
|
+
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
5
|
import '@dynamic-labs/sdk-api-core';
|
|
@@ -30,6 +30,7 @@ import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
|
30
30
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
31
31
|
import 'react-dom';
|
|
32
32
|
import '../../../context/WalletContext/WalletContext.js';
|
|
33
|
+
import { useSmartWallets } from '../useSmartWallets/useSmartWallets.js';
|
|
33
34
|
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
34
35
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
35
36
|
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
@@ -87,24 +88,25 @@ import '../../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
|
87
88
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
88
89
|
|
|
89
90
|
const useIsLoggedIn = () => {
|
|
90
|
-
var _a, _b, _c
|
|
91
|
+
var _a, _b, _c;
|
|
91
92
|
const { user, primaryWallet, authMode, projectSettings } = useInternalDynamicContext();
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const { getEOAWallet } = useSmartWallets();
|
|
94
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
95
|
+
const isSessionKeyCompatible = (primaryWallet && isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
96
|
+
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
95
97
|
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
96
98
|
// a user is set even when on connect-only mode if signing in with social,
|
|
97
99
|
// but it won't have a primaryWallet in this case
|
|
98
100
|
const isLoggedIn = Boolean(user) || (authMode === 'connect-only' && Boolean(primaryWallet));
|
|
99
|
-
const
|
|
100
|
-
const hasEmbeddedWalletVerifiedCredential = Boolean(
|
|
101
|
+
const userWalletsCredentials = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.filter(({ walletProvider }) => walletProvider);
|
|
102
|
+
const hasEmbeddedWalletVerifiedCredential = Boolean(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.find(({ walletProvider }) => walletProvider === 'embeddedWallet'));
|
|
101
103
|
const isTurnkeyPregen = isTurnkeyProviderEnabled &&
|
|
102
|
-
((
|
|
104
|
+
((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.embeddedWallets) === null || _c === void 0 ? void 0 : _c.automaticEmbeddedWalletCreation) &&
|
|
103
105
|
(!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets.forceAuthenticatorAtSignup) ||
|
|
104
|
-
|
|
106
|
+
isSessionKeyCompatible);
|
|
105
107
|
const shouldHaveTurnkeyWallet = isTurnkeyPregen &&
|
|
106
108
|
// if user doesn't have a branded wallet only
|
|
107
|
-
(!(
|
|
109
|
+
(!(userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) || hasEmbeddedWalletVerifiedCredential);
|
|
108
110
|
// if turnkey is enabled we need to check if the user that is logged/connected
|
|
109
111
|
// has a primaryWallet to not show the widget without secure
|
|
110
112
|
if (shouldHaveTurnkeyWallet) {
|
|
@@ -27,7 +27,6 @@ require('react-international-phone');
|
|
|
27
27
|
require('../../../config/ApiEndpoint.cjs');
|
|
28
28
|
require('@dynamic-labs/store');
|
|
29
29
|
require('../../../locale/locale.cjs');
|
|
30
|
-
var getEOAWallet = require('../../functions/getEOAWallet/getEOAWallet.cjs');
|
|
31
30
|
var getUserVerifiedCredentialType = require('../../functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.cjs');
|
|
32
31
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
33
32
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
@@ -35,6 +34,7 @@ require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
|
35
34
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
36
35
|
require('react-dom');
|
|
37
36
|
require('../../../context/WalletContext/WalletContext.cjs');
|
|
37
|
+
var useSmartWallets = require('../useSmartWallets/useSmartWallets.cjs');
|
|
38
38
|
require('../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
39
39
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
40
40
|
require('../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
@@ -92,15 +92,12 @@ require('../../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
|
92
92
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
93
93
|
|
|
94
94
|
const useIsTurnkeyWallet = () => {
|
|
95
|
-
var _a, _b;
|
|
95
|
+
var _a, _b, _c;
|
|
96
96
|
const { primaryWallet, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
|
-
const
|
|
97
|
+
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
98
|
+
const wallet = (_a = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _a !== void 0 ? _a : primaryWallet;
|
|
98
99
|
const getTurnkeyVerifiedCredential = () => {
|
|
99
|
-
if (!wallet || !user) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
const isPrimaryWalletTurnkey = wallet.connector.key.startsWith('turnkey');
|
|
103
|
-
if (!isPrimaryWalletTurnkey) {
|
|
100
|
+
if (!wallet || !user || !wallet.connector.key.startsWith('turnkey')) {
|
|
104
101
|
return undefined;
|
|
105
102
|
}
|
|
106
103
|
const primaryWalletId = wallet.id;
|
|
@@ -123,16 +120,15 @@ const useIsTurnkeyWallet = () => {
|
|
|
123
120
|
return smartContractWalletWithUnclaimedTurnkeySigner;
|
|
124
121
|
};
|
|
125
122
|
const turnkeyVerifiedCredential = getTurnkeyVerifiedCredential();
|
|
126
|
-
const
|
|
127
|
-
const isUnclaimedTurnkeyTheSignerOfScw = Boolean(unclaimedTurnkeyTheSignerOfScw);
|
|
123
|
+
const isUnclaimedTurnkeyTheSignerOfScw = Boolean(getUnclaimedTurnkeyTheSignerOfScw());
|
|
128
124
|
const isTurnkeyWallet = Boolean(turnkeyVerifiedCredential || isUnclaimedTurnkeyTheSignerOfScw);
|
|
129
|
-
const hasTurnkeyVerifiedCredentialAuthenticator = Boolean((
|
|
125
|
+
const hasTurnkeyVerifiedCredentialAuthenticator = Boolean((_b = turnkeyVerifiedCredential === null || turnkeyVerifiedCredential === void 0 ? void 0 : turnkeyVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
130
126
|
const isTurnkeyWalletWithoutAuthenticator = (isTurnkeyWallet && !hasTurnkeyVerifiedCredentialAuthenticator) ||
|
|
131
127
|
isUnclaimedTurnkeyTheSignerOfScw;
|
|
132
128
|
const hasRecoveryEmail = isTurnkeyWallet &&
|
|
133
129
|
Boolean(getUserVerifiedCredentialType.getUserVerifiedCredentialType(user, sdkApiCore.JwtVerifiedCredentialFormatEnum.Email));
|
|
134
130
|
const isSessionKeyCompatible = isTurnkeyWallet &&
|
|
135
|
-
Boolean((
|
|
131
|
+
Boolean((_c = turnkeyVerifiedCredential === null || turnkeyVerifiedCredential === void 0 ? void 0 : turnkeyVerifiedCredential.walletProperties) === null || _c === void 0 ? void 0 : _c.isSessionKeyCompatible);
|
|
136
132
|
return {
|
|
137
133
|
hasRecoveryEmail,
|
|
138
134
|
hasTurnkeyVerifiedCredentialAuthenticator,
|
|
@@ -23,7 +23,6 @@ import 'react-international-phone';
|
|
|
23
23
|
import '../../../config/ApiEndpoint.js';
|
|
24
24
|
import '@dynamic-labs/store';
|
|
25
25
|
import '../../../locale/locale.js';
|
|
26
|
-
import { getEOAWallet } from '../../functions/getEOAWallet/getEOAWallet.js';
|
|
27
26
|
import { getUserVerifiedCredentialType } from '../../functions/getUserVerifiedCredentialType/getUserVerifiedCredentialType.js';
|
|
28
27
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
29
28
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
@@ -31,6 +30,7 @@ import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
|
31
30
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
32
31
|
import 'react-dom';
|
|
33
32
|
import '../../../context/WalletContext/WalletContext.js';
|
|
33
|
+
import { useSmartWallets } from '../useSmartWallets/useSmartWallets.js';
|
|
34
34
|
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
35
35
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
36
36
|
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
@@ -88,15 +88,12 @@ import '../../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
|
88
88
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
89
89
|
|
|
90
90
|
const useIsTurnkeyWallet = () => {
|
|
91
|
-
var _a, _b;
|
|
91
|
+
var _a, _b, _c;
|
|
92
92
|
const { primaryWallet, user } = useInternalDynamicContext();
|
|
93
|
-
const
|
|
93
|
+
const { getEOAWallet } = useSmartWallets();
|
|
94
|
+
const wallet = (_a = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _a !== void 0 ? _a : primaryWallet;
|
|
94
95
|
const getTurnkeyVerifiedCredential = () => {
|
|
95
|
-
if (!wallet || !user) {
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
const isPrimaryWalletTurnkey = wallet.connector.key.startsWith('turnkey');
|
|
99
|
-
if (!isPrimaryWalletTurnkey) {
|
|
96
|
+
if (!wallet || !user || !wallet.connector.key.startsWith('turnkey')) {
|
|
100
97
|
return undefined;
|
|
101
98
|
}
|
|
102
99
|
const primaryWalletId = wallet.id;
|
|
@@ -119,16 +116,15 @@ const useIsTurnkeyWallet = () => {
|
|
|
119
116
|
return smartContractWalletWithUnclaimedTurnkeySigner;
|
|
120
117
|
};
|
|
121
118
|
const turnkeyVerifiedCredential = getTurnkeyVerifiedCredential();
|
|
122
|
-
const
|
|
123
|
-
const isUnclaimedTurnkeyTheSignerOfScw = Boolean(unclaimedTurnkeyTheSignerOfScw);
|
|
119
|
+
const isUnclaimedTurnkeyTheSignerOfScw = Boolean(getUnclaimedTurnkeyTheSignerOfScw());
|
|
124
120
|
const isTurnkeyWallet = Boolean(turnkeyVerifiedCredential || isUnclaimedTurnkeyTheSignerOfScw);
|
|
125
|
-
const hasTurnkeyVerifiedCredentialAuthenticator = Boolean((
|
|
121
|
+
const hasTurnkeyVerifiedCredentialAuthenticator = Boolean((_b = turnkeyVerifiedCredential === null || turnkeyVerifiedCredential === void 0 ? void 0 : turnkeyVerifiedCredential.walletProperties) === null || _b === void 0 ? void 0 : _b.isAuthenticatorAttached);
|
|
126
122
|
const isTurnkeyWalletWithoutAuthenticator = (isTurnkeyWallet && !hasTurnkeyVerifiedCredentialAuthenticator) ||
|
|
127
123
|
isUnclaimedTurnkeyTheSignerOfScw;
|
|
128
124
|
const hasRecoveryEmail = isTurnkeyWallet &&
|
|
129
125
|
Boolean(getUserVerifiedCredentialType(user, JwtVerifiedCredentialFormatEnum.Email));
|
|
130
126
|
const isSessionKeyCompatible = isTurnkeyWallet &&
|
|
131
|
-
Boolean((
|
|
127
|
+
Boolean((_c = turnkeyVerifiedCredential === null || turnkeyVerifiedCredential === void 0 ? void 0 : turnkeyVerifiedCredential.walletProperties) === null || _c === void 0 ? void 0 : _c.isSessionKeyCompatible);
|
|
132
128
|
return {
|
|
133
129
|
hasRecoveryEmail,
|
|
134
130
|
hasTurnkeyVerifiedCredentialAuthenticator,
|
|
@@ -98,7 +98,7 @@ const useNetworkDataFromWallet = (wallet) => {
|
|
|
98
98
|
const { networkConfigurations } = useInternalDynamicContext.useInternalDynamicContext();
|
|
99
99
|
if (!wallet || !network)
|
|
100
100
|
return undefined;
|
|
101
|
-
if (wallet.chain === '
|
|
101
|
+
if (wallet.chain === 'SOL') {
|
|
102
102
|
return (_a = networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.solana) === null || _a === void 0 ? void 0 : _a[0];
|
|
103
103
|
}
|
|
104
104
|
return (_b = networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations[wallet.connector.connectedChain.toLowerCase()]) === null || _b === void 0 ? void 0 : _b.find((_network) => _network.chainId === network);
|
|
@@ -94,7 +94,7 @@ const useNetworkDataFromWallet = (wallet) => {
|
|
|
94
94
|
const { networkConfigurations } = useInternalDynamicContext();
|
|
95
95
|
if (!wallet || !network)
|
|
96
96
|
return undefined;
|
|
97
|
-
if (wallet.chain === '
|
|
97
|
+
if (wallet.chain === 'SOL') {
|
|
98
98
|
return (_a = networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.solana) === null || _a === void 0 ? void 0 : _a[0];
|
|
99
99
|
}
|
|
100
100
|
return (_b = networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations[wallet.connector.connectedChain.toLowerCase()]) === null || _b === void 0 ? void 0 : _b.find((_network) => _network.chainId === network);
|
|
@@ -100,14 +100,15 @@ const useNetworkNotSupported = () => {
|
|
|
100
100
|
});
|
|
101
101
|
const { network: walletConnectorNetwork } = useWalletConnectorNetwork.useWalletConnectorNetwork(walletConnector, {
|
|
102
102
|
onChange: (walletConnectorNetwork) => {
|
|
103
|
-
if (!
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
if (!walletConnector ||
|
|
104
|
+
!isSupportedNetwork.isSupportedNetwork({
|
|
105
|
+
network: walletConnectorNetwork,
|
|
106
|
+
walletConnector,
|
|
107
|
+
})) {
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
110
|
finishConnectAndSign({
|
|
110
|
-
walletConnector
|
|
111
|
+
walletConnector,
|
|
111
112
|
}).then(() => {
|
|
112
113
|
// if user still has to do onboarding, we should not hide the auth flow
|
|
113
114
|
if (!user && authMode === 'connect-and-sign') {
|
|
@@ -96,14 +96,15 @@ const useNetworkNotSupported = () => {
|
|
|
96
96
|
});
|
|
97
97
|
const { network: walletConnectorNetwork } = useWalletConnectorNetwork(walletConnector, {
|
|
98
98
|
onChange: (walletConnectorNetwork) => {
|
|
99
|
-
if (!
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
if (!walletConnector ||
|
|
100
|
+
!isSupportedNetwork({
|
|
101
|
+
network: walletConnectorNetwork,
|
|
102
|
+
walletConnector,
|
|
103
|
+
})) {
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
106
|
finishConnectAndSign({
|
|
106
|
-
walletConnector
|
|
107
|
+
walletConnector,
|
|
107
108
|
}).then(() => {
|
|
108
109
|
// if user still has to do onboarding, we should not hide the auth flow
|
|
109
110
|
if (!user && authMode === 'connect-and-sign') {
|