@dynamic-labs/sdk-react-core 1.0.0-alpha.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +12 -11
- package/src/index.cjs +41 -34
- package/src/index.d.ts +3 -1
- package/src/index.js +26 -22
- package/src/lib/Main.cjs +24 -22
- package/src/lib/Main.js +24 -22
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +18 -17
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +18 -17
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +19 -18
- package/src/lib/components/AnimatePresence/AnimatePresence.js +19 -18
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +15 -14
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +15 -14
- package/src/lib/components/Divider/Divider.cjs +16 -15
- package/src/lib/components/Divider/Divider.js +16 -15
- package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +16 -15
- package/src/lib/components/MenuList/Dropdown/Dropdown.js +16 -15
- package/src/lib/components/Modal/Modal.cjs +17 -16
- package/src/lib/components/Modal/Modal.js +17 -16
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +21 -19
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +21 -19
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +17 -16
- package/src/lib/components/NetworkPicker/NetworkPicker.js +17 -16
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +15 -14
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +15 -14
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +17 -16
- package/src/lib/components/NetworkPicker/components/Network/Network.js +17 -16
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +16 -15
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +16 -15
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +16 -15
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +16 -15
- package/src/lib/components/OverlayCard/OverlayCard.cjs +17 -16
- package/src/lib/components/OverlayCard/OverlayCard.js +17 -16
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs +16 -15
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js +16 -15
- package/src/lib/components/Popper/PopperContext/PopperContext.js +1 -1
- package/src/lib/components/Portal/Portal.cjs +17 -16
- package/src/lib/components/Portal/Portal.js +17 -16
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.cjs +1 -1
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.js +1 -1
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.cjs +2 -1
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.js +2 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +16 -15
- package/src/lib/components/SocialSignIn/SocialSignIn.js +16 -15
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.cjs +15 -14
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.js +15 -14
- package/src/lib/components/Tooltip/Tooltip.cjs +15 -14
- package/src/lib/components/Tooltip/Tooltip.js +15 -14
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +14 -13
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +14 -13
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +18 -17
- package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +18 -17
- package/src/lib/components/UserAddress/UserAddress.cjs +16 -15
- package/src/lib/components/UserAddress/UserAddress.js +16 -15
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +16 -15
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +16 -15
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +16 -15
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +16 -15
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +16 -15
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +16 -15
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.js +1 -1
- package/src/lib/context/AccountExistsContext/AccountExistsContext.js +1 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +44 -38
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +5 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +44 -39
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +3 -3
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +2 -2
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +3 -3
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +3 -3
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts +2 -2
- package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +3 -3
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +18 -17
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +18 -17
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -5
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -5
- package/src/lib/context/EmailVerificationContext/EmailVerificationContext.js +1 -1
- package/src/lib/context/FundingContext/FundingContext.cjs +35 -27
- package/src/lib/context/FundingContext/FundingContext.d.ts +4 -0
- package/src/lib/context/FundingContext/FundingContext.js +36 -28
- package/src/lib/context/FundingContext/index.d.ts +1 -0
- package/src/lib/context/FundingContext/useFunding/index.d.ts +1 -0
- package/src/lib/context/FundingContext/useFunding/useFunding.cjs +39 -0
- package/src/lib/context/FundingContext/useFunding/useFunding.d.ts +9 -0
- package/src/lib/context/FundingContext/useFunding/useFunding.js +35 -0
- package/src/lib/context/LoadingContext/LoadingContext.js +1 -1
- package/src/lib/context/MockContext/MockContext.cjs +13 -11
- package/src/lib/context/MockContext/MockContext.js +13 -11
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +18 -17
- package/src/lib/context/QrCodeContext/QrCodeContext.js +18 -17
- package/src/lib/context/SendBalanceContext/SendBalanceContext.cjs +15 -14
- package/src/lib/context/SendBalanceContext/SendBalanceContext.js +15 -14
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +31 -16
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +32 -17
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +16 -15
- package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +16 -15
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +52 -0
- package/src/lib/context/UserWalletsContext/UserWalletsContext.d.ts +21 -0
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +45 -0
- package/src/lib/context/UserWalletsContext/index.d.ts +1 -0
- package/src/lib/context/ViewContext/ViewContext.js +1 -1
- package/src/lib/data/api.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +16 -15
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +16 -15
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +16 -15
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.cjs +14 -13
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.js +14 -13
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.cjs +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/Item/Item.js +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +16 -15
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +15 -14
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +15 -14
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +15 -14
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.js +15 -14
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +16 -15
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +16 -15
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.cjs +15 -14
- package/src/lib/layout/DynamicAuthLayout/WalletProgressStepper/WalletProgressStepper.js +15 -14
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +17 -15
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +17 -15
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.cjs +16 -15
- package/src/lib/layouts/BridgeNextWalletToConnectLayout/BridgeNextWalletToConnectLayout.js +16 -15
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +16 -15
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +16 -15
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +16 -15
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +16 -15
- package/src/lib/locale/en/translation.cjs +4 -4
- package/src/lib/locale/en/translation.d.ts +2 -2
- package/src/lib/locale/en/translation.js +4 -4
- package/src/lib/modals/DynamicAuthModal/DynamicAuthModal.cjs +16 -15
- package/src/lib/modals/DynamicAuthModal/DynamicAuthModal.js +16 -15
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +16 -15
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +16 -15
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +17 -16
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +17 -16
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.types.d.ts +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.cjs +15 -10
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.d.ts +4 -2
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.js +15 -10
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +16 -16
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +16 -16
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.cjs +16 -15
- package/src/lib/modals/UserFieldEditorModal/UserFieldEditorModal.js +16 -15
- package/src/lib/shared/types/index.d.ts +9 -0
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +4 -2
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.d.ts +2 -2
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +4 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.cjs +39 -0
- package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.d.ts +3 -0
- package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.js +35 -0
- package/src/lib/utils/functions/createOwnerWallet/index.d.ts +1 -0
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +1 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +1 -1
- package/src/lib/utils/functions/index.d.ts +2 -0
- package/src/lib/utils/functions/isAccountAbstractionWallet/index.d.ts +1 -0
- package/src/lib/utils/functions/isAccountAbstractionWallet/isAccountAbstractionWallet.cjs +18 -0
- package/src/lib/utils/functions/isAccountAbstractionWallet/isAccountAbstractionWallet.d.ts +2 -0
- package/src/lib/utils/functions/isAccountAbstractionWallet/isAccountAbstractionWallet.js +14 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +9 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +9 -2
- package/src/lib/utils/hooks/index.d.ts +35 -35
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +4 -3
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +4 -3
- package/src/lib/utils/hooks/useConnectWallet/updateUserWalletsFromConnectedWallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectWallet/updateUserWalletsFromConnectedWallets/updateUserWalletsFromConnectedWallets.cjs +37 -0
- package/src/lib/utils/hooks/useConnectWallet/updateUserWalletsFromConnectedWallets/updateUserWalletsFromConnectedWallets.d.ts +8 -0
- package/src/lib/utils/hooks/useConnectWallet/updateUserWalletsFromConnectedWallets/updateUserWalletsFromConnectedWallets.js +33 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +14 -7
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +2 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +14 -7
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +8 -5
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.d.ts +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +8 -5
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +6 -3
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +6 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +14 -11
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +14 -11
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs +16 -1
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js +16 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +2 -2
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +6 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +7 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +34 -5
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.d.ts +33 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +34 -5
- package/src/lib/utils/hooks/useWalletConnectorOptions/index.d.ts +1 -0
- package/src/lib/utils/hooks/{useWallets/useWallets.cjs → useWalletConnectorOptions/useWalletConnectorOptions.cjs} +8 -8
- package/src/lib/utils/hooks/{useWallets/useWallets.d.ts → useWalletConnectorOptions/useWalletConnectorOptions.d.ts} +2 -2
- package/src/lib/utils/hooks/{useWallets/useWallets.js → useWalletConnectorOptions/useWalletConnectorOptions.js} +8 -8
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/errors/ConnectorSetupError.cjs +13 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/errors/ConnectorSetupError.d.ts +4 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/errors/ConnectorSetupError.js +9 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/errors/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/{useWallets → useWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +3 -5
- package/src/lib/utils/hooks/{useWallets → useWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.d.ts +0 -3
- package/src/lib/utils/hooks/{useWallets → useWalletConnectorOptions}/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +4 -4
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyRequiredConnectorsAreSetup/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs +13 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.d.ts +3 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.js +9 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +32 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.d.ts +3 -0
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +28 -0
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +17 -15
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +3 -7
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +17 -15
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +5 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.d.ts +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +5 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +3 -3
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +2 -2
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +3 -3
- package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.cjs +34 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.d.ts +8 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.js +30 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -4
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +9 -8
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +9 -8
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +13 -12
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +13 -12
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +18 -17
- package/src/lib/views/AccountExistsView/AccountExistsView.js +18 -17
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +16 -15
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +16 -15
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +17 -16
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +17 -16
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +19 -18
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +19 -18
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +17 -16
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +17 -16
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +17 -16
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +17 -16
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +15 -14
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +15 -14
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +16 -15
- package/src/lib/views/EmailUpdate/EmailUpdate.js +16 -15
- package/src/lib/views/EmailVerification/EmailVerification.cjs +20 -19
- package/src/lib/views/EmailVerification/EmailVerification.js +20 -19
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +15 -14
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +15 -14
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +17 -16
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +17 -16
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +17 -16
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +17 -16
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +17 -16
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +17 -16
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +15 -14
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +15 -14
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.cjs +16 -15
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.js +16 -15
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -2
- package/src/lib/views/LoginView/useLoginView.cjs +9 -2
- package/src/lib/views/LoginView/useLoginView.js +9 -2
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +16 -15
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +16 -15
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +19 -18
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +19 -18
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +19 -18
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +19 -18
- package/src/lib/views/NoAccess/NoAccess.cjs +16 -15
- package/src/lib/views/NoAccess/NoAccess.js +16 -15
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +16 -15
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +16 -15
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +16 -15
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +16 -15
- package/src/lib/views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.cjs +16 -15
- package/src/lib/views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.js +16 -15
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +21 -20
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +21 -20
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +37 -20
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +38 -21
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +24 -18
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +24 -18
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +26 -20
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +26 -20
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +12 -7
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +2 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +12 -7
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +16 -15
- package/src/lib/views/PendingConnectView/PendingConnectView.js +16 -15
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +16 -15
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +16 -15
- package/src/lib/views/QrCodeView/QRCode.cjs +17 -16
- package/src/lib/views/QrCodeView/QRCode.js +17 -16
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +14 -13
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +14 -13
- package/src/lib/views/QrCodeView/QrCodeView.cjs +14 -13
- package/src/lib/views/QrCodeView/QrCodeView.js +14 -13
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +17 -16
- package/src/lib/views/SendBalanceView/SendBalanceView.js +17 -16
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +17 -17
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +17 -17
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +17 -16
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +17 -16
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +17 -16
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +17 -16
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +21 -25
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +21 -25
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.types.d.ts +4 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +19 -12
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.d.ts +2 -11
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +19 -12
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs +19 -18
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +19 -18
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.cjs +16 -15
- package/src/lib/views/UserFieldEditorView/UserFieldEditorView.js +16 -15
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +16 -15
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +16 -15
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +16 -15
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +16 -15
- package/src/lib/views/WalletList/WalletList.cjs +4 -4
- package/src/lib/views/WalletList/WalletList.js +4 -4
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +16 -15
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +16 -15
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +16 -15
- package/src/lib/views/WalletLockedView/WalletLockedView.js +16 -15
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +14 -13
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +14 -13
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +18 -17
- package/src/lib/views/WalletUsedView/WalletUsedView.js +18 -17
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +16 -15
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +16 -15
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +17 -16
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +17 -16
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.cjs +16 -15
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCard/DynamicBridgeWalletCard.js +16 -15
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +16 -15
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +16 -15
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.cjs +13 -12
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWidgetEmptyCard/DynamicBridgeWidgetEmptyCard.js +13 -12
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +15 -14
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +15 -14
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +17 -16
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +17 -16
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +18 -16
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +18 -16
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +17 -16
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +17 -16
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +13 -12
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +13 -12
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +24 -18
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +24 -18
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +15 -14
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +15 -14
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +17 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +17 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +18 -17
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +18 -17
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +17 -16
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +17 -16
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +17 -16
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +17 -16
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.js +16 -15
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +13 -12
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +13 -12
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +16 -15
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +17 -16
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +17 -16
- package/src/lib/widgets/DynamicWidget/helpers/helpers.cjs +7 -7
- package/src/lib/widgets/DynamicWidget/helpers/helpers.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/helpers/helpers.js +7 -7
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +13 -12
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +13 -12
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +15 -14
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +15 -14
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +14 -13
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +14 -13
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +16 -15
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +15 -14
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +15 -14
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +15 -14
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +15 -14
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +18 -17
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +18 -17
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +28 -29
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +28 -29
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +17 -16
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +17 -16
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +16 -15
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +16 -15
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +17 -16
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +17 -16
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +16 -15
- package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +16 -15
- package/src/lib/utils/hooks/useWallets/index.d.ts +0 -1
- package/src/lib/utils/hooks/useWallets/utils/index.d.ts +0 -1
- package/src/lib/views/Passkey/passkey.types.d.ts +0 -8
- /package/src/lib/utils/hooks/{useWallets → useWalletConnectorOptions}/utils/verifyMagicIsSetup/index.d.ts +0 -0
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
6
|
-
var utils = require('@dynamic-labs/utils');
|
|
7
6
|
require('../../../../../shared/logger.cjs');
|
|
8
7
|
require('@dynamic-labs/iconic');
|
|
9
8
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -14,11 +13,12 @@ require('@dynamic-labs/wallet-book');
|
|
|
14
13
|
require('../../../../constants/colors.cjs');
|
|
15
14
|
require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
15
|
require('viem');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
17
|
require('../../../../../shared/consts/index.cjs');
|
|
18
18
|
require('@dynamic-labs/multi-wallet');
|
|
19
19
|
var isProviderEnabled = require('../../../../functions/isProviderEnabled/isProviderEnabled.cjs');
|
|
20
|
+
var ConnectorSetupError = require('../errors/ConnectorSetupError.cjs');
|
|
20
21
|
|
|
21
|
-
const MissingMagicSetupError = new utils.DynamicError('Magic is enabled but @dynamic-labs/magic package is not set up.\nSee https://docs.dynamic.xyz/docs/reduce-bundle-size-with-modular-sdk for more information');
|
|
22
22
|
const magicEmailOtpWalletConnectorKey = 'magicemailotp';
|
|
23
23
|
const magicSocialWalletConnectorKey = 'magicsocial';
|
|
24
24
|
const verifyMagicIsSetup = (projectSettings, walletConnectors) => {
|
|
@@ -26,10 +26,8 @@ const verifyMagicIsSetup = (projectSettings, walletConnectors) => {
|
|
|
26
26
|
const isMagicEnabled = isProviderEnabled.isProviderEnabled((_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [], sdkApi.ProviderEnum.MagicLink);
|
|
27
27
|
const isMagicWalletConnectorPresent = walletConnectors.some(({ key }) => [magicEmailOtpWalletConnectorKey, magicSocialWalletConnectorKey].includes(key));
|
|
28
28
|
if (isMagicEnabled && !isMagicWalletConnectorPresent) {
|
|
29
|
-
throw
|
|
29
|
+
throw new ConnectorSetupError.ConnectorSetupError('Magic', 'MagicWalletConnectors');
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
exports.MissingMagicSetupError = MissingMagicSetupError;
|
|
34
|
-
exports.magicEmailOtpWalletConnectorKey = magicEmailOtpWalletConnectorKey;
|
|
35
33
|
exports.verifyMagicIsSetup = verifyMagicIsSetup;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
2
2
|
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
-
export declare const MissingMagicSetupError: DynamicError;
|
|
5
|
-
export declare const magicEmailOtpWalletConnectorKey = "magicemailotp";
|
|
6
3
|
export declare const verifyMagicIsSetup: (projectSettings: ProjectSettings, walletConnectors: WalletConnector[]) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
2
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
3
2
|
import '../../../../../shared/logger.js';
|
|
4
3
|
import '@dynamic-labs/iconic';
|
|
5
4
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -10,11 +9,12 @@ import '@dynamic-labs/wallet-book';
|
|
|
10
9
|
import '../../../../constants/colors.js';
|
|
11
10
|
import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
11
|
import 'viem';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
13
|
import '../../../../../shared/consts/index.js';
|
|
14
14
|
import '@dynamic-labs/multi-wallet';
|
|
15
15
|
import { isProviderEnabled } from '../../../../functions/isProviderEnabled/isProviderEnabled.js';
|
|
16
|
+
import { ConnectorSetupError } from '../errors/ConnectorSetupError.js';
|
|
16
17
|
|
|
17
|
-
const MissingMagicSetupError = new DynamicError('Magic is enabled but @dynamic-labs/magic package is not set up.\nSee https://docs.dynamic.xyz/docs/reduce-bundle-size-with-modular-sdk for more information');
|
|
18
18
|
const magicEmailOtpWalletConnectorKey = 'magicemailotp';
|
|
19
19
|
const magicSocialWalletConnectorKey = 'magicsocial';
|
|
20
20
|
const verifyMagicIsSetup = (projectSettings, walletConnectors) => {
|
|
@@ -22,8 +22,8 @@ const verifyMagicIsSetup = (projectSettings, walletConnectors) => {
|
|
|
22
22
|
const isMagicEnabled = isProviderEnabled((_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [], ProviderEnum.MagicLink);
|
|
23
23
|
const isMagicWalletConnectorPresent = walletConnectors.some(({ key }) => [magicEmailOtpWalletConnectorKey, magicSocialWalletConnectorKey].includes(key));
|
|
24
24
|
if (isMagicEnabled && !isMagicWalletConnectorPresent) {
|
|
25
|
-
throw
|
|
25
|
+
throw new ConnectorSetupError('Magic', 'MagicWalletConnectors');
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export {
|
|
29
|
+
export { verifyMagicIsSetup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { verifyRequiredConnectorsAreSetup } from './verifyRequiredConnectorsAreSetup';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var verifyMagicIsSetup = require('../verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
6
|
+
var verifyZeroDevIsSetup = require('../verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs');
|
|
7
|
+
|
|
8
|
+
const verifyRequiredConnectorsAreSetup = (projectSettings, walletConnectors) => {
|
|
9
|
+
verifyMagicIsSetup.verifyMagicIsSetup(projectSettings, walletConnectors);
|
|
10
|
+
verifyZeroDevIsSetup.verifyZeroDevIsSetup(projectSettings, walletConnectors);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.verifyRequiredConnectorsAreSetup = verifyRequiredConnectorsAreSetup;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { verifyMagicIsSetup } from '../verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
2
|
+
import { verifyZeroDevIsSetup } from '../verifyZeroDevIsSetup/verifyZeroDevIsSetup.js';
|
|
3
|
+
|
|
4
|
+
const verifyRequiredConnectorsAreSetup = (projectSettings, walletConnectors) => {
|
|
5
|
+
verifyMagicIsSetup(projectSettings, walletConnectors);
|
|
6
|
+
verifyZeroDevIsSetup(projectSettings, walletConnectors);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { verifyRequiredConnectorsAreSetup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { verifyZeroDevIsSetup } from './verifyZeroDevIsSetup';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
6
|
+
require('../../../../../shared/logger.cjs');
|
|
7
|
+
require('@dynamic-labs/iconic');
|
|
8
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
require('react/jsx-runtime');
|
|
10
|
+
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
11
|
+
require('react');
|
|
12
|
+
require('@dynamic-labs/wallet-book');
|
|
13
|
+
require('../../../../constants/colors.cjs');
|
|
14
|
+
require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
15
|
+
require('viem');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../../../../shared/consts/index.cjs');
|
|
18
|
+
require('@dynamic-labs/multi-wallet');
|
|
19
|
+
var isProviderEnabled = require('../../../../functions/isProviderEnabled/isProviderEnabled.cjs');
|
|
20
|
+
var ConnectorSetupError = require('../errors/ConnectorSetupError.cjs');
|
|
21
|
+
|
|
22
|
+
const zeroDevWalletConnectorKey = 'zerodev';
|
|
23
|
+
const verifyZeroDevIsSetup = (projectSettings, walletConnectors) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const isZeroDevEnabled = isProviderEnabled.isProviderEnabled((_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [], sdkApi.ProviderEnum.Zerodev);
|
|
26
|
+
const isZeroDevWalletConnectorPresent = walletConnectors.some(({ key }) => key === zeroDevWalletConnectorKey);
|
|
27
|
+
if (isZeroDevEnabled && !isZeroDevWalletConnectorPresent) {
|
|
28
|
+
throw new ConnectorSetupError.ConnectorSetupError('ZeroDev', 'ZeroDevSmartWalletConnectors');
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.verifyZeroDevIsSetup = verifyZeroDevIsSetup;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import '../../../../../shared/logger.js';
|
|
3
|
+
import '@dynamic-labs/iconic';
|
|
4
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '@dynamic-labs/wallet-book';
|
|
9
|
+
import '../../../../constants/colors.js';
|
|
10
|
+
import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
11
|
+
import 'viem';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../../../../shared/consts/index.js';
|
|
14
|
+
import '@dynamic-labs/multi-wallet';
|
|
15
|
+
import { isProviderEnabled } from '../../../../functions/isProviderEnabled/isProviderEnabled.js';
|
|
16
|
+
import { ConnectorSetupError } from '../errors/ConnectorSetupError.js';
|
|
17
|
+
|
|
18
|
+
const zeroDevWalletConnectorKey = 'zerodev';
|
|
19
|
+
const verifyZeroDevIsSetup = (projectSettings, walletConnectors) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const isZeroDevEnabled = isProviderEnabled((_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [], ProviderEnum.Zerodev);
|
|
22
|
+
const isZeroDevWalletConnectorPresent = walletConnectors.some(({ key }) => key === zeroDevWalletConnectorKey);
|
|
23
|
+
if (isZeroDevEnabled && !isZeroDevWalletConnectorPresent) {
|
|
24
|
+
throw new ConnectorSetupError('ZeroDev', 'ZeroDevSmartWalletConnectors');
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { verifyZeroDevIsSetup };
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api');
|
|
10
11
|
var logger = require('../../../shared/logger.cjs');
|
|
11
12
|
require('@dynamic-labs/iconic');
|
|
@@ -18,10 +19,11 @@ require('viem');
|
|
|
18
19
|
require('../../../shared/consts/index.cjs');
|
|
19
20
|
var isSameWalletName = require('../../functions/isSameWalletName/isSameWalletName.cjs');
|
|
20
21
|
var useWalletsConnectionState = require('../useWalletsConnectionState/useWalletsConnectionState.cjs');
|
|
21
|
-
var createLinkedWalletsFromWalletOptions = require('./utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs');
|
|
22
22
|
var reconnectSocialWallet = require('./reconnectSocialWallet.cjs');
|
|
23
|
+
var createLinkedWalletsFromWalletOptions = require('./utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs');
|
|
24
|
+
var updateUserWalletsFromLinkedWallets = require('./utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.cjs');
|
|
23
25
|
|
|
24
|
-
const useWalletConnectors = ({ authMode, authToken, connectedWallets,
|
|
26
|
+
const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConnectorOptions, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, canHaveMultipleWalletsConnected, }) => {
|
|
25
27
|
const [showQrcodeModal, setShowQrcodeModal] = React.useState(false);
|
|
26
28
|
const linkedWallets = React.useMemo(() => {
|
|
27
29
|
if (!authToken) {
|
|
@@ -30,9 +32,9 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
30
32
|
return createLinkedWalletsFromWalletOptions.createLinkedWalletsFromWalletOptions({
|
|
31
33
|
authToken,
|
|
32
34
|
primaryWalletId,
|
|
33
|
-
|
|
35
|
+
walletConnectorOptions,
|
|
34
36
|
});
|
|
35
|
-
}, [authToken, primaryWalletId,
|
|
37
|
+
}, [authToken, primaryWalletId, walletConnectorOptions]);
|
|
36
38
|
const walletsBasedOnAuthMode = React.useMemo(() => {
|
|
37
39
|
// Before signing the first message we are using connected wallets list
|
|
38
40
|
// This is because we want the first connected wallet to have events applied by useWalletEventListeners
|
|
@@ -64,8 +66,13 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
64
66
|
}), [walletsBasedOnAuthMode]);
|
|
65
67
|
const { connectedWalletMap, didConnectedStateLoad } = useWalletsConnectionState.useWalletsConnectionState(walletsBasedOnAuthMode);
|
|
66
68
|
const wallets = React.useMemo(() => walletsBasedOnAuthMode.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletMap[wallet.id]) }))), [connectedWalletMap, walletsBasedOnAuthMode]);
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
+
const { setUserWallets } = UserWalletsContext.useInternalUserWallets();
|
|
70
|
+
// Keep userWallets in sync whenever linkedWallets changes
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets.updateUserWalletsFromLinkedWallets(userWallets, wallets));
|
|
73
|
+
}, [setUserWallets, wallets]);
|
|
74
|
+
const primaryWallet = React.useMemo(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
75
|
+
const secondaryWallets = React.useMemo(() => canHaveMultipleWalletsConnected
|
|
69
76
|
? wallets.filter((wallet) => wallet.id !== primaryWalletId)
|
|
70
77
|
: [], [primaryWalletId, wallets, canHaveMultipleWalletsConnected]);
|
|
71
78
|
const getSelectedWallet = React.useCallback((walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -102,7 +109,6 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
102
109
|
}
|
|
103
110
|
if (primaryWalletId === walletId)
|
|
104
111
|
return;
|
|
105
|
-
const primaryWallet = getPrimaryWallet();
|
|
106
112
|
if (checkIfAccountChangeIsRequired(primaryWallet, newPrimaryWallet)) {
|
|
107
113
|
yield newPrimaryWallet.connector.connect();
|
|
108
114
|
setPrimaryWalletId(walletId);
|
|
@@ -154,7 +160,7 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
154
160
|
authToken,
|
|
155
161
|
checkIfAccountChangeIsRequired,
|
|
156
162
|
checkIfShowQrCodeModal,
|
|
157
|
-
|
|
163
|
+
primaryWallet,
|
|
158
164
|
getSelectedWallet,
|
|
159
165
|
primaryWalletId,
|
|
160
166
|
setDesktopUri,
|
|
@@ -162,17 +168,13 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
162
168
|
setPrimaryWalletId,
|
|
163
169
|
setQrcodeUri,
|
|
164
170
|
]);
|
|
165
|
-
const walletConnectors = wallets.map((wallet) => wallet.connector);
|
|
166
171
|
return {
|
|
167
172
|
didConnectedStateLoad,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
primaryWallet: getPrimaryWallet(),
|
|
171
|
-
secondaryWallets: getSecondaryWallets(),
|
|
173
|
+
primaryWallet,
|
|
174
|
+
secondaryWallets,
|
|
172
175
|
setPrimaryWallet,
|
|
173
176
|
setShowQrcodeModal,
|
|
174
177
|
showQrcodeModal,
|
|
175
|
-
walletConnectors,
|
|
176
178
|
wallets,
|
|
177
179
|
};
|
|
178
180
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AuthModeType, MultiWalletWidgetState, UserProfile, Wallet, WalletOption } from '../../../shared';
|
|
3
3
|
import { MultiWalletWidgetStateSetter } from '../multiWallet';
|
|
4
|
-
import { WalletConnector } from '../../../..';
|
|
5
4
|
type Props = {
|
|
6
5
|
authMode: AuthModeType;
|
|
7
6
|
authToken: string | undefined;
|
|
@@ -10,7 +9,7 @@ type Props = {
|
|
|
10
9
|
setDesktopUri: Dispatch<SetStateAction<string>>;
|
|
11
10
|
setMultiWalletWidgetState: MultiWalletWidgetStateSetter;
|
|
12
11
|
setQrcodeUri: Dispatch<SetStateAction<string>>;
|
|
13
|
-
|
|
12
|
+
walletConnectorOptions: WalletOption[];
|
|
14
13
|
setPrimaryWalletId: (walletId: string) => void;
|
|
15
14
|
primaryWalletId: string | undefined;
|
|
16
15
|
user?: UserProfile;
|
|
@@ -19,15 +18,12 @@ type Props = {
|
|
|
19
18
|
};
|
|
20
19
|
export interface UseWalletConnectors {
|
|
21
20
|
didConnectedStateLoad: boolean;
|
|
22
|
-
getPrimaryWallet: () => Wallet | null;
|
|
23
|
-
getSecondaryWallets: () => Wallet[];
|
|
24
21
|
primaryWallet: Wallet | null;
|
|
25
22
|
secondaryWallets: Wallet[];
|
|
26
23
|
setPrimaryWallet: (walletId: string) => Promise<void>;
|
|
27
24
|
setShowQrcodeModal: Dispatch<SetStateAction<boolean>>;
|
|
28
25
|
showQrcodeModal: boolean;
|
|
29
|
-
walletConnectors: WalletConnector[];
|
|
30
26
|
wallets: Wallet[];
|
|
31
27
|
}
|
|
32
|
-
export declare const useWalletConnectors: ({ authMode, authToken, connectedWallets,
|
|
28
|
+
export declare const useWalletConnectors: ({ authMode, authToken, connectedWallets, walletConnectorOptions, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, canHaveMultipleWalletsConnected, }: Props) => UseWalletConnectors;
|
|
33
29
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
2
|
import { useState, useMemo, useEffect, useCallback } from 'react';
|
|
3
|
-
import { isEmbeddedConnector, isEmailWalletConnector, isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
3
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { isEmbeddedConnector, isEmailWalletConnector, isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api';
|
|
6
7
|
import { logger } from '../../../shared/logger.js';
|
|
7
8
|
import '@dynamic-labs/iconic';
|
|
@@ -14,10 +15,11 @@ import 'viem';
|
|
|
14
15
|
import '../../../shared/consts/index.js';
|
|
15
16
|
import { isSameWalletName } from '../../functions/isSameWalletName/isSameWalletName.js';
|
|
16
17
|
import { useWalletsConnectionState } from '../useWalletsConnectionState/useWalletsConnectionState.js';
|
|
17
|
-
import { createLinkedWalletsFromWalletOptions } from './utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js';
|
|
18
18
|
import { reconnectSocialWallet } from './reconnectSocialWallet.js';
|
|
19
|
+
import { createLinkedWalletsFromWalletOptions } from './utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js';
|
|
20
|
+
import { updateUserWalletsFromLinkedWallets } from './utils/updateUserWalletsFromLinkedWallets/updateUserWalletsFromLinkedWallets.js';
|
|
19
21
|
|
|
20
|
-
const useWalletConnectors = ({ authMode, authToken, connectedWallets,
|
|
22
|
+
const useWalletConnectors = ({ authMode, authToken, connectedWallets, walletConnectorOptions, multiWalletWidgetState, setDesktopUri, setMultiWalletWidgetState, setQrcodeUri, primaryWalletId, setPrimaryWalletId, user, onboardingOnlyJwt, canHaveMultipleWalletsConnected, }) => {
|
|
21
23
|
const [showQrcodeModal, setShowQrcodeModal] = useState(false);
|
|
22
24
|
const linkedWallets = useMemo(() => {
|
|
23
25
|
if (!authToken) {
|
|
@@ -26,9 +28,9 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
26
28
|
return createLinkedWalletsFromWalletOptions({
|
|
27
29
|
authToken,
|
|
28
30
|
primaryWalletId,
|
|
29
|
-
|
|
31
|
+
walletConnectorOptions,
|
|
30
32
|
});
|
|
31
|
-
}, [authToken, primaryWalletId,
|
|
33
|
+
}, [authToken, primaryWalletId, walletConnectorOptions]);
|
|
32
34
|
const walletsBasedOnAuthMode = useMemo(() => {
|
|
33
35
|
// Before signing the first message we are using connected wallets list
|
|
34
36
|
// This is because we want the first connected wallet to have events applied by useWalletEventListeners
|
|
@@ -60,8 +62,13 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
60
62
|
}), [walletsBasedOnAuthMode]);
|
|
61
63
|
const { connectedWalletMap, didConnectedStateLoad } = useWalletsConnectionState(walletsBasedOnAuthMode);
|
|
62
64
|
const wallets = useMemo(() => walletsBasedOnAuthMode.map((wallet) => (Object.assign(Object.assign({}, wallet), { connected: Boolean(connectedWalletMap[wallet.id]) }))), [connectedWalletMap, walletsBasedOnAuthMode]);
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
+
const { setUserWallets } = useInternalUserWallets();
|
|
66
|
+
// Keep userWallets in sync whenever linkedWallets changes
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setUserWallets((userWallets) => updateUserWalletsFromLinkedWallets(userWallets, wallets));
|
|
69
|
+
}, [setUserWallets, wallets]);
|
|
70
|
+
const primaryWallet = useMemo(() => { var _a; return (_a = wallets.find((wallet) => wallet.id === primaryWalletId)) !== null && _a !== void 0 ? _a : null; }, [primaryWalletId, wallets]);
|
|
71
|
+
const secondaryWallets = useMemo(() => canHaveMultipleWalletsConnected
|
|
65
72
|
? wallets.filter((wallet) => wallet.id !== primaryWalletId)
|
|
66
73
|
: [], [primaryWalletId, wallets, canHaveMultipleWalletsConnected]);
|
|
67
74
|
const getSelectedWallet = useCallback((walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -98,7 +105,6 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
98
105
|
}
|
|
99
106
|
if (primaryWalletId === walletId)
|
|
100
107
|
return;
|
|
101
|
-
const primaryWallet = getPrimaryWallet();
|
|
102
108
|
if (checkIfAccountChangeIsRequired(primaryWallet, newPrimaryWallet)) {
|
|
103
109
|
yield newPrimaryWallet.connector.connect();
|
|
104
110
|
setPrimaryWalletId(walletId);
|
|
@@ -150,7 +156,7 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
150
156
|
authToken,
|
|
151
157
|
checkIfAccountChangeIsRequired,
|
|
152
158
|
checkIfShowQrCodeModal,
|
|
153
|
-
|
|
159
|
+
primaryWallet,
|
|
154
160
|
getSelectedWallet,
|
|
155
161
|
primaryWalletId,
|
|
156
162
|
setDesktopUri,
|
|
@@ -158,17 +164,13 @@ const useWalletConnectors = ({ authMode, authToken, connectedWallets, wallets: a
|
|
|
158
164
|
setPrimaryWalletId,
|
|
159
165
|
setQrcodeUri,
|
|
160
166
|
]);
|
|
161
|
-
const walletConnectors = wallets.map((wallet) => wallet.connector);
|
|
162
167
|
return {
|
|
163
168
|
didConnectedStateLoad,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
primaryWallet: getPrimaryWallet(),
|
|
167
|
-
secondaryWallets: getSecondaryWallets(),
|
|
169
|
+
primaryWallet,
|
|
170
|
+
secondaryWallets,
|
|
168
171
|
setPrimaryWallet,
|
|
169
172
|
setShowQrcodeModal,
|
|
170
173
|
showQrcodeModal,
|
|
171
|
-
walletConnectors,
|
|
172
174
|
wallets,
|
|
173
175
|
};
|
|
174
176
|
};
|
|
@@ -21,15 +21,15 @@ var shouldManuallyReconnectOnRefresh = require('../../../../functions/shouldManu
|
|
|
21
21
|
var findWallet = require('../findWallet/findWallet.cjs');
|
|
22
22
|
var smartWallet = require('../smartWallet/smartWallet.cjs');
|
|
23
23
|
|
|
24
|
-
const createLinkedWalletsFromWalletOptions = ({ authToken,
|
|
24
|
+
const createLinkedWalletsFromWalletOptions = ({ authToken, walletConnectorOptions, primaryWalletId, }) => {
|
|
25
25
|
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
26
26
|
// wallet state should be null while loading all the wallets or when there is no user
|
|
27
|
-
if (!
|
|
27
|
+
if (!walletConnectorOptions || !decodedJwt) {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
|
30
30
|
return decodedJwt.verifiedCredentials
|
|
31
31
|
.map((account) => {
|
|
32
|
-
const wallet = findWallet.findWallet(account,
|
|
32
|
+
const wallet = findWallet.findWallet(account, walletConnectorOptions);
|
|
33
33
|
// this probably shouldn't happen. this would mean that the user has an account linked
|
|
34
34
|
// with wallet W, but the customer has toggled off wallet W or the chain that
|
|
35
35
|
// supports wallet W
|
|
@@ -49,11 +49,12 @@ const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primar
|
|
|
49
49
|
smartWallet.initializeSmartWallet({
|
|
50
50
|
account,
|
|
51
51
|
verifiedCredentials: decodedJwt.verifiedCredentials,
|
|
52
|
-
|
|
52
|
+
walletConnectorOptions,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
56
|
address: account.address,
|
|
57
|
+
authenticated: true,
|
|
57
58
|
chain: account.chain,
|
|
58
59
|
connected: false,
|
|
59
60
|
connector: wallet.walletConnector,
|
|
@@ -2,7 +2,7 @@ import { Wallet, WalletOption } from '../../../../../shared';
|
|
|
2
2
|
type CreateWalletsFromWalletOptionsProps = {
|
|
3
3
|
authToken: string;
|
|
4
4
|
primaryWalletId: string | undefined;
|
|
5
|
-
|
|
5
|
+
walletConnectorOptions: WalletOption[] | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare const createLinkedWalletsFromWalletOptions: ({ authToken,
|
|
7
|
+
export declare const createLinkedWalletsFromWalletOptions: ({ authToken, walletConnectorOptions, primaryWalletId, }: CreateWalletsFromWalletOptionsProps) => Wallet[];
|
|
8
8
|
export {};
|
|
@@ -17,15 +17,15 @@ import { shouldManuallyReconnectOnRefresh } from '../../../../functions/shouldMa
|
|
|
17
17
|
import { findWallet } from '../findWallet/findWallet.js';
|
|
18
18
|
import { isOwnerOfASmartWallet, initializeSmartWallet } from '../smartWallet/smartWallet.js';
|
|
19
19
|
|
|
20
|
-
const createLinkedWalletsFromWalletOptions = ({ authToken,
|
|
20
|
+
const createLinkedWalletsFromWalletOptions = ({ authToken, walletConnectorOptions, primaryWalletId, }) => {
|
|
21
21
|
const decodedJwt = decodeJwt(authToken);
|
|
22
22
|
// wallet state should be null while loading all the wallets or when there is no user
|
|
23
|
-
if (!
|
|
23
|
+
if (!walletConnectorOptions || !decodedJwt) {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
26
|
return decodedJwt.verifiedCredentials
|
|
27
27
|
.map((account) => {
|
|
28
|
-
const wallet = findWallet(account,
|
|
28
|
+
const wallet = findWallet(account, walletConnectorOptions);
|
|
29
29
|
// this probably shouldn't happen. this would mean that the user has an account linked
|
|
30
30
|
// with wallet W, but the customer has toggled off wallet W or the chain that
|
|
31
31
|
// supports wallet W
|
|
@@ -45,11 +45,12 @@ const createLinkedWalletsFromWalletOptions = ({ authToken, walletOptions, primar
|
|
|
45
45
|
initializeSmartWallet({
|
|
46
46
|
account,
|
|
47
47
|
verifiedCredentials: decodedJwt.verifiedCredentials,
|
|
48
|
-
|
|
48
|
+
walletConnectorOptions,
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
return {
|
|
52
52
|
address: account.address,
|
|
53
|
+
authenticated: true,
|
|
53
54
|
chain: account.chain,
|
|
54
55
|
connected: false,
|
|
55
56
|
connector: wallet.walletConnector,
|
|
@@ -11,16 +11,16 @@ var findWallet = require('../findWallet/findWallet.cjs');
|
|
|
11
11
|
const findOwner = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.id === account.signerRefId);
|
|
12
12
|
const findSmartWallet = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.signerRefId === account.id);
|
|
13
13
|
const isOwnerOfASmartWallet = (account, verifiedCredentials) => Boolean(findSmartWallet(account, verifiedCredentials));
|
|
14
|
-
const initializeSmartWallet = ({ account, verifiedCredentials,
|
|
14
|
+
const initializeSmartWallet = ({ account, verifiedCredentials, walletConnectorOptions, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
const owner = findOwner(account, verifiedCredentials);
|
|
16
16
|
if (!owner) {
|
|
17
17
|
throw new Error('could not find associated eoa account for smart wallet');
|
|
18
18
|
}
|
|
19
|
-
const ownerWallet = findWallet.findWallet(owner,
|
|
19
|
+
const ownerWallet = findWallet.findWallet(owner, walletConnectorOptions);
|
|
20
20
|
if (!ownerWallet) {
|
|
21
21
|
throw new Error('could not find owner wallet from wallet options');
|
|
22
22
|
}
|
|
23
|
-
const smartWallet = findWallet.findWallet(account,
|
|
23
|
+
const smartWallet = findWallet.findWallet(account, walletConnectorOptions);
|
|
24
24
|
if (!smartWallet) {
|
|
25
25
|
throw new Error('could not find smart wallet from wallet options');
|
|
26
26
|
}
|
|
@@ -3,8 +3,8 @@ import { WalletOption } from '../../../../../shared';
|
|
|
3
3
|
export declare const findOwner: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => JwtVerifiedCredential | undefined;
|
|
4
4
|
export declare const findSmartWallet: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => JwtVerifiedCredential | undefined;
|
|
5
5
|
export declare const isOwnerOfASmartWallet: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => boolean;
|
|
6
|
-
export declare const initializeSmartWallet: ({ account, verifiedCredentials,
|
|
6
|
+
export declare const initializeSmartWallet: ({ account, verifiedCredentials, walletConnectorOptions, }: {
|
|
7
7
|
account: JwtVerifiedCredential;
|
|
8
8
|
verifiedCredentials: JwtVerifiedCredential[];
|
|
9
|
-
|
|
9
|
+
walletConnectorOptions: WalletOption[];
|
|
10
10
|
}) => Promise<void>;
|
|
@@ -7,16 +7,16 @@ import { findWallet } from '../findWallet/findWallet.js';
|
|
|
7
7
|
const findOwner = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.id === account.signerRefId);
|
|
8
8
|
const findSmartWallet = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.signerRefId === account.id);
|
|
9
9
|
const isOwnerOfASmartWallet = (account, verifiedCredentials) => Boolean(findSmartWallet(account, verifiedCredentials));
|
|
10
|
-
const initializeSmartWallet = ({ account, verifiedCredentials,
|
|
10
|
+
const initializeSmartWallet = ({ account, verifiedCredentials, walletConnectorOptions, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
const owner = findOwner(account, verifiedCredentials);
|
|
12
12
|
if (!owner) {
|
|
13
13
|
throw new Error('could not find associated eoa account for smart wallet');
|
|
14
14
|
}
|
|
15
|
-
const ownerWallet = findWallet(owner,
|
|
15
|
+
const ownerWallet = findWallet(owner, walletConnectorOptions);
|
|
16
16
|
if (!ownerWallet) {
|
|
17
17
|
throw new Error('could not find owner wallet from wallet options');
|
|
18
18
|
}
|
|
19
|
-
const smartWallet = findWallet(account,
|
|
19
|
+
const smartWallet = findWallet(account, walletConnectorOptions);
|
|
20
20
|
if (!smartWallet) {
|
|
21
21
|
throw new Error('could not find smart wallet from wallet options');
|
|
22
22
|
}
|
package/src/lib/utils/hooks/useWalletConnectors/utils/updateUserWalletsFromLinkedWallets/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './updateUserWalletsFromLinkedWallets';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This takes a userWallets and linkedWallets array, and returns a new userWallets array
|
|
7
|
+
* updated to match the linkedWallets array.
|
|
8
|
+
* It will add any missing wallets, update properties that don't match, and remove wallets that aren't
|
|
9
|
+
* in the linkedWallets.
|
|
10
|
+
*/
|
|
11
|
+
const updateUserWalletsFromLinkedWallets = (userWallets, authenticatedWallets) => {
|
|
12
|
+
const userWalletsCopy = [...userWallets];
|
|
13
|
+
/** We will use this to find wallets addresses that were removed */
|
|
14
|
+
const newWalletsAddresses = new Set();
|
|
15
|
+
// First pass: add missing wallets and update changed properties
|
|
16
|
+
for (const authenticatedWallet of authenticatedWallets) {
|
|
17
|
+
newWalletsAddresses.add(authenticatedWallet.address);
|
|
18
|
+
const respectiveIndex = userWalletsCopy.findIndex((wallet) => wallet.address === authenticatedWallet.address);
|
|
19
|
+
// Catch new wallets
|
|
20
|
+
if (respectiveIndex === -1) {
|
|
21
|
+
userWalletsCopy.push(authenticatedWallet);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
// If already present, just update to match the new state
|
|
25
|
+
userWalletsCopy[respectiveIndex] = authenticatedWallet;
|
|
26
|
+
// NOTE: this will actually update the wallet's ID if it changed, which happens when a wallet is signed
|
|
27
|
+
// It initially has a id in the format "connected-wallet-X", and after being signed it changes to a hash
|
|
28
|
+
}
|
|
29
|
+
// This filter is to remove a wallet that was previously added to userWallets but is not present
|
|
30
|
+
// among the verified credentials wallets anymore
|
|
31
|
+
return userWalletsCopy.filter((userWallet) => newWalletsAddresses.has(userWallet.address));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.updateUserWalletsFromLinkedWallets = updateUserWalletsFromLinkedWallets;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Wallet } from '../../../../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* This takes a userWallets and linkedWallets array, and returns a new userWallets array
|
|
4
|
+
* updated to match the linkedWallets array.
|
|
5
|
+
* It will add any missing wallets, update properties that don't match, and remove wallets that aren't
|
|
6
|
+
* in the linkedWallets.
|
|
7
|
+
*/
|
|
8
|
+
export declare const updateUserWalletsFromLinkedWallets: (userWallets: Wallet[], authenticatedWallets: Wallet[]) => Wallet[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This takes a userWallets and linkedWallets array, and returns a new userWallets array
|
|
3
|
+
* updated to match the linkedWallets array.
|
|
4
|
+
* It will add any missing wallets, update properties that don't match, and remove wallets that aren't
|
|
5
|
+
* in the linkedWallets.
|
|
6
|
+
*/
|
|
7
|
+
const updateUserWalletsFromLinkedWallets = (userWallets, authenticatedWallets) => {
|
|
8
|
+
const userWalletsCopy = [...userWallets];
|
|
9
|
+
/** We will use this to find wallets addresses that were removed */
|
|
10
|
+
const newWalletsAddresses = new Set();
|
|
11
|
+
// First pass: add missing wallets and update changed properties
|
|
12
|
+
for (const authenticatedWallet of authenticatedWallets) {
|
|
13
|
+
newWalletsAddresses.add(authenticatedWallet.address);
|
|
14
|
+
const respectiveIndex = userWalletsCopy.findIndex((wallet) => wallet.address === authenticatedWallet.address);
|
|
15
|
+
// Catch new wallets
|
|
16
|
+
if (respectiveIndex === -1) {
|
|
17
|
+
userWalletsCopy.push(authenticatedWallet);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
// If already present, just update to match the new state
|
|
21
|
+
userWalletsCopy[respectiveIndex] = authenticatedWallet;
|
|
22
|
+
// NOTE: this will actually update the wallet's ID if it changed, which happens when a wallet is signed
|
|
23
|
+
// It initially has a id in the format "connected-wallet-X", and after being signed it changes to a hash
|
|
24
|
+
}
|
|
25
|
+
// This filter is to remove a wallet that was previously added to userWallets but is not present
|
|
26
|
+
// among the verified credentials wallets anymore
|
|
27
|
+
return userWalletsCopy.filter((userWallet) => newWalletsAddresses.has(userWallet.address));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { updateUserWalletsFromLinkedWallets };
|