@dynamic-labs-sdk/client 1.18.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/createDynamicClient/createDynamicClient.d.ts +11 -1
- package/dist/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
- package/dist/client/defaultClient/defaultClient.d.ts +12 -1
- package/dist/client/defaultClient/defaultClient.d.ts.map +1 -1
- package/dist/core.cjs +5 -5
- package/dist/core.esm.js +7 -7
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +7 -7
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/APIError/APIError.d.ts +11 -1
- package/dist/errors/APIError/APIError.d.ts.map +1 -1
- package/dist/errors/DeviceRegistrationIdentityMismatchError.d.ts +21 -0
- package/dist/errors/DeviceRegistrationIdentityMismatchError.d.ts.map +1 -1
- package/dist/errors/MergeAccountsConfirmationError.d.ts +49 -0
- package/dist/errors/MergeAccountsConfirmationError.d.ts.map +1 -0
- package/dist/errors/WalletScreeningBlockedError.d.ts +13 -0
- package/dist/errors/WalletScreeningBlockedError.d.ts.map +1 -1
- package/dist/exports/index.d.ts +15 -5
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +2 -0
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CEs4SGW4.esm.js → getNetworkProviderFromNetworkId-Ct6nH2tC.esm.js} +106 -21
- package/dist/getNetworkProviderFromNetworkId-Ct6nH2tC.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-C6DBO0OX.native.esm.js → getNetworkProviderFromNetworkId-DL6OXPUn.native.esm.js} +90 -9
- package/dist/getNetworkProviderFromNetworkId-DL6OXPUn.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-CMIgKqEH.cjs → getNetworkProviderFromNetworkId-DmH039jx.cjs} +114 -17
- package/dist/getNetworkProviderFromNetworkId-DmH039jx.cjs.map +1 -0
- package/dist/{getSignedSessionId-CUqILBh8.esm.js → getSignedSessionId-CAQwZYYk.esm.js} +3 -3
- package/dist/{getSignedSessionId-CUqILBh8.esm.js.map → getSignedSessionId-CAQwZYYk.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-Hp1nSbaW.native.esm.js → getSignedSessionId-CPautem1.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-Hp1nSbaW.native.esm.js.map → getSignedSessionId-CPautem1.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-De_N_Ofg.cjs → getSignedSessionId-Dz4U61DG.cjs} +3 -3
- package/dist/{getSignedSessionId-De_N_Ofg.cjs.map → getSignedSessionId-Dz4U61DG.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-D5M801xH.native.esm.js → getWalletProviderByKey-BKveb5Rh.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-D5M801xH.native.esm.js.map → getWalletProviderByKey-BKveb5Rh.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-D3e0XMjs.cjs → getWalletProviderByKey-CSVSMios.cjs} +2 -2
- package/dist/{getWalletProviderByKey-D3e0XMjs.cjs.map → getWalletProviderByKey-CSVSMios.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-CKORCA8l.esm.js → getWalletProviderByKey-DTBGx_qd.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-CKORCA8l.esm.js.map → getWalletProviderByKey-DTBGx_qd.esm.js.map} +1 -1
- package/dist/index.cjs +736 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +729 -67
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +656 -52
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isDynamicWaasEnabled-BlVIlXMZ.esm.js → isDynamicWaasEnabled-Bb9e8w3u.esm.js} +19 -5
- package/dist/isDynamicWaasEnabled-Bb9e8w3u.esm.js.map +1 -0
- package/dist/{isDynamicWaasEnabled-BQuXZne_.cjs → isDynamicWaasEnabled-Dmbdiybh.cjs} +20 -6
- package/dist/isDynamicWaasEnabled-Dmbdiybh.cjs.map +1 -0
- package/dist/{isDynamicWaasEnabled-BaY09iv6.native.esm.js → isDynamicWaasEnabled-gu-9QF8-.native.esm.js} +19 -5
- package/dist/isDynamicWaasEnabled-gu-9QF8-.native.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-CwOGwiDz.native.esm.js → isMfaRequiredForAction-BkrwKqo1.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CwOGwiDz.native.esm.js.map → isMfaRequiredForAction-BkrwKqo1.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-Dghiguch.cjs → isMfaRequiredForAction-CHeYEkjj.cjs} +19 -2
- package/dist/isMfaRequiredForAction-CHeYEkjj.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-r9aDdmK5.esm.js → isMfaRequiredForAction-DxJQm48x.esm.js} +19 -2
- package/dist/isMfaRequiredForAction-DxJQm48x.esm.js.map +1 -0
- package/dist/{isUserOnboardingComplete-C-ioFLRR.native.esm.js → isUserOnboardingComplete-BLm0JQ_z.native.esm.js} +10 -3
- package/dist/{isUserOnboardingComplete-C-ioFLRR.native.esm.js.map → isUserOnboardingComplete-BLm0JQ_z.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-j4b_q9Pf.cjs → isUserOnboardingComplete-CruwjMvs.cjs} +11 -4
- package/dist/{isUserOnboardingComplete-j4b_q9Pf.cjs.map → isUserOnboardingComplete-CruwjMvs.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-BMNAbXk1.esm.js → isUserOnboardingComplete-DAesufca.esm.js} +10 -3
- package/dist/{isUserOnboardingComplete-BMNAbXk1.esm.js.map → isUserOnboardingComplete-DAesufca.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-D--uqWp5.esm.js → migrateFromFireblocks-C-lXWvvo.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-D--uqWp5.esm.js.map → migrateFromFireblocks-C-lXWvvo.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-D8Y5h0hz.native.esm.js → migrateFromFireblocks-Do4mQTl7.native.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-D8Y5h0hz.native.esm.js.map → migrateFromFireblocks-Do4mQTl7.native.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-D9pJIgt5.cjs → migrateFromFireblocks-DrHwloUB.cjs} +3 -3
- package/dist/{migrateFromFireblocks-D9pJIgt5.cjs.map → migrateFromFireblocks-DrHwloUB.cjs.map} +1 -1
- package/dist/modules/apiClient/constants.d.ts +8 -0
- package/dist/modules/apiClient/constants.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts +11 -1
- package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts.map +1 -1
- package/dist/modules/auth/isSignedIn/isSignedIn.d.ts +9 -0
- package/dist/modules/auth/isSignedIn/isSignedIn.d.ts.map +1 -1
- package/dist/modules/auth/logout/logout.d.ts +13 -0
- package/dist/modules/auth/logout/logout.d.ts.map +1 -1
- package/dist/modules/auth/mergeUserAccounts/index.d.ts +3 -0
- package/dist/modules/auth/mergeUserAccounts/index.d.ts.map +1 -0
- package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts +62 -0
- package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts.map +1 -0
- package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.types.d.ts +78 -0
- package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.types.d.ts.map +1 -0
- package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +7 -0
- package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +9 -0
- package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/authenticateWithSocial/authenticateWithSocial.d.ts +8 -0
- package/dist/modules/auth/social/oauth/authenticateWithSocial/authenticateWithSocial.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts +34 -0
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/index.d.ts +2 -0
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/index.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts +11 -0
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/detectSocialRedirectUrl/detectSocialRedirectUrl.d.ts +0 -1
- package/dist/modules/auth/social/oauth/detectSocialRedirectUrl/detectSocialRedirectUrl.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.d.ts +12 -0
- package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/signInWithSocialRedirect/signInWithSocialRedirect.d.ts +10 -0
- package/dist/modules/auth/social/oauth/signInWithSocialRedirect/signInWithSocialRedirect.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -1
- package/dist/modules/captcha/CaptchaProviderEnum/CaptchaProviderEnum.d.ts +37 -0
- package/dist/modules/captcha/CaptchaProviderEnum/CaptchaProviderEnum.d.ts.map +1 -0
- package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.d.ts +41 -5
- package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.d.ts.map +1 -1
- package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.types.d.ts +22 -0
- package/dist/modules/captcha/getCaptchaSettings/getCaptchaSettings.types.d.ts.map +1 -0
- package/dist/modules/captcha/getCaptchaSettings/index.d.ts +1 -1
- package/dist/modules/captcha/getCaptchaSettings/index.d.ts.map +1 -1
- package/dist/modules/clientEvents/clientEvents.d.ts +34 -0
- package/dist/modules/clientEvents/clientEvents.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/clearDeviceRegistrationRedirectParams.d.ts +35 -0
- package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/clearDeviceRegistrationRedirectParams.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts +8 -1
- package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts.map +1 -1
- package/dist/modules/flow/cancelFlow/cancelFlow.d.ts +10 -3
- package/dist/modules/flow/cancelFlow/cancelFlow.d.ts.map +1 -1
- package/dist/modules/flow/getFlow/getFlow.d.ts +11 -3
- package/dist/modules/flow/getFlow/getFlow.d.ts.map +1 -1
- package/dist/modules/flow/getFlowQuote/getFlowQuote.d.ts +16 -3
- package/dist/modules/flow/getFlowQuote/getFlowQuote.d.ts.map +1 -1
- package/dist/modules/initializeClient/initializeClient.d.ts +16 -0
- package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts +12 -2
- package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts.map +1 -1
- package/dist/modules/otp/sendEmailOTP/sendEmailOTP.d.ts +14 -0
- package/dist/modules/otp/sendEmailOTP/sendEmailOTP.d.ts.map +1 -1
- package/dist/modules/otp/sendSmsOTP/sendSmsOTP.d.ts +12 -0
- package/dist/modules/otp/sendSmsOTP/sendSmsOTP.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +33 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts.map +1 -1
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +8 -0
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
- package/dist/modules/user/checkUserScopes/checkUserScopes.d.ts +28 -0
- package/dist/modules/user/checkUserScopes/checkUserScopes.d.ts.map +1 -0
- package/dist/modules/user/checkUserScopes/index.d.ts +2 -0
- package/dist/modules/user/checkUserScopes/index.d.ts.map +1 -0
- package/dist/modules/user/deleteUser/deleteUser.d.ts +8 -0
- package/dist/modules/user/deleteUser/deleteUser.d.ts.map +1 -1
- package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts +8 -1
- package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts.map +1 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts +17 -3
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
- package/dist/modules/user/refreshUser/refreshUser.d.ts +16 -3
- package/dist/modules/user/refreshUser/refreshUser.d.ts.map +1 -1
- package/dist/modules/user/user.types.d.ts +9 -1
- package/dist/modules/user/user.types.d.ts.map +1 -1
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.d.ts +30 -0
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.d.ts.map +1 -0
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/index.d.ts +2 -0
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/index.d.ts.map +1 -0
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.d.ts +23 -0
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.d.ts.map +1 -0
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/index.d.ts +2 -0
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/index.d.ts.map +1 -0
- package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts +11 -1
- package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts.map +1 -1
- package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts +11 -3
- package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts.map +1 -1
- package/dist/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.d.ts +16 -3
- package/dist/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/getConnectedAddresses/getConnectedAddresses.d.ts +9 -1
- package/dist/modules/wallets/getConnectedAddresses/getConnectedAddresses.d.ts.map +1 -1
- package/dist/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts +11 -1
- package/dist/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts.map +1 -1
- package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts +9 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts.map +1 -1
- package/dist/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.d.ts +10 -2
- package/dist/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts +8 -0
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts +8 -0
- package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts.map +1 -1
- package/dist/modules/wallets/networks/switchActiveNetwork/switchActiveNetwork.d.ts +11 -1
- package/dist/modules/wallets/networks/switchActiveNetwork/switchActiveNetwork.d.ts.map +1 -1
- package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts +10 -0
- package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts.map +1 -1
- package/dist/modules/wallets/removeWalletAccount/removeWalletAccount.d.ts +9 -1
- package/dist/modules/wallets/removeWalletAccount/removeWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts +24 -0
- package/dist/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/index.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/getSelectedWalletAccount.d.ts +30 -0
- package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/getSelectedWalletAccount.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/index.d.ts +2 -0
- package/dist/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/index.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/index.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts +28 -0
- package/dist/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/index.d.ts +2 -0
- package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/index.d.ts.map +1 -0
- package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/setSelectedWalletAccount.d.ts +34 -0
- package/dist/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/setSelectedWalletAccount.d.ts.map +1 -0
- package/dist/modules/wallets/signMessage/signMessage.d.ts +12 -1
- package/dist/modules/wallets/signMessage/signMessage.d.ts.map +1 -1
- package/dist/modules/wallets/transferAmount/transferAmount.d.ts +13 -2
- package/dist/modules/wallets/transferAmount/transferAmount.d.ts.map +1 -1
- package/dist/modules/wallets/transferWalletAccount/transferWalletAccount.d.ts +10 -1
- package/dist/modules/wallets/transferWalletAccount/transferWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/utils/getWalletAccountFromAddress/getWalletAccountFromAddress.d.ts +11 -1
- package/dist/modules/wallets/utils/getWalletAccountFromAddress/getWalletAccountFromAddress.d.ts.map +1 -1
- package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts +1 -0
- package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts.map +1 -1
- package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts +12 -1
- package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts.map +1 -1
- package/dist/services/storage/createLocalStorageAdapter/createLocalStorageAdapter.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-Deg9em9o.cjs → updateAuthFromVerifyResponse-CY0xTIXF.cjs} +93 -17
- package/dist/updateAuthFromVerifyResponse-CY0xTIXF.cjs.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-wVY_DoiL.native.esm.js → updateAuthFromVerifyResponse-D4au3jUv.native.esm.js} +93 -17
- package/dist/updateAuthFromVerifyResponse-D4au3jUv.native.esm.js.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-BQes11vz.esm.js → updateAuthFromVerifyResponse-inxvMWJB.esm.js} +93 -17
- package/dist/updateAuthFromVerifyResponse-inxvMWJB.esm.js.map +1 -0
- package/dist/waas.cjs +72 -5
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +70 -5
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +70 -5
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +6 -6
- package/dist/waasCore.esm.js +6 -6
- package/dist/waasCore.native.esm.js +6 -6
- package/package.json +3 -3
- package/dist/getNetworkProviderFromNetworkId-C6DBO0OX.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CEs4SGW4.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CMIgKqEH.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-BQuXZne_.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-BaY09iv6.native.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-BlVIlXMZ.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-Dghiguch.cjs.map +0 -1
- package/dist/isMfaRequiredForAction-r9aDdmK5.esm.js.map +0 -1
- package/dist/modules/wallets/primaryWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts +0 -10
- package/dist/modules/wallets/primaryWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.d.ts.map +0 -1
- package/dist/modules/wallets/primaryWalletAccount/getPrimaryWalletAccount/index.d.ts.map +0 -1
- package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/index.d.ts.map +0 -1
- package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts +0 -12
- package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts.map +0 -1
- package/dist/updateAuthFromVerifyResponse-BQes11vz.esm.js.map +0 -1
- package/dist/updateAuthFromVerifyResponse-Deg9em9o.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-wVY_DoiL.native.esm.js.map +0 -1
- /package/dist/modules/wallets/{primaryWalletAccount → selectedWalletAccount}/getPrimaryWalletAccount/index.d.ts +0 -0
- /package/dist/modules/wallets/{primaryWalletAccount → selectedWalletAccount}/selectPrimaryWalletAccount/index.d.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
2
|
-
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-
|
|
3
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
4
|
-
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-
|
|
5
|
-
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-
|
|
6
|
-
const require_getWalletProviderByKey = require('./getWalletProviderByKey-
|
|
1
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-CHeYEkjj.cjs');
|
|
2
|
+
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CY0xTIXF.cjs');
|
|
3
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DmH039jx.cjs');
|
|
4
|
+
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-Dmbdiybh.cjs');
|
|
5
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-CruwjMvs.cjs');
|
|
6
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-CSVSMios.cjs');
|
|
7
7
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
8
8
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
9
9
|
let zod_mini = require("zod/mini");
|
|
@@ -355,13 +355,26 @@ const initializeStorageSync = async (client) => {
|
|
|
355
355
|
//#endregion
|
|
356
356
|
//#region src/modules/user/refreshUser/refreshUser.ts
|
|
357
357
|
/**
|
|
358
|
-
* Refreshes the current user's
|
|
358
|
+
* Refreshes the current user's profile from the server.
|
|
359
359
|
*
|
|
360
|
-
* This
|
|
361
|
-
*
|
|
360
|
+
* This fetches the latest authenticated user from the backend and updates only
|
|
361
|
+
* the local user state, returning the `SdkUser`. It does not touch the auth
|
|
362
|
+
* token — use it when you just need up-to-date user data.
|
|
363
|
+
*
|
|
364
|
+
* Prefer `refreshAuth` when you need to rotate the auth token as well: it runs
|
|
365
|
+
* a full verify, updates both token and user state, and returns the raw
|
|
366
|
+
* `VerifyResponse` (including the new token).
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* const user = await refreshUser();
|
|
371
|
+
* console.log('Updated user:', user.email);
|
|
372
|
+
* ```
|
|
362
373
|
*
|
|
363
374
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
364
375
|
* @returns A promise that resolves to the authenticated user.
|
|
376
|
+
* @see refreshAuth
|
|
377
|
+
* @see deleteUser
|
|
365
378
|
* @instrumented
|
|
366
379
|
* @noHook Low-level refresh primitive that is not exposed as a React hook.
|
|
367
380
|
*/
|
|
@@ -412,9 +425,25 @@ var ClientAlreadyInitializedError = class extends require_updateAuthFromVerifyRe
|
|
|
412
425
|
*
|
|
413
426
|
* You only need to call this function if you are not using `autoInitialize: true` in createDynamicClient.
|
|
414
427
|
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```ts
|
|
430
|
+
* const client = createDynamicClient({
|
|
431
|
+
* environmentId: 'env-id',
|
|
432
|
+
* autoInitialize: false,
|
|
433
|
+
* });
|
|
434
|
+
*
|
|
435
|
+
* try {
|
|
436
|
+
* await initializeClient(client);
|
|
437
|
+
* } catch (error) {
|
|
438
|
+
* console.error('Failed to initialize:', error);
|
|
439
|
+
* }
|
|
440
|
+
* ```
|
|
441
|
+
*
|
|
415
442
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
416
443
|
* @returns A promise that resolves when initialization is complete.
|
|
417
444
|
* @throws ClientAlreadyInitializedError If the client is already initialized.
|
|
445
|
+
* @see createDynamicClient
|
|
446
|
+
* @see waitForClientInitialized
|
|
418
447
|
* @instrumented
|
|
419
448
|
* @noHook Client lifecycle management is not exposed as a React hook.
|
|
420
449
|
*/
|
|
@@ -596,20 +625,6 @@ const createAsyncTrack = () => {
|
|
|
596
625
|
/** @notInstrumented */
|
|
597
626
|
const createEventEmitter = () => new eventemitter3.default();
|
|
598
627
|
|
|
599
|
-
//#endregion
|
|
600
|
-
//#region src/errors/UnavailableInServerSideError.ts
|
|
601
|
-
var UnavailableInServerSideError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
602
|
-
constructor(unavailableFeature) {
|
|
603
|
-
super({
|
|
604
|
-
cause: null,
|
|
605
|
-
code: "unavailable_in_server_side_error",
|
|
606
|
-
docsUrl: null,
|
|
607
|
-
name: "UnavailableInServerSideError",
|
|
608
|
-
shortMessage: `This function is not available in server-side rendering: ${unavailableFeature}`
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
};
|
|
612
|
-
|
|
613
628
|
//#endregion
|
|
614
629
|
//#region src/services/fetch/createWebFetch.ts
|
|
615
630
|
/**
|
|
@@ -617,7 +632,7 @@ var UnavailableInServerSideError = class extends require_updateAuthFromVerifyRes
|
|
|
617
632
|
* @notInstrumented
|
|
618
633
|
*/
|
|
619
634
|
const createWebFetch = () => {
|
|
620
|
-
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new UnavailableInServerSideError("createWebFetch"));
|
|
635
|
+
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new require_getNetworkProviderFromNetworkId.UnavailableInServerSideError("createWebFetch"));
|
|
621
636
|
return window.fetch.bind(window);
|
|
622
637
|
};
|
|
623
638
|
|
|
@@ -749,7 +764,7 @@ const createDynamicTransport = (params) => {
|
|
|
749
764
|
* @notInstrumented
|
|
750
765
|
*/
|
|
751
766
|
const createNavigationHandler = () => {
|
|
752
|
-
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new UnavailableInServerSideError("createNavigationHandler"));
|
|
767
|
+
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new require_getNetworkProviderFromNetworkId.UnavailableInServerSideError("createNavigationHandler"));
|
|
753
768
|
return async (url) => {
|
|
754
769
|
require_getNetworkProviderFromNetworkId.assertSafeNavigationUrl(url);
|
|
755
770
|
window.location.href = url;
|
|
@@ -829,7 +844,7 @@ const assertSafeDeeplinkUrl = (url) => {
|
|
|
829
844
|
* @notInstrumented
|
|
830
845
|
*/
|
|
831
846
|
const createWebDeeplinkOpener = () => {
|
|
832
|
-
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new UnavailableInServerSideError("createWebDeeplinkOpener"));
|
|
847
|
+
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) return () => Promise.reject(new require_getNetworkProviderFromNetworkId.UnavailableInServerSideError("createWebDeeplinkOpener"));
|
|
833
848
|
return async (url) => {
|
|
834
849
|
assertSafeDeeplinkUrl(url);
|
|
835
850
|
window.location.assign(url);
|
|
@@ -1098,8 +1113,18 @@ const createCore = (config) => {
|
|
|
1098
1113
|
* Manually calling `initializeClient` also allows you to catch any potential
|
|
1099
1114
|
* errors that may occur during initialization.
|
|
1100
1115
|
*
|
|
1116
|
+
* @example
|
|
1117
|
+
* ```ts
|
|
1118
|
+
* const client = createDynamicClient({
|
|
1119
|
+
* environmentId: 'your-environment-id',
|
|
1120
|
+
* appUrl: 'https://myapp.com',
|
|
1121
|
+
* });
|
|
1122
|
+
* ```
|
|
1123
|
+
*
|
|
1101
1124
|
* @param config - The configuration for the Dynamic client, like the environment ID, app url, etc.
|
|
1102
1125
|
* @returns The Dynamic client instance.
|
|
1126
|
+
* @see initializeClient
|
|
1127
|
+
* @see getDefaultClient
|
|
1103
1128
|
* @instrumented
|
|
1104
1129
|
*/
|
|
1105
1130
|
const createDynamicClient = (config) => {
|
|
@@ -1190,6 +1215,27 @@ var DeeplinkConnectAndVerifyUnsupportedError = class extends require_updateAuthF
|
|
|
1190
1215
|
|
|
1191
1216
|
//#endregion
|
|
1192
1217
|
//#region src/errors/DeviceRegistrationIdentityMismatchError.ts
|
|
1218
|
+
/**
|
|
1219
|
+
* Thrown when completing device registration would replace the current session
|
|
1220
|
+
* with a different user's identity.
|
|
1221
|
+
*
|
|
1222
|
+
* The device registration token resolved to a user other than the one currently
|
|
1223
|
+
* authenticated, which can indicate a login-CSRF / session-fixation attempt, so
|
|
1224
|
+
* the returned session is rejected and the current session is left untouched.
|
|
1225
|
+
*
|
|
1226
|
+
* @example
|
|
1227
|
+
* ```ts
|
|
1228
|
+
* try {
|
|
1229
|
+
* await completeDeviceRegistration({ token });
|
|
1230
|
+
* } catch (error) {
|
|
1231
|
+
* if (error instanceof DeviceRegistrationIdentityMismatchError) {
|
|
1232
|
+
* // The current session was preserved; ask the user to retry on this device.
|
|
1233
|
+
* }
|
|
1234
|
+
* }
|
|
1235
|
+
* ```
|
|
1236
|
+
* @see completeDeviceRegistration
|
|
1237
|
+
* @see InvalidDeviceRegistrationRedirectError
|
|
1238
|
+
*/
|
|
1193
1239
|
var DeviceRegistrationIdentityMismatchError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1194
1240
|
constructor() {
|
|
1195
1241
|
super({
|
|
@@ -1688,9 +1734,19 @@ const __requestExternalAuthElevatedToken_wrapped = require_updateAuthFromVerifyR
|
|
|
1688
1734
|
* This function allows authentication using JWT tokens from external providers,
|
|
1689
1735
|
* enabling integration with custom authentication systems.
|
|
1690
1736
|
*
|
|
1737
|
+
* @example
|
|
1738
|
+
* ```ts
|
|
1739
|
+
* const response = await signInWithExternalJwt({
|
|
1740
|
+
* externalJwt: 'eyJhbGciOiJSUzI1NiIs...',
|
|
1741
|
+
* });
|
|
1742
|
+
* ```
|
|
1743
|
+
*
|
|
1691
1744
|
* @param [params.externalJwt] - Optional external JWT token to authenticate with. Not required when using cookie based auth.
|
|
1745
|
+
* @param [params.sessionPublicKey] - Optional session public key for session-based auth.
|
|
1692
1746
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1693
1747
|
* @returns A promise that resolves to the authentication response from the server.
|
|
1748
|
+
* @see logout
|
|
1749
|
+
* @see refreshAuth
|
|
1694
1750
|
* @instrumented
|
|
1695
1751
|
*/
|
|
1696
1752
|
const signInWithExternalJwt = async ({ externalJwt, sessionPublicKey } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -1723,8 +1779,21 @@ const __signInWithExternalJwt_wrapped = require_updateAuthFromVerifyResponse.ins
|
|
|
1723
1779
|
/**
|
|
1724
1780
|
* Logs out the current user and clears all authentication data.
|
|
1725
1781
|
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* await logout();
|
|
1785
|
+
* ```
|
|
1786
|
+
*
|
|
1787
|
+
* @example
|
|
1788
|
+
* ```ts
|
|
1789
|
+
* // With explicit client for multi-client setups
|
|
1790
|
+
* await logout(myClient);
|
|
1791
|
+
* ```
|
|
1792
|
+
*
|
|
1726
1793
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1727
1794
|
* @returns A promise that resolves when the logout process is complete.
|
|
1795
|
+
* @see isAnyWalletAccountConnected
|
|
1796
|
+
* @see refreshAuth
|
|
1728
1797
|
* @notInstrumented
|
|
1729
1798
|
*/
|
|
1730
1799
|
const logout = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -1737,6 +1806,58 @@ const logout = async (client = require_updateAuthFromVerifyResponse.getDefaultCl
|
|
|
1737
1806
|
return require_isMfaRequiredForAction.__logoutWithReason_wrapped({ reason: "user-intent" }, client);
|
|
1738
1807
|
};
|
|
1739
1808
|
|
|
1809
|
+
//#endregion
|
|
1810
|
+
//#region src/modules/auth/mergeUserAccounts/mergeUserAccounts.ts
|
|
1811
|
+
/**
|
|
1812
|
+
* Completes an account merge after a credential was found to already belong to
|
|
1813
|
+
* another user (surfaced as `MergeAccountsConfirmationError` during
|
|
1814
|
+
* verification / linking).
|
|
1815
|
+
*
|
|
1816
|
+
* When the merge has no field-level conflicts, call it with no resolutions to
|
|
1817
|
+
* merge directly. When the two accounts hold different values for the same
|
|
1818
|
+
* profile field, pass the user's chosen `conflictResolutions` (one per
|
|
1819
|
+
* conflict) so the backend knows which value to keep. On success the two users
|
|
1820
|
+
* are folded into one, the merged session is persisted, and the merged user is
|
|
1821
|
+
* returned.
|
|
1822
|
+
*
|
|
1823
|
+
* @example
|
|
1824
|
+
* ```ts
|
|
1825
|
+
* try {
|
|
1826
|
+
* await verifyWalletAccount({ walletAccount });
|
|
1827
|
+
* } catch (error) {
|
|
1828
|
+
* if (error instanceof MergeAccountsConfirmationError) {
|
|
1829
|
+
* // resolveConflicts is your own function (not provided by the SDK): given
|
|
1830
|
+
* // the conflicting fields, decide which value to keep for each one —
|
|
1831
|
+
* // usually by prompting the user — and return them as MergeUserConflictResolution[].
|
|
1832
|
+
* await mergeUserAccounts(
|
|
1833
|
+
* error.mergeConflicts
|
|
1834
|
+
* ? { conflictResolutions: resolveConflicts(error.mergeConflicts) }
|
|
1835
|
+
* : undefined,
|
|
1836
|
+
* );
|
|
1837
|
+
* }
|
|
1838
|
+
* }
|
|
1839
|
+
* ```
|
|
1840
|
+
* @param params.conflictResolutions - Optional per-field conflict resolutions.
|
|
1841
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1842
|
+
* @returns A promise that resolves to the merged user.
|
|
1843
|
+
* @see MergeAccountsConfirmationError
|
|
1844
|
+
* @see MergeUserConflictResolution
|
|
1845
|
+
* @notInstrumented
|
|
1846
|
+
*/
|
|
1847
|
+
const mergeUserAccounts = async ({ conflictResolutions } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1848
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1849
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
1850
|
+
const hasConflictResolutions = conflictResolutions !== void 0 && conflictResolutions.length > 0;
|
|
1851
|
+
let response;
|
|
1852
|
+
if (hasConflictResolutions) response = await apiClient.verifyMergeUsers({
|
|
1853
|
+
environmentId: core.environmentId,
|
|
1854
|
+
mergeUserConflictResolutions: { mergeUserResolutions: conflictResolutions }
|
|
1855
|
+
});
|
|
1856
|
+
else response = await apiClient.mergeUsers({ environmentId: core.environmentId });
|
|
1857
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
1858
|
+
return response.user;
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1740
1861
|
//#endregion
|
|
1741
1862
|
//#region src/modules/auth/passkeys/deletePasskey/deletePasskey.ts
|
|
1742
1863
|
/**
|
|
@@ -1822,10 +1943,17 @@ const serverRegisterPasskey = async ({ registration, createMfaToken }, client) =
|
|
|
1822
1943
|
* passwordless authentication. The user will be prompted to create a passkey
|
|
1823
1944
|
* using their device's biometric authentication or security key.
|
|
1824
1945
|
*
|
|
1946
|
+
* @example
|
|
1947
|
+
* ```ts
|
|
1948
|
+
* await registerPasskey();
|
|
1949
|
+
* ```
|
|
1950
|
+
*
|
|
1825
1951
|
* @param [params.createMfaToken] - Optional configuration for MFA token creation.
|
|
1826
1952
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1827
1953
|
* @returns A promise that resolves to the registration response.
|
|
1828
1954
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1955
|
+
* @see signInWithPasskey
|
|
1956
|
+
* @see getPasskeys
|
|
1829
1957
|
* @instrumented
|
|
1830
1958
|
*/
|
|
1831
1959
|
const registerPasskey = async ({ createMfaToken } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -1890,9 +2018,18 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client) =
|
|
|
1890
2018
|
* credential, providing passwordless authentication using biometrics or
|
|
1891
2019
|
* security keys.
|
|
1892
2020
|
*
|
|
2021
|
+
* @example
|
|
2022
|
+
* ```ts
|
|
2023
|
+
* const response = await signInWithPasskey();
|
|
2024
|
+
* console.log('Signed in:', response.user.email);
|
|
2025
|
+
* ```
|
|
2026
|
+
*
|
|
2027
|
+
* @param [params.relatedOriginRpId] - Optional relying party ID for cross-origin authentication.
|
|
1893
2028
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1894
2029
|
* @returns A promise that resolves to the authentication response.
|
|
1895
2030
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
2031
|
+
* @see registerPasskey
|
|
2032
|
+
* @see getPasskeys
|
|
1896
2033
|
* @instrumented
|
|
1897
2034
|
*/
|
|
1898
2035
|
const signInWithPasskey = async ({ relatedOriginRpId } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -2088,9 +2225,19 @@ const buildOAuthUrl = async (core, provider) => {
|
|
|
2088
2225
|
* back because of this flow, then call `completeSocialRedirect` to finish
|
|
2089
2226
|
* the social authentication.
|
|
2090
2227
|
*
|
|
2228
|
+
* @example
|
|
2229
|
+
* ```ts
|
|
2230
|
+
* await signInWithSocialRedirect({
|
|
2231
|
+
* provider: 'google',
|
|
2232
|
+
* redirectUrl: window.location.href,
|
|
2233
|
+
* });
|
|
2234
|
+
* ```
|
|
2235
|
+
*
|
|
2091
2236
|
* @param params.provider - The social provider to authenticate with (e.g., 'google', 'github').
|
|
2092
2237
|
* @param params.redirectUrl - The URL to redirect back to after authentication.
|
|
2093
2238
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2239
|
+
* @see completeSocialRedirect
|
|
2240
|
+
* @see detectSocialRedirectUrl
|
|
2094
2241
|
* @instrumented
|
|
2095
2242
|
*/
|
|
2096
2243
|
const signInWithSocialRedirect = async ({ provider, redirectUrl }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -2133,6 +2280,14 @@ const __signInWithSocialRedirect_wrapped = require_updateAuthFromVerifyResponse.
|
|
|
2133
2280
|
* @deprecated Renamed to {@link signInWithSocialRedirect}. This alias will be
|
|
2134
2281
|
* removed in a future major version.
|
|
2135
2282
|
*
|
|
2283
|
+
* @example
|
|
2284
|
+
* ```ts
|
|
2285
|
+
* // Prefer signInWithSocialRedirect instead
|
|
2286
|
+
* await signInWithSocialRedirect({ provider: 'google', redirectUrl: window.location.href });
|
|
2287
|
+
* ```
|
|
2288
|
+
*
|
|
2289
|
+
* @see signInWithSocialRedirect
|
|
2290
|
+
* @see completeSocialRedirect
|
|
2136
2291
|
* @instrumented
|
|
2137
2292
|
* @noHook Deprecated alias that is not exposed as a React hook.
|
|
2138
2293
|
*/
|
|
@@ -2150,6 +2305,45 @@ const __authenticateWithSocial_wrapped = require_updateAuthFromVerifyResponse.in
|
|
|
2150
2305
|
}
|
|
2151
2306
|
});
|
|
2152
2307
|
|
|
2308
|
+
//#endregion
|
|
2309
|
+
//#region src/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.ts
|
|
2310
|
+
/**
|
|
2311
|
+
* Removes the social OAuth redirect parameters that `signInWithSocialRedirect`
|
|
2312
|
+
* appends to the return URL from the browser's current URL, leaving every other
|
|
2313
|
+
* query parameter, the path, and the hash untouched.
|
|
2314
|
+
*
|
|
2315
|
+
* Call this once you have finished `completeSocialRedirect` so a page refresh
|
|
2316
|
+
* doesn't re-trigger the redirect flow. Unlike clearing the whole query
|
|
2317
|
+
* string, this preserves any of your own parameters on the callback URL.
|
|
2318
|
+
*
|
|
2319
|
+
* This reads and rewrites `window.location`, so it can only run in the
|
|
2320
|
+
* browser. Calling it during server-side rendering (no `window`) throws
|
|
2321
|
+
* `UnavailableInServerSideError`.
|
|
2322
|
+
*
|
|
2323
|
+
* @returns Nothing. The current URL is rewritten in place via
|
|
2324
|
+
* `window.history.replaceState`.
|
|
2325
|
+
*
|
|
2326
|
+
* @throws {UnavailableInServerSideError} When called without a `window`
|
|
2327
|
+
* (e.g. during server-side rendering).
|
|
2328
|
+
*
|
|
2329
|
+
* @example
|
|
2330
|
+
* ```ts
|
|
2331
|
+
* await completeSocialRedirect({ url: new URL(window.location.href) });
|
|
2332
|
+
* clearSocialRedirectParams();
|
|
2333
|
+
* ```
|
|
2334
|
+
*
|
|
2335
|
+
* @see {@link completeSocialRedirect} to finish the redirect sign-in before
|
|
2336
|
+
* clearing the parameters.
|
|
2337
|
+
* @see {@link detectSocialRedirectUrl} to check whether the current URL is a
|
|
2338
|
+
* social OAuth callback.
|
|
2339
|
+
*
|
|
2340
|
+
* @notInstrumented
|
|
2341
|
+
*/
|
|
2342
|
+
const clearSocialRedirectParams = () => {
|
|
2343
|
+
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) throw new require_getNetworkProviderFromNetworkId.UnavailableInServerSideError("clearSocialRedirectParams");
|
|
2344
|
+
window.history.replaceState({}, "", removeDynamicOauthParamsFromUrl(window.location.href));
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2153
2347
|
//#endregion
|
|
2154
2348
|
//#region src/modules/auth/social/oauth/processSocialCallback/processSocialCallback.ts
|
|
2155
2349
|
/**
|
|
@@ -2231,12 +2425,23 @@ const __processSocialCallback_wrapped = require_updateAuthFromVerifyResponse.ins
|
|
|
2231
2425
|
* authenticating (or linking) the user with the social provider. This is the
|
|
2232
2426
|
* final step after `signInWithSocialRedirect` + `detectSocialRedirectUrl`.
|
|
2233
2427
|
*
|
|
2428
|
+
* @example
|
|
2429
|
+
* ```ts
|
|
2430
|
+
* const redirectUrl = detectSocialRedirectUrl();
|
|
2431
|
+
* if (redirectUrl) {
|
|
2432
|
+
* const user = await completeSocialRedirect({ url: redirectUrl });
|
|
2433
|
+
* }
|
|
2434
|
+
* ```
|
|
2435
|
+
*
|
|
2234
2436
|
* @param params.url - The callback URL containing OAuth response parameters.
|
|
2235
2437
|
* @param [params.requestedScopes] - Optional scopes to request an elevated access token when verifying (linking) a social account.
|
|
2236
2438
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2237
2439
|
* @returns A promise that resolves to the authenticated user or null.
|
|
2238
2440
|
* @throws MissingSocialUrlParamError If required OAuth parameters are missing.
|
|
2239
2441
|
* @throws InvalidRedirectStorageStateError If the stored state doesn't match.
|
|
2442
|
+
* @see signInWithSocialRedirect
|
|
2443
|
+
* @see detectSocialRedirectUrl
|
|
2444
|
+
* @see clearSocialRedirectParams
|
|
2240
2445
|
* @instrumented
|
|
2241
2446
|
*/
|
|
2242
2447
|
const completeSocialRedirect = ({ url, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => __processSocialCallback_wrapped({
|
|
@@ -2292,7 +2497,6 @@ const __completeSocialAuthentication_wrapped = require_updateAuthFromVerifyRespo
|
|
|
2292
2497
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2293
2498
|
* @returns A promise that resolves to true if the URL is an OAuth redirect, false otherwise.
|
|
2294
2499
|
* @notInstrumented
|
|
2295
|
-
* @noHook Low-level redirect-detection primitive that is not exposed as a React hook.
|
|
2296
2500
|
*/
|
|
2297
2501
|
const detectSocialRedirectUrl = async ({ url }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2298
2502
|
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
@@ -2324,7 +2528,19 @@ const detectOAuthRedirect = (params, client = require_updateAuthFromVerifyRespon
|
|
|
2324
2528
|
* {@link signInWithSocialRedirect} + {@link completeSocialRedirect} instead —
|
|
2325
2529
|
* the browser already owns the tab so there is no popup to open.
|
|
2326
2530
|
*
|
|
2531
|
+
* @example
|
|
2532
|
+
* ```ts
|
|
2533
|
+
* // React Native only
|
|
2534
|
+
* const user = await signInWithSocialPopUp({ provider: 'google' });
|
|
2535
|
+
* ```
|
|
2536
|
+
*
|
|
2537
|
+
* @param params.provider - The social provider to authenticate with.
|
|
2538
|
+
* @param [params.requestedScopes] - Optional scopes to request from the provider.
|
|
2539
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2540
|
+
* @returns A promise that resolves to the authenticated user or null.
|
|
2327
2541
|
* @throws MethodNotImplementedError Always on web.
|
|
2542
|
+
* @see signInWithSocialRedirect
|
|
2543
|
+
* @see completeSocialRedirect
|
|
2328
2544
|
* @instrumented
|
|
2329
2545
|
*/
|
|
2330
2546
|
const signInWithSocialPopUp = async ({ provider, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -2344,19 +2560,39 @@ const __signInWithSocialPopUp_wrapped = require_updateAuthFromVerifyResponse.ins
|
|
|
2344
2560
|
});
|
|
2345
2561
|
|
|
2346
2562
|
//#endregion
|
|
2347
|
-
//#region src/modules/wallets/
|
|
2563
|
+
//#region src/modules/wallets/selectedWalletAccount/getSelectedWalletAccount/getSelectedWalletAccount.ts
|
|
2348
2564
|
/**
|
|
2349
|
-
* Get the
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2352
|
-
*
|
|
2565
|
+
* Get the wallet account currently selected for the user.
|
|
2566
|
+
*
|
|
2567
|
+
* The SDK itself does not use or care about which wallet is "selected" — it has
|
|
2568
|
+
* no bearing on authentication, signing, or any other SDK behaviour. This is
|
|
2569
|
+
* purely a convenience for *reading* which wallet the user most recently
|
|
2570
|
+
* selected (derived from the backend `lastSelectedAt` timestamp, across both
|
|
2571
|
+
* unverified and verified wallet accounts). Applications that need a notion of
|
|
2572
|
+
* an active/current wallet should own that selection state themselves.
|
|
2573
|
+
*
|
|
2574
|
+
* The one exception is the wagmi integration (`@dynamic-labs-sdk/wagmi`), which
|
|
2575
|
+
* mirrors the selected EVM wallet into wagmi's connector state.
|
|
2576
|
+
*
|
|
2577
|
+
* @example
|
|
2578
|
+
* ```ts
|
|
2579
|
+
* const selected = getSelectedWalletAccount();
|
|
2580
|
+
* if (selected) {
|
|
2581
|
+
* console.log('Selected wallet:', selected.address);
|
|
2582
|
+
* }
|
|
2583
|
+
* ```
|
|
2584
|
+
*
|
|
2585
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2586
|
+
* @returns The selected wallet account, or null if no wallet has been selected.
|
|
2587
|
+
* @see setSelectedWalletAccount
|
|
2588
|
+
* @see getWalletAccounts
|
|
2353
2589
|
* @notInstrumented
|
|
2354
2590
|
*/
|
|
2355
|
-
const
|
|
2591
|
+
const getSelectedWalletAccount = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2356
2592
|
const sortedLastSelectedWalletAccounts = require_updateAuthFromVerifyResponse.getWalletAccounts(client).filter((walletAccount) => Boolean(walletAccount.lastSelectedAt)).sort((a, b) => b.lastSelectedAt.getTime() - a.lastSelectedAt.getTime());
|
|
2357
2593
|
if (sortedLastSelectedWalletAccounts.length === 0) return null;
|
|
2358
|
-
const [
|
|
2359
|
-
return
|
|
2594
|
+
const [selectedWallet] = sortedLastSelectedWalletAccounts;
|
|
2595
|
+
return selectedWallet;
|
|
2360
2596
|
};
|
|
2361
2597
|
|
|
2362
2598
|
//#endregion
|
|
@@ -2378,9 +2614,9 @@ const getPrimaryWalletAccount = (client = require_updateAuthFromVerifyResponse.g
|
|
|
2378
2614
|
const unlinkSocialAccount = async ({ verifiedCredentialId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2379
2615
|
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2380
2616
|
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink }, client);
|
|
2381
|
-
const
|
|
2382
|
-
const walletId =
|
|
2383
|
-
const isEmbeddedWallet = !!
|
|
2617
|
+
const selectedWallet = getSelectedWalletAccount(client);
|
|
2618
|
+
const walletId = selectedWallet?.verifiedCredentialId?.replace("-zerodev", "") ?? void 0;
|
|
2619
|
+
const isEmbeddedWallet = !!selectedWallet && require_getWalletProviderByKey.getVerifiedCredentialForWalletAccount({ walletAccount: selectedWallet }, client)?.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet;
|
|
2384
2620
|
const response = await apiClient.verifyUnlink({
|
|
2385
2621
|
environmentId: core.environmentId,
|
|
2386
2622
|
verifyUnlinkRequest: {
|
|
@@ -2496,10 +2732,37 @@ const getMultichainBalances = (params, client = require_updateAuthFromVerifyResp
|
|
|
2496
2732
|
//#endregion
|
|
2497
2733
|
//#region src/modules/captcha/getCaptchaSettings/getCaptchaSettings.ts
|
|
2498
2734
|
/**
|
|
2735
|
+
* The captcha providers Dynamic can be configured to use for an environment.
|
|
2736
|
+
* Use it to branch on which captcha widget to render for the active provider.
|
|
2737
|
+
*
|
|
2738
|
+
* Redeclared locally (rather than re-exported directly from the generated
|
|
2739
|
+
* `sdk-api-core`) so the public client entry point owns its own documented,
|
|
2740
|
+
* stable surface for this token.
|
|
2741
|
+
*
|
|
2742
|
+
* @example
|
|
2743
|
+
* ```ts
|
|
2744
|
+
* const settings = getCaptchaSettings();
|
|
2745
|
+
* if (settings?.provider === CaptchaProviderEnum.Hcaptcha) {
|
|
2746
|
+
* renderHcaptcha(settings.siteKey);
|
|
2747
|
+
* }
|
|
2748
|
+
* ```
|
|
2749
|
+
* @see getCaptchaSettings
|
|
2750
|
+
* @see CaptchaSettingsResult
|
|
2751
|
+
*/
|
|
2752
|
+
const CaptchaProviderEnum = _dynamic_labs_sdk_api_core.CaptchaProviderEnum;
|
|
2753
|
+
/**
|
|
2499
2754
|
* Returns the active captcha provider and site key, or undefined if captcha is not enabled.
|
|
2500
2755
|
* Use this to determine which captcha widget to render and which site key to pass it.
|
|
2501
2756
|
*
|
|
2757
|
+
* @example
|
|
2758
|
+
* ```ts
|
|
2759
|
+
* const settings = getCaptchaSettings();
|
|
2760
|
+
* if (settings) renderCaptcha(settings.provider, settings.siteKey);
|
|
2761
|
+
* ```
|
|
2762
|
+
* @see CaptchaSettingsResult
|
|
2763
|
+
* @see CaptchaProviderEnum
|
|
2502
2764
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2765
|
+
* @returns The active captcha provider and site key, or undefined when captcha is not enabled.
|
|
2503
2766
|
* @notInstrumented
|
|
2504
2767
|
*/
|
|
2505
2768
|
const getCaptchaSettings = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -2508,13 +2771,13 @@ const getCaptchaSettings = (client = require_updateAuthFromVerifyResponse.getDef
|
|
|
2508
2771
|
const { security } = projectSettings;
|
|
2509
2772
|
if (security.captcha) {
|
|
2510
2773
|
if (security.captcha.enabled) return {
|
|
2511
|
-
provider: security.captcha.provider ??
|
|
2774
|
+
provider: security.captcha.provider ?? CaptchaProviderEnum.Hcaptcha,
|
|
2512
2775
|
siteKey: security.captcha.siteKey
|
|
2513
2776
|
};
|
|
2514
2777
|
return;
|
|
2515
2778
|
}
|
|
2516
2779
|
if (security.hCaptcha?.enabled) return {
|
|
2517
|
-
provider:
|
|
2780
|
+
provider: CaptchaProviderEnum.Hcaptcha,
|
|
2518
2781
|
siteKey: security.hCaptcha.siteKey
|
|
2519
2782
|
};
|
|
2520
2783
|
};
|
|
@@ -3078,10 +3341,59 @@ const requiresConversion = async ({ transaction }, client = require_updateAuthFr
|
|
|
3078
3341
|
return !checkout.settlementConfig.settlements.some((settlement) => settlement.chainName === transaction.fromChainName && settlement.chainId === transaction.fromChainId && settlement.tokenAddress === transaction.fromToken);
|
|
3079
3342
|
};
|
|
3080
3343
|
|
|
3344
|
+
//#endregion
|
|
3345
|
+
//#region src/modules/deviceRegistration/clearDeviceRegistrationRedirectParams/clearDeviceRegistrationRedirectParams.ts
|
|
3346
|
+
/**
|
|
3347
|
+
* Removes the device registration redirect parameters that the device
|
|
3348
|
+
* registration email link appends to the return URL from the browser's current
|
|
3349
|
+
* URL, leaving every other query parameter, the path, and the hash untouched.
|
|
3350
|
+
*
|
|
3351
|
+
* Call this once you have finished `completeDeviceRegistration` so a page
|
|
3352
|
+
* refresh doesn't re-trigger the registration flow. Unlike clearing the whole
|
|
3353
|
+
* query string, this preserves any of your own parameters on the callback URL.
|
|
3354
|
+
*
|
|
3355
|
+
* This reads and rewrites `window.location`, so it can only run in the
|
|
3356
|
+
* browser. Calling it during server-side rendering (no `window`) throws
|
|
3357
|
+
* `UnavailableInServerSideError`.
|
|
3358
|
+
*
|
|
3359
|
+
* @returns Nothing. The current URL is rewritten in place via
|
|
3360
|
+
* `window.history.replaceState`.
|
|
3361
|
+
*
|
|
3362
|
+
* @throws {UnavailableInServerSideError} When called without a `window`
|
|
3363
|
+
* (e.g. during server-side rendering).
|
|
3364
|
+
*
|
|
3365
|
+
* @example
|
|
3366
|
+
* ```ts
|
|
3367
|
+
* const deviceToken = getDeviceRegistrationTokenFromUrl({ url: window.location.href });
|
|
3368
|
+
* await completeDeviceRegistration({ deviceToken });
|
|
3369
|
+
* clearDeviceRegistrationRedirectParams();
|
|
3370
|
+
* ```
|
|
3371
|
+
*
|
|
3372
|
+
* @see {@link completeDeviceRegistration} to finish the registration before
|
|
3373
|
+
* clearing the parameters.
|
|
3374
|
+
* @see {@link detectDeviceRegistrationRedirect} to check whether the current
|
|
3375
|
+
* URL is a device registration callback.
|
|
3376
|
+
*
|
|
3377
|
+
* @notInstrumented
|
|
3378
|
+
*/
|
|
3379
|
+
const clearDeviceRegistrationRedirectParams = () => {
|
|
3380
|
+
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) throw new require_getNetworkProviderFromNetworkId.UnavailableInServerSideError("clearDeviceRegistrationRedirectParams");
|
|
3381
|
+
const url = new URL(window.location.href);
|
|
3382
|
+
url.searchParams.delete("deviceRegistrationToken");
|
|
3383
|
+
window.history.replaceState({}, "", url.toString());
|
|
3384
|
+
};
|
|
3385
|
+
|
|
3081
3386
|
//#endregion
|
|
3082
3387
|
//#region src/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.ts
|
|
3083
3388
|
const DEVICE_REGISTRATION_TOKEN_HEADER = "x-dynamic-device-registration-token";
|
|
3084
|
-
/**
|
|
3389
|
+
/**
|
|
3390
|
+
* Completes device registration using the token from a device registration
|
|
3391
|
+
* redirect, authenticating the current device against the user's account.
|
|
3392
|
+
*
|
|
3393
|
+
* @see detectDeviceRegistrationRedirect
|
|
3394
|
+
* @see clearDeviceRegistrationRedirectParams
|
|
3395
|
+
* @instrumented
|
|
3396
|
+
*/
|
|
3085
3397
|
const completeDeviceRegistration = async ({ deviceToken }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3086
3398
|
require_updateAuthFromVerifyResponse.assertDefined(deviceToken, "deviceToken is required");
|
|
3087
3399
|
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
@@ -3429,11 +3741,18 @@ const cancelFlowInstrumentation = { resolved: (flow) => ({
|
|
|
3429
3741
|
//#endregion
|
|
3430
3742
|
//#region src/modules/flow/cancelFlow/cancelFlow.ts
|
|
3431
3743
|
/**
|
|
3432
|
-
* Cancels a flow before it has been broadcasted
|
|
3744
|
+
* Cancels a flow before it has been broadcasted.
|
|
3433
3745
|
*
|
|
3434
|
-
* @
|
|
3746
|
+
* @example
|
|
3747
|
+
* ```ts
|
|
3748
|
+
* const cancelledFlow = await cancelFlow({ flowId: 'flow-abc123' });
|
|
3749
|
+
* ```
|
|
3750
|
+
*
|
|
3751
|
+
* @param params.flowId - The unique identifier of the flow to cancel.
|
|
3435
3752
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3436
|
-
* @returns
|
|
3753
|
+
* @returns A promise that resolves to the cancelled flow.
|
|
3754
|
+
* @see getFlow
|
|
3755
|
+
* @see getFlowQuote
|
|
3437
3756
|
* @instrumented
|
|
3438
3757
|
*/
|
|
3439
3758
|
const cancelFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -3466,11 +3785,19 @@ const __cancelFlow_wrapped = require_updateAuthFromVerifyResponse.instrumentFunc
|
|
|
3466
3785
|
//#endregion
|
|
3467
3786
|
//#region src/modules/flow/getFlow/getFlow.ts
|
|
3468
3787
|
/**
|
|
3469
|
-
* Fetches a flow by its ID
|
|
3788
|
+
* Fetches a flow by its ID.
|
|
3470
3789
|
*
|
|
3471
|
-
* @
|
|
3790
|
+
* @example
|
|
3791
|
+
* ```ts
|
|
3792
|
+
* const flow = await getFlow({ flowId: 'flow-abc123' });
|
|
3793
|
+
* console.log('Flow status:', flow.status);
|
|
3794
|
+
* ```
|
|
3795
|
+
*
|
|
3796
|
+
* @param params.flowId - The unique identifier of the flow to fetch.
|
|
3472
3797
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3473
|
-
* @returns
|
|
3798
|
+
* @returns A promise that resolves to the flow object.
|
|
3799
|
+
* @see cancelFlow
|
|
3800
|
+
* @see getFlowQuote
|
|
3474
3801
|
* @notInstrumented
|
|
3475
3802
|
*/
|
|
3476
3803
|
const getFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -3484,11 +3811,24 @@ const getFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse
|
|
|
3484
3811
|
//#endregion
|
|
3485
3812
|
//#region src/modules/flow/getFlowQuote/getFlowQuote.ts
|
|
3486
3813
|
/**
|
|
3487
|
-
* Fetches a quote for a flow
|
|
3814
|
+
* Fetches a quote for a flow.
|
|
3815
|
+
*
|
|
3816
|
+
* @example
|
|
3817
|
+
* ```ts
|
|
3818
|
+
* const flow = await getFlowQuote({
|
|
3819
|
+
* flowId: 'flow-abc123',
|
|
3820
|
+
* slippage: 0.5,
|
|
3821
|
+
* });
|
|
3822
|
+
* ```
|
|
3488
3823
|
*
|
|
3489
|
-
* @param params
|
|
3824
|
+
* @param params.flowId - The unique identifier of the flow.
|
|
3825
|
+
* @param [params.fromChainId] - Optional chain ID overriding the one set at attachFlowSource time.
|
|
3826
|
+
* @param [params.fromTokenAddress] - Optional token address (defaults to native token).
|
|
3827
|
+
* @param [params.slippage] - Acceptable slippage percentage.
|
|
3490
3828
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3491
|
-
* @returns
|
|
3829
|
+
* @returns A promise that resolves to the updated flow with quote data.
|
|
3830
|
+
* @see getFlow
|
|
3831
|
+
* @see cancelFlow
|
|
3492
3832
|
* @notInstrumented
|
|
3493
3833
|
*/
|
|
3494
3834
|
const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -4010,7 +4350,17 @@ const __getMoonPayUrl_wrapped = require_updateAuthFromVerifyResponse.instrumentF
|
|
|
4010
4350
|
* Allows waiting until all modules of the client have been properly initialized
|
|
4011
4351
|
* and are ready for use.
|
|
4012
4352
|
*
|
|
4013
|
-
* @
|
|
4353
|
+
* @example
|
|
4354
|
+
* ```ts
|
|
4355
|
+
* const client = createDynamicClient({ environmentId: 'env-id' });
|
|
4356
|
+
* await waitForClientInitialized(client);
|
|
4357
|
+
* // Client is now fully ready
|
|
4358
|
+
* ```
|
|
4359
|
+
*
|
|
4360
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4361
|
+
* @returns A promise that resolves once the client is fully initialized.
|
|
4362
|
+
* @see initializeClient
|
|
4363
|
+
* @see createDynamicClient
|
|
4014
4364
|
* @notInstrumented
|
|
4015
4365
|
* @noHook Client lifecycle management is not exposed as a hook; use useInitStatus.
|
|
4016
4366
|
*/
|
|
@@ -4997,9 +5347,23 @@ const __setDefaultMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instr
|
|
|
4997
5347
|
*
|
|
4998
5348
|
* Once you have the OTP code, you should then use `verifyOTP` to verify it and complete the authentication process.
|
|
4999
5349
|
*
|
|
5350
|
+
* @example
|
|
5351
|
+
* ```ts
|
|
5352
|
+
* const { verificationUUID } = await sendEmailOTP({
|
|
5353
|
+
* email: 'user@example.com',
|
|
5354
|
+
* });
|
|
5355
|
+
* // Then verify with the code the user received
|
|
5356
|
+
* await verifyOTP({
|
|
5357
|
+
* otpVerification: { email: 'user@example.com', verificationUUID },
|
|
5358
|
+
* verificationToken: '123456',
|
|
5359
|
+
* });
|
|
5360
|
+
* ```
|
|
5361
|
+
*
|
|
5000
5362
|
* @param params.email - The email address to send the OTP to.
|
|
5001
5363
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
5002
5364
|
* @returns A promise that resolves to an OTPVerification object containing the email and verification UUID.
|
|
5365
|
+
* @see verifyOTP
|
|
5366
|
+
* @see sendSmsOTP
|
|
5003
5367
|
* @instrumented
|
|
5004
5368
|
*/
|
|
5005
5369
|
const sendEmailOTP = async ({ email }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -5957,10 +6321,22 @@ const supportedCountries = {
|
|
|
5957
6321
|
/**
|
|
5958
6322
|
* Sends a one-time password (OTP) via SMS to the specified phone number.
|
|
5959
6323
|
*
|
|
6324
|
+
* @example
|
|
6325
|
+
* ```ts
|
|
6326
|
+
* const { verificationUUID } = await sendSmsOTP({
|
|
6327
|
+
* isoCountryCode: 'US',
|
|
6328
|
+
* phoneNumber: '5551234567',
|
|
6329
|
+
* });
|
|
6330
|
+
* // Then verify with the code the user received
|
|
6331
|
+
* await verifyOTP({ otpVerification: { phoneNumber: '5551234567', verificationUUID }, verificationToken: '123456' });
|
|
6332
|
+
* ```
|
|
6333
|
+
*
|
|
5960
6334
|
* @param params.isoCountryCode - The ISO country code for the phone number (e.g., 'US', 'CA', 'GB').
|
|
5961
6335
|
* @param params.phoneNumber - The phone number to send the OTP to.
|
|
5962
6336
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
5963
6337
|
* @returns A promise that resolves to an OTPVerification object containing the phone details and verification UUID.
|
|
6338
|
+
* @see verifyOTP
|
|
6339
|
+
* @see sendEmailOTP
|
|
5964
6340
|
* @instrumented
|
|
5965
6341
|
*/
|
|
5966
6342
|
const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -6000,10 +6376,11 @@ const __sendSmsOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunc
|
|
|
6000
6376
|
//#endregion
|
|
6001
6377
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.ts
|
|
6002
6378
|
/** @notInstrumented */
|
|
6003
|
-
const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, client) => {
|
|
6379
|
+
const verifyOTPForUserSignIn = async ({ allowNewMFALinking, otpVerification, verificationToken }, client) => {
|
|
6004
6380
|
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
6005
6381
|
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
6006
6382
|
const verifyRequest = {
|
|
6383
|
+
...allowNewMFALinking !== void 0 && { allowNewMFALinking },
|
|
6007
6384
|
verificationToken,
|
|
6008
6385
|
verificationUUID: otpVerification.verificationUUID
|
|
6009
6386
|
};
|
|
@@ -6046,13 +6423,26 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
6046
6423
|
* This function validates the OTP code provided by the user and completes
|
|
6047
6424
|
* the verification process for either sign-in or account updates.
|
|
6048
6425
|
*
|
|
6426
|
+
* @example
|
|
6427
|
+
* ```ts
|
|
6428
|
+
* const { verificationUUID } = await sendEmailOTP({ email: 'user@example.com' });
|
|
6429
|
+
* const response = await verifyOTP({
|
|
6430
|
+
* otpVerification: { email: 'user@example.com', verificationUUID },
|
|
6431
|
+
* verificationToken: '123456',
|
|
6432
|
+
* });
|
|
6433
|
+
* ```
|
|
6434
|
+
*
|
|
6435
|
+
* @param [params.allowNewMFALinking] - Whether sign-in may return a credential-link elevated token for users without MFA.
|
|
6049
6436
|
* @param params.otpVerification - The OTP verification object containing verification details.
|
|
6050
6437
|
* @param params.verificationToken - The token received from the OTP verification process.
|
|
6438
|
+
* @param [params.requestedScopes] - Optional token scopes to request during verification.
|
|
6051
6439
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6052
6440
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
6441
|
+
* @see sendEmailOTP
|
|
6442
|
+
* @see sendSmsOTP
|
|
6053
6443
|
* @instrumented
|
|
6054
6444
|
*/
|
|
6055
|
-
const verifyOTP = async ({
|
|
6445
|
+
const verifyOTP = async ({ allowNewMFALinking, otpVerification, requestedScopes, verificationToken }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
6056
6446
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
6057
6447
|
let response;
|
|
6058
6448
|
if (client.user) response = await verifyOTPForUserUpdate({
|
|
@@ -6061,6 +6451,7 @@ const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }
|
|
|
6061
6451
|
verificationToken
|
|
6062
6452
|
}, client);
|
|
6063
6453
|
else response = await verifyOTPForUserSignIn({
|
|
6454
|
+
allowNewMFALinking,
|
|
6064
6455
|
otpVerification,
|
|
6065
6456
|
verificationToken
|
|
6066
6457
|
}, client);
|
|
@@ -6159,6 +6550,33 @@ const getSwapStatus = async (params, client = require_updateAuthFromVerifyRespon
|
|
|
6159
6550
|
}
|
|
6160
6551
|
};
|
|
6161
6552
|
|
|
6553
|
+
//#endregion
|
|
6554
|
+
//#region src/modules/user/checkUserScopes/checkUserScopes.ts
|
|
6555
|
+
/**
|
|
6556
|
+
* Checks whether the given user has all the specified scopes.
|
|
6557
|
+
*
|
|
6558
|
+
* The user's `scope` field is a whitespace-separated string of granted
|
|
6559
|
+
* permissions (per RFC 8693 §4.2). This helper splits it and verifies that
|
|
6560
|
+
* every entry in `scopes` is present.
|
|
6561
|
+
*
|
|
6562
|
+
* @example
|
|
6563
|
+
* const user = getDefaultClient().user;
|
|
6564
|
+
* if (user && checkUserScopes({ user, scopes: ['wallets:read'] })) {
|
|
6565
|
+
* showWalletBalances();
|
|
6566
|
+
* }
|
|
6567
|
+
*
|
|
6568
|
+
* @param params.user - The authenticated user to check.
|
|
6569
|
+
* @param params.scopes - The scope strings the user must have.
|
|
6570
|
+
* @returns `true` if the user has every scope in `scopes`, `false` otherwise.
|
|
6571
|
+
* @see User
|
|
6572
|
+
* @see updateUser
|
|
6573
|
+
* @notInstrumented
|
|
6574
|
+
*/
|
|
6575
|
+
const checkUserScopes = ({ scopes, user }) => {
|
|
6576
|
+
const grantedScopes = user.scope?.split(/\s+/).filter(Boolean) ?? [];
|
|
6577
|
+
return scopes.every((requiredScope) => grantedScopes.includes(requiredScope));
|
|
6578
|
+
};
|
|
6579
|
+
|
|
6162
6580
|
//#endregion
|
|
6163
6581
|
//#region src/modules/user/deleteUser/deleteUser.ts
|
|
6164
6582
|
/**
|
|
@@ -6167,8 +6585,16 @@ const getSwapStatus = async (params, client = require_updateAuthFromVerifyRespon
|
|
|
6167
6585
|
* This function performs a hard delete of the user account. Upon successful deletion,
|
|
6168
6586
|
* the user will be automatically logged out and all authentication data will be cleared.
|
|
6169
6587
|
*
|
|
6588
|
+
* @example
|
|
6589
|
+
* ```ts
|
|
6590
|
+
* // Permanently delete the user's account
|
|
6591
|
+
* await deleteUser();
|
|
6592
|
+
* ```
|
|
6593
|
+
*
|
|
6170
6594
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6171
6595
|
* @returns A promise that resolves when the user account is successfully deleted.
|
|
6596
|
+
* @see logout
|
|
6597
|
+
* @see refreshUser
|
|
6172
6598
|
* @instrumented
|
|
6173
6599
|
*/
|
|
6174
6600
|
const deleteUser = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -7502,8 +7928,14 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
7502
7928
|
*
|
|
7503
7929
|
* Note: This function will not verify the wallet account, use the verifyWalletAccount function to do that
|
|
7504
7930
|
* or connectAndVerifyWithWalletProvider to do that in a single step.
|
|
7505
|
-
*
|
|
7506
|
-
* @
|
|
7931
|
+
*
|
|
7932
|
+
* @example
|
|
7933
|
+
* ```ts
|
|
7934
|
+
* const walletAccount = await connectWithWalletProvider({
|
|
7935
|
+
* walletProviderKey: 'metamaskevm',
|
|
7936
|
+
* });
|
|
7937
|
+
* console.log(walletAccount.address);
|
|
7938
|
+
* ```
|
|
7507
7939
|
*
|
|
7508
7940
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to (e.g. 'metamaskevm', 'phantomsol').
|
|
7509
7941
|
* @param [params.addToDynamicWalletAccounts] - Whether to add the connected wallet account to the user's wallet accounts. Defaults to true.
|
|
@@ -7511,7 +7943,9 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
7511
7943
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7512
7944
|
* @returns A promise that resolves to the connected wallet account.
|
|
7513
7945
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
7514
|
-
*
|
|
7946
|
+
* @see verifyWalletAccount
|
|
7947
|
+
* @see connectAndVerifyWithWalletProvider
|
|
7948
|
+
* @instrumented
|
|
7515
7949
|
*/
|
|
7516
7950
|
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7517
7951
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
@@ -7648,9 +8082,19 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
7648
8082
|
* This function generates a sign-in message and requires the user to sign it
|
|
7649
8083
|
* with their wallet's private key, proving they control the wallet address.
|
|
7650
8084
|
*
|
|
8085
|
+
* @example
|
|
8086
|
+
* ```ts
|
|
8087
|
+
* const { messageToSign, signature } = await proveWalletAccountOwnership({
|
|
8088
|
+
* walletAccount: wallets[0],
|
|
8089
|
+
* });
|
|
8090
|
+
* // Send signature to your backend for verification
|
|
8091
|
+
* ```
|
|
8092
|
+
*
|
|
7651
8093
|
* @param params.walletAccount - The wallet account to prove ownership of.
|
|
7652
8094
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7653
8095
|
* @returns A promise that resolves to an object containing the message and signature.
|
|
8096
|
+
* @see signMessage
|
|
8097
|
+
* @see verifyWalletAccount
|
|
7654
8098
|
* @instrumented
|
|
7655
8099
|
*/
|
|
7656
8100
|
const proveWalletAccountOwnership = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -7754,11 +8198,22 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
7754
8198
|
* This function requires the user to sign a message to prove wallet ownership,
|
|
7755
8199
|
* then sets the wallet account as verified.
|
|
7756
8200
|
*
|
|
8201
|
+
* @example
|
|
8202
|
+
* ```ts
|
|
8203
|
+
* const walletAccount = await connectWithWalletProvider({
|
|
8204
|
+
* walletProviderKey: 'metamaskevm',
|
|
8205
|
+
* });
|
|
8206
|
+
* const verified = await verifyWalletAccount({ walletAccount });
|
|
8207
|
+
* ```
|
|
8208
|
+
*
|
|
7757
8209
|
* @param params.walletAccount - The wallet account to verify ownership of.
|
|
8210
|
+
* @param [params.requestedScopes] - Optional token scopes to request during verification.
|
|
7758
8211
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7759
8212
|
* @returns A promise that resolves to the verified wallet account.
|
|
7760
8213
|
* @throws WalletAccountAlreadyVerifiedError If the wallet is already verified.
|
|
7761
8214
|
* @throws WalletAlreadyLinkedToAnotherUserError If the wallet is linked to another user.
|
|
8215
|
+
* @see connectWithWalletProvider
|
|
8216
|
+
* @see connectAndVerifyWithWalletProvider
|
|
7762
8217
|
* @instrumented
|
|
7763
8218
|
*/
|
|
7764
8219
|
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -7808,10 +8263,20 @@ const isDeeplinkWalletProvider = ({ walletProvider }) => walletProvider.walletPr
|
|
|
7808
8263
|
* `verifyWalletAccount` separately from a new user gesture (e.g. a "Verify
|
|
7809
8264
|
* Ownership" button).
|
|
7810
8265
|
*
|
|
8266
|
+
* @example
|
|
8267
|
+
* ```ts
|
|
8268
|
+
* const walletAccount = await connectAndVerifyWithWalletProvider({
|
|
8269
|
+
* walletProviderKey: 'metamaskevm',
|
|
8270
|
+
* });
|
|
8271
|
+
* console.log('Verified address:', walletAccount.address);
|
|
8272
|
+
* ```
|
|
8273
|
+
*
|
|
7811
8274
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to.
|
|
7812
8275
|
* @param [params.hardwareWalletVendor] - The hardware wallet vendor, if connecting via a hardware wallet (e.g. 'ledger').
|
|
7813
8276
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7814
8277
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
8278
|
+
* @see connectWithWalletProvider
|
|
8279
|
+
* @see verifyWalletAccount
|
|
7815
8280
|
* @instrumented
|
|
7816
8281
|
*/
|
|
7817
8282
|
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -7873,9 +8338,17 @@ const getAvailableWalletProvidersData = (client = require_updateAuthFromVerifyRe
|
|
|
7873
8338
|
* This function returns the list of wallet addresses that are currently
|
|
7874
8339
|
* connected and available through the specified wallet provider.
|
|
7875
8340
|
*
|
|
8341
|
+
* @example
|
|
8342
|
+
* ```ts
|
|
8343
|
+
* const addresses = getConnectedAddresses({ walletProviderKey: 'metamaskevm' });
|
|
8344
|
+
* console.log('Connected:', addresses);
|
|
8345
|
+
* ```
|
|
8346
|
+
*
|
|
7876
8347
|
* @param params.walletProviderKey - The unique key of the wallet provider to query.
|
|
7877
8348
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7878
8349
|
* @returns An array of connected wallet addresses.
|
|
8350
|
+
* @see connectWithWalletProvider
|
|
8351
|
+
* @see getWalletAccounts
|
|
7879
8352
|
* @notInstrumented
|
|
7880
8353
|
*/
|
|
7881
8354
|
const getConnectedAddresses = ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -7956,8 +8429,17 @@ const isHardwareWalletAccount = ({ walletAccount }) => walletAccount.hardwareWal
|
|
|
7956
8429
|
* else your app considers "signed in" (e.g. `client.user`, completed onboarding,
|
|
7957
8430
|
* a required embedded wallet, …).
|
|
7958
8431
|
*
|
|
8432
|
+
* @example
|
|
8433
|
+
* ```ts
|
|
8434
|
+
* if (isAnyWalletAccountConnected()) {
|
|
8435
|
+
* console.log('At least one wallet is connected');
|
|
8436
|
+
* }
|
|
8437
|
+
* ```
|
|
8438
|
+
*
|
|
7959
8439
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7960
8440
|
* @returns True if the session has at least one wallet account, false otherwise.
|
|
8441
|
+
* @see getWalletAccounts
|
|
8442
|
+
* @see isWalletAccountVerified
|
|
7961
8443
|
* @notInstrumented
|
|
7962
8444
|
*/
|
|
7963
8445
|
const isAnyWalletAccountConnected = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => require_updateAuthFromVerifyResponse.getWalletAccounts(client).length > 0;
|
|
@@ -7967,8 +8449,16 @@ const isAnyWalletAccountConnected = (client = require_updateAuthFromVerifyRespon
|
|
|
7967
8449
|
/**
|
|
7968
8450
|
* Checks if a wallet account has been verified by a user.
|
|
7969
8451
|
*
|
|
7970
|
-
* @
|
|
8452
|
+
* @example
|
|
8453
|
+
* ```ts
|
|
8454
|
+
* const wallets = getWalletAccounts();
|
|
8455
|
+
* const verified = wallets.filter(w => isWalletAccountVerified({ walletAccount: w }));
|
|
8456
|
+
* ```
|
|
8457
|
+
*
|
|
8458
|
+
* @param params.walletAccount - The wallet account to check.
|
|
7971
8459
|
* @returns True if the wallet account has been verified, false otherwise.
|
|
8460
|
+
* @see verifyWalletAccount
|
|
8461
|
+
* @see getWalletAccounts
|
|
7972
8462
|
* @notInstrumented
|
|
7973
8463
|
*/
|
|
7974
8464
|
const isWalletAccountVerified = ({ walletAccount }) => {
|
|
@@ -8058,9 +8548,17 @@ const getActiveNetworkId = ({ walletAccount }, client = require_updateAuthFromVe
|
|
|
8058
8548
|
* {@link getTokenBalances}; for a multi-chain portfolio snapshot, use
|
|
8059
8549
|
* {@link getMultichainTokenBalances}.
|
|
8060
8550
|
*
|
|
8551
|
+
* @example
|
|
8552
|
+
* ```ts
|
|
8553
|
+
* const { balance } = await getNativeBalance({ walletAccount: wallets[0] });
|
|
8554
|
+
* console.log('Native balance:', balance);
|
|
8555
|
+
* ```
|
|
8556
|
+
*
|
|
8061
8557
|
* @param params.walletAccount - The wallet account to get the balance for.
|
|
8062
8558
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8063
8559
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
8560
|
+
* @see getMultichainTokenBalances
|
|
8561
|
+
* @see switchActiveNetwork
|
|
8064
8562
|
* @notInstrumented
|
|
8065
8563
|
*/
|
|
8066
8564
|
const getNativeBalance = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8080,6 +8578,14 @@ const getNativeBalance = async ({ walletAccount }, client = require_updateAuthFr
|
|
|
8080
8578
|
* with the token-balance fetchers (`getTokenBalances` /
|
|
8081
8579
|
* `getMultichainTokenBalances`).
|
|
8082
8580
|
*
|
|
8581
|
+
* @example
|
|
8582
|
+
* ```ts
|
|
8583
|
+
* // Prefer getNativeBalance instead
|
|
8584
|
+
* const balance = await getNativeBalance({ walletAccount });
|
|
8585
|
+
* ```
|
|
8586
|
+
*
|
|
8587
|
+
* @see getNativeBalance
|
|
8588
|
+
* @see getMultichainBalances
|
|
8083
8589
|
* @notInstrumented
|
|
8084
8590
|
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
8085
8591
|
*/
|
|
@@ -8165,11 +8671,21 @@ const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client = requir
|
|
|
8165
8671
|
* This function programmatically changes the network
|
|
8166
8672
|
* that the wallet is currently connected to.
|
|
8167
8673
|
*
|
|
8674
|
+
* @example
|
|
8675
|
+
* ```ts
|
|
8676
|
+
* await switchActiveNetwork({
|
|
8677
|
+
* walletAccount: wallets[0],
|
|
8678
|
+
* networkId: '137', // Polygon
|
|
8679
|
+
* });
|
|
8680
|
+
* ```
|
|
8681
|
+
*
|
|
8168
8682
|
* @param params.networkId - The identifier of the network to switch to. Should match the networkId of the network data.
|
|
8169
8683
|
* @param params.walletAccount - The wallet account to switch networks for.
|
|
8170
8684
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8171
8685
|
* @returns A promise that resolves when the network switch is complete.
|
|
8172
8686
|
* @throws NetworkSwitchingUnavailableError If the wallet provider doesn't support network switching.
|
|
8687
|
+
* @see getNativeBalance
|
|
8688
|
+
* @see isProgrammaticNetworkSwitchAvailable
|
|
8173
8689
|
* @instrumented
|
|
8174
8690
|
*/
|
|
8175
8691
|
const switchActiveNetwork = async ({ networkId, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8195,15 +8711,37 @@ const __switchActiveNetwork_wrapped = require_updateAuthFromVerifyResponse.instr
|
|
|
8195
8711
|
});
|
|
8196
8712
|
|
|
8197
8713
|
//#endregion
|
|
8198
|
-
//#region src/modules/wallets/
|
|
8714
|
+
//#region src/modules/wallets/selectedWalletAccount/setSelectedWalletAccount/setSelectedWalletAccount.ts
|
|
8199
8715
|
/**
|
|
8200
|
-
*
|
|
8716
|
+
* Set the wallet account that is currently selected for the user.
|
|
8717
|
+
*
|
|
8718
|
+
* The SDK itself does not use or care about which wallet is "selected" — this
|
|
8719
|
+
* only records the selection (updating the backend `lastSelectedAt` and, for
|
|
8720
|
+
* verified wallets, persisting it server-side) so it can later be read back via
|
|
8721
|
+
* `getSelectedWalletAccount`. It has no bearing on authentication or signing.
|
|
8722
|
+
* Applications that need a notion of an active/current wallet should own that
|
|
8723
|
+
* selection state themselves.
|
|
8724
|
+
*
|
|
8725
|
+
* The one exception is the wagmi integration (`@dynamic-labs-sdk/wagmi`), which
|
|
8726
|
+
* relies on the selected EVM wallet.
|
|
8727
|
+
*
|
|
8728
|
+
* @example
|
|
8729
|
+
* ```ts
|
|
8730
|
+
* const wallets = getWalletAccounts();
|
|
8731
|
+
* await setSelectedWalletAccount({ walletAccount: wallets[1] });
|
|
8732
|
+
* ```
|
|
8733
|
+
*
|
|
8734
|
+
* @param params.walletAccount - The wallet account to mark as selected.
|
|
8735
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8736
|
+
* @returns A promise that resolves when the selection is persisted.
|
|
8737
|
+
* @see getSelectedWalletAccount
|
|
8738
|
+
* @see getWalletAccounts
|
|
8201
8739
|
* @instrumented
|
|
8202
|
-
* @noHook The
|
|
8740
|
+
* @noHook The selected-wallet concept is not exposed as a hook.
|
|
8203
8741
|
*/
|
|
8204
|
-
const
|
|
8742
|
+
const setSelectedWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8205
8743
|
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
8206
|
-
if (
|
|
8744
|
+
if (getSelectedWalletAccount(client)?.id === walletAccount.id) return;
|
|
8207
8745
|
if (walletAccount.verifiedCredentialId) require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response: await require_updateAuthFromVerifyResponse.createApiClient({}, client).selectUserWallet({
|
|
8208
8746
|
environmentId: core.environmentId,
|
|
8209
8747
|
userWalletSelectionRequest: { walletId: walletAccount.verifiedCredentialId }
|
|
@@ -8213,6 +8751,68 @@ const selectPrimaryWalletAccount = async ({ walletAccount }, client = require_up
|
|
|
8213
8751
|
lastSelectedAt: /* @__PURE__ */ new Date()
|
|
8214
8752
|
}] }, client);
|
|
8215
8753
|
};
|
|
8754
|
+
const __setSelectedWalletAccount_impl = setSelectedWalletAccount;
|
|
8755
|
+
const __setSelectedWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8756
|
+
fn: __setSelectedWalletAccount_impl,
|
|
8757
|
+
functionName: "setSelectedWalletAccount",
|
|
8758
|
+
getCore: () => {
|
|
8759
|
+
try {
|
|
8760
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8761
|
+
} catch {
|
|
8762
|
+
return;
|
|
8763
|
+
}
|
|
8764
|
+
}
|
|
8765
|
+
});
|
|
8766
|
+
|
|
8767
|
+
//#endregion
|
|
8768
|
+
//#region src/modules/wallets/selectedWalletAccount/getPrimaryWalletAccount/getPrimaryWalletAccount.ts
|
|
8769
|
+
/**
|
|
8770
|
+
* Get the primary wallet account.
|
|
8771
|
+
*
|
|
8772
|
+
* @deprecated Renamed to `getSelectedWalletAccount`. The "primary wallet" naming was
|
|
8773
|
+
* misleading — the SDK does not use or care about which wallet is selected; it
|
|
8774
|
+
* only lets you *read* the user's most recently selected wallet. Migrate to
|
|
8775
|
+
* `getSelectedWalletAccount`, and own your own wallet-selection state in your
|
|
8776
|
+
* application rather than relying on the SDK's selected wallet.
|
|
8777
|
+
*
|
|
8778
|
+
* @example
|
|
8779
|
+
* ```ts
|
|
8780
|
+
* const primary = getPrimaryWalletAccount();
|
|
8781
|
+
* if (primary) {
|
|
8782
|
+
* console.log('Primary wallet:', primary.address);
|
|
8783
|
+
* }
|
|
8784
|
+
* ```
|
|
8785
|
+
*
|
|
8786
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8787
|
+
* @returns The primary wallet account, or null if no wallet has been selected.
|
|
8788
|
+
* @notInstrumented
|
|
8789
|
+
*/
|
|
8790
|
+
const getPrimaryWalletAccount = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => getSelectedWalletAccount(client);
|
|
8791
|
+
|
|
8792
|
+
//#endregion
|
|
8793
|
+
//#region src/modules/wallets/selectedWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.ts
|
|
8794
|
+
/**
|
|
8795
|
+
* Make the wallet account provided as the primary wallet account.
|
|
8796
|
+
*
|
|
8797
|
+
* @deprecated Renamed to `setSelectedWalletAccount`. The "primary wallet" naming was
|
|
8798
|
+
* misleading — the SDK does not use or care about which wallet is selected;
|
|
8799
|
+
* this only records the selection so it can later be read back. Migrate to
|
|
8800
|
+
* `setSelectedWalletAccount`, and own your own wallet-selection state in your
|
|
8801
|
+
* application rather than relying on the SDK's selected wallet.
|
|
8802
|
+
*
|
|
8803
|
+
* @example
|
|
8804
|
+
* ```ts
|
|
8805
|
+
* const wallets = getWalletAccounts();
|
|
8806
|
+
* await selectPrimaryWalletAccount({ walletAccount: wallets[1] });
|
|
8807
|
+
* ```
|
|
8808
|
+
*
|
|
8809
|
+
* @param params.walletAccount - The wallet account to set as primary.
|
|
8810
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8811
|
+
* @returns A promise that resolves when the selection is persisted.
|
|
8812
|
+
* @instrumented
|
|
8813
|
+
* @noHook The selected-wallet concept is not exposed as a hook.
|
|
8814
|
+
*/
|
|
8815
|
+
const selectPrimaryWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => __setSelectedWalletAccount_wrapped({ walletAccount }, client);
|
|
8216
8816
|
const __selectPrimaryWalletAccount_impl = selectPrimaryWalletAccount;
|
|
8217
8817
|
const __selectPrimaryWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8218
8818
|
fn: __selectPrimaryWalletAccount_impl,
|
|
@@ -8229,10 +8829,23 @@ const __selectPrimaryWalletAccount_wrapped = require_updateAuthFromVerifyRespons
|
|
|
8229
8829
|
//#endregion
|
|
8230
8830
|
//#region src/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.ts
|
|
8231
8831
|
/**
|
|
8232
|
-
*
|
|
8832
|
+
* Disconnects the specified wallet account from its wallet provider.
|
|
8233
8833
|
*
|
|
8234
|
-
* The wallet account is not removed from the user's profile or from
|
|
8834
|
+
* The wallet account is not removed from the user's profile or from Dynamic's state,
|
|
8235
8835
|
* it is only responsible for terminating the connection with the wallet provider.
|
|
8836
|
+
* Use `removeWalletAccount` to fully remove a wallet from the user's session.
|
|
8837
|
+
*
|
|
8838
|
+
* @example
|
|
8839
|
+
* ```ts
|
|
8840
|
+
* const wallets = getWalletAccounts();
|
|
8841
|
+
* await disconnectWalletAccount({ walletAccount: wallets[0] }, client);
|
|
8842
|
+
* ```
|
|
8843
|
+
*
|
|
8844
|
+
* @param params.walletAccount - The wallet account to disconnect.
|
|
8845
|
+
* @param client - The Dynamic client instance.
|
|
8846
|
+
* @returns A promise that resolves when the wallet is disconnected from the provider.
|
|
8847
|
+
* @see removeWalletAccount
|
|
8848
|
+
* @see connectWithWalletProvider
|
|
8236
8849
|
* @notInstrumented
|
|
8237
8850
|
*/
|
|
8238
8851
|
const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
@@ -8253,9 +8866,17 @@ const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
|
8253
8866
|
* updating local state and server records (if there is an authenticated user).
|
|
8254
8867
|
* For verified wallets, it will unlink them from the user's account.
|
|
8255
8868
|
*
|
|
8869
|
+
* @example
|
|
8870
|
+
* ```ts
|
|
8871
|
+
* const wallets = getWalletAccounts();
|
|
8872
|
+
* await removeWalletAccount({ walletAccount: wallets[0] });
|
|
8873
|
+
* ```
|
|
8874
|
+
*
|
|
8256
8875
|
* @param params.walletAccount - The wallet account to remove.
|
|
8257
8876
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8258
8877
|
* @returns A promise that resolves when the wallet account is successfully removed.
|
|
8878
|
+
* @see getWalletAccounts
|
|
8879
|
+
* @see disconnectWalletAccount
|
|
8259
8880
|
* @instrumented
|
|
8260
8881
|
*/
|
|
8261
8882
|
const removeWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8292,10 +8913,21 @@ const __removeWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instr
|
|
|
8292
8913
|
* This function uses the wallet's private key to cryptographically sign
|
|
8293
8914
|
* the provided message.
|
|
8294
8915
|
*
|
|
8916
|
+
* @example
|
|
8917
|
+
* ```ts
|
|
8918
|
+
* const wallets = getWalletAccounts();
|
|
8919
|
+
* const { signature } = await signMessage({
|
|
8920
|
+
* walletAccount: wallets[0],
|
|
8921
|
+
* message: 'Hello Dynamic!',
|
|
8922
|
+
* });
|
|
8923
|
+
* ```
|
|
8924
|
+
*
|
|
8295
8925
|
* @param params.walletAccount - The wallet account to use for signing.
|
|
8296
8926
|
* @param params.message - The message to sign.
|
|
8297
8927
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8298
8928
|
* @returns A promise that resolves to an object containing the signature.
|
|
8929
|
+
* @see getWalletAccounts
|
|
8930
|
+
* @see connectWithWalletProvider
|
|
8299
8931
|
* @instrumented
|
|
8300
8932
|
*/
|
|
8301
8933
|
const signMessage = async ({ walletAccount, message }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8328,13 +8960,24 @@ const __signMessage_wrapped = require_updateAuthFromVerifyResponse.instrumentFun
|
|
|
8328
8960
|
* Supports native token transfers and, where supported by the chain,
|
|
8329
8961
|
* fungible/token transfers via the optional `token` parameter.
|
|
8330
8962
|
*
|
|
8963
|
+
* @example
|
|
8964
|
+
* ```ts
|
|
8965
|
+
* const { transactionHash } = await transferAmount({
|
|
8966
|
+
* walletAccount: wallets[0],
|
|
8967
|
+
* amount: '0.1',
|
|
8968
|
+
* recipient: '0x1234...abcd',
|
|
8969
|
+
* });
|
|
8970
|
+
* ```
|
|
8971
|
+
*
|
|
8331
8972
|
* @param params.walletAccount - The wallet account to transfer from.
|
|
8332
8973
|
* @param params.amount - The amount to transfer as a decimal string (e.g. "1.5").
|
|
8333
8974
|
* @param params.recipient - The recipient address.
|
|
8334
|
-
* @param params.token - Optional token info for non-native transfers.
|
|
8975
|
+
* @param [params.token] - Optional token info for non-native transfers.
|
|
8335
8976
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8336
8977
|
* @returns A promise that resolves to an object containing the transaction hash.
|
|
8337
8978
|
* @throws If the wallet provider does not support the transfer amount method.
|
|
8979
|
+
* @see getWalletAccounts
|
|
8980
|
+
* @see signMessage
|
|
8338
8981
|
* @instrumented
|
|
8339
8982
|
*/
|
|
8340
8983
|
const transferAmount = async ({ walletAccount, amount, recipient, token }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8369,9 +9012,18 @@ const __transferAmount_wrapped = require_updateAuthFromVerifyResponse.instrument
|
|
|
8369
9012
|
* This function requires the user to sign a message to prove wallet ownership,
|
|
8370
9013
|
* then transfers the wallet account to the current user's account.
|
|
8371
9014
|
*
|
|
9015
|
+
* @example
|
|
9016
|
+
* ```ts
|
|
9017
|
+
* const walletAccount = await transferWalletAccount({
|
|
9018
|
+
* walletProviderKey: 'metamaskevm',
|
|
9019
|
+
* });
|
|
9020
|
+
* ```
|
|
9021
|
+
*
|
|
8372
9022
|
* @param params.walletProviderKey - The key of the wallet provider of the wallet account to transfer.
|
|
8373
9023
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8374
9024
|
* @returns A promise that resolves to the transferred wallet account.
|
|
9025
|
+
* @see connectWithWalletProvider
|
|
9026
|
+
* @see verifyWalletAccount
|
|
8375
9027
|
* @instrumented
|
|
8376
9028
|
*/
|
|
8377
9029
|
const transferWalletAccount = async ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8404,10 +9056,20 @@ const __transferWalletAccount_wrapped = require_updateAuthFromVerifyResponse.ins
|
|
|
8404
9056
|
* This function searches through the current session's wallet accounts
|
|
8405
9057
|
* to find one matching the specified address and chain.
|
|
8406
9058
|
*
|
|
9059
|
+
* @example
|
|
9060
|
+
* ```ts
|
|
9061
|
+
* const account = getWalletAccountFromAddress({
|
|
9062
|
+
* address: '0x1234...abcd',
|
|
9063
|
+
* chain: 'EVM',
|
|
9064
|
+
* });
|
|
9065
|
+
* ```
|
|
9066
|
+
*
|
|
8407
9067
|
* @param params.address - The wallet address to search for.
|
|
8408
9068
|
* @param params.chain - The blockchain the wallet belongs to.
|
|
8409
9069
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8410
9070
|
* @returns The matching wallet account, or undefined if not found.
|
|
9071
|
+
* @see getWalletAccounts
|
|
9072
|
+
* @see isWalletAccountVerified
|
|
8411
9073
|
* @notInstrumented
|
|
8412
9074
|
*/
|
|
8413
9075
|
const getWalletAccountFromAddress = ({ address, chain }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
@@ -8567,12 +9229,7 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
8567
9229
|
|
|
8568
9230
|
//#endregion
|
|
8569
9231
|
exports.BaseError = require_updateAuthFromVerifyResponse.BaseError;
|
|
8570
|
-
|
|
8571
|
-
enumerable: true,
|
|
8572
|
-
get: function () {
|
|
8573
|
-
return _dynamic_labs_sdk_api_core.CaptchaProviderEnum;
|
|
8574
|
-
}
|
|
8575
|
-
});
|
|
9232
|
+
exports.CaptchaProviderEnum = CaptchaProviderEnum;
|
|
8576
9233
|
exports.CheckoutSessionTokenMissingError = CheckoutSessionTokenMissingError;
|
|
8577
9234
|
exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
8578
9235
|
exports.DeeplinkConnectAndVerifyUnsupportedError = DeeplinkConnectAndVerifyUnsupportedError;
|
|
@@ -8598,6 +9255,7 @@ Object.defineProperty(exports, 'MFAAction', {
|
|
|
8598
9255
|
return _dynamic_labs_sdk_api_core.MFAAction;
|
|
8599
9256
|
}
|
|
8600
9257
|
});
|
|
9258
|
+
exports.MergeAccountsConfirmationError = require_getNetworkProviderFromNetworkId.MergeAccountsConfirmationError;
|
|
8601
9259
|
exports.MfaInvalidOtpError = require_updateAuthFromVerifyResponse.MfaInvalidOtpError;
|
|
8602
9260
|
exports.MfaRateLimitedError = require_updateAuthFromVerifyResponse.MfaRateLimitedError;
|
|
8603
9261
|
exports.MissingRedirectStorageStateError = MissingRedirectStorageStateError;
|
|
@@ -8628,7 +9286,7 @@ Object.defineProperty(exports, 'TokenScope', {
|
|
|
8628
9286
|
});
|
|
8629
9287
|
exports.TokenSwapError = TokenSwapError;
|
|
8630
9288
|
exports.UnauthorizedError = require_updateAuthFromVerifyResponse.UnauthorizedError;
|
|
8631
|
-
exports.UnavailableInServerSideError = UnavailableInServerSideError;
|
|
9289
|
+
exports.UnavailableInServerSideError = require_getNetworkProviderFromNetworkId.UnavailableInServerSideError;
|
|
8632
9290
|
exports.UnrecognizedNetworkError = UnrecognizedNetworkError;
|
|
8633
9291
|
exports.UserCancelledSocialPopUpError = UserCancelledSocialPopUpError;
|
|
8634
9292
|
exports.UserNotAuthenticatedError = UserNotAuthenticatedError;
|
|
@@ -8657,6 +9315,9 @@ exports.canConnectWithHardwareWallet = canConnectWithHardwareWallet;
|
|
|
8657
9315
|
exports.cancelCheckoutTransaction = __cancelCheckoutTransaction_wrapped;
|
|
8658
9316
|
exports.cancelFlow = __cancelFlow_wrapped;
|
|
8659
9317
|
exports.checkStepUpAuth = __checkStepUpAuth_wrapped;
|
|
9318
|
+
exports.checkUserScopes = checkUserScopes;
|
|
9319
|
+
exports.clearDeviceRegistrationRedirectParams = clearDeviceRegistrationRedirectParams;
|
|
9320
|
+
exports.clearSocialRedirectParams = clearSocialRedirectParams;
|
|
8660
9321
|
exports.completeDeviceRegistration = __completeDeviceRegistration_wrapped;
|
|
8661
9322
|
exports.completeSocialAuthentication = __completeSocialAuthentication_wrapped;
|
|
8662
9323
|
exports.completeSocialRedirect = __completeSocialRedirect_wrapped;
|
|
@@ -8714,6 +9375,7 @@ exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSma
|
|
|
8714
9375
|
exports.getPasskeys = getPasskeys;
|
|
8715
9376
|
exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
|
|
8716
9377
|
exports.getRegisteredDevices = getRegisteredDevices;
|
|
9378
|
+
exports.getSelectedWalletAccount = getSelectedWalletAccount;
|
|
8717
9379
|
exports.getSwapQuote = getSwapQuote;
|
|
8718
9380
|
exports.getSwapStatus = getSwapStatus;
|
|
8719
9381
|
exports.getTokenBalances = getTokenBalances;
|
|
@@ -8745,6 +9407,7 @@ exports.isUserOnboardingComplete = require_isUserOnboardingComplete.isUserOnboar
|
|
|
8745
9407
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|
|
8746
9408
|
exports.logout = logout;
|
|
8747
9409
|
exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
|
|
9410
|
+
exports.mergeUserAccounts = mergeUserAccounts;
|
|
8748
9411
|
exports.offEvent = require_updateAuthFromVerifyResponse.offEvent;
|
|
8749
9412
|
exports.offWalletProviderEvent = offWalletProviderEvent;
|
|
8750
9413
|
exports.onEvent = require_updateAuthFromVerifyResponse.onEvent;
|
|
@@ -8769,6 +9432,7 @@ exports.sendSmsOTP = __sendSmsOTP_wrapped;
|
|
|
8769
9432
|
exports.setCaptchaToken = require_getNetworkProviderFromNetworkId.__setCaptchaToken_wrapped;
|
|
8770
9433
|
exports.setDefaultMfaDevice = __setDefaultMfaDevice_wrapped;
|
|
8771
9434
|
exports.setInstrumentationEnabled = __setInstrumentationEnabled_wrapped;
|
|
9435
|
+
exports.setSelectedWalletAccount = __setSelectedWalletAccount_wrapped;
|
|
8772
9436
|
exports.signInWithExternalJwt = __signInWithExternalJwt_wrapped;
|
|
8773
9437
|
exports.signInWithPasskey = __signInWithPasskey_wrapped;
|
|
8774
9438
|
exports.signInWithSocialPopUp = __signInWithSocialPopUp_wrapped;
|