@dynamic-labs-sdk/client 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InvalidParamError-Dhv4EhOy.native.esm.js → InvalidParamError-9kQBK3sP.native.esm.js} +2 -2
- package/dist/{InvalidParamError-Dhv4EhOy.native.esm.js.map → InvalidParamError-9kQBK3sP.native.esm.js.map} +1 -1
- package/dist/{InvalidParamError-CPzPxL0l.cjs → InvalidParamError-DQvZQdQ9.cjs} +3 -3
- package/dist/{InvalidParamError-CPzPxL0l.cjs.map → InvalidParamError-DQvZQdQ9.cjs.map} +1 -1
- package/dist/{InvalidParamError-BWWTxQ9d.esm.js → InvalidParamError-Za4cvW7K.esm.js} +2 -2
- package/dist/{InvalidParamError-BWWTxQ9d.esm.js.map → InvalidParamError-Za4cvW7K.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-D_mLDrYD.native.esm.js → NotWaasWalletAccountError-BTMvHTA8.native.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-D_mLDrYD.native.esm.js.map → NotWaasWalletAccountError-BTMvHTA8.native.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-D1EuiYyR.esm.js → NotWaasWalletAccountError-By3Y4taq.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-D1EuiYyR.esm.js.map → NotWaasWalletAccountError-By3Y4taq.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-BcIbGm0s.cjs → NotWaasWalletAccountError-Ciq7b-Y6.cjs} +3 -3
- package/dist/{NotWaasWalletAccountError-BcIbGm0s.cjs.map → NotWaasWalletAccountError-Ciq7b-Y6.cjs.map} +1 -1
- package/dist/core.cjs +45 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +45 -8
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +43 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/ArrayMustNotBeEmptyError.d.ts +5 -0
- package/dist/errors/ArrayMustNotBeEmptyError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +8 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +5 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-D26TNjm4.cjs → getNetworkProviderFromNetworkId-BA0CHZzu.cjs} +30 -4
- package/dist/getNetworkProviderFromNetworkId-BA0CHZzu.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-VkHaRqMa.native.esm.js → getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js} +25 -5
- package/dist/getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-C9QzgcLs.esm.js → getNetworkProviderFromNetworkId-RWcIZDgC.esm.js} +29 -9
- package/dist/getNetworkProviderFromNetworkId-RWcIZDgC.esm.js.map +1 -0
- package/dist/{getSignedSessionId-D52QC0hh.cjs → getSignedSessionId-BCU987hO.cjs} +3 -3
- package/dist/{getSignedSessionId-D52QC0hh.cjs.map → getSignedSessionId-BCU987hO.cjs.map} +1 -1
- package/dist/{getSignedSessionId-L0T26uTy.native.esm.js → getSignedSessionId-DzNCj6g_.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-L0T26uTy.native.esm.js.map → getSignedSessionId-DzNCj6g_.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DcJl2sy8.esm.js → getSignedSessionId-la6RXITX.esm.js} +3 -3
- package/dist/{getSignedSessionId-DcJl2sy8.esm.js.map → getSignedSessionId-la6RXITX.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-Cm2e3Boz.esm.js → getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js} +3 -2
- package/dist/getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-C94BZhqL.cjs → getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs} +4 -3
- package/dist/getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-CMEe9e1b.native.esm.js → getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js} +3 -2
- package/dist/getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js.map +1 -0
- package/dist/index.cjs +967 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +968 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +970 -24
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-vbGFqLFc.esm.js → isMfaRequiredForAction-C1u4Z__n.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-vbGFqLFc.esm.js.map → isMfaRequiredForAction-C1u4Z__n.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-kxGzZLB_.cjs → isMfaRequiredForAction-CMClgbT0.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-kxGzZLB_.cjs.map → isMfaRequiredForAction-CMClgbT0.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-B6kjcIA2.native.esm.js → isMfaRequiredForAction-DSX-TV2z.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-B6kjcIA2.native.esm.js.map → isMfaRequiredForAction-DSX-TV2z.native.esm.js.map} +1 -1
- package/dist/modules/balances/getBalances/getBalances.d.ts +22 -10
- package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts +6 -2
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts.map +1 -1
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.d.ts +26 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.d.ts +28 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/{shouldFilterWallet → shouldFilterWalletForWalletConnect}/index.d.ts.map +1 -1
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.d.ts +13 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.d.ts +26 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.d.ts +10 -0
- package/dist/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/index.d.ts +3 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.d.ts +34 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts +22 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.d.ts +21 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts +27 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts +23 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts +39 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts +54 -0
- package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.d.ts +31 -0
- package/dist/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.d.ts +15 -0
- package/dist/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.d.ts +21 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.d.ts +44 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.d.ts +20 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts +15 -0
- package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.d.ts +16 -0
- package/dist/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +24 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.d.ts +49 -0
- package/dist/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.d.ts +23 -0
- package/dist/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts +22 -0
- package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts +20 -0
- package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts +34 -0
- package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +164 -0
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -0
- package/dist/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/createSignInMessageStatement.d.ts.map +1 -1
- package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
- package/dist/modules/wallets/utils/stripChainSuffix/stripChainSuffix.d.ts +20 -0
- package/dist/modules/wallets/utils/stripChainSuffix/stripChainSuffix.d.ts.map +1 -0
- package/dist/modules/wallets/walletProviderRegistry/createWalletProviderRegistry/createWalletProviderRegistry.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts +1 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts +19 -0
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts +23 -0
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/assertNonEmptyArray/assertNonEmptyArray.d.ts +19 -0
- package/dist/utils/assertNonEmptyArray/assertNonEmptyArray.d.ts.map +1 -0
- package/dist/utils/assertNonEmptyArray/index.d.ts +2 -0
- package/dist/utils/assertNonEmptyArray/index.d.ts.map +1 -0
- package/dist/utils/getAppMetadata/getAppMetadata.d.ts +16 -0
- package/dist/utils/getAppMetadata/getAppMetadata.d.ts.map +1 -0
- package/dist/utils/getAppMetadata/index.d.ts +3 -0
- package/dist/utils/getAppMetadata/index.d.ts.map +1 -0
- package/dist/waas.cjs +6 -5
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +5 -4
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +5 -4
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +4 -4
- package/dist/waasCore.esm.js +3 -3
- package/dist/waasCore.native.esm.js +3 -3
- package/package.json +3 -3
- package/dist/getNetworkProviderFromNetworkId-C9QzgcLs.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-D26TNjm4.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-VkHaRqMa.native.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-C94BZhqL.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-CMEe9e1b.native.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-Cm2e3Boz.esm.js.map +0 -1
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/index.d.ts +0 -2
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/shouldFilterWallet.d.ts +0 -21
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/shouldFilterWallet.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waas.native.esm.js","names":["requirement: WalletCreationRequirement","refreshAuth","refreshAuth","refreshAuth","packageName","packageVersion"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts","../src/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.ts","../src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts","../src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @not-instrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Backs up WaaS wallet key shares to Google Drive for secure recovery.\n *\n * This function creates a backup of the wallet's cryptographic key shares\n * to Google Drive, allowing users to recover their wallet later.\n *\n * @param params.walletAccount - The WaaS wallet account to backup.\n * @param [params.password] - Optional password to encrypt the backup.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the backup process is complete.\n * @not-instrumented\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n { password, walletAccount }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n password,\n walletAccount,\n });\n};\n","import type { Chain } from '../../chain';\nimport type { WalletCreationRequirement } from '../waas.types';\n\n/**\n * Type guard to check if an item is a WalletCreationRequirement object.\n * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.\n *\n * @param item - The item to check, either a WalletCreationRequirement or Chain string\n * @returns True if the item is a WalletCreationRequirement object\n * @not-instrumented\n */\nexport const isWalletCreationRequirement = (\n item: WalletCreationRequirement | Chain\n): item is WalletCreationRequirement =>\n typeof item === 'object' && item !== null && 'chain' in item;\n","import type { Chain } from '../../chain';\nimport { isWalletCreationRequirement } from '../isWalletCreationRequirement/isWalletCreationRequirement';\nimport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../waas.types';\n\nconst DEFAULT_BITCOIN_ADDRESS_TYPE = 'native_segwit' as const;\n\ntype NormalizeWalletRequirementsParams = {\n defaultBitcoinConfig?: WalletCreationBitcoinConfig;\n input: WalletCreationRequirement[] | Chain[];\n};\n\n/**\n * Normalizes wallet creation input from either legacy Chain[] format\n * or new WalletCreationRequirement[] format to WalletCreationRequirement[].\n *\n * For BTC chains without explicit bitcoinConfig, defaults to native_segwit.\n *\n * @param params.input - Either an array of Chain strings or WalletCreationRequirement objects\n * @param params.defaultBitcoinConfig - Optional default bitcoin config to use for BTC chains when converting from legacy format\n * @returns Array of WalletCreationRequirement objects\n * @not-instrumented\n */\nexport const normalizeWalletRequirements = ({\n defaultBitcoinConfig,\n input,\n}: NormalizeWalletRequirementsParams): WalletCreationRequirement[] => {\n if (input.length === 0) {\n return [];\n }\n\n const [firstItem] = input;\n\n if (isWalletCreationRequirement(firstItem)) {\n return (input as WalletCreationRequirement[]).map((requirement) => {\n if (requirement.chain === 'BTC' && !requirement.bitcoinConfig) {\n return {\n ...requirement,\n bitcoinConfig: { addressType: DEFAULT_BITCOIN_ADDRESS_TYPE },\n };\n }\n\n return requirement;\n });\n }\n\n return (input as Chain[]).map((chain) => {\n const requirement: WalletCreationRequirement = { chain };\n\n if (chain === 'BTC') {\n requirement.bitcoinConfig = defaultBitcoinConfig ?? {\n addressType: DEFAULT_BITCOIN_ADDRESS_TYPE,\n };\n }\n\n return requirement;\n });\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviderByKey } from '../../wallets/getWalletProviderByKey';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport { normalizeWalletRequirements } from '../normalizeWalletRequirements/normalizeWalletRequirements';\nimport type { WalletCreationRequirement } from '../waas.types';\n\ntype CreateWaasWalletAccountsParams = {\n /**\n * For which chains to create wallet accounts.\n * Accepts either an array of chain strings (legacy format) or an array of\n * WalletCreationRequirement objects for chain-specific configuration.\n *\n * For Bitcoin, you can specify the address type ('native_segwit' or 'taproot').\n * If not specified, defaults to 'native_segwit'.\n *\n * If a chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n * @not-instrumented\n */\n chains: Chain[] | WalletCreationRequirement[];\n /**\n * The optional password to use for the wallet accounts.\n * It's used to encrypt the user shares.\n * The same password must be used for all waas wallet accounts created for the same user.\n */\n password?: string;\n /**\n * The threshold signature scheme to use for the wallet accounts.\n * If not provided, TWO_OF_TWO will be used.\n */\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Creates wallet accounts for the specified chains.\n *\n * This function creates wallet accounts for the specified chains.\n * If the same chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n *\n * @example\n * ```ts\n * // Legacy format - will create wallet accounts for EVM and SOL, BTC defaults to native_segwit\n * await createWaasWalletAccounts({ chains: ['EVM', 'SOL', 'BTC'] });\n *\n * // New format with chain-specific config\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * { chain: 'EVM' },\n * ]\n * });\n *\n * // Create both BTC address types\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'native_segwit' } },\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * ]\n * });\n * ```\n *\n * @param params.chains - The chains to create wallet accounts for.\n * @param params.password - The optional password to use for the wallet accounts.\n * @param params.thresholdSignatureScheme - The threshold signature scheme to use for the wallet accounts. (Default: TWO_OF_TWO)\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when all wallet accounts are created.\n * @not-instrumented\n */\nexport const createWaasWalletAccounts = async (\n {\n chains,\n password,\n thresholdSignatureScheme,\n }: CreateWaasWalletAccountsParams,\n client = getDefaultClient()\n): Promise<void> => {\n const normalizedRequirements = normalizeWalletRequirements({ input: chains });\n\n // we need this right now so we don't try to create wallet accounts for chains\n // that we don't support Dynamic Waas yet in the JS SDK, like TRON\n const supportedChains = ['BTC', 'EVM', 'SOL', 'SUI', 'TON'];\n\n const filteredRequirements = normalizedRequirements.filter((requirement) =>\n supportedChains.includes(requirement.chain)\n );\n\n if (filteredRequirements.length === 0) {\n return;\n }\n\n const walletProviderMap = new Map<\n string,\n ReturnType<typeof getWalletProviderByKey>\n >();\n\n for (const requirement of filteredRequirements) {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n if (!walletProviderMap.has(walletProviderKey)) {\n const walletProvider = getWalletProviderByKey(\n { walletProviderKey },\n client\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({\n walletProviderKey,\n });\n }\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletProviderError({\n walletProviderKey,\n });\n }\n\n walletProviderMap.set(walletProviderKey, walletProvider);\n }\n }\n\n await Promise.all(\n filteredRequirements.map((requirement) => {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const walletProvider = walletProviderMap.get(walletProviderKey);\n\n if (!walletProvider || !isWaasWalletProvider(walletProvider)) {\n return Promise.resolve();\n }\n\n return walletProvider.createWalletAccount({\n bitcoinConfig: requirement.bitcoinConfig,\n password,\n thresholdSignatureScheme,\n });\n })\n );\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n * @not-instrumented\n */\nexport const delegateWaasKeyShares = async (\n { password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasClientKeysharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the client-side key shares for a WaaS wallet account.\n *\n * This function retrieves the cryptographic key shares that are stored\n * on the client side for backup or migration purposes.\n *\n * @param params.walletAccount - The WaaS wallet account to export shares from.\n * @param [params.password] - Optional password to encrypt the exported shares.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the exported key shares.\n * @not-instrumented\n */\nexport const exportWaasClientKeyshares = async (\n { password, walletAccount }: ExportWaasClientKeysharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportClientKeyshares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasPrivateKeyParams = {\n displayContainer: HTMLElement;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the private key for a WaaS wallet account with secure display.\n *\n * This function reveals the private key for a WaaS wallet and displays it\n * securely within an iframe dynamically inserted into the specified HTML container element.\n *\n * @param params.walletAccount - The WaaS wallet account to export the private key from.\n * @param params.displayContainer - The HTML element where the iframe will be injected.\n * @param [params.password] - Optional password to decrypt the private key.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key export is complete.\n * @not-instrumented\n */\nexport const exportWaasPrivateKey = async (\n { displayContainer, password, walletAccount }: ExportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportPrivateKey({\n displayContainer,\n password,\n walletAccount,\n });\n};\n","import { type SdkUser, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getChainFromVerifiedCredentialChain } from '../../../utils/getChainFromVerifiedCredentialChain';\nimport type { Chain } from '../../chain/chain.types';\n\ntype UserHasEmbeddedWalletForChainProps = {\n chain: Chain;\n user: SdkUser;\n};\n\n/** @not-instrumented */\nexport const userHasEmbeddedWalletForChain = ({\n user,\n chain,\n}: UserHasEmbeddedWalletForChainProps): boolean => {\n const hasEmbeddedWalletForChain = user.verifiedCredentials.some(\n (vc) =>\n vc.walletProvider === WalletProviderEnum.EmbeddedWallet &&\n vc.chain &&\n getChainFromVerifiedCredentialChain(vc.chain) === chain\n );\n\n return hasEmbeddedWalletForChain;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @not-instrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain/chain.types';\nimport { userHasEmbeddedWalletForChain } from '../../wallets/userHasEmbeddedWalletForChain';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Gets all chains missing a waas wallet account for the current user.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of all chains that have waas wallet accounts enabled\n * but for which the current user does not yet have an embedded wallet account.\n * @not-instrumented\n */\nexport const getChainsMissingWaasWalletAccounts = (\n client = getDefaultClient()\n): Chain[] => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const isWaasEnabled = isDynamicWaasEnabled(client);\n\n const user = client.user;\n\n if (!user || !isWaasEnabled) {\n return [];\n }\n\n const enabledChainForWaas: Chain[] = (\n embeddedWalletSettings?.chainConfigurations?.filter(\n (chain) => chain.enabled\n ) ?? []\n ).map((chain) => chain.name as Chain);\n\n // For each enabled chain, if user does NOT have an embedded wallet, add to missing\n return enabledChainForWaas.filter(\n (chain) => !userHasEmbeddedWalletForChain({ chain, user })\n );\n};\n","import type { WalletRecoveryState } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype GetWalletRecoveryStateParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Retrieves the recovery state of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to get the recovery state for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet recovery state.\n * @not-instrumented\n */\nexport const getWalletRecoveryState = async (\n { walletAccount }: GetWalletRecoveryStateParams,\n client: DynamicClient = getDefaultClient()\n): Promise<WalletRecoveryState> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.getWalletRecoveryState({\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getVerifiedCredentialForWalletAccount } from '../../wallets/utils/getVerifiedCredentialForWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\n\ntype HasDelegatedAccessParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Checks if a WaaS wallet account has delegated access.\n *\n * @param params.walletAccount - The WaaS wallet account to check for delegated access.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the wallet account has delegated access, false otherwise.\n * @not-instrumented\n */\nexport const hasDelegatedAccess = (\n { walletAccount }: HasDelegatedAccessParams,\n client = getDefaultClient()\n): boolean => {\n const verifiedCredential = getVerifiedCredentialForWalletAccount(\n { walletAccount },\n client\n );\n\n assertDefined(\n verifiedCredential,\n 'Verified credential not found for Waas wallet account'\n );\n\n const hasDelegatedKeyShare =\n verifiedCredential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.backupLocation === 'delegated'\n );\n\n return !!hasDelegatedKeyShare;\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport type { WaasWalletProvider } from '../waas.types';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain/findWaasWalletProviderByChain';\n\ntype GetWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\n/** @not-instrumented */\nexport const getWaasWalletProviderByChain = (\n { chain }: GetWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const waasProvider = findWaasWalletProviderByChain({ chain }, client);\n\n if (!waasProvider) {\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n throw new NoWalletProviderFoundError({\n walletProviderKey: waasProviderKey,\n });\n }\n\n return waasProvider;\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { Chain } from '../../chain';\nimport { getWaasWalletProviderByChain } from '../getWaasWalletProviderByChain';\n\ntype ImportWaasPrivateKeyParams = {\n chain: Chain;\n privateKey: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Imports an existing private key to create a new WaaS wallet account.\n *\n * This function allows users to import their existing private key into\n * Dynamic's WaaS infrastructure for secure management.\n *\n * @param params.chain - The chain for the imported wallet.\n * @param params.privateKey - The private key to import.\n * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key is successfully imported.\n * @not-instrumented\n */\nexport const importWaasPrivateKey = async (\n { chain, privateKey, thresholdSignatureScheme }: ImportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderByChain({ chain }, client);\n\n return provider.importPrivateKey({\n privateKey,\n thresholdSignatureScheme,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user Waas wallets are password protected.\n *\n * If the user's Waas wallets are password protected, it means that user's will have to be prompted for a\n * password for the first wallet action that happens on each session.\n * The password is also required for creating any new Waas wallets.\n *\n * @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user has any password protected Waas wallets, false otherwise\n * @not-instrumented\n */\nexport const isPasswordRequiredForWaasWallets = (\n client = getDefaultClient()\n): boolean => {\n const { user } = client;\n\n assertDefined(user, 'User is not authenticated');\n\n return user.verifiedCredentials.some((credential) =>\n credential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.passwordEncrypted\n )\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RefreshWaasWalletAccountSharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Refreshes the cryptographic key shares for a WaaS wallet account.\n *\n * This function generates new key shares for the wallet while maintaining\n * the same threshold signature scheme.\n *\n * @param params.walletAccount - The WaaS wallet account to refresh shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key shares are refreshed.\n * @not-instrumented\n */\nexport const refreshWaasWalletAccountShares = async (\n { walletAccount, password }: RefreshWaasWalletAccountSharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.refreshWalletAccountShares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RevokeWaasDelegationParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Revokes the delegation of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to revoke delegation for.\n * @param [params.password] - Optional password for delegation operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the delegation is revoked.\n * @not-instrumented\n */\nexport const revokeWaasDelegation = async (\n { password, walletAccount }: RevokeWaasDelegationParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.revokeDelegation({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype SetWaasWalletAccountPasswordParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Sets a password for a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to set the password for.\n * @param params.password - The password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully set.\n * @not-instrumented\n */\nexport const setWaasWalletAccountPassword = async (\n { password, walletAccount }: SetWaasWalletAccountPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.setWaasWalletAccountPassword({\n password,\n walletAccount,\n });\n};\n","import {\n JwtVerifiedCredentialFormatEnum,\n type SdkUser,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\n/** @not-instrumented */\nexport const userHasExternalWallet = (user: SdkUser) => {\n const hasExternalWallet = user?.verifiedCredentials.some(\n (vc) =>\n vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&\n vc.walletProvider !== WalletProviderEnum.EmbeddedWallet\n );\n\n return hasExternalWallet;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain';\nimport { userHasExternalWallet } from '../../wallets/userHasExternalWallet';\nimport { getChainsMissingWaasWalletAccounts } from '../getChainsMissingWaasWalletAccounts';\n\ntype ShouldAutoCreateWalletForChainParams = {\n chain: Chain;\n};\n\n/**\n * Checks if a WaaS wallet should be automatically created for the specified blockchain.\n *\n * This function determines whether the current user configuration and project\n * settings require automatic wallet creation for the given chain, considering\n * whether the user already has an embedded wallet for the enabled chains or an external wallet.\n *\n * @param params.chain - The blockchain network to check.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if a wallet should be auto-created for the chain, false otherwise.\n * @not-instrumented\n */\nexport const shouldAutoCreateWalletForChain = (\n { chain }: ShouldAutoCreateWalletForChainParams,\n client = getDefaultClient()\n) => {\n assertDefined(client.projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;\n\n const automaticEmbeddedWalletCreationEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreation;\n\n if (!automaticEmbeddedWalletCreationEnabled || !client.user) {\n return false;\n }\n\n const automaticEmbeddedWalletCreationForExternalEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;\n\n // If user has an external wallet (e.g metamask, phantom, etc), should only\n // create if automaticEmbeddedWalletCreationForExternalEnabled is true\n const shouldCreateDynamicWaasWallet =\n !userHasExternalWallet(client.user) ||\n automaticEmbeddedWalletCreationForExternalEnabled;\n\n if (!shouldCreateDynamicWaasWallet) {\n return false;\n }\n\n const chainsMissingAutoCreatedWallet =\n getChainsMissingWaasWalletAccounts(client);\n\n return chainsMissingAutoCreatedWallet.includes(chain);\n};\n","import type { GetWalletResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UnlockWalletParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Unlocks a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to unlock.\n * @param params.password - The password to unlock the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet information.\n * @not-instrumented\n */\nexport const unlockWallet = async (\n { password, walletAccount }: UnlockWalletParams,\n client = getDefaultClient()\n): Promise<GetWalletResponse> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.unlockWallet({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UpdateWaasPasswordParams = {\n currentPassword: string;\n newPassword: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Updates the password for a WaaS wallet account.\n *\n * This function changes the password used to encrypt and protect the\n * cryptographic key shares for the specified wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to update the password for.\n * @param params.currentPassword - The current password for the wallet.\n * @param params.newPassword - The new password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully updated.\n * @not-instrumented\n */\nexport const updateWaasPassword = async (\n { currentPassword, newPassword, walletAccount }: UpdateWaasPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.updatePassword({\n currentPassword,\n newPassword,\n walletAccount,\n });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport type {\n GetWalletResponse,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getChainsMissingWaasWalletAccounts } from '../modules/waas/getChainsMissingWaasWalletAccounts';\nexport { getWalletRecoveryState } from '../modules/waas/getWalletRecoveryState';\nexport { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';\nexport { importWaasPrivateKey } from '../modules/waas/importWaasPrivateKey';\nexport { isDynamicWaasEnabled } from '../modules/waas/isDynamicWaasEnabled';\nexport { isPasswordRequiredForWaasWallets } from '../modules/waas/isPasswordRequiredForWaasWallets';\nexport { isWaasWalletAccount } from '../modules/waas/isWaasWalletAccount';\nexport { isWalletCreationRequirement } from '../modules/waas/isWalletCreationRequirement/isWalletCreationRequirement';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { setWaasWalletAccountPassword } from '../modules/waas/setWaasWalletAccountPassword';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACp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oB,MACjD,OACC,GAAG,WAAW,gCAAgC,cAC9C,GAAG,mBAAmB,mBAAmB,eAC5C;;;;;;;;;;;;;;;;;ACUH,MAAa,kCACX,EAAE,SACF,SAAS,kBAAkB,KACxB;AACH,eAAc,OAAO,iBAAiB,qCAAqC;CAE3E,MAAM,yBAAyB,OAAO,gBAAgB,IAAI;AAK1D,KAAI,CAFF,wBAAwB,mCAEqB,CAAC,OAAO,KACrD,QAAO;CAGT,MAAM,oDACJ,wBAAwB;AAQ1B,KAAI,EAHF,CAAC,sBAAsB,OAAO,KAAK,IACnC,mDAGA,QAAO;AAMT,QAFE,mCAAmC,OAAO,CAEN,SAAS,MAAM;;;;;;;;;;;;;;ACjCvD,MAAa,eAAe,OAC1B,EAAE,UAAU,iBACZ,SAAS,kBAAkB,KACI;AAM/B,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,aAAa;EAC3B;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;ACTJ,MAAa,qBAAqB,OAChC,EAAE,iBAAiB,aAAa,iBAChC,SAAS,kBAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,eAAe;EAC7B;EACA;EACA;EACD,CAAC;;;;;AC9BJ,qBAAqBC,MAAaC,QAAe"}
|
|
1
|
+
{"version":3,"file":"waas.native.esm.js","names":["requirement: WalletCreationRequirement","refreshAuth","refreshAuth","refreshAuth","packageName","packageVersion"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts","../src/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.ts","../src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts","../src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @not-instrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Backs up WaaS wallet key shares to Google Drive for secure recovery.\n *\n * This function creates a backup of the wallet's cryptographic key shares\n * to Google Drive, allowing users to recover their wallet later.\n *\n * @param params.walletAccount - The WaaS wallet account to backup.\n * @param [params.password] - Optional password to encrypt the backup.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the backup process is complete.\n * @not-instrumented\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n { password, walletAccount }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n password,\n walletAccount,\n });\n};\n","import type { Chain } from '../../chain';\nimport type { WalletCreationRequirement } from '../waas.types';\n\n/**\n * Type guard to check if an item is a WalletCreationRequirement object.\n * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.\n *\n * @param item - The item to check, either a WalletCreationRequirement or Chain string\n * @returns True if the item is a WalletCreationRequirement object\n * @not-instrumented\n */\nexport const isWalletCreationRequirement = (\n item: WalletCreationRequirement | Chain\n): item is WalletCreationRequirement =>\n typeof item === 'object' && item !== null && 'chain' in item;\n","import type { Chain } from '../../chain';\nimport { isWalletCreationRequirement } from '../isWalletCreationRequirement/isWalletCreationRequirement';\nimport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../waas.types';\n\nconst DEFAULT_BITCOIN_ADDRESS_TYPE = 'native_segwit' as const;\n\ntype NormalizeWalletRequirementsParams = {\n defaultBitcoinConfig?: WalletCreationBitcoinConfig;\n input: WalletCreationRequirement[] | Chain[];\n};\n\n/**\n * Normalizes wallet creation input from either legacy Chain[] format\n * or new WalletCreationRequirement[] format to WalletCreationRequirement[].\n *\n * For BTC chains without explicit bitcoinConfig, defaults to native_segwit.\n *\n * @param params.input - Either an array of Chain strings or WalletCreationRequirement objects\n * @param params.defaultBitcoinConfig - Optional default bitcoin config to use for BTC chains when converting from legacy format\n * @returns Array of WalletCreationRequirement objects\n * @not-instrumented\n */\nexport const normalizeWalletRequirements = ({\n defaultBitcoinConfig,\n input,\n}: NormalizeWalletRequirementsParams): WalletCreationRequirement[] => {\n if (input.length === 0) {\n return [];\n }\n\n const [firstItem] = input;\n\n if (isWalletCreationRequirement(firstItem)) {\n return (input as WalletCreationRequirement[]).map((requirement) => {\n if (requirement.chain === 'BTC' && !requirement.bitcoinConfig) {\n return {\n ...requirement,\n bitcoinConfig: { addressType: DEFAULT_BITCOIN_ADDRESS_TYPE },\n };\n }\n\n return requirement;\n });\n }\n\n return (input as Chain[]).map((chain) => {\n const requirement: WalletCreationRequirement = { chain };\n\n if (chain === 'BTC') {\n requirement.bitcoinConfig = defaultBitcoinConfig ?? {\n addressType: DEFAULT_BITCOIN_ADDRESS_TYPE,\n };\n }\n\n return requirement;\n });\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviderByKey } from '../../wallets/getWalletProviderByKey';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport { normalizeWalletRequirements } from '../normalizeWalletRequirements/normalizeWalletRequirements';\nimport type { WalletCreationRequirement } from '../waas.types';\n\ntype CreateWaasWalletAccountsParams = {\n /**\n * For which chains to create wallet accounts.\n * Accepts either an array of chain strings (legacy format) or an array of\n * WalletCreationRequirement objects for chain-specific configuration.\n *\n * For Bitcoin, you can specify the address type ('native_segwit' or 'taproot').\n * If not specified, defaults to 'native_segwit'.\n *\n * If a chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n * @not-instrumented\n */\n chains: Chain[] | WalletCreationRequirement[];\n /**\n * The optional password to use for the wallet accounts.\n * It's used to encrypt the user shares.\n * The same password must be used for all waas wallet accounts created for the same user.\n */\n password?: string;\n /**\n * The threshold signature scheme to use for the wallet accounts.\n * If not provided, TWO_OF_TWO will be used.\n */\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Creates wallet accounts for the specified chains.\n *\n * This function creates wallet accounts for the specified chains.\n * If the same chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n *\n * @example\n * ```ts\n * // Legacy format - will create wallet accounts for EVM and SOL, BTC defaults to native_segwit\n * await createWaasWalletAccounts({ chains: ['EVM', 'SOL', 'BTC'] });\n *\n * // New format with chain-specific config\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * { chain: 'EVM' },\n * ]\n * });\n *\n * // Create both BTC address types\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'native_segwit' } },\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * ]\n * });\n * ```\n *\n * @param params.chains - The chains to create wallet accounts for.\n * @param params.password - The optional password to use for the wallet accounts.\n * @param params.thresholdSignatureScheme - The threshold signature scheme to use for the wallet accounts. (Default: TWO_OF_TWO)\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when all wallet accounts are created.\n * @not-instrumented\n */\nexport const createWaasWalletAccounts = async (\n {\n chains,\n password,\n thresholdSignatureScheme,\n }: CreateWaasWalletAccountsParams,\n client = getDefaultClient()\n): Promise<void> => {\n const normalizedRequirements = normalizeWalletRequirements({ input: chains });\n\n // we need this right now so we don't try to create wallet accounts for chains\n // that we don't support Dynamic Waas yet in the JS SDK\n const supportedChains = ['BTC', 'EVM', 'SOL', 'SUI', 'TON', 'TRON'];\n\n const filteredRequirements = normalizedRequirements.filter((requirement) =>\n supportedChains.includes(requirement.chain)\n );\n\n if (filteredRequirements.length === 0) {\n return;\n }\n\n const walletProviderMap = new Map<\n string,\n ReturnType<typeof getWalletProviderByKey>\n >();\n\n for (const requirement of filteredRequirements) {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n if (!walletProviderMap.has(walletProviderKey)) {\n const walletProvider = getWalletProviderByKey(\n { walletProviderKey },\n client\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({\n walletProviderKey,\n });\n }\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletProviderError({\n walletProviderKey,\n });\n }\n\n walletProviderMap.set(walletProviderKey, walletProvider);\n }\n }\n\n await Promise.all(\n filteredRequirements.map((requirement) => {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const walletProvider = walletProviderMap.get(walletProviderKey);\n\n if (!walletProvider || !isWaasWalletProvider(walletProvider)) {\n return Promise.resolve();\n }\n\n return walletProvider.createWalletAccount({\n bitcoinConfig: requirement.bitcoinConfig,\n password,\n thresholdSignatureScheme,\n });\n })\n );\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n * @not-instrumented\n */\nexport const delegateWaasKeyShares = async (\n { password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasClientKeysharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the client-side key shares for a WaaS wallet account.\n *\n * This function retrieves the cryptographic key shares that are stored\n * on the client side for backup or migration purposes.\n *\n * @param params.walletAccount - The WaaS wallet account to export shares from.\n * @param [params.password] - Optional password to encrypt the exported shares.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the exported key shares.\n * @not-instrumented\n */\nexport const exportWaasClientKeyshares = async (\n { password, walletAccount }: ExportWaasClientKeysharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportClientKeyshares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasPrivateKeyParams = {\n displayContainer: HTMLElement;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the private key for a WaaS wallet account with secure display.\n *\n * This function reveals the private key for a WaaS wallet and displays it\n * securely within an iframe dynamically inserted into the specified HTML container element.\n *\n * @param params.walletAccount - The WaaS wallet account to export the private key from.\n * @param params.displayContainer - The HTML element where the iframe will be injected.\n * @param [params.password] - Optional password to decrypt the private key.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key export is complete.\n * @not-instrumented\n */\nexport const exportWaasPrivateKey = async (\n { displayContainer, password, walletAccount }: ExportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportPrivateKey({\n displayContainer,\n password,\n walletAccount,\n });\n};\n","import { type SdkUser, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getChainFromVerifiedCredentialChain } from '../../../utils/getChainFromVerifiedCredentialChain';\nimport type { Chain } from '../../chain/chain.types';\n\ntype UserHasEmbeddedWalletForChainProps = {\n chain: Chain;\n user: SdkUser;\n};\n\n/** @not-instrumented */\nexport const userHasEmbeddedWalletForChain = ({\n user,\n chain,\n}: UserHasEmbeddedWalletForChainProps): boolean => {\n const hasEmbeddedWalletForChain = user.verifiedCredentials.some(\n (vc) =>\n vc.walletProvider === WalletProviderEnum.EmbeddedWallet &&\n vc.chain &&\n getChainFromVerifiedCredentialChain(vc.chain) === chain\n );\n\n return hasEmbeddedWalletForChain;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @not-instrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain/chain.types';\nimport { userHasEmbeddedWalletForChain } from '../../wallets/userHasEmbeddedWalletForChain';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Gets all chains missing a waas wallet account for the current user.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of all chains that have waas wallet accounts enabled\n * but for which the current user does not yet have an embedded wallet account.\n * @not-instrumented\n */\nexport const getChainsMissingWaasWalletAccounts = (\n client = getDefaultClient()\n): Chain[] => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const isWaasEnabled = isDynamicWaasEnabled(client);\n\n const user = client.user;\n\n if (!user || !isWaasEnabled) {\n return [];\n }\n\n const enabledChainForWaas: Chain[] = (\n embeddedWalletSettings?.chainConfigurations?.filter(\n (chain) => chain.enabled\n ) ?? []\n ).map((chain) => chain.name as Chain);\n\n // For each enabled chain, if user does NOT have an embedded wallet, add to missing\n return enabledChainForWaas.filter(\n (chain) => !userHasEmbeddedWalletForChain({ chain, user })\n );\n};\n","import type { WalletRecoveryState } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype GetWalletRecoveryStateParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Retrieves the recovery state of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to get the recovery state for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet recovery state.\n * @not-instrumented\n */\nexport const getWalletRecoveryState = async (\n { walletAccount }: GetWalletRecoveryStateParams,\n client: DynamicClient = getDefaultClient()\n): Promise<WalletRecoveryState> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.getWalletRecoveryState({\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getVerifiedCredentialForWalletAccount } from '../../wallets/utils/getVerifiedCredentialForWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\n\ntype HasDelegatedAccessParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Checks if a WaaS wallet account has delegated access.\n *\n * @param params.walletAccount - The WaaS wallet account to check for delegated access.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the wallet account has delegated access, false otherwise.\n * @not-instrumented\n */\nexport const hasDelegatedAccess = (\n { walletAccount }: HasDelegatedAccessParams,\n client = getDefaultClient()\n): boolean => {\n const verifiedCredential = getVerifiedCredentialForWalletAccount(\n { walletAccount },\n client\n );\n\n assertDefined(\n verifiedCredential,\n 'Verified credential not found for Waas wallet account'\n );\n\n const hasDelegatedKeyShare =\n verifiedCredential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.backupLocation === 'delegated'\n );\n\n return !!hasDelegatedKeyShare;\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport type { WaasWalletProvider } from '../waas.types';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain/findWaasWalletProviderByChain';\n\ntype GetWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\n/** @not-instrumented */\nexport const getWaasWalletProviderByChain = (\n { chain }: GetWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const waasProvider = findWaasWalletProviderByChain({ chain }, client);\n\n if (!waasProvider) {\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n throw new NoWalletProviderFoundError({\n walletProviderKey: waasProviderKey,\n });\n }\n\n return waasProvider;\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { Chain } from '../../chain';\nimport { getWaasWalletProviderByChain } from '../getWaasWalletProviderByChain';\n\ntype ImportWaasPrivateKeyParams = {\n chain: Chain;\n privateKey: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Imports an existing private key to create a new WaaS wallet account.\n *\n * This function allows users to import their existing private key into\n * Dynamic's WaaS infrastructure for secure management.\n *\n * @param params.chain - The chain for the imported wallet.\n * @param params.privateKey - The private key to import.\n * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key is successfully imported.\n * @not-instrumented\n */\nexport const importWaasPrivateKey = async (\n { chain, privateKey, thresholdSignatureScheme }: ImportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderByChain({ chain }, client);\n\n return provider.importPrivateKey({\n privateKey,\n thresholdSignatureScheme,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user Waas wallets are password protected.\n *\n * If the user's Waas wallets are password protected, it means that user's will have to be prompted for a\n * password for the first wallet action that happens on each session.\n * The password is also required for creating any new Waas wallets.\n *\n * @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user has any password protected Waas wallets, false otherwise\n * @not-instrumented\n */\nexport const isPasswordRequiredForWaasWallets = (\n client = getDefaultClient()\n): boolean => {\n const { user } = client;\n\n assertDefined(user, 'User is not authenticated');\n\n return user.verifiedCredentials.some((credential) =>\n credential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.passwordEncrypted\n )\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RefreshWaasWalletAccountSharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Refreshes the cryptographic key shares for a WaaS wallet account.\n *\n * This function generates new key shares for the wallet while maintaining\n * the same threshold signature scheme.\n *\n * @param params.walletAccount - The WaaS wallet account to refresh shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key shares are refreshed.\n * @not-instrumented\n */\nexport const refreshWaasWalletAccountShares = async (\n { walletAccount, password }: RefreshWaasWalletAccountSharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.refreshWalletAccountShares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RevokeWaasDelegationParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Revokes the delegation of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to revoke delegation for.\n * @param [params.password] - Optional password for delegation operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the delegation is revoked.\n * @not-instrumented\n */\nexport const revokeWaasDelegation = async (\n { password, walletAccount }: RevokeWaasDelegationParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.revokeDelegation({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype SetWaasWalletAccountPasswordParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Sets a password for a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to set the password for.\n * @param params.password - The password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully set.\n * @not-instrumented\n */\nexport const setWaasWalletAccountPassword = async (\n { password, walletAccount }: SetWaasWalletAccountPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.setWaasWalletAccountPassword({\n password,\n walletAccount,\n });\n};\n","import {\n JwtVerifiedCredentialFormatEnum,\n type SdkUser,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\n/** @not-instrumented */\nexport const userHasExternalWallet = (user: SdkUser) => {\n const hasExternalWallet = user?.verifiedCredentials.some(\n (vc) =>\n vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&\n vc.walletProvider !== WalletProviderEnum.EmbeddedWallet\n );\n\n return hasExternalWallet;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain';\nimport { userHasExternalWallet } from '../../wallets/userHasExternalWallet';\nimport { getChainsMissingWaasWalletAccounts } from '../getChainsMissingWaasWalletAccounts';\n\ntype ShouldAutoCreateWalletForChainParams = {\n chain: Chain;\n};\n\n/**\n * Checks if a WaaS wallet should be automatically created for the specified blockchain.\n *\n * This function determines whether the current user configuration and project\n * settings require automatic wallet creation for the given chain, considering\n * whether the user already has an embedded wallet for the enabled chains or an external wallet.\n *\n * @param params.chain - The blockchain network to check.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if a wallet should be auto-created for the chain, false otherwise.\n * @not-instrumented\n */\nexport const shouldAutoCreateWalletForChain = (\n { chain }: ShouldAutoCreateWalletForChainParams,\n client = getDefaultClient()\n) => {\n assertDefined(client.projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;\n\n const automaticEmbeddedWalletCreationEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreation;\n\n if (!automaticEmbeddedWalletCreationEnabled || !client.user) {\n return false;\n }\n\n const automaticEmbeddedWalletCreationForExternalEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;\n\n // If user has an external wallet (e.g metamask, phantom, etc), should only\n // create if automaticEmbeddedWalletCreationForExternalEnabled is true\n const shouldCreateDynamicWaasWallet =\n !userHasExternalWallet(client.user) ||\n automaticEmbeddedWalletCreationForExternalEnabled;\n\n if (!shouldCreateDynamicWaasWallet) {\n return false;\n }\n\n const chainsMissingAutoCreatedWallet =\n getChainsMissingWaasWalletAccounts(client);\n\n return chainsMissingAutoCreatedWallet.includes(chain);\n};\n","import type { GetWalletResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UnlockWalletParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Unlocks a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to unlock.\n * @param params.password - The password to unlock the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet information.\n * @not-instrumented\n */\nexport const unlockWallet = async (\n { password, walletAccount }: UnlockWalletParams,\n client = getDefaultClient()\n): Promise<GetWalletResponse> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.unlockWallet({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UpdateWaasPasswordParams = {\n currentPassword: string;\n newPassword: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Updates the password for a WaaS wallet account.\n *\n * This function changes the password used to encrypt and protect the\n * cryptographic key shares for the specified wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to update the password for.\n * @param params.currentPassword - The current password for the wallet.\n * @param params.newPassword - The new password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully updated.\n * @not-instrumented\n */\nexport const updateWaasPassword = async (\n { currentPassword, newPassword, walletAccount }: UpdateWaasPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.updatePassword({\n currentPassword,\n newPassword,\n walletAccount,\n });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport type {\n GetWalletResponse,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getChainsMissingWaasWalletAccounts } from '../modules/waas/getChainsMissingWaasWalletAccounts';\nexport { getWalletRecoveryState } from '../modules/waas/getWalletRecoveryState';\nexport { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';\nexport { importWaasPrivateKey } from '../modules/waas/importWaasPrivateKey';\nexport { isDynamicWaasEnabled } from '../modules/waas/isDynamicWaasEnabled';\nexport { isPasswordRequiredForWaasWallets } from '../modules/waas/isPasswordRequiredForWaasWallets';\nexport { isWaasWalletAccount } from '../modules/waas/isWaasWalletAccount';\nexport { isWalletCreationRequirement } from '../modules/waas/isWalletCreationRequirement/isWalletCreationRequirement';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { setWaasWalletAccountPassword } from '../modules/waas/setWaasWalletAccountPassword';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,qBAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;;;ACNT,MAAa,mCAAmC,OAC9C,EAAE,UAAU,iBACZ,SAAS,kBAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,6BAA6B;EAC3C;EACA;EACD,CAAC;;;;;;;;;;;;;ACtBJ,MAAa,+BACX,SAEA,OAAO,SAAS,YAAY,SAAS,QAAQ,WAAW;;;;ACP1D,MAAM,+BAA+B;;;;;;;;;;;;AAkBrC,MAAa,+BAA+B,EAC1C,sBACA,YACoE;AACpE,KAAI,MAAM,WAAW,EACnB,QAAO,EAAE;CAGX,MAAM,CAAC,aAAa;AAEpB,KAAI,4BAA4B,UAAU,CACxC,QAAQ,MAAsC,KAAK,gBAAgB;AACjE,MAAI,YAAY,UAAU,SAAS,CAAC,YAAY,cAC9C,QAAO;GACL,GAAG;GACH,eAAe,EAAE,aAAa,8BAA8B;GAC7D;AAGH,SAAO;GACP;AAGJ,QAAQ,MAAkB,KAAK,UAAU;EACvC,MAAMA,cAAyC,EAAE,OAAO;AAExD,MAAI,UAAU,MACZ,aAAY,gBAAgB,wBAAwB,EAClD,aAAa,8BACd;AAGH,SAAO;GACP;;;;;;;;;;;;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EACjB,OACD,CAEc,iBAAiB;EAC9B;EACA;EACD,CAAC;AAEF,OAAMC,sBAAY,OAAO;;;;;;;;;;;;;;ACf3B,MAAa,+BAA+B,OAC1C,EAAE,UAAU,iBACZ,SAAS,kBAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,6BAA6B;EAC3C;EACA;EACD,CAAC;;;;;;ACvBJ,MAAa,yBAAyB,SAAkB;AAOtD,QAN0B,MAAM,oBAAoB,MACjD,OACC,GAAG,WAAW,gCAAgC,cAC9C,GAAG,mBAAmB,mBAAmB,eAC5C;;;;;;;;;;;;;;;;;ACUH,MAAa,kCACX,EAAE,SACF,SAAS,kBAAkB,KACxB;AACH,eAAc,OAAO,iBAAiB,qCAAqC;CAE3E,MAAM,yBAAyB,OAAO,gBAAgB,IAAI;AAK1D,KAAI,CAFF,wBAAwB,mCAEqB,CAAC,OAAO,KACrD,QAAO;CAGT,MAAM,oDACJ,wBAAwB;AAQ1B,KAAI,EAHF,CAAC,sBAAsB,OAAO,KAAK,IACnC,mDAGA,QAAO;AAMT,QAFE,mCAAmC,OAAO,CAEN,SAAS,MAAM;;;;;;;;;;;;;;ACjCvD,MAAa,eAAe,OAC1B,EAAE,UAAU,iBACZ,SAAS,kBAAkB,KACI;AAM/B,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,aAAa;EAC3B;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;ACTJ,MAAa,qBAAqB,OAChC,EAAE,iBAAiB,aAAa,iBAChC,SAAS,kBAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,eAAe;EAC7B;EACA;EACA;EACD,CAAC;;;;;AC9BJ,qBAAqBC,MAAaC,QAAe"}
|
package/dist/waasCore.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
2
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
3
|
-
require('./isMfaRequiredForAction-
|
|
4
|
-
const require_getSignedSessionId = require('./getSignedSessionId-
|
|
1
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-BA0CHZzu.cjs');
|
|
2
|
+
const require_InvalidParamError = require('./InvalidParamError-DQvZQdQ9.cjs');
|
|
3
|
+
require('./isMfaRequiredForAction-CMClgbT0.cjs');
|
|
4
|
+
const require_getSignedSessionId = require('./getSignedSessionId-BCU987hO.cjs');
|
|
5
5
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
6
6
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
7
7
|
let _dynamic_labs_wallet_browser_wallet_client = require("@dynamic-labs-wallet/browser-wallet-client");
|
package/dist/waasCore.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as name, C as isCookieEnabled, E as __getElevatedAccessToken_wrapped, M as CLIENT_SDK_NAME, V as version, c as CHAINS_INFO_MAP, i as DYNAMIC_WAAS_METADATA, n as DEFAULT_WAAS_BASE_API_URL, r as DEFAULT_WAAS_BASE_MPC_RELAY_API_URL, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, z as getCore } from "./InvalidParamError-
|
|
2
|
-
import "./isMfaRequiredForAction-
|
|
3
|
-
import { n as consumeMfaTokenIfRequiredForAction, t as getSignedSessionId } from "./getSignedSessionId-
|
|
1
|
+
import { B as name, C as isCookieEnabled, E as __getElevatedAccessToken_wrapped, M as CLIENT_SDK_NAME, V as version, c as CHAINS_INFO_MAP, i as DYNAMIC_WAAS_METADATA, n as DEFAULT_WAAS_BASE_API_URL, r as DEFAULT_WAAS_BASE_MPC_RELAY_API_URL, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, z as getCore } from "./InvalidParamError-Za4cvW7K.esm.js";
|
|
2
|
+
import "./isMfaRequiredForAction-C1u4Z__n.esm.js";
|
|
3
|
+
import { n as consumeMfaTokenIfRequiredForAction, t as getSignedSessionId } from "./getSignedSessionId-la6RXITX.esm.js";
|
|
4
4
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
5
5
|
import { MFAAction, TokenScope, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
6
6
|
import { DynamicWalletClient, ThresholdSignatureScheme, WalletOperation } from "@dynamic-labs-wallet/browser-wallet-client";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as name, C as isCookieEnabled, E as __getElevatedAccessToken_wrapped, M as CLIENT_SDK_NAME, V as version, c as CHAINS_INFO_MAP, i as DYNAMIC_WAAS_METADATA, n as DEFAULT_WAAS_BASE_API_URL, r as DEFAULT_WAAS_BASE_MPC_RELAY_API_URL, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, z as getCore } from "./InvalidParamError-
|
|
2
|
-
import "./isMfaRequiredForAction-
|
|
3
|
-
import { n as consumeMfaTokenIfRequiredForAction, t as getSignedSessionId } from "./getSignedSessionId-
|
|
1
|
+
import { B as name, C as isCookieEnabled, E as __getElevatedAccessToken_wrapped, M as CLIENT_SDK_NAME, V as version, c as CHAINS_INFO_MAP, i as DYNAMIC_WAAS_METADATA, n as DEFAULT_WAAS_BASE_API_URL, r as DEFAULT_WAAS_BASE_MPC_RELAY_API_URL, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, z as getCore } from "./InvalidParamError-9kQBK3sP.native.esm.js";
|
|
2
|
+
import "./isMfaRequiredForAction-DSX-TV2z.native.esm.js";
|
|
3
|
+
import { n as consumeMfaTokenIfRequiredForAction, t as getSignedSessionId } from "./getSignedSessionId-DzNCj6g_.native.esm.js";
|
|
4
4
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
5
5
|
import { MFAAction, TokenScope, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
6
6
|
import { DynamicWalletClient, ThresholdSignatureScheme, WalletOperation } from "@dynamic-labs-wallet/browser-wallet-client";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.351",
|
|
36
36
|
"@dynamic-labs-wallet/forward-mpc-client": "0.9.0",
|
|
37
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
37
|
+
"@dynamic-labs/sdk-api-core": "0.0.1015",
|
|
38
38
|
"@simplewebauthn/browser": "13.1.0",
|
|
39
39
|
"ably": "2.17.1",
|
|
40
40
|
"buffer": "6.0.3",
|
|
41
41
|
"eventemitter3": "5.0.1",
|
|
42
42
|
"zod": "4.0.5",
|
|
43
|
-
"@dynamic-labs-sdk/assert-package-version": "1.
|
|
43
|
+
"@dynamic-labs-sdk/assert-package-version": "1.3.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@inrupt/jest-jsdom-polyfills": "4.0.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getNetworkProviderFromNetworkId-C9QzgcLs.esm.js","names":["item: StorageFormat<typeof value>","walletProvidersMap: Map<string, WalletProvider>","BufferPolyfill","resolve: (value: T) => void","reject: (reason?: unknown) => void","EventEmitter","LOG_LEVELS: Record<LogLevel, number>","eventEmitter: LoggerEventEmitter","minLevel: LogLevel","createKeychainService: CreateKeychainService","ABLY_STATE_TO_REALTIME_STATE: Record<string, RealtimeConnectionState>","EventEmitter","ablyClient: BaseRealtime | undefined","connectionState: RealtimeConnectionState","connect: RealtimeService['connect']","disconnect: RealtimeService['disconnect']","subscribe: RealtimeService['subscribe']","handler: messageCallback<InboundMessage>","unsubscribe: RealtimeService['unsubscribe']","publish: RealtimeService['publish']","connectRequest: ConnectRequest","filteredUnverifiedWalletAccounts: UnverifiedWalletAccount[]","suffixFields: string[]","networkProvider"],"sources":["../src/utils/isEqualShallow/isEqualShallow.ts","../src/utils/observable/subscribeWithSelector/subscribeWithSelector.ts","../src/utils/retryOnFail/InvalidRetryOnFailCallError.ts","../src/utils/retryOnFail/retryOnFail.ts","../src/modules/auth/isSignedIn/isSignedIn.ts","../src/services/storage/createLocalStorageAdapter/createLocalStorageAdapter.ts","../src/errors/InvalidStorageSet.ts","../src/services/storage/createStorage/formatForStorage/isValidDateISOString/isValidDateISOString.ts","../src/services/storage/createStorage/formatForStorage/storageFormat.ts","../src/services/storage/createStorage/createStorage.ts","../src/services/storage/createStorageKeySchema/createStorageKeySchema.ts","../src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.ts","../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts","../src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts","../src/modules/wallets/utils/getAvailableWalletProvidersFromWalletAccounts/getAvailableWalletProvidersFromWalletAccounts.ts","../src/modules/wallets/destroyWalletProviders/destroyWalletProviders.ts","../src/modules/auth/logoutWithReason/logoutWithReason.ts","../src/utils/getBuffer/getBuffer.ts","../src/utils/isServerSideRendering/isServerSideRendering.ts","../src/modules/initializeClient/consts.ts","../src/utils/deferredPromise/createDeferredPromise.ts","../src/errors/CannotTrackError.ts","../src/services/crossTabBroadcast/crossTabBroadcast.schema.ts","../src/services/crossTabBroadcast/createCrossTabBroadcast/createCrossTabBroadcast.ts","../src/services/logger/createLogger/createLogger.ts","../src/utils/bufferToHex/bufferToHex.ts","../src/utils/compressRawPublicKey/compressRawPublicKey.ts","../src/services/keychain/createKeychainService/KeyNotFoundError.ts","../src/services/keychain/createKeychainService/utils/constants.ts","../src/services/keychain/createKeychainService/utils/deleteIndexedDBItem.ts","../src/services/keychain/createKeychainService/utils/getIndexedDBItem.ts","../src/services/keychain/createKeychainService/utils/setIndexedDBItem.ts","../src/services/keychain/createKeychainService/utils/openDatabase.ts","../src/services/keychain/createKeychainService/utils/withDatabase/withDatabase.ts","../src/services/keychain/createKeychainService/createKeychainService.ts","../src/errors/InvalidRealtimePublishError.ts","../src/errors/RealtimeNotConnectedError.ts","../src/services/realtime/createRealtimeService/createRealtimeService.ts","../src/utils/getKeychainIndexedDBName/getKeychainIndexedDBName.ts","../src/errors/NoNetworkProvidersError.ts","../src/errors/WalletAlreadyLinkedToAnotherUserError.ts","../src/errors/MethodNotImplementedError.ts","../src/modules/captcha/isCaptchaRequired/isCaptchaRequired.ts","../src/modules/captcha/consumeCaptchaToken/consumeCaptchaToken.ts","../src/modules/captcha/setCaptchaToken/setCaptchaToken.ts","../src/modules/extension/hasExtension/hasExtension.ts","../src/modules/auth/createVisit/createVisit.ts","../src/modules/wallets/unverifiedWalletAccounts/setUnverifiedWalletAccounts/setUnverifiedWalletAccounts.ts","../src/modules/wallets/utils/formatSignInMessage/formatSignInMessage.ts","../src/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/createSignInMessageStatement.ts","../src/modules/wallets/unverifiedWalletAccounts/removeUnverifiedWalletAccount/removeUnverifiedWalletAccount.ts","../src/utils/isError/isError.ts","../src/utils/isErrorWithCode/isErrorWithCode.ts","../src/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.ts","../src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/updateWalletProviderKeysForVerifiedCredentials.ts","../src/modules/wallets/networks/getSdkChainFromApiChainName/getSdkChainFromApiChainName.ts","../src/modules/wallets/networks/getNetworksData/getNetworksData.ts","../src/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.ts","../src/modules/wallets/networks/networkProviderBuilderRegistry/getNetworkProviderBuilderRegistry/getNetworkProviderBuilderRegistry.ts","../src/modules/wallets/networks/getNetworkProviders/getNetworkProviders.ts","../src/modules/wallets/networks/getNetworkProviderFromNetworkId/getNetworkProviderFromNetworkId.ts"],"sourcesContent":["/**\n * Shallow compare two objects.\n *\n * Source: https://github.com/pmndrs/zustand/blob/main/src/vanilla/shallow.ts\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const isEqualShallow = <T>(objA: T, objB: T) => {\n if (Object.is(objA, objB)) return true;\n\n if (\n typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null\n ) {\n return objA === objB;\n }\n\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) return false;\n }\n\n return true;\n }\n\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n\n for (const value of objA) {\n if (!objB.has(value)) return false;\n }\n return true;\n }\n\n const keysA = Object.keys(objA);\n\n if (keysA.length !== Object.keys(objB).length) return false;\n\n for (const keyA of keysA) {\n if (\n !Object.prototype.hasOwnProperty.call(objB, keyA as string) ||\n !Object.is(objA[keyA as keyof T], objB[keyA as keyof T])\n ) {\n return false;\n }\n }\n\n if (objA.constructor !== objB.constructor) return false;\n\n return true;\n};\n","import { isEqualShallow } from '../../isEqualShallow';\nimport type { ObservableState } from '../observable.types';\n\n/**\n * Allows subscribing to a slice of the state.\n * The slice is a computation of the states.\n *\n * The callback will only be called when the slice has changed.\n * Change is determined by shallow comparison.\n *\n * Returns a function to unsubscribe the callback.\n * @not-instrumented\n */\nexport const subscribeWithSelector =\n // eslint-disable-next-line custom-rules/require-single-object-param\n <T extends Record<string, unknown>, Slice>(\n observable: ObservableState<T>,\n selector: (value: T) => Slice\n ) =>\n // eslint-disable-next-line custom-rules/require-single-object-param\n (callback: (slice: Slice) => void) => {\n let lastSlice = selector(observable.get());\n\n return observable.subscribe((value) => {\n const nextSlice = selector(value);\n\n if (isEqualShallow(nextSlice, lastSlice)) return;\n\n lastSlice = nextSlice;\n\n callback(nextSlice);\n });\n };\n","import { BaseError } from '../../errors/base';\n\n/**\n * This error is thrown when the `retryOnFail` function is called with an invalid\n * number of retries (i.e. less than 0).\n */\nexport class InvalidRetryOnFailCallError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(maxRetries: number) {\n super({\n cause: null,\n code: 'invalid_retry_on_fail_call_error',\n docsUrl: null,\n name: 'InvalidRetryOnFailCallError',\n shortMessage: `Invalid retries parameter for retryOnFail call: ${maxRetries}`,\n });\n }\n}\n","import { InvalidRetryOnFailCallError } from './InvalidRetryOnFailCallError';\n\nexport type RetryOnFailParams<T> = {\n /**\n * The delay between retries in milliseconds.\n */\n delay?: number;\n /**\n * The function to call.\n */\n fn: () => Promise<T>;\n /**\n * The maximum number of retries.\n *\n * When set to 0, the function will be called only once and is\n * therefore equivalent to calling the function directly.\n */\n maxRetries: number;\n};\n\n/** @not-instrumented */\nexport const retryOnFail = async <T>({\n delay = 0,\n fn,\n maxRetries,\n}: RetryOnFailParams<T>) => {\n for (let retry = 0; retry <= maxRetries; retry++) {\n try {\n return await fn();\n } catch (error) {\n if (retry >= maxRetries) {\n throw error;\n }\n\n if (delay > 0) {\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n }\n\n /**\n * Reaching this point should never happen and this\n * error is thrown to help us debug the issue.\n */\n throw new InvalidRetryOnFailCallError(maxRetries);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\n\n/**\n * Checks if the user is currently signed in to the Dynamic client.\n *\n * The client is considered to be in a signed in state if a user has\n * authenticated or if the client has at least one wallet connected.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user is signed in, false otherwise.\n * @not-instrumented\n */\nexport const isSignedIn = (client = getDefaultClient()) =>\n Boolean(client.user || getWalletAccounts(client).length > 0);\n","/* eslint-disable no-restricted-globals -- this is the abstraction for localStorage */\nimport type { StorageAdapter } from '../storage.types';\n\n/**\n * Creates a localStorage adapter.\n * @not-instrumented\n */\nexport const createLocalStorageAdapter = (): StorageAdapter => ({\n getItem: async (key) => localStorage.getItem(key),\n removeItem: async (key) => localStorage.removeItem(key),\n setItem: async (key, value) => localStorage.setItem(key, value),\n});\n","import { BaseError } from './base';\n\ntype InvalidStorageSetParams = {\n key: string;\n value: string;\n};\n\nexport class InvalidStorageSet extends BaseError {\n constructor({ key, value }: InvalidStorageSetParams) {\n super({\n cause: null,\n code: 'invalid_storage_set',\n docsUrl: null,\n metaMessages: [`key: ${key}`, value],\n name: 'InvalidStorageSet',\n shortMessage: 'Tried to store a value that does not match the schema',\n });\n }\n}\n","/**\n * Returns whether the given string is a valid ISO date string.\n *\n * Does not support timezone offsets.\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const isValidDateISOString = (value: string): boolean => {\n const date = new Date(value);\n\n return !isNaN(date.getTime()) && date.toISOString() === value;\n};\n","/* eslint-disable custom-rules/function-name-matches-filename */\nimport type { StorageFormat } from '../../storage.types';\nimport { isValidDateISOString } from './isValidDateISOString';\n\nconst DATE_PREFIX = '__DATE__';\n\n/** @not-instrumented */\nexport const formatForStorage = (value: unknown) => {\n const item: StorageFormat<typeof value> = { value };\n\n return JSON.stringify(item, (_, entry) => {\n // You might think that entry here would be a Date and one could simply do \"entry instanceof Date\",\n // but actually it will be a string already (no idea why JSON.stringify does this)\n if (isValidDateISOString(entry)) {\n return `${DATE_PREFIX}${entry}`;\n }\n\n return entry;\n });\n};\n\n/** @not-instrumented */\n// eslint-disable-next-line custom-rules/one-function-per-file, custom-rules/require-single-object-param\nexport const parseFromStorage = <T>(value: string): StorageFormat<T> | null => {\n try {\n const parsed = JSON.parse(value, (_, entry) => {\n if (typeof entry === 'string' && entry.startsWith(DATE_PREFIX)) {\n return new Date(entry.slice(DATE_PREFIX.length));\n }\n\n return entry;\n }) as StorageFormat<T>;\n\n return parsed;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n return null;\n }\n};\n","import type { Storage, StorageAdapter, StorageAdapterOptions, StorageTier } from '../storage.types';\nimport { InvalidStorageSet } from './../../../errors/InvalidStorageSet';\nimport { formatForStorage } from './formatForStorage';\nimport { parseFromStorage } from './formatForStorage/storageFormat';\n\ntype CreateWebStorageParams = {\n prefix?: string;\n storageAdapter: StorageAdapter;\n};\n\n/**\n * Creates a Storage service to interact with storage adapter.\n * Reads the `storageTier` from each key's config and passes it\n * to the adapter on every operation, defaulting to `'default'`.\n * @not-instrumented\n */\nexport const createStorage = ({\n prefix = '',\n storageAdapter,\n}: CreateWebStorageParams): Storage => {\n const getPrefixedKey = (key: string) => (prefix ? `${prefix}_${key}` : key);\n\n const getAdapterOptions = (storageTier?: StorageTier): StorageAdapterOptions => ({\n storageTier: storageTier ?? 'default',\n });\n\n return {\n getItem: async (storageKeySchema) => {\n const prefixedKey = getPrefixedKey(storageKeySchema.key);\n const options = getAdapterOptions(storageKeySchema.config?.storageTier);\n\n const rawItem = await storageAdapter.getItem(prefixedKey, options);\n\n const parsedItem = rawItem ? parseFromStorage(rawItem) : null;\n\n /**\n * The item saved to localStorage may be malformed.\n * In this case, we remove it and return null.\n */\n if (parsedItem !== null) {\n const parsed = storageKeySchema.schema.safeParse(parsedItem.value);\n\n if (parsed.success) {\n return parsed.data;\n }\n }\n\n /**\n * The item saved to localStorage may be malformed.\n * In this case, we remove it and return null.\n */\n\n await storageAdapter.removeItem(prefixedKey, options);\n\n return null;\n },\n\n removeItem: async (storageKeySchema) => {\n await storageAdapter.removeItem(\n getPrefixedKey(storageKeySchema.key),\n getAdapterOptions(storageKeySchema.config?.storageTier),\n );\n },\n\n setItem: async (storageKeySchema, value) => {\n const parsed = storageKeySchema.schema.safeParse(value);\n\n if (!parsed.success) {\n throw new InvalidStorageSet({\n key: storageKeySchema.key,\n value: JSON.stringify(value),\n });\n }\n\n const item = formatForStorage(parsed.data);\n\n await storageAdapter.setItem(\n getPrefixedKey(storageKeySchema.key),\n item,\n getAdapterOptions(storageKeySchema.config?.storageTier),\n );\n },\n };\n};\n","import type * as z from 'zod/mini';\n\nimport type { StorageKeySchema, StorageKeySchemaConfig } from '../storage.types';\n\n/** @not-instrumented */\nexport const createStorageKeySchema = <T>(params: {\n config?: StorageKeySchemaConfig;\n key: string;\n schema: z.ZodMiniType<T>;\n}): StorageKeySchema<T> => {\n return params;\n};\n","import * as z from 'zod/mini';\n\nimport { createStorageKeySchema } from '../../../services/storage';\n\n/**\n * The schema to track the expiration time of the project settings.\n */\nexport const projectSettingsExpirationStorageKeySchema = createStorageKeySchema(\n {\n key: 'projectSettingsExpiration',\n schema: z.number(),\n }\n);\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { retryOnFail } from '../../../utils/retryOnFail';\nimport { createApiClient } from '../../apiClient';\nimport { CLIENT_SDK_NAME } from '../../apiClient/constants';\nimport { isSignedIn } from '../../auth/isSignedIn';\nimport { projectSettingsExpirationStorageKeySchema } from './projectSettingsExpirationScheme';\n\n/**\n * Expiration time of the project settings in milliseconds.\n */\nexport const PROJECT_SETTINGS_EXPIRATION_TIME = 1000 * 60 * 5; // 5 minutes\n\n/**\n * Fetches and updates the project settings from the API.\n *\n * This function retrieves the latest project configuration settings\n * from Dynamic's servers, including authentication options, enabled chains,\n * and security configurations. The settings are cached for performance.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the updated project settings.\n * @not-instrumented\n */\nexport const fetchProjectSettings = async (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const currentExpiration = await core.storage.getItem(\n projectSettingsExpirationStorageKeySchema\n );\n\n const hasProjectSettings = Boolean(client.projectSettings);\n const isExpired = currentExpiration && currentExpiration < Date.now();\n\n // We want to cache the project settings if its valid and user is connected.\n // This avoids unnecessary API calls and speeds up the initial load.\n if (hasProjectSettings && !isExpired && isSignedIn(client)) {\n return client.projectSettings;\n }\n\n const apiClient = createApiClient({}, client);\n\n core.logger.debug('[fetchProjectSettings] Fetching project settings...');\n\n const doFetch = async () =>\n apiClient.getEnvironmentSettings(\n {\n environmentId: core.environmentId,\n sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`,\n },\n {\n credentials: 'omit',\n }\n );\n\n const projectSettings = await retryOnFail({\n fn: doFetch,\n maxRetries: 2,\n });\n\n core.state.set({ projectSettings: projectSettings ?? null });\n\n await core.storage.setItem(\n projectSettingsExpirationStorageKeySchema,\n Date.now() + PROJECT_SETTINGS_EXPIRATION_TIME\n );\n\n return projectSettings;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { SessionKeys } from '../sessionKeys.types';\n\n/** @not-instrumented */\nexport const generateSessionKeys = async (\n client: DynamicClient\n): Promise<SessionKeys> => {\n const core = getCore(client);\n\n await core.keychain.removeKey('session');\n\n const publicKey = await core.keychain.generateKey('session');\n\n assertDefined(publicKey, 'Public key not found');\n\n core.state.set({\n sessionKeys: publicKey,\n });\n\n return { publicKey };\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { getWalletAccounts } from '../../getWalletAccounts';\nimport type { WalletProvider } from '../../walletProvider';\nimport { getWalletProviderFromWalletAccount } from '../getWalletProviderFromWalletAccount';\n\n/** @not-instrumented */\nexport const getAvailableWalletProvidersFromWalletAccounts = (\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProvidersMap: Map<string, WalletProvider> = new Map();\n\n const walletAccounts = getWalletAccounts(client);\n\n walletAccounts.forEach((walletAccount) => {\n if (walletProvidersMap.has(walletAccount.walletProviderKey)) {\n return;\n }\n\n try {\n const walletProvider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);\n } catch (error) {\n core.logger.debug('Wallet provider not found for wallet account', {\n error,\n walletAccount: walletAccount.address,\n });\n }\n });\n\n return Array.from(walletProvidersMap.values());\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { LogoutReason } from '../../auth/logoutReason';\nimport { getAvailableWalletProvidersFromWalletAccounts } from '../utils/getAvailableWalletProvidersFromWalletAccounts';\n\n/**\n * Tear down every wallet provider on the client.\n *\n * Each provider's `destroy` is responsible for its own local + remote\n * cleanup. We swallow errors so a failing destroy on one provider does not\n * block teardown of the others (e.g. during logout).\n *\n * @not-instrumented\n */\nexport const destroyWalletProviders = async (\n { reason }: { reason?: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProviders = getAvailableWalletProvidersFromWalletAccounts(client);\n\n await Promise.all(\n walletProviders.map(async (walletProvider) => {\n if (!walletProvider.destroy) return;\n try {\n await walletProvider.destroy({ reason });\n } catch (err) {\n core.logger.error(\n `Error destroying wallet provider ${walletProvider.key}`,\n err\n );\n }\n })\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getCore } from '../../../client/core/getCore';\nimport { setCookie } from '../../../utils/setCookie';\nimport { createApiClient } from '../../apiClient';\nimport { emitEvent } from '../../clientEvents';\nimport { fetchProjectSettings } from '../../projectSettings/fetchProjectSettings';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { generateSessionKeys } from '../../sessionKeys/generateSessionKeys';\nimport { destroyWalletProviders } from '../../wallets/destroyWalletProviders';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport type { LogoutReason } from '../logoutReason';\n\n/**\n * Logs the user out with an explicit reason.\n *\n * Revokes the session, clears auth state, terminates wallet providers, and\n * emits the `logout` client event with the given reason. The reason is also\n * captured as an argument on the function-instrumentation event, which is\n * how Datadog distinguishes between different logout causes.\n *\n * Use this instead of the public `logout` when triggering a logout from\n * internal or extension code — the caller owns the reason string, so the\n * telemetry correctly attributes *why* the logout happened.\n *\n * @param params - The logout params.\n * @param params.reason - Why the logout is being triggered. Extension authors\n * needing a reason outside the SDK catalog can cast with `as LogoutReason`.\n * @param client - The Dynamic client instance.\n * @instrumented\n */\nexport const logoutWithReason = async (\n { reason }: { reason: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n core.logger.debug('[logoutWithReason] Logging out...', { reason });\n\n await destroyWalletProviders({ reason }, client);\n\n if (client.user !== null) {\n const apiClient = createApiClient({}, client);\n\n try {\n await apiClient.revokeSession({\n environmentId: core.environmentId,\n });\n } catch (error) {\n core.logger.error('Failed to revoke session', error);\n }\n\n /**\n * This deletes the auth cookie if it exists.\n * If the cookie doesn't exist, this sets a new cookie that expires immediately.\n */\n if (isCookieEnabled(client)) {\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`\n );\n }\n }\n\n await core.keychain.removeKey('session');\n\n core.state.set({\n captchaToken: null,\n elevatedAccessTokens: [],\n legacyToken: null,\n mfaToken: null,\n sessionExpiresAt: null,\n sessionKeys: null,\n token: null,\n unverifiedWalletAccounts: [],\n user: null,\n });\n\n emitEvent({ args: { reason }, event: 'logout' }, client);\n\n // Refetch project settings\n void fetchProjectSettings(client);\n\n // Regenerate session keys\n void generateSessionKeys(client);\n};\n","/* eslint-disable no-restricted-globals */\nimport { Buffer as BufferPolyfill } from 'buffer';\n\n/** @not-instrumented */\nexport const getBuffer = () =>\n typeof Buffer !== 'undefined' ? Buffer : BufferPolyfill;\n","/**\n * Indicates if the code is running in a server-side environment.\n * @not-instrumented\n */\n// eslint-disable-next-line no-restricted-globals\nexport const isServerSideRendering = () => typeof window === 'undefined';\n","export const REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY =\n 'refresh-user-state-from-cookie';\n\nexport const INITIALIZE_STORAGE_SYNC_TRACKER_KEY = 'initialize-storage-sync';\n\nexport const FETCH_PROJECT_SETTINGS_TRACKER_KEY = 'fetch-project-settings';\n\nexport const GENERATE_SESSION_KEYS_TRACKER_KEY = 'generate-session-keys';\n\nexport const REFRESH_USER_STATE_FROM_VALID_TOKEN_TRACKER_KEY =\n 'refresh-user-state-from-valid-token';\n","import type { DeferredPromise } from './deferredPromise.types';\n\n/** @not-instrumented */\nexport const createDeferredPromise = <T>(): DeferredPromise<T> => {\n let resolve: (value: T) => void;\n let reject: (reason?: unknown) => void;\n\n const promise = new Promise<T>((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n\n return {\n promise,\n reject: (reason?: unknown) => reject?.(reason),\n resolve: (value: T) => resolve?.(value),\n };\n};\n","import { BaseError } from './base';\n\nexport class CannotTrackError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'cannot_track_error',\n docsUrl: null,\n name: 'CannotTrackError',\n shortMessage: 'All track calls must be performed in the same node tick',\n });\n }\n}\n","import * as z from 'zod/mini';\n\n/**\n * Schema for validating cross-tab broadcast messages.\n */\nexport const CrossTabBroadcastMessageSchema = z.object({\n args: z.optional(z.unknown()),\n event: z.string(),\n});\n","import EventEmitter from 'eventemitter3';\n\nimport { isServerSideRendering } from '../../../utils/isServerSideRendering';\nimport { CrossTabBroadcastMessageSchema } from '../crossTabBroadcast.schema';\nimport type { CrossTabBroadcast } from '../crossTabBroadcast.types';\n\ntype CreateCrossTabBroadcastParams = {\n channelName: string;\n};\n\n/**\n * Creates a cross-tab broadcast service instance using the BroadcastChannel API.\n *\n * Enables communication between multiple tabs/windows of the same application.\n * Messages are validated against the schema and invalid messages are silently ignored.\n *\n * In SSR or when BroadcastChannel is unavailable, returns a no-op implementation.\n *\n * @param params - Configuration parameters\n * @param params.channelName - The name of the broadcast channel to use\n * @returns A cross-tab broadcast service instance\n * @not-instrumented\n */\nexport const createCrossTabBroadcast = ({\n channelName,\n}: CreateCrossTabBroadcastParams): CrossTabBroadcast => {\n // SSR check - return no-op implementation\n // eslint-disable-next-line no-restricted-globals\n if (isServerSideRendering() || typeof BroadcastChannel === 'undefined') {\n return {\n off: () => {},\n on: () => {},\n send: () => {},\n };\n }\n\n // eslint-disable-next-line no-restricted-globals\n const channel = new BroadcastChannel(channelName);\n const eventEmitter = new EventEmitter();\n\n // Message handler with validation\n const handleMessage = (messageEvent: MessageEvent) => {\n const parsed = CrossTabBroadcastMessageSchema.safeParse(messageEvent.data);\n\n if (!parsed.success) {\n // Silently ignore invalid messages (consistent with storage patterns)\n return;\n }\n\n const { args, event } = parsed.data;\n eventEmitter.emit(event, args);\n };\n\n channel.addEventListener('message', handleMessage);\n\n return {\n off: (event, callback) => {\n eventEmitter.off(event, callback);\n },\n\n on: (event, callback) => {\n eventEmitter.on(event, callback);\n },\n\n send: ({ args, event }) => {\n channel.postMessage({ args, event });\n },\n };\n};\n","import { EventEmitter } from 'eventemitter3';\n\nimport type { LogLevel, Logger, LoggerEventEmitter } from '../logger.types';\n\n/**\n * Configuration options for the logger\n * @not-instrumented\n */\ntype CreateLoggerOptions = {\n level?: LogLevel;\n};\n\n/**\n * Log levels and their corresponding numeric values\n */\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n error: 3,\n info: 1,\n warn: 2,\n};\n\n// Assign to avoid lint errors\nconst defaultConsole = console;\n\n/**\n * Creates a logger instance with configurable log level and event emission capabilities.\n * @returns A logger instance with debug, info, warn, and error methods\n * @not-instrumented\n */\nexport const createLogger = (options: CreateLoggerOptions = {}): Logger => {\n const eventEmitter: LoggerEventEmitter = new EventEmitter();\n\n // Default to 'debug' if no level is provided\n const minLevel: LogLevel = options.level ?? 'warn';\n\n // Helper to decide if we should log based on current log level\n // eslint-disable-next-line custom-rules/require-single-object-param\n const shouldLog = (level: LogLevel): boolean => {\n return LOG_LEVELS[level] >= LOG_LEVELS[minLevel];\n };\n\n // Helper to format the log message\n // eslint-disable-next-line custom-rules/require-single-object-param\n const formatMessage = (level: LogLevel, message: string): string => {\n const timestamp = new Date().toISOString();\n\n return `[${timestamp}] ${level.toUpperCase()}: ${message}`;\n };\n\n // Unified logger function that checks the level and calls the appropriate console method\n // eslint-disable-next-line custom-rules/require-single-object-param\n const log = (\n level: LogLevel,\n consoleMethod: (...data: unknown[]) => void,\n message: string,\n ...args: unknown[]\n ) => {\n eventEmitter.emit('log', level, message, ...args);\n\n if (!shouldLog(level)) return;\n\n consoleMethod(formatMessage(level, message), ...args);\n };\n\n return {\n debug: (message, ...args) =>\n log('debug', defaultConsole.debug, message, ...args),\n\n error: (message, ...args) =>\n log('error', defaultConsole.error, message, ...args),\n\n info: (message, ...args) =>\n log('info', defaultConsole.info, message, ...args),\n\n off: eventEmitter.off.bind(eventEmitter),\n\n on: eventEmitter.on.bind(eventEmitter),\n warn: (message, ...args) =>\n log('warn', defaultConsole.warn, message, ...args),\n };\n};\n","/**\n * Converts an ArrayBuffer or Uint8Array to a hex-encoded string\n * @not-instrumented\n */\nexport const bufferToHex = (buffer: ArrayBufferLike | Uint8Array) =>\n [...(buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer))]\n .map((x) => x.toString(16).padStart(2, '0'))\n .join('');\n","/**\n * Accepts a public key array buffer, and returns a buffer with the compressed version of the public key\n * @not-instrumented\n */\nexport const compressRawPublicKey = (rawPublicKey: ArrayBuffer) => {\n const rawPublicKeyBytes = new Uint8Array(rawPublicKey);\n const len = rawPublicKeyBytes.byteLength;\n\n // Drop the y coordinate\n const compressedBytes = rawPublicKeyBytes.slice(0, (1 + len) >>> 1);\n\n // Encode the parity of `y` in first bit\n compressedBytes[0] = 0x2 | (rawPublicKeyBytes[len - 1] & 0x01);\n return compressedBytes.buffer;\n};\n","import { BaseError } from '../../../errors/base';\n\nexport class KeyNotFoundError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(keyName: string) {\n super({\n cause: null,\n code: 'key_not_found',\n docsUrl: null,\n name: 'KeyNotFoundError',\n shortMessage: `Key \"${keyName}\" not found in keychain`,\n });\n }\n}\n","export const STORE_NAME = 'keys';\n","import { STORE_NAME } from './constants';\n\nexport type DeleteIndexedDBItemOptions = {\n /** The IndexedDB database handle. */\n db: IDBDatabase;\n\n /** The key name to delete. */\n keyName: string;\n};\n\n/** @not-instrumented */\nexport const deleteIndexedDBItem = ({\n db,\n keyName,\n}: DeleteIndexedDBItemOptions): Promise<void> =>\n new Promise((resolve, reject) => {\n const transaction = db.transaction(STORE_NAME, 'readwrite');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.delete(keyName);\n\n request.onsuccess = () => resolve();\n request.onerror = () => reject(request.error as Error);\n });\n","import type { StoredKey } from '../createKeychainService.types';\nimport { STORE_NAME } from './constants';\n\nexport type GetIndexedDBItemOptions = {\n /** The IndexedDB database handle. */\n db: IDBDatabase;\n\n /** The key name to look up. */\n keyName: string;\n};\n\n/** @not-instrumented */\nexport const getIndexedDBItem = ({\n db,\n keyName,\n}: GetIndexedDBItemOptions): Promise<StoredKey | undefined> =>\n new Promise((resolve, reject) => {\n const transaction = db.transaction(STORE_NAME, 'readonly');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.get(keyName);\n\n request.onsuccess = () => resolve(request.result as StoredKey | undefined);\n request.onerror = () => reject(request.error as Error);\n });\n","import type { StoredKey } from '../createKeychainService.types';\nimport { STORE_NAME } from './constants';\n\nexport type SetIndexedDBItemOptions = {\n /** The IndexedDB database handle. */\n db: IDBDatabase;\n\n /** The stored key entry to write. */\n entry: StoredKey;\n};\n\n/** @not-instrumented */\nexport const setIndexedDBItem = ({\n db,\n entry,\n}: SetIndexedDBItemOptions): Promise<void> =>\n new Promise((resolve, reject) => {\n const transaction = db.transaction(STORE_NAME, 'readwrite');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.put(entry);\n\n request.onsuccess = () => resolve();\n request.onerror = () => reject(request.error as Error);\n });\n","import { STORE_NAME } from './constants';\n\n/** @not-instrumented */\nexport const openDatabase = (dbName: string): Promise<IDBDatabase> =>\n new Promise((resolve, reject) => {\n const request = indexedDB.open(dbName, 1);\n\n request.onupgradeneeded = () => {\n const db = request.result;\n\n if (!db.objectStoreNames.contains(STORE_NAME)) {\n db.createObjectStore(STORE_NAME, { keyPath: 'keyName' });\n }\n };\n\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error as Error);\n });\n","import { openDatabase } from '../openDatabase';\n\ntype WithDatabaseParams<T> = {\n dbName: string;\n operation: (db: IDBDatabase) => Promise<T>;\n};\n\n/**\n * Scopes a database connection to the lifetime of a callback.\n * Opens a connection, passes it to the operation, and guarantees\n * the connection is closed when the operation completes or throws.\n * @not-instrumented\n */\nexport const withDatabase = async <T>({\n dbName,\n operation,\n}: WithDatabaseParams<T>): Promise<T> => {\n const db = await openDatabase(dbName);\n try {\n const result = await operation(db);\n\n return result;\n } finally {\n db.close();\n }\n};\n","import { bufferToHex } from '../../../utils/bufferToHex';\nimport { compressRawPublicKey } from '../../../utils/compressRawPublicKey';\nimport type { CreateKeychainService } from './createKeychainService.types';\nimport { KeyNotFoundError } from './KeyNotFoundError';\nimport { deleteIndexedDBItem } from './utils/deleteIndexedDBItem';\nimport { getIndexedDBItem } from './utils/getIndexedDBItem';\nimport { setIndexedDBItem } from './utils/setIndexedDBItem';\nimport { withDatabase } from './utils/withDatabase';\n\nconst DEFAULT_DB_NAME = 'dynamic_keychain';\n\n/** @not-instrumented */\nexport const createKeychainService: CreateKeychainService = (params) => {\n const dbName = params?.dbName ?? DEFAULT_DB_NAME;\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const generateKey = async (keyName: string): Promise<string> => {\n const keyPair = await crypto.subtle.generateKey(\n { name: 'ECDSA', namedCurve: 'P-256' },\n false,\n ['sign']\n );\n\n const rawPublicKey = await crypto.subtle.exportKey(\n 'raw',\n keyPair.publicKey\n );\n\n const compressedPublicKey = compressRawPublicKey(rawPublicKey);\n const publicKeyHex = bufferToHex(compressedPublicKey);\n\n await withDatabase({\n dbName,\n operation: (db) =>\n setIndexedDBItem({\n db,\n entry: {\n keyName,\n privateKey: keyPair.privateKey,\n publicKeyHex,\n },\n }),\n });\n\n return publicKeyHex;\n };\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const importKey = async (\n keyName: string,\n jwk: JsonWebKey\n ): Promise<string> => {\n const privateKey = await crypto.subtle.importKey(\n 'jwk',\n jwk,\n { name: 'ECDSA', namedCurve: 'P-256' },\n false,\n ['sign']\n );\n\n const publicJwk = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };\n\n const publicCryptoKey = await crypto.subtle.importKey(\n 'jwk',\n publicJwk,\n { name: 'ECDSA', namedCurve: 'P-256' },\n true,\n ['verify']\n );\n\n const rawPublicKey = await crypto.subtle.exportKey('raw', publicCryptoKey);\n const compressedPublicKey = compressRawPublicKey(rawPublicKey);\n const publicKeyHex = bufferToHex(compressedPublicKey);\n\n await withDatabase({\n dbName,\n operation: (db) =>\n setIndexedDBItem({\n db,\n entry: {\n keyName,\n privateKey,\n publicKeyHex,\n },\n }),\n });\n\n return publicKeyHex;\n };\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const getPublicKey = async (keyName: string): Promise<string | null> => {\n const entry = await withDatabase({\n dbName,\n operation: (db) => getIndexedDBItem({ db, keyName }),\n });\n\n return entry?.publicKeyHex ?? null;\n };\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const sign = async (keyName: string, message: string): Promise<string> => {\n const entry = await withDatabase({\n dbName,\n operation: (db) => getIndexedDBItem({ db, keyName }),\n });\n\n if (!entry) {\n throw new KeyNotFoundError(keyName);\n }\n\n const encoder = new TextEncoder();\n const data = encoder.encode(message);\n\n const signature = await crypto.subtle.sign(\n { hash: { name: 'SHA-256' }, name: 'ECDSA' },\n entry.privateKey,\n data\n );\n\n return bufferToHex(signature);\n };\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const hasKey = async (keyName: string): Promise<boolean> => {\n const entry = await withDatabase({\n dbName,\n operation: (db) => getIndexedDBItem({ db, keyName }),\n });\n\n return entry !== undefined;\n };\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const removeKey = async (keyName: string): Promise<void> => {\n await withDatabase({\n dbName,\n operation: (db) => deleteIndexedDBItem({ db, keyName }),\n });\n };\n\n return {\n generateKey,\n getPublicKey,\n hasKey,\n importKey,\n removeKey,\n sign,\n };\n};\n","import { BaseError } from './base';\n\ntype InvalidRealtimePublishParams = {\n channel: string;\n};\n\nexport class InvalidRealtimePublishError extends BaseError {\n constructor({ channel }: InvalidRealtimePublishParams) {\n super({\n cause: null,\n code: 'invalid_realtime_publish',\n docsUrl: null,\n metaMessages: [`channel: ${channel}`],\n name: 'InvalidRealtimePublishError',\n shortMessage:\n 'Tried to publish data that does not match the channel schema',\n });\n }\n}\n","import { BaseError } from './base';\n\nexport class RealtimeNotConnectedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'realtime_not_connected_error',\n docsUrl: null,\n name: 'RealtimeNotConnectedError',\n shortMessage:\n 'Realtime service is not connected. Call connect() before subscribing or publishing.',\n });\n }\n}\n","import type { InboundMessage, RealtimeChannel, messageCallback } from 'ably';\nimport type { BaseRealtime } from 'ably/modular';\nimport EventEmitter from 'eventemitter3';\n\nimport { getCore } from '../../../client/core/getCore';\nimport { InvalidRealtimePublishError } from '../../../errors/InvalidRealtimePublishError';\nimport { RealtimeNotConnectedError } from '../../../errors/RealtimeNotConnectedError';\nimport { createApiClient } from '../../../modules/apiClient';\nimport { isServerSideRendering } from '../../../utils/isServerSideRendering';\nimport type {\n RealtimeChannelSchema,\n RealtimeConnectionState,\n RealtimeEventMap,\n RealtimeService,\n} from '../realtime.types';\n\nconst ABLY_STATE_TO_REALTIME_STATE: Record<string, RealtimeConnectionState> = {\n closed: 'closed',\n closing: 'closing',\n connected: 'connected',\n connecting: 'connecting',\n disconnected: 'disconnected',\n failed: 'failed',\n initialized: 'idle',\n suspended: 'suspended',\n};\n\nconst mapAblyState = (ablyState: string): RealtimeConnectionState =>\n ABLY_STATE_TO_REALTIME_STATE[ablyState] ?? 'idle';\n\n/**\n * Creates a realtime pub/sub service backed by Ably.\n *\n * The service starts idle. Call `connect({ client })` to establish\n * a connection, passing the DynamicClient explicitly.\n *\n * SSR environments receive a no-op implementation.\n * @not-instrumented\n */\n \nexport const createRealtimeService = (): RealtimeService => {\n if (isServerSideRendering()) {\n return {\n connect: () => Promise.resolve(),\n disconnect: () => {},\n getConnectionState: () => 'idle',\n off: () => {},\n on: () => {},\n publish: () => Promise.resolve(),\n subscribe: () => Promise.resolve(),\n unsubscribe: () => {},\n };\n }\n\n const eventEmitter = new EventEmitter<RealtimeEventMap>();\n const channels = new Map<string, RealtimeChannel>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const handlerMap = new WeakMap<(message: { data: any }) => void, messageCallback<InboundMessage>>();\n\n let ablyClient: BaseRealtime | undefined;\n let connectionState: RealtimeConnectionState = 'idle';\n let isConnecting = false;\n\n const setConnectionState = (state: RealtimeConnectionState) => {\n connectionState = state;\n eventEmitter.emit('connectionStateChange', state);\n };\n\n // eslint-disable-next-line custom-rules/require-single-object-param\n const getOrCreateChannel = (channelName: string): RealtimeChannel => {\n const existing = channels.get(channelName);\n\n if (existing) {\n return existing;\n }\n\n if (!ablyClient) {\n throw new RealtimeNotConnectedError();\n }\n\n const channel = ablyClient.channels.get(channelName);\n channels.set(channelName, channel);\n\n return channel;\n };\n\n const connect: RealtimeService['connect'] = async ({ client, headers }) => {\n if (isConnecting) {\n return;\n }\n\n isConnecting = true;\n\n try {\n const core = getCore(client);\n\n if (ablyClient) {\n ablyClient.close();\n channels.clear();\n }\n\n // Dynamic import to keep the module tree-shakeable\n // and avoid loading Ably in SSR environments\n const {\n BaseRealtime: AblyBaseRealtime,\n FetchRequest,\n WebSocketTransport,\n } = await import('ably/modular');\n\n ablyClient = new AblyBaseRealtime({\n // authCallback must return void (not Promise<void>), so we use\n // .then().catch() instead of async/await to avoid returning a Promise\n // to Ably's callback-style auth handler.\n authCallback: (_tokenParams, callback) => {\n const apiClient = createApiClient({ headers }, client);\n\n apiClient\n .getRealtimeAuthToken({ environmentId: core.environmentId })\n .then((response) => {\n callback(null, response.token);\n })\n .catch((err: unknown) => {\n const message = err instanceof Error ? err.message : String(err);\n callback(message, null);\n });\n },\n autoConnect: false,\n plugins: { FetchRequest, WebSocketTransport },\n });\n\n ablyClient.connection.on((stateChange) => {\n setConnectionState(mapAblyState(stateChange.current));\n });\n\n ablyClient.connect();\n } finally {\n isConnecting = false;\n }\n };\n\n const disconnect: RealtimeService['disconnect'] = () => {\n if (!ablyClient) {\n return;\n }\n\n for (const channel of channels.values()) {\n channel.detach().catch(() => {});\n }\n\n channels.clear();\n ablyClient.close();\n ablyClient = undefined;\n };\n\n const subscribe: RealtimeService['subscribe'] = async <T>({\n channelSchema,\n callback,\n }: {\n callback: (message: { data: T }) => void;\n channelSchema: RealtimeChannelSchema<T>;\n }) => {\n const channel = getOrCreateChannel(channelSchema.channel);\n\n const handler: messageCallback<InboundMessage> = (message) => {\n const parsed = channelSchema.schema.safeParse(message.data);\n\n if (!parsed.success) {\n return;\n }\n\n callback({ data: parsed.data });\n };\n\n handlerMap.set(callback, handler);\n\n await channel.subscribe(handler);\n };\n\n const unsubscribe: RealtimeService['unsubscribe'] = <T>({\n channelSchema,\n callback,\n }: {\n callback: (message: { data: T }) => void;\n channelSchema: RealtimeChannelSchema<T>;\n }) => {\n const channel = channels.get(channelSchema.channel);\n\n if (!channel) {\n return;\n }\n\n const handler = handlerMap.get(callback);\n\n if (handler) {\n channel.unsubscribe(handler);\n handlerMap.delete(callback);\n }\n };\n\n const publish: RealtimeService['publish'] = async <T>({\n channelSchema,\n data,\n }: {\n channelSchema: RealtimeChannelSchema<T>;\n data: T;\n }) => {\n const parsed = channelSchema.schema.safeParse(data);\n\n if (!parsed.success) {\n throw new InvalidRealtimePublishError({ channel: channelSchema.channel });\n }\n\n const channel = getOrCreateChannel(channelSchema.channel);\n await channel.publish('message', parsed.data);\n };\n\n return {\n connect,\n disconnect,\n getConnectionState: () => connectionState,\n off: (event, callback) => {\n eventEmitter.off(event, callback);\n },\n on: (event, callback) => {\n eventEmitter.on(event, callback);\n },\n publish,\n subscribe,\n unsubscribe,\n };\n};\n","type GetKeychainIndexedDBNameParams = {\n environmentId: string;\n};\n\n/**\n * Builds the IndexedDB database name used by the keychain service for a given\n * environment. Centralizing this avoids drift between the SDK and any\n * extension code that needs to read or migrate the same database.\n *\n * @param params.environmentId - The Dynamic environment id.\n * @returns The IndexedDB database name for the keychain.\n * @not-instrumented\n */\nexport const getKeychainIndexedDBName = ({\n environmentId,\n}: GetKeychainIndexedDBNameParams): string =>\n `dynamic_${environmentId}_keychain`;\n","import { BaseError } from './base';\n\nexport class NoNetworkProvidersError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'no_network_providers',\n docsUrl: null,\n name: 'NoNetworkProvidersError',\n shortMessage: 'No networks were registered in the client',\n });\n }\n}\n","import { BaseError, type BaseErrorParameters } from './base';\n\nexport class WalletAlreadyLinkedToAnotherUserError extends BaseError {\n constructor({ cause }: Pick<BaseErrorParameters, 'cause'>) {\n super({\n cause,\n code: 'wallet_already_linked_to_another_user_error',\n docsUrl: null,\n name: 'WalletAlreadyLinkedToAnotherUserError',\n shortMessage: 'This wallet is already linked to another user',\n });\n }\n}\n","import { BaseError } from './base';\n\nexport class MethodNotImplementedError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(methodName: string) {\n super({\n cause: null,\n code: 'method_not_implemented_error',\n docsUrl: null,\n name: 'MethodNotImplementedError',\n shortMessage: `This method is not implemented: ${methodName}`,\n });\n }\n}\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/** @not-instrumented */\nexport const isCaptchaRequired = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n return projectSettings.security.hCaptcha?.enabled ?? false;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { isCaptchaRequired } from '../isCaptchaRequired';\n\n/**\n * Retrieves the current captcha token from the client state and sets it to null.\n * @not-instrumented\n */\nexport const consumeCaptchaToken = (\n client: DynamicClient\n): string | undefined => {\n const core = getCore(client);\n\n const captchaToken = core.state.get().captchaToken;\n\n if (isCaptchaRequired(client)) {\n assertDefined(captchaToken, 'Captcha token is required');\n }\n\n core.state.set({\n captchaToken: null,\n });\n\n return captchaToken ?? undefined;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\n\ntype SetCaptchaTokenProps = {\n captchaToken: string;\n};\n\n/**\n * Sets the given captcha token in the client state.\n *\n * @param params.captchaToken - The captcha token to set.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @instrumented\n */\nexport const setCaptchaToken = (\n { captchaToken }: SetCaptchaTokenProps,\n client = getDefaultClient()\n) => {\n const core = getCore(client);\n\n core.state.set({\n captchaToken,\n });\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\n\ntype HasExtensionParams = {\n extensionKey: string;\n};\n\n/**\n * Checks if a specific extension has been applied to the Dynamic client.\n *\n * Extensions add optional features to the Dynamic SDK,\n * such as EVM, Solana, or other chain support.\n *\n * @param params.extensionKey - The unique key identifying the extension to check for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the extension is applied, false otherwise.\n * @not-instrumented\n */\nexport const hasExtension = (\n { extensionKey }: HasExtensionParams,\n client = getDefaultClient()\n) => {\n const core = getCore(client);\n\n return core.extensions.has(extensionKey);\n};\n","import {\n AuthModeEnum,\n type ChainEnum,\n type ConnectRequest,\n} from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { createApiClient } from '../../apiClient';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport { normalizeWalletNameWithChain } from '../../wallets/utils/normalizeWalletNameWithChain';\nimport type { WalletAccount } from '../../wallets/walletAccount';\n\ntype CreateVisitParams = {\n authMode?: AuthModeEnum;\n walletAccount: WalletAccount;\n};\n\n/* \n In older SDK versions we used to have the concept of \"connect-only\" vs \"connect-and-sign\". \n The only difference in backend is it stores some extra data for connect-only, \n so we can just default to using it.\n*/\n/** @not-instrumented */\nexport const createVisit = async (\n { walletAccount, authMode = AuthModeEnum.Only }: CreateVisitParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n try {\n const walletName = normalizeWalletNameWithChain({\n chain: walletProvider.chain,\n displayName: walletProvider.metadata.displayName,\n });\n\n const connectRequest: ConnectRequest = {\n address: walletAccount.address,\n authMode,\n // eslint-disable-next-line custom-rules/ban-chain-enum\n chain: walletProvider.chain as ChainEnum,\n provider: walletProvider.walletProviderType,\n walletName,\n };\n\n await apiClient.createVisit({\n connectRequest,\n environmentId: core.environmentId,\n });\n } catch (error) {\n core.logger.error('Error creating visit', { error });\n }\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport type { UnverifiedWalletAccount } from '../unverifiedWalletAccounts.types';\n\ntype SetUnverifiedWalletAccountsParams = {\n unverifiedWalletAccountsToUpdate: UnverifiedWalletAccount[];\n};\n\n/**\n * Updates the unverified wallet account in the client state.\n * This will add new wallet accounts and override those with matching ids,\n * but will leave other preexisting wallet accounts unchanged.\n * @not-instrumented\n */\nexport const setUnverifiedWalletAccounts = (\n { unverifiedWalletAccountsToUpdate }: SetUnverifiedWalletAccountsParams,\n client: DynamicClient\n): void => {\n if (unverifiedWalletAccountsToUpdate.length === 0) {\n return;\n }\n\n const core = getCore(client);\n\n const unverifiedWalletAccountsToUpdateIds =\n unverifiedWalletAccountsToUpdate.map(({ id }) => id);\n\n const filteredUnverifiedWalletAccounts: UnverifiedWalletAccount[] = core.state\n .get()\n .unverifiedWalletAccounts.filter(\n (unverifiedWalletAccount) =>\n !unverifiedWalletAccountsToUpdateIds.includes(\n unverifiedWalletAccount.id\n )\n );\n\n core.state.set({\n unverifiedWalletAccounts: [\n ...filteredUnverifiedWalletAccounts,\n ...unverifiedWalletAccountsToUpdate,\n ],\n });\n};\n","type FormatSignInMessageParams = {\n address: string;\n blockchainName: string;\n chainId?: string;\n domain: string;\n issuedAt?: string;\n nonce: string;\n requestId?: string;\n resources?: string[];\n statement?: string;\n uri: string;\n};\n\n/**\n * Formats a sign in message to prove ownership of an address.\n * @not-instrumented\n */\nexport const formatSignInMessage = async ({\n domain,\n blockchainName,\n address,\n uri,\n chainId,\n nonce,\n issuedAt,\n requestId,\n statement,\n resources,\n}: FormatSignInMessageParams) => {\n // This format follows the sign-in with ethereum (SIWE) standard,\n // but we are using it also for non-ethereum wallets for now (eg. Solana)\n // for more context on format and fields, please see:\n // https://docs.login.xyz/general-information/siwe-overview/eip-4361\n const header = `${domain} wants you to sign in with your ${blockchainName} account:`;\n const prefix = [header, address].join('\\n');\n\n // If there is a statement, we want to add a gap between the prefix and the statement\n // two times '\\n', first to move statement to next line and second to add a gap between prefix and statement\n const prefixWithStatementGap = statement ? '\\n\\n' : '\\n';\n const prefixWithStatement = `${[prefix, statement].join(\n prefixWithStatementGap\n )}\\n`;\n\n const suffixFields: string[] = [];\n suffixFields.push(`URI: ${uri}`);\n suffixFields.push('Version: 1');\n if (chainId) {\n suffixFields.push(`Chain ID: ${chainId}`);\n }\n\n suffixFields.push(`Nonce: ${nonce}`);\n\n if (issuedAt) {\n suffixFields.push(`Issued At: ${issuedAt}`);\n }\n\n if (requestId) {\n suffixFields.push(`Request ID: ${requestId}`);\n }\n\n if (resources?.length) {\n suffixFields.push(\n `Resources:${resources.map((resource) => '\\n- ' + resource).join()}`\n );\n }\n\n const suffix = suffixFields.join('\\n');\n\n return [prefixWithStatement, suffix].join('\\n');\n};\n","import { getCore } from '../../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../../client/types';\n\n/** @not-instrumented */\nexport const createSignInMessageStatement = (client: DynamicClient) => {\n const core = getCore(client);\n\n const appName =\n core.metadata?.name ?? client.projectSettings?.general.displayName;\n\n return `Welcome to ${appName}. Signing is the only way we can truly know that you are the owner of the wallet you are connecting. Signing is a safe, gas-less transaction that does not in any way give ${appName} permission to perform any transactions with your wallet.`;\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { checkAndRaiseWalletAccountsChangedEvent } from '../../../auth/updateAuthFromVerifyResponse/checkAndRaiseWalletAccountsChangedEvent';\nimport type { UnverifiedWalletAccount } from '../unverifiedWalletAccounts.types';\n\ntype RemoveUnverifiedWalletAccountParams = {\n unverifiedWalletAccount: UnverifiedWalletAccount;\n};\n\n/**\n * Removes an unverified wallet account from the client's state.\n * @not-instrumented\n */\nexport const removeUnverifiedWalletAccount = (\n { unverifiedWalletAccount }: RemoveUnverifiedWalletAccountParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const previousState = core.state.get();\n\n const { unverifiedWalletAccounts } = core.state.get();\n\n const filteredUnverifiedWalletAccounts = unverifiedWalletAccounts.filter(\n (account) => account.id !== unverifiedWalletAccount.id\n );\n\n core.state.set({\n unverifiedWalletAccounts: filteredUnverifiedWalletAccounts,\n });\n\n /**\n * We check before raising because the wallet account we are removing might still\n * be present in wallet accounts due to having been moved to verified credentials.\n */\n checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);\n};\n","/**\n * Check if the given value is an Error object\n * @not-instrumented\n */\nexport const isError = (error: unknown): error is Error =>\n error instanceof Error;\n","import { isError } from '../isError';\n\n/**\n * Check if the given value is an Error object with a specific code\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const isErrorWithCode = <T extends string>(\n error: unknown,\n code: T\n): error is Error & { code: T } => {\n if (!isError(error)) return false;\n\n return 'code' in error && error.code === code;\n};\n","import type {\n ChainEnum,\n TokenScope,\n VerifyResponse,\n WalletAddressType,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { isErrorWithCode } from '../../../utils/isErrorWithCode';\nimport { createApiClient } from '../../apiClient';\nimport { consumeCaptchaToken } from '../../captcha/consumeCaptchaToken';\nimport type { Chain } from '../../chain';\nimport { normalizeWalletNameWithChain } from '../utils/normalizeWalletNameWithChain';\nimport type { WalletAddressWithType } from '../walletAccount/walletAccount.types';\nimport { WalletAlreadyLinkedToAnotherUserError } from './../../../errors/WalletAlreadyLinkedToAnotherUserError';\n\ntype VerifyMessageSignatureOwnershipParams = {\n addressesWithTypes?: WalletAddressWithType[];\n chain: Chain;\n isTransfer?: boolean;\n messageToSign: string;\n networkId?: string;\n requestedScopes?: TokenScope[];\n signature: string;\n walletAddress: string;\n walletDisplayName: string;\n walletProviderType: WalletProviderEnum;\n};\n\n/**\n * Verifies a signed message by calling either the verifyLink, verifyTransfer or verify API function,\n * depending on whether the user is signing in, linking or transferring a wallet.\n *\n * Does NOT call updateAuthFromVerifyResponse, it should be called from the return of this function.\n * @not-instrumented\n */\nexport const verifyMessageSignatureOwnership = async (\n {\n messageToSign,\n walletAddress,\n addressesWithTypes,\n signature,\n chain,\n isTransfer = false,\n walletDisplayName,\n walletProviderType,\n networkId,\n requestedScopes,\n }: VerifyMessageSignatureOwnershipParams,\n client: DynamicClient\n): Promise<VerifyResponse> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const walletName = normalizeWalletNameWithChain({\n chain,\n displayName: walletDisplayName,\n });\n\n let verifyApiFunction;\n\n if (!client.user) {\n // If the user is not authenticated, call the walletsSignin API function to sign in\n verifyApiFunction = apiClient.walletsSignin.bind(apiClient);\n } else if (isTransfer) {\n // If the user is authenticated and is transferring a wallet, call the verifyTransfer API function\n verifyApiFunction = apiClient.verifyTransfer.bind(apiClient);\n } else if (client.user && requestedScopes) {\n // Scopes = step-up auth: user requests permission for a sensitive op (e.g. wallet export).\n // We grant it only if they prove they own an existing credential (walletsVerify).\n // Must use walletsVerify: user is already logged in (not signin) and credential exists (not transfer/link).\n // If the user is authenticated and requested scopes are provided, call the walletsVerify API function\n verifyApiFunction = apiClient.walletsVerify.bind(apiClient);\n } else {\n // If the user is authenticated and is signing in, call the verifyLink API function\n verifyApiFunction = apiClient.verifyLink.bind(apiClient);\n }\n\n try {\n return await verifyApiFunction({\n environmentId: core.environmentId,\n verifyRequest: {\n // mapping to handle typecasting for address type\n additionalWalletAddresses: addressesWithTypes?.map((address) => ({\n address: address.address,\n publicKey: address.publicKey,\n type: address.type as WalletAddressType,\n })),\n captchaToken: consumeCaptchaToken(client),\n // eslint-disable-next-line custom-rules/ban-chain-enum\n chain: chain as ChainEnum,\n messageToSign,\n network: networkId,\n publicWalletAddress: walletAddress,\n requestedScopes,\n signedMessage: signature,\n walletName,\n walletProvider: walletProviderType,\n },\n });\n } catch (error) {\n core.logger.error('Failed to verify message signature ownership', error);\n\n if (\n isErrorWithCode(error, 'reassign_wallet_confirm') ||\n isErrorWithCode(error, 'merge_accounts_confirmation')\n ) {\n throw new WalletAlreadyLinkedToAnotherUserError({\n cause: error,\n });\n }\n\n throw error;\n }\n};\n","import { getCore } from '../../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../../client/types';\n\ntype updateWalletProviderKeysForVerifiedCredentialsParams = {\n keysToUpdate: Record<string, string>;\n};\n\n/** @not-instrumented */\nexport const updateWalletProviderKeysForVerifiedCredentials = (\n { keysToUpdate }: updateWalletProviderKeysForVerifiedCredentialsParams,\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n core.state.set({\n walletProviderKeyMap: {\n ...core.state.get().walletProviderKeyMap,\n ...keysToUpdate,\n },\n });\n};\n","import type { Chain } from '../../../chain';\nimport { CHAINS_INFO_MAP } from '../../constants';\n\n/**\n * Maps the chain name from the API to the SDK chain name\n * @not-instrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const getSdkChainFromApiChainName = (\n chainName: string\n): Chain | null => {\n const chains = Object.keys(CHAINS_INFO_MAP) as Chain[];\n\n const chain = chains.find(\n (chain) => CHAINS_INFO_MAP[chain].apiChainName === chainName\n );\n\n return chain || null;\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport { getSdkChainFromApiChainName } from '../getSdkChainFromApiChainName';\nimport type { NetworkData } from '../networkProvider/networkProvider.types';\n\n/**\n * Retrieves all available network configurations from project settings.\n *\n * This function returns detailed configuration data for all networks enabled\n * in your Dynamic project, including RPC URLs, native currencies, and metadata.\n *\n * If a `transformers.networkData` callback was provided in the client configuration,\n * it will be applied to each network before returning the data. This allows you to\n * customize network properties (such as RPC URLs) in a centralized way.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of network configuration data for all enabled networks.\n * @not-instrumented\n */\nexport const getNetworksData = (client = getDefaultClient()): NetworkData[] => {\n const core = getCore(client);\n const { state, transformers } = core;\n\n const networkDataTransformer =\n transformers?.networkData ?? ((networkData) => networkData);\n\n const { projectSettings } = state.get();\n\n assertDefined(projectSettings, 'projectSettings not found');\n\n const networks = projectSettings.networks;\n\n if (!networks) {\n return [];\n }\n\n const networksData = networks\n .map((network) => {\n if (!network.chainName) return [];\n\n const chain = getSdkChainFromApiChainName(network.chainName);\n\n if (!network?.networks?.length || !chain) return [];\n\n return network.networks.map((networkConfiguration) => {\n const networkData: NetworkData = {\n blockExplorerUrls: networkConfiguration.blockExplorerUrls,\n chain,\n cluster: networkConfiguration.cluster,\n displayName:\n networkConfiguration.vanityName || networkConfiguration.name,\n genesisHash: networkConfiguration.genesisHash,\n iconUrl: networkConfiguration.iconUrls[0],\n name: networkConfiguration.name,\n nativeCurrency: {\n decimals: networkConfiguration.nativeCurrency.decimals,\n iconUrl: networkConfiguration.nativeCurrency.iconUrl,\n name: networkConfiguration.nativeCurrency.name,\n symbol: networkConfiguration.nativeCurrency.symbol,\n },\n networkId: networkConfiguration.networkId,\n rpcUrls: {\n http: [\n ...(networkConfiguration.privateCustomerRpcUrls ?? []),\n ...(networkConfiguration.rpcUrls ?? []),\n ],\n },\n testnet: networkConfiguration.isTestnet ?? false,\n };\n\n return networkDataTransformer(networkData);\n });\n })\n .flat();\n\n return networksData;\n};\n","import type { Chain } from '../../../../chain';\nimport type {\n NetworkProviderBuilder,\n NetworkProviderBuilderRegistry,\n} from '../networkProviderBuilderRegistry.types';\n\n/** @not-instrumented */\nexport const createNetworkProviderBuilderRegistry =\n (): NetworkProviderBuilderRegistry => {\n const registry = new Map<Chain, NetworkProviderBuilder>();\n\n return {\n get: () => registry,\n register: (networkProviderBuilder) => {\n registry.set(networkProviderBuilder.chain, networkProviderBuilder);\n },\n };\n };\n","import { createRuntimeServiceAccessKey } from '../../../../../services/runtimeServices';\nimport { createNetworkProviderBuilderRegistry } from '../createNetworkProviderBuilderRegistry';\n\nexport const getNetworkProviderBuilderRegistry = createRuntimeServiceAccessKey(\n 'networkProviderBuilderRegistry',\n createNetworkProviderBuilderRegistry\n);\n","import type { DynamicClient } from '../../../../client/types';\nimport { getNetworksData } from '../getNetworksData';\nimport type { NetworkProvider } from '../networkProvider';\nimport { getNetworkProviderBuilderRegistry } from '../networkProviderBuilderRegistry';\n\n/**\n * Retrieves all registered network providers for enabled chains.\n * @not-instrumented\n */\nexport const getNetworkProviders = (\n client: DynamicClient\n): NetworkProvider[] => {\n const networkProviderBuilderRegistry =\n getNetworkProviderBuilderRegistry(client);\n\n const registeredNetworkProviderBuilders = Array.from(\n networkProviderBuilderRegistry.get().values()\n );\n\n const networksData = getNetworksData(client);\n\n const networkProviders = registeredNetworkProviderBuilders.map(\n ({ builder, chain }) => {\n const networksDataForChain = networksData.filter(\n (networkData) => networkData.chain === chain\n );\n\n return networksDataForChain.map(builder);\n }\n );\n\n return networkProviders.flat();\n};\n","import type { DynamicClient } from '../../../../client/types';\nimport { NoNetworkProvidersError } from '../../../../errors/NoNetworkProvidersError';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport type { Chain } from '../../../chain';\nimport { getNetworkProviders } from '../getNetworkProviders';\nimport type { NetworkProvider } from '../networkProvider/networkProvider.types';\n\ntype GetNetworkProviderFromNetworkIdProps = {\n chain: Chain;\n networkId: string;\n};\n\n/** @not-instrumented */\nexport const getNetworkProviderFromNetworkId = (\n { networkId, chain }: GetNetworkProviderFromNetworkIdProps,\n client: DynamicClient\n): NetworkProvider => {\n const networkProviders = getNetworkProviders(client);\n\n if (networkProviders.length === 0) {\n throw new NoNetworkProvidersError();\n }\n\n const networkProvider = networkProviders.find(\n (networkProvider) =>\n networkProvider.networkId === networkId && networkProvider.chain === chain\n );\n\n assertDefined(\n networkProvider,\n `No network provider found for chain ${chain} with network id ${networkId}`\n );\n\n return networkProvider;\n};\n"],"mappings":";;;;;;;;;;;;;;AAOA,MAAa,kBAAqB,MAAS,SAAY;AACrD,KAAI,OAAO,GAAG,MAAM,KAAK,CAAE,QAAO;AAElC,KACE,OAAO,SAAS,YAChB,SAAS,QACT,OAAO,SAAS,YAChB,SAAS,KAET,QAAO,SAAS;AAGlB,KAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,MAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AAEpC,OAAK,MAAM,CAAC,KAAK,UAAU,KACzB,KAAI,CAAC,OAAO,GAAG,OAAO,KAAK,IAAI,IAAI,CAAC,CAAE,QAAO;AAG/C,SAAO;;AAGT,KAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,MAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AAEpC,OAAK,MAAM,SAAS,KAClB,KAAI,CAAC,KAAK,IAAI,MAAM,CAAE,QAAO;AAE/B,SAAO;;CAGT,MAAM,QAAQ,OAAO,KAAK,KAAK;AAE/B,KAAI,MAAM,WAAW,OAAO,KAAK,KAAK,CAAC,OAAQ,QAAO;AAEtD,MAAK,MAAM,QAAQ,MACjB,KACE,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,KAAe,IAC3D,CAAC,OAAO,GAAG,KAAK,OAAkB,KAAK,MAAiB,CAExD,QAA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