@dynamic-labs-sdk/client 1.26.0 → 1.27.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/core.cjs +5 -5
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/exports/index.d.ts +8 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +1 -0
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-D7lIOS6I.esm.js → getNetworkProviderFromNetworkId-CIKbNKdk.esm.js} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-D7lIOS6I.esm.js.map → getNetworkProviderFromNetworkId-CIKbNKdk.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-C5GtE2ef.native.esm.js → getNetworkProviderFromNetworkId-CsZBSoWG.native.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-C5GtE2ef.native.esm.js.map → getNetworkProviderFromNetworkId-CsZBSoWG.native.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CSxvdrc9.cjs → getNetworkProviderFromNetworkId-DmLtSJC9.cjs} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-CSxvdrc9.cjs.map → getNetworkProviderFromNetworkId-DmLtSJC9.cjs.map} +1 -1
- package/dist/{getSignedSessionId-B5Dijw-8.native.esm.js → getSignedSessionId-BIz9qPIB.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-B5Dijw-8.native.esm.js.map → getSignedSessionId-BIz9qPIB.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-CpcQiZTF.cjs → getSignedSessionId-B_NkNNim.cjs} +3 -3
- package/dist/{getSignedSessionId-CpcQiZTF.cjs.map → getSignedSessionId-B_NkNNim.cjs.map} +1 -1
- package/dist/{getSignedSessionId-BiL9k0nE.esm.js → getSignedSessionId-CV4WePdo.esm.js} +3 -3
- package/dist/{getSignedSessionId-BiL9k0nE.esm.js.map → getSignedSessionId-CV4WePdo.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-CBIrILYZ.native.esm.js → getWalletProviderByKey-B7eSVPP5.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-CBIrILYZ.native.esm.js.map → getWalletProviderByKey-B7eSVPP5.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-BMJ9TcjM.cjs → getWalletProviderByKey-CRTAETJR.cjs} +2 -2
- package/dist/{getWalletProviderByKey-BMJ9TcjM.cjs.map → getWalletProviderByKey-CRTAETJR.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-CU8zmrf2.esm.js → getWalletProviderByKey-W0eocsJF.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-CU8zmrf2.esm.js.map → getWalletProviderByKey-W0eocsJF.esm.js.map} +1 -1
- package/dist/index.cjs +129 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +126 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +126 -9
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isDynamicWaasEnabled-CBvSRUgG.esm.js → isDynamicWaasEnabled-1CgDWfqH.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-CBvSRUgG.esm.js.map → isDynamicWaasEnabled-1CgDWfqH.esm.js.map} +1 -1
- package/dist/{isDynamicWaasEnabled-idmeju9B.cjs → isDynamicWaasEnabled-CMhy_gpM.cjs} +2 -2
- package/dist/{isDynamicWaasEnabled-idmeju9B.cjs.map → isDynamicWaasEnabled-CMhy_gpM.cjs.map} +1 -1
- package/dist/{isDynamicWaasEnabled-d82cX7j9.native.esm.js → isDynamicWaasEnabled-DkcnybRZ.native.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-d82cX7j9.native.esm.js.map → isDynamicWaasEnabled-DkcnybRZ.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-D1rhRlDu.esm.js → isMfaRequiredForAction-BOgi2PMg.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-D1rhRlDu.esm.js.map → isMfaRequiredForAction-BOgi2PMg.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-1O_rFiPN.native.esm.js → isMfaRequiredForAction-DGfi_fNE.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-1O_rFiPN.native.esm.js.map → isMfaRequiredForAction-DGfi_fNE.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-D5o4qznt.cjs → isMfaRequiredForAction-DnUUklVz.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-D5o4qznt.cjs.map → isMfaRequiredForAction-DnUUklVz.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-bR7jwdjO.native.esm.js → isUserOnboardingComplete-C-VfVV0L.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-bR7jwdjO.native.esm.js.map → isUserOnboardingComplete-C-VfVV0L.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-BfRUVwrT.cjs → isUserOnboardingComplete-CIOYKiII.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-BfRUVwrT.cjs.map → isUserOnboardingComplete-CIOYKiII.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-k3nlisFA.esm.js → isUserOnboardingComplete-Dg8M45Ba.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-k3nlisFA.esm.js.map → isUserOnboardingComplete-Dg8M45Ba.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-Bm7eIfaa.esm.js → migrateFromFireblocks-Ch5R5fWp.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-Bm7eIfaa.esm.js.map → migrateFromFireblocks-Ch5R5fWp.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-BcYmEZ3_.cjs → migrateFromFireblocks-LZXyDEH6.cjs} +3 -3
- package/dist/{migrateFromFireblocks-BcYmEZ3_.cjs.map → migrateFromFireblocks-LZXyDEH6.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-DVP5tGv_.native.esm.js → migrateFromFireblocks-zHTABzLP.native.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-DVP5tGv_.native.esm.js.map → migrateFromFireblocks-zHTABzLP.native.esm.js.map} +1 -1
- package/dist/modules/swap/utils/ensureCorrectActiveNetwork/ensureCorrectActiveNetwork.d.ts.map +1 -1
- package/dist/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.d.ts +31 -0
- package/dist/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.d.ts.map +1 -0
- package/dist/modules/waas/createWaasOfflineRecoveryShares/index.d.ts +2 -0
- package/dist/modules/waas/createWaasOfflineRecoveryShares/index.d.ts.map +1 -0
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/hasDelegatedAccess/hasDelegatedAccess.d.ts.map +1 -1
- package/dist/modules/waas/waas.types.d.ts +6 -0
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/yield/getYieldDetails/getYieldDetails.d.ts +36 -0
- package/dist/modules/yield/getYieldDetails/getYieldDetails.d.ts.map +1 -0
- package/dist/modules/yield/getYieldDetails/index.d.ts +3 -0
- package/dist/modules/yield/getYieldDetails/index.d.ts.map +1 -0
- package/dist/modules/yield/getYieldPosition/getYieldPosition.d.ts +37 -0
- package/dist/modules/yield/getYieldPosition/getYieldPosition.d.ts.map +1 -0
- package/dist/modules/yield/getYieldPosition/index.d.ts +3 -0
- package/dist/modules/yield/getYieldPosition/index.d.ts.map +1 -0
- package/dist/modules/yield/getYieldRewards/getYieldRewards.d.ts +39 -0
- package/dist/modules/yield/getYieldRewards/getYieldRewards.d.ts.map +1 -0
- package/dist/modules/yield/getYieldRewards/index.d.ts +3 -0
- package/dist/modules/yield/getYieldRewards/index.d.ts.map +1 -0
- package/dist/modules/yield/listYieldVaults/index.d.ts +2 -0
- package/dist/modules/yield/listYieldVaults/index.d.ts.map +1 -0
- package/dist/modules/yield/listYieldVaults/listYieldVaults.d.ts +23 -0
- package/dist/modules/yield/listYieldVaults/listYieldVaults.d.ts.map +1 -0
- package/dist/modules/yield/yield.types.d.ts +60 -0
- package/dist/modules/yield/yield.types.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-CTfG6oZa.native.esm.js → updateAuthFromVerifyResponse-BIWu4Bis.native.esm.js} +3 -3
- package/dist/{updateAuthFromVerifyResponse-CTfG6oZa.native.esm.js.map → updateAuthFromVerifyResponse-BIWu4Bis.native.esm.js.map} +1 -1
- package/dist/{updateAuthFromVerifyResponse-CPOvKWih.cjs → updateAuthFromVerifyResponse-D1QJtRk1.cjs} +3 -3
- package/dist/{updateAuthFromVerifyResponse-CPOvKWih.cjs.map → updateAuthFromVerifyResponse-D1QJtRk1.cjs.map} +1 -1
- package/dist/{updateAuthFromVerifyResponse-CfqviWkz.esm.js → updateAuthFromVerifyResponse-DU4h_W6v.esm.js} +3 -3
- package/dist/{updateAuthFromVerifyResponse-CfqviWkz.esm.js.map → updateAuthFromVerifyResponse-DU4h_W6v.esm.js.map} +1 -1
- package/dist/waas.cjs +35 -5
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +36 -7
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +36 -7
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +22 -6
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +22 -6
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +22 -6
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/waas.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waas.esm.js","names":["IDENTIFIER_TYPE_TO_API: Record<\n BusinessAccountSignerIdentifierType,\n UserIdentifierTypeEnum\n>","refreshAuth","refreshAuth","requirement: WalletCreationRequirement","refreshAuth","refreshAuth","refreshAuth","refreshAuth","refreshAuth","logoutWithReason","ROLE_TO_API: Record<AssignableRole, AssignableBusinessAccountMemberRole>","packageName","packageVersion"],"sources":["../src/modules/waas/businessAccounts/assertTargetIdentity.ts","../src/modules/waas/businessAccounts/businessAccounts.constants.ts","../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts","../src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.ts","../src/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.ts","../src/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.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/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/businessAccounts/updateBusinessAccount/updateBusinessAccount.ts","../src/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { InvalidParamError } from '../../../errors/InvalidParamError';\nimport type { TargetIdentity } from './businessAccounts.types';\n\ntype AssertTargetIdentityParams = {\n fnName: string;\n targetIdentity: TargetIdentity;\n};\n\n/**\n * Asserts a {@link TargetIdentity} resolves to a user: a `userId`, or an\n * `identifier` with its `identifierType`. Throws otherwise.\n *\n * @notInstrumented\n */\nexport const assertTargetIdentity = ({\n fnName,\n targetIdentity,\n}: AssertTargetIdentityParams): void => {\n const hasUserId = Boolean(targetIdentity.userId);\n const hasIdentifier = Boolean(\n targetIdentity.identifier && targetIdentity.identifierType\n );\n if (!hasUserId && !hasIdentifier) {\n throw new InvalidParamError(\n `${fnName}: targetIdentity must provide a userId, or an identifier with its identifierType`\n );\n }\n};\n","import { UserIdentifierTypeEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { BusinessAccountSignerIdentifierType } from './businessAccounts.types';\n\n/** Maps the SDK's identifier-type union to the generated API enum. */\nexport const IDENTIFIER_TYPE_TO_API: Record<\n BusinessAccountSignerIdentifierType,\n UserIdentifierTypeEnum\n> = {\n email: UserIdentifierTypeEnum.Email,\n externalUserId: UserIdentifierTypeEnum.ExternalUserId,\n id: UserIdentifierTypeEnum.Id,\n phoneNumber: UserIdentifierTypeEnum.PhoneNumber,\n socialAccountId: UserIdentifierTypeEnum.SocialAccountId,\n socialUsername: UserIdentifierTypeEnum.SocialUsername,\n};\n\n","import {\n AssignableBusinessAccountMemberRole,\n type ProviderEnum,\n TokenScope,\n} from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { assertTargetIdentity } from '../assertTargetIdentity';\nimport { IDENTIFIER_TYPE_TO_API } from '../businessAccounts.constants';\nimport type {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n TargetIdentity,\n} from '../businessAccounts.types';\n\ntype AddMemberParams = {\n businessAccountId: string;\n role?: BusinessAccountMemberRole;\n targetIdentity: TargetIdentity;\n};\n\n/**\n * Adds a member to an existing business account. Identify the target with a\n * `targetIdentity`: a known `userId`, or an `identifier` + `identifierType`\n * (e.g. an email — the user is created if absent).\n *\n * Calls the SDK API directly (not the WaaS iframe): this is a server-state\n * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces\n * as a thrown error rather than stalling in the iframe bridge.\n *\n * @param params.businessAccountId - The ID of the business account.\n * @param params.targetIdentity - The member to add (userId, or identifier + identifierType).\n * @param [params.role] - The member role (`admin` or `viewer`). Defaults to `viewer`.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The created business account member.\n * @notInstrumented\n */\nexport const addBusinessAccountMember = async (\n { businessAccountId, targetIdentity, role }: AddMemberParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n assertTargetIdentity({ fnName: 'addBusinessAccountMember', targetIdentity });\n\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountmemberadd },\n client\n );\n const { userId, identifier, identifierType, socialProvider, smsCountryCode } =\n targetIdentity;\n\n const member = await apiClient.sdkAddBusinessAccountMember({\n addBusinessAccountMemberSdkRequest: {\n identifier,\n role:\n role === 'admin'\n ? AssignableBusinessAccountMemberRole.Admin\n : AssignableBusinessAccountMemberRole.Viewer,\n smsCountryCode,\n socialProvider: socialProvider as ProviderEnum | undefined,\n type: identifierType ? IDENTIFIER_TYPE_TO_API[identifierType] : undefined,\n userId,\n },\n businessAccountId,\n environmentId: core.environmentId,\n });\n\n return member as BusinessAccountMember;\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/** @notInstrumented */\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 { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport type { WalletAccount } from '../../../wallets/walletAccount';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport { getWaasWalletProviderByChain } from '../../getWaasWalletProviderByChain';\nimport { assertTargetIdentity } from '../assertTargetIdentity';\nimport type {\n BusinessAccountDetail,\n BusinessAccountSignerType,\n TargetIdentity,\n} from '../businessAccounts.types';\n\ntype AddSignerParams = {\n businessAccountId?: string;\n password?: string;\n signerType?: BusinessAccountSignerType;\n targetIdentity: TargetIdentity;\n walletAccount: WalletAccount;\n walletId?: string;\n};\n\n/**\n * Adds a signer to a business-account wallet via the reshare ceremony, minting\n * the new signer's share set. Identify the target by `userId`, or `identifier`\n * + `identifierType` (the user is created if absent).\n *\n * Omit `businessAccountId` to add a signer to a wallet that isn't in a business\n * account yet: the wallet's per-account is found-or-created first (idempotent —\n * converts the personal wallet, seating its owner as the first signer), then\n * the new signer is reshared in.\n *\n * @param params.walletAccount - The wallet account to add the signer to.\n * @param [params.businessAccountId] - The business account; found-or-created when omitted.\n * @param [params.walletId] - The wallet UUID to link when finding-or-creating; defaults to `walletAccount.verifiedCredentialId`.\n * @param params.targetIdentity - The signer to add (userId, or identifier + identifierType).\n * @param [params.signerType] - `endUser` (default) or `server`.\n * @param [params.password] - Password for the reshare, if the wallet is password-encrypted.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The new signer's share set id.\n * @notInstrumented\n */\nexport const addBusinessAccountSigner = async (\n {\n walletAccount,\n businessAccountId,\n walletId,\n targetIdentity,\n signerType,\n password,\n }: AddSignerParams,\n client = getDefaultClient()\n): Promise<{ shareSetId: string }> => {\n assertTargetIdentity({ fnName: 'addBusinessAccountSigner', targetIdentity });\n\n // A wallet already owned by a business account can't be found-or-created into\n // one — require the caller to name that account explicitly.\n if (walletAccount.businessAccountId) {\n assertDefined(\n businessAccountId,\n 'addBusinessAccountSigner: this wallet is already part of a business account'\n );\n }\n\n // No account yet: find-or-create the per-wallet business account first\n // (idempotent), then reshare the signer into it.\n let resolvedBusinessAccountId = businessAccountId;\n if (!resolvedBusinessAccountId) {\n // The link endpoint wants the wallet's UUID. WalletAccount.id is a\n // composite (`walletProviderKey:address`), so use verifiedCredentialId —\n // the VC id, which is the walletId redcoast keys wallets by.\n const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;\n assertDefined(\n linkWalletId,\n 'addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account'\n );\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountsigneradd },\n client\n );\n const account = await apiClient.sdkLinkBusinessAccountWallet({\n environmentId: core.environmentId,\n linkBusinessAccountWalletSdkRequest: { walletId: linkWalletId },\n });\n resolvedBusinessAccountId = (account as BusinessAccountDetail).id;\n }\n\n // Resolve the provider by chain (not by the wallet's provider key) so the\n // reshare works for any business-account wallet the caller can sign — it need\n // not be one of the session's own `getWalletAccounts()`.\n const provider = getWaasWalletProviderByChain(\n { chain: walletAccount.chain },\n client\n );\n\n const result = await provider.reshareToNewSignerShareSet({\n businessAccountId: resolvedBusinessAccountId,\n password,\n signerType,\n targetSignerIdentity: targetIdentity,\n walletAccount,\n });\n\n // The find-or-create link above can bind the caller's wallet to the business\n // account (changing its verifiedCredential); refresh local auth so the\n // caller's wallet state doesn't go stale.\n await refreshAuth(client);\n\n return result;\n};\n","import { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype AddWalletParams = {\n businessAccountId?: string;\n walletId: string;\n};\n\n/**\n * Links a wallet to a business account, or omit `businessAccountId` to\n * find-or-create the per-wallet business account (the server seats the wallet's\n * owner as the first member/signer).\n *\n * Calls the SDK API directly (not the WaaS iframe): this is a server-state\n * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces\n * as a thrown error rather than stalling in the iframe bridge.\n *\n * @param [params.businessAccountId] - The business account to link to; found-or-created when omitted.\n * @param params.walletId - The ID of the wallet to link.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account detail.\n * @notInstrumented\n */\nexport const addWalletToBusinessAccount = async (\n { businessAccountId, walletId }: AddWalletParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountlinkWallet },\n client\n );\n\n const detail = await apiClient.sdkLinkBusinessAccountWallet({\n environmentId: core.environmentId,\n linkBusinessAccountWalletSdkRequest: {\n businessAccountId,\n walletId,\n },\n });\n\n // Linking mutates the wallet's businessAccount binding on its\n // verifiedCredential; refresh local auth so the change is reflected.\n await refreshAuth(client);\n\n return detail as BusinessAccountDetail;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n /**\n * Optional consumer-supplied Google Drive access token. When provided (and\n * already granted Drive scopes), the SDK uses it directly instead of falling\n * back to the stored OAuth token — avoiding a second Google consent prompt.\n *\n * Especially useful for consumers using external auth: the user's Google\n * account isn't linked in Dynamic, so there's no stored OAuth token to fall\n * back on — they obtain a Drive-scoped token themselves and pass it here.\n */\n googleDriveAccessToken?: string;\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 [params.googleDriveAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.\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 * @notInstrumented\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n {\n googleDriveAccessToken,\n password,\n walletAccount,\n }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n googleDriveAccessToken,\n password,\n walletAccount,\n });\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccount } from '../businessAccounts.types';\n\ntype CreateBusinessAccountParams = {\n /**\n * Optional developer-supplied label for the account. Not unique — multiple\n * accounts may share the same value — so use it to group accounts or map\n * them to an ID in your own system (a common B2B2B2C pattern). It's metadata,\n * never an internal key.\n */\n externalRef?: string;\n /** Arbitrary key-value metadata to store alongside the account. */\n metadata?: Record<string, unknown>;\n name?: string;\n};\n\n/**\n * Creates a new business account.\n *\n * @param [params] - Optional parameters for the business account.\n * @param [params.name] - Optional name for the business account.\n * @param [params.externalRef] - Optional developer-supplied label (not unique; accounts may share one).\n * @param [params.metadata] - Optional arbitrary key-value metadata.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The created business account.\n * @notInstrumented\n */\nexport const createBusinessAccount = async (\n params?: CreateBusinessAccountParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccount> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const result = await apiClient.sdkCreateBusinessAccount({\n createBusinessAccountSdkRequest: {\n externalRef: params?.externalRef,\n metadata: params?.metadata,\n name: params?.name,\n },\n environmentId: core.environmentId,\n });\n\n return result as unknown as BusinessAccount;\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 * @notInstrumented\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 * @notInstrumented\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 * @notInstrumented\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 * @notInstrumented\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 type { Chain } from '../../../chain';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport { getWaasWalletProviderByChain } from '../../getWaasWalletProviderByChain';\nimport type { ThresholdSignatureScheme } from '../../waas.types';\n\ntype CreateWalletForBusinessAccountParams = {\n businessAccountId: string;\n chain: Chain;\n password?: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Creates a WaaS wallet account owned directly by a business account, in one\n * step — the server seats the wallet's signer row against the business account\n * as it is minted, so no separate link call is needed.\n *\n * @example\n * ```ts\n * const wallet = await createWalletForBusinessAccount({\n * businessAccountId: 'ba-1',\n * chain: 'EVM',\n * });\n * ```\n *\n * @param params.businessAccountId - The business account that will own the wallet.\n * @param params.chain - The chain to create the wallet account for.\n * @param [params.password] - Optional password used to encrypt the user share.\n * @param [params.thresholdSignatureScheme] - The threshold signature scheme to use. (Default: TWO_OF_TWO)\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The created wallet account.\n * @notInstrumented\n */\nexport const createWalletForBusinessAccount = async (\n {\n businessAccountId,\n chain,\n password,\n thresholdSignatureScheme,\n }: CreateWalletForBusinessAccountParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderByChain({ chain }, client);\n\n const wallet = await provider.createWalletAccount({\n businessAccountId,\n password,\n thresholdSignatureScheme,\n });\n\n // Re-hydrate local auth so the new wallet's verifiedCredential is present —\n // mirrors createWaasWalletAccounts. Without it the wallet list goes stale\n // (wallets vanish until the next refresh).\n await refreshAuth(client);\n\n return wallet;\n};\n","import type { WaasPolicyRule } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n initialSignerRules?: WaasPolicyRule[];\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 [params.initialSignerRules] - Optional policy rules used to seed the delegated signer's policy layer at delegation time.\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 * @notInstrumented\n */\nexport const delegateWaasKeyShares = async (\n { initialSignerRules, password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n initialSignerRules,\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 * @notInstrumented\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 * @notInstrumented\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 { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype GetBusinessAccountParams = {\n businessAccountId: string;\n};\n\n/**\n * Retrieves a business account by ID, including its members, signers, and wallets.\n *\n * @param params.businessAccountId - The ID of the business account to retrieve.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The business account with its members, signers, and wallets.\n * @notInstrumented\n */\nexport const getBusinessAccount = async (\n { businessAccountId }: GetBusinessAccountParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const result = await apiClient.sdkGetBusinessAccountById({\n businessAccountId,\n environmentId: core.environmentId,\n });\n\n return result as unknown as BusinessAccountDetail;\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/** @notInstrumented */\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 { 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 * @notInstrumented\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 * @notInstrumented\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 * @notInstrumented\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 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 * @notInstrumented\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 * @notInstrumented\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 { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountList } from '../businessAccounts.types';\n\ntype ListBusinessAccountsParams = {\n /**\n * Filter to business accounts whose `externalRef` is one of these values.\n * externalRef is not unique, so each value may match multiple accounts —\n * the result is always the full array of matches (the caller is a member of).\n */\n externalRefs?: string[];\n};\n\n/**\n * Lists the business accounts the current user is a member of, scoped to the\n * active project environment. Optionally filter by `externalRefs`.\n *\n * @param [params] - Optional filters.\n * @param [params.externalRefs] - Return only accounts whose externalRef is in this list.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A paginated list of business accounts.\n * @notInstrumented\n */\nexport const listBusinessAccounts = async (\n params?: ListBusinessAccountsParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountList> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const result = await apiClient.sdkListBusinessAccounts({\n environmentId: core.environmentId,\n externalRef: params?.externalRefs,\n });\n\n return result as unknown as BusinessAccountList;\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 * @notInstrumented\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 { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountMember } from '../businessAccounts.types';\n\ntype RemoveMemberParams = {\n businessAccountId: string;\n userId: string;\n};\n\n/**\n * Removes a member from a business account. Any signer rows the member held on\n * the account's wallets are torn down as part of the removal. The backend\n * refuses to remove the account's last owner.\n *\n * @param params.businessAccountId - The business account to remove the member from.\n * @param params.userId - The id of the user to remove.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The removed member.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * const member = detail.members[0];\n * await removeBusinessAccountMember({\n * businessAccountId,\n * userId: member.userId,\n * });\n * ```\n *\n * @see addBusinessAccountMember\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const removeBusinessAccountMember = async (\n { businessAccountId, userId }: RemoveMemberParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountmemberremove },\n client\n );\n\n const { member } = await apiClient.sdkRemoveBusinessAccountMember({\n businessAccountId,\n environmentId: core.environmentId,\n userId,\n });\n\n return member as BusinessAccountMember;\n};\n","import { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountSigner } from '../businessAccounts.types';\n\ntype RemoveSignerParams = {\n businessAccountId: string;\n signerId: string;\n walletId: string;\n};\n\n/**\n * Removes a signer from a business-account wallet. This detaches the signer's\n * share set from the wallet — it does not run an MPC ceremony — so the removed\n * identity can no longer sign for that wallet. The backend refuses to remove\n * the last remaining signer on a wallet.\n *\n * @param params.businessAccountId - The business account the wallet belongs to.\n * @param params.walletId - The wallet the signer is attached to.\n * @param params.signerId - The id of the signer to remove (`BusinessAccountSigner.id`).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The removed signer.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * const signer = detail.signers[0];\n * await removeBusinessAccountSigner({\n * businessAccountId,\n * walletId: signer.walletId,\n * signerId: signer.id,\n * });\n * ```\n *\n * @see addBusinessAccountSigner\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const removeBusinessAccountSigner = async (\n { businessAccountId, walletId, signerId }: RemoveSignerParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountSigner> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountsignerremove },\n client\n );\n\n const { signer } = await apiClient.sdkRemoveBusinessAccountSigner({\n businessAccountId,\n environmentId: core.environmentId,\n signerId,\n walletId,\n });\n\n return signer as BusinessAccountSigner;\n};\n","import { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype RemoveBusinessAccountWalletParams = {\n businessAccountId: string;\n walletId: string;\n};\n\n/**\n * Removes a wallet from a business account (owner-/admin-only). The wallet and\n * all its associated signer rows are detached from the account. The backend\n * refuses to remove the last wallet on a business account.\n *\n * @param params.businessAccountId - The business account the wallet belongs to.\n * @param params.walletId - The wallet to remove (`BusinessAccountWallet.id`).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account detail.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * await removeBusinessAccountWallet({\n * businessAccountId,\n * walletId: detail.wallets[0].id,\n * });\n * ```\n *\n * @see addWalletToBusinessAccount\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const removeBusinessAccountWallet = async (\n { businessAccountId, walletId }: RemoveBusinessAccountWalletParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountwalletremove },\n client\n );\n\n const detail = await apiClient.sdkRemoveBusinessAccountWallet({\n businessAccountId,\n environmentId: core.environmentId,\n walletId,\n });\n\n // Removing a wallet detaches its businessAccount binding on the\n // verifiedCredential; refresh local auth so the change is reflected.\n await refreshAuth(client);\n\n return detail as BusinessAccountDetail;\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 * @notInstrumented\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 * @notInstrumented\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/** @notInstrumented */\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 * @notInstrumented\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 { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { logoutWithReason } from '../../../auth/logoutWithReason';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype TransferBusinessAccountOwnershipParams = {\n businessAccountId: string;\n newOwnerUserId: string;\n};\n\n/**\n * Transfers ownership of a business account to another member. Owner-only: the\n * `newOwnerUserId` must already be a member, is promoted to owner, and the\n * current owner is atomically demoted to admin.\n *\n * @param params.businessAccountId - The business account whose ownership moves.\n * @param params.newOwnerUserId - The member to promote to owner.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account detail.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * const target = detail.members.find((m) => m.role === 'admin');\n * await transferBusinessAccountOwnership({\n * businessAccountId,\n * newOwnerUserId: target.userId,\n * });\n * ```\n *\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const transferBusinessAccountOwnership = async (\n { businessAccountId, newOwnerUserId }: TransferBusinessAccountOwnershipParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccounttransferOwnership },\n client\n );\n\n const detail = await apiClient.sdkTransferBusinessAccountOwnership({\n businessAccountId,\n environmentId: core.environmentId,\n transferBusinessAccountOwnershipSdkRequest: { newOwnerUserId },\n });\n\n // Ownership transfer demotes the caller (owner -> admin) and revokes their\n // session server-side, so a token refresh would 401. Sign the caller out\n // instead — they re-authenticate into their new (admin) scope.\n await logoutWithReason(\n { reason: 'business-account-ownership-transferred' },\n client\n );\n\n return detail as BusinessAccountDetail;\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 * @notInstrumented\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 { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccount } from '../businessAccounts.types';\n\ntype UpdateBusinessAccountParams = {\n businessAccountId: string;\n name: string;\n};\n\n/**\n * Renames a business account (owner-/admin-only). Calls the SDK API directly\n * (no MPC step), so a rejection surfaces as a thrown error.\n *\n * @param params.businessAccountId - The business account to rename.\n * @param params.name - The new name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account.\n *\n * @example\n * ```ts\n * await updateBusinessAccount({ businessAccountId, name: 'Acme Inc' });\n * ```\n *\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const updateBusinessAccount = async (\n { businessAccountId, name }: UpdateBusinessAccountParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccount> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const account = await apiClient.sdkUpdateBusinessAccount({\n businessAccountId,\n environmentId: core.environmentId,\n updateBusinessAccountSdkRequest: { name },\n });\n\n return account as BusinessAccount;\n};\n","import { AssignableBusinessAccountMemberRole, TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n} from '../businessAccounts.types';\n\n/** Roles a member can be reassigned to — owner moves only via transferOwnership. */\ntype AssignableRole = Exclude<BusinessAccountMemberRole, 'owner'>;\n\ntype UpdateBusinessAccountMemberRoleParams = {\n businessAccountId: string;\n role: AssignableRole;\n userId: string;\n};\n\nconst ROLE_TO_API: Record<AssignableRole, AssignableBusinessAccountMemberRole> =\n {\n admin: AssignableBusinessAccountMemberRole.Admin,\n viewer: AssignableBusinessAccountMemberRole.Viewer,\n };\n\n/**\n * Changes an existing member's role between `admin` and `viewer` (owner-/admin-only).\n * Owner is not assignable here — use `transferBusinessAccountOwnership` for that.\n *\n * @param params.businessAccountId - The business account the member belongs to.\n * @param params.userId - The member whose role changes.\n * @param params.role - The new role (`admin` or `viewer`).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account member.\n *\n * @example\n * ```ts\n * await updateBusinessAccountMemberRole({\n * businessAccountId,\n * userId: member.userId,\n * role: 'admin',\n * });\n * ```\n *\n * @see transferBusinessAccountOwnership\n * @see addBusinessAccountMember\n * @notInstrumented\n */\nexport const updateBusinessAccountMemberRole = async (\n { businessAccountId, userId, role }: UpdateBusinessAccountMemberRoleParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountmemberroleupdate },\n client\n );\n\n const member = await apiClient.sdkUpdateBusinessAccountMemberRole({\n businessAccountId,\n environmentId: core.environmentId,\n updateBusinessAccountMemberRoleSdkRequest: { role: ROLE_TO_API[role] },\n userId,\n });\n\n return member as BusinessAccountMember;\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 * @notInstrumented\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 MigrateFromFireblocksResponse,\n WaasPolicyRule,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport {\n TransactionBroadcastError,\n type TransactionBroadcastErrorCode,\n type TransactionBroadcastSubmissionState,\n} from '../errors/TransactionBroadcastError';\nexport type {\n BusinessAccount,\n BusinessAccountDetail,\n BusinessAccountList,\n BusinessAccountMember,\n BusinessAccountSigner,\n BusinessAccountSignerIdentifierType,\n BusinessAccountWalletSummary,\n SmsCountryCode,\n SocialProvider,\n TargetIdentity,\n} from '../modules/waas/businessAccounts/businessAccounts.types';\nexport { addBusinessAccountMember } from '../modules/waas/businessAccounts/addBusinessAccountMember';\nexport { addBusinessAccountSigner } from '../modules/waas/businessAccounts/addBusinessAccountSigner';\nexport { addWalletToBusinessAccount } from '../modules/waas/businessAccounts/addWalletToBusinessAccount';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createBusinessAccount } from '../modules/waas/businessAccounts/createBusinessAccount';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { createWalletForBusinessAccount } from '../modules/waas/businessAccounts/createWalletForBusinessAccount';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getBusinessAccount } from '../modules/waas/businessAccounts/getBusinessAccount';\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 { listBusinessAccounts } from '../modules/waas/businessAccounts/listBusinessAccounts';\nexport { migrateFromFireblocks } from '../modules/waas/migrateFromFireblocks';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { removeBusinessAccountMember } from '../modules/waas/businessAccounts/removeBusinessAccountMember';\nexport { removeBusinessAccountSigner } from '../modules/waas/businessAccounts/removeBusinessAccountSigner';\nexport { removeBusinessAccountWallet } from '../modules/waas/businessAccounts/removeBusinessAccountWallet';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { setWaasWalletAccountPassword } from '../modules/waas/setWaasWalletAccountPassword';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { transferBusinessAccountOwnership } from '../modules/waas/businessAccounts/transferBusinessAccountOwnership';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateBusinessAccount } from '../modules/waas/businessAccounts/updateBusinessAccount';\nexport { updateBusinessAccountMemberRole } from '../modules/waas/businessAccounts/updateBusinessAccountMemberRole';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WaasTransactionBroadcastEncoding,\n WaasTransactionBroadcastResult,\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,wBAAwB,EACnC,QACA,qBACsC;CACtC,MAAM,YAAY,QAAQ,eAAe,OAAO;CAChD,MAAM,gBAAgB,QACpB,eAAe,cAAc,eAAe,eAC7C;AACD,KAAI,CAAC,aAAa,CAAC,cACjB,OAAM,IAAI,kBACR,GAAG,OAAO,kFACX;;;;;;ACpBL,MAAaA,yBAGT;CACF,OAAO,uBAAuB;CAC9B,gBAAgB,uBAAuB;CACvC,IAAI,uBAAuB;CAC3B,aAAa,uBAAuB;CACpC,iBAAiB,uBAAuB;CACxC,gBAAgB,uBAAuB;CACxC;;;;;;;;;;;;;;;;;;;;ACyBD,MAAa,2BAA2B,OACtC,EAAE,mBAAmB,gBAAgB,QACrC,SAAwB,kBAAkB,KACP;AACnC,sBAAqB;EAAE,QAAQ;EAA4B;EAAgB,CAAC;CAE5E,MAAM,OAAO,QAAQ,OAAO;CAC5B,MAAM,YAAY,gBAChB,EAAE,0BAA0B,WAAW,0BAA0B,EACjE,OACD;CACD,MAAM,EAAE,QAAQ,YAAY,gBAAgB,gBAAgB,mBAC1D;AAkBF,QAhBe,MAAM,UAAU,4BAA4B;EACzD,oCAAoC;GAClC;GACA,MACE,SAAS,UACL,oCAAoC,QACpC,oCAAoC;GAC1C;GACgB;GAChB,MAAM,iBAAiB,uBAAuB,kBAAkB;GAChE;GACD;EACD;EACA,eAAe,KAAK;EACrB,CAAC;;;;;;ACrDJ,MAAa,gCACX,EAAE,SACF,WACuB;CACvB,MAAM,eAAe,8BAA8B,EAAE,OAAO,EAAE,OAAO;AAErE,KAAI,CAAC,aAOH,OAAM,IAAI,2BAA2B,EACnC,mBAPsB,wBAAwB;EAC9C;EACA,aAAa,sBAAsB;EACnC,oBAAoB,mBAAmB;EACxC,CAAC,EAID,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;;;;;;;;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;EACD,CAAC;;;;;;;;;;;;;;;;;;ACzCJ,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.esm.js","names":["IDENTIFIER_TYPE_TO_API: Record<\n BusinessAccountSignerIdentifierType,\n UserIdentifierTypeEnum\n>","refreshAuth","refreshAuth","requirement: WalletCreationRequirement","refreshAuth","refreshAuth","refreshAuth","refreshAuth","refreshAuth","logoutWithReason","ROLE_TO_API: Record<AssignableRole, AssignableBusinessAccountMemberRole>","packageName","packageVersion"],"sources":["../src/modules/waas/businessAccounts/assertTargetIdentity.ts","../src/modules/waas/businessAccounts/businessAccounts.constants.ts","../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts","../src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts","../src/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.ts","../src/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.ts","../src/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.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/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/businessAccounts/updateBusinessAccount/updateBusinessAccount.ts","../src/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { InvalidParamError } from '../../../errors/InvalidParamError';\nimport type { TargetIdentity } from './businessAccounts.types';\n\ntype AssertTargetIdentityParams = {\n fnName: string;\n targetIdentity: TargetIdentity;\n};\n\n/**\n * Asserts a {@link TargetIdentity} resolves to a user: a `userId`, or an\n * `identifier` with its `identifierType`. Throws otherwise.\n *\n * @notInstrumented\n */\nexport const assertTargetIdentity = ({\n fnName,\n targetIdentity,\n}: AssertTargetIdentityParams): void => {\n const hasUserId = Boolean(targetIdentity.userId);\n const hasIdentifier = Boolean(\n targetIdentity.identifier && targetIdentity.identifierType\n );\n if (!hasUserId && !hasIdentifier) {\n throw new InvalidParamError(\n `${fnName}: targetIdentity must provide a userId, or an identifier with its identifierType`\n );\n }\n};\n","import { UserIdentifierTypeEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { BusinessAccountSignerIdentifierType } from './businessAccounts.types';\n\n/** Maps the SDK's identifier-type union to the generated API enum. */\nexport const IDENTIFIER_TYPE_TO_API: Record<\n BusinessAccountSignerIdentifierType,\n UserIdentifierTypeEnum\n> = {\n email: UserIdentifierTypeEnum.Email,\n externalUserId: UserIdentifierTypeEnum.ExternalUserId,\n id: UserIdentifierTypeEnum.Id,\n phoneNumber: UserIdentifierTypeEnum.PhoneNumber,\n socialAccountId: UserIdentifierTypeEnum.SocialAccountId,\n socialUsername: UserIdentifierTypeEnum.SocialUsername,\n};\n\n","import {\n AssignableBusinessAccountMemberRole,\n type ProviderEnum,\n TokenScope,\n} from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { assertTargetIdentity } from '../assertTargetIdentity';\nimport { IDENTIFIER_TYPE_TO_API } from '../businessAccounts.constants';\nimport type {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n TargetIdentity,\n} from '../businessAccounts.types';\n\ntype AddMemberParams = {\n businessAccountId: string;\n role?: BusinessAccountMemberRole;\n targetIdentity: TargetIdentity;\n};\n\n/**\n * Adds a member to an existing business account. Identify the target with a\n * `targetIdentity`: a known `userId`, or an `identifier` + `identifierType`\n * (e.g. an email — the user is created if absent).\n *\n * Calls the SDK API directly (not the WaaS iframe): this is a server-state\n * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces\n * as a thrown error rather than stalling in the iframe bridge.\n *\n * @param params.businessAccountId - The ID of the business account.\n * @param params.targetIdentity - The member to add (userId, or identifier + identifierType).\n * @param [params.role] - The member role (`admin` or `viewer`). Defaults to `viewer`.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The created business account member.\n * @notInstrumented\n */\nexport const addBusinessAccountMember = async (\n { businessAccountId, targetIdentity, role }: AddMemberParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n assertTargetIdentity({ fnName: 'addBusinessAccountMember', targetIdentity });\n\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountmemberadd },\n client\n );\n const { userId, identifier, identifierType, socialProvider, smsCountryCode } =\n targetIdentity;\n\n const member = await apiClient.sdkAddBusinessAccountMember({\n addBusinessAccountMemberSdkRequest: {\n identifier,\n role:\n role === 'admin'\n ? AssignableBusinessAccountMemberRole.Admin\n : AssignableBusinessAccountMemberRole.Viewer,\n smsCountryCode,\n socialProvider: socialProvider as ProviderEnum | undefined,\n type: identifierType ? IDENTIFIER_TYPE_TO_API[identifierType] : undefined,\n userId,\n },\n businessAccountId,\n environmentId: core.environmentId,\n });\n\n return member as BusinessAccountMember;\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/** @notInstrumented */\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 { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport type { WalletAccount } from '../../../wallets/walletAccount';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport { getWaasWalletProviderByChain } from '../../getWaasWalletProviderByChain';\nimport { assertTargetIdentity } from '../assertTargetIdentity';\nimport type {\n BusinessAccountDetail,\n BusinessAccountSignerType,\n TargetIdentity,\n} from '../businessAccounts.types';\n\ntype AddSignerParams = {\n businessAccountId?: string;\n password?: string;\n signerType?: BusinessAccountSignerType;\n targetIdentity: TargetIdentity;\n walletAccount: WalletAccount;\n walletId?: string;\n};\n\n/**\n * Adds a signer to a business-account wallet via the reshare ceremony, minting\n * the new signer's share set. Identify the target by `userId`, or `identifier`\n * + `identifierType` (the user is created if absent).\n *\n * Omit `businessAccountId` to add a signer to a wallet that isn't in a business\n * account yet: the wallet's per-account is found-or-created first (idempotent —\n * converts the personal wallet, seating its owner as the first signer), then\n * the new signer is reshared in.\n *\n * @param params.walletAccount - The wallet account to add the signer to.\n * @param [params.businessAccountId] - The business account; found-or-created when omitted.\n * @param [params.walletId] - The wallet UUID to link when finding-or-creating; defaults to `walletAccount.verifiedCredentialId`.\n * @param params.targetIdentity - The signer to add (userId, or identifier + identifierType).\n * @param [params.signerType] - `endUser` (default) or `server`.\n * @param [params.password] - Password for the reshare, if the wallet is password-encrypted.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The new signer's share set id.\n * @notInstrumented\n */\nexport const addBusinessAccountSigner = async (\n {\n walletAccount,\n businessAccountId,\n walletId,\n targetIdentity,\n signerType,\n password,\n }: AddSignerParams,\n client = getDefaultClient()\n): Promise<{ shareSetId: string }> => {\n assertTargetIdentity({ fnName: 'addBusinessAccountSigner', targetIdentity });\n\n // A wallet already owned by a business account can't be found-or-created into\n // one — require the caller to name that account explicitly.\n if (walletAccount.businessAccountId) {\n assertDefined(\n businessAccountId,\n 'addBusinessAccountSigner: this wallet is already part of a business account'\n );\n }\n\n // No account yet: find-or-create the per-wallet business account first\n // (idempotent), then reshare the signer into it.\n let resolvedBusinessAccountId = businessAccountId;\n if (!resolvedBusinessAccountId) {\n // The link endpoint wants the wallet's UUID. WalletAccount.id is a\n // composite (`walletProviderKey:address`), so use verifiedCredentialId —\n // the VC id, which is the walletId redcoast keys wallets by.\n const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;\n assertDefined(\n linkWalletId,\n 'addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account'\n );\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountsigneradd },\n client\n );\n const account = await apiClient.sdkLinkBusinessAccountWallet({\n environmentId: core.environmentId,\n linkBusinessAccountWalletSdkRequest: { walletId: linkWalletId },\n });\n resolvedBusinessAccountId = (account as BusinessAccountDetail).id;\n }\n\n // Resolve the provider by chain (not by the wallet's provider key) so the\n // reshare works for any business-account wallet the caller can sign — it need\n // not be one of the session's own `getWalletAccounts()`.\n const provider = getWaasWalletProviderByChain(\n { chain: walletAccount.chain },\n client\n );\n\n const result = await provider.reshareToNewSignerShareSet({\n businessAccountId: resolvedBusinessAccountId,\n password,\n signerType,\n targetSignerIdentity: targetIdentity,\n walletAccount,\n });\n\n // The find-or-create link above can bind the caller's wallet to the business\n // account (changing its verifiedCredential); refresh local auth so the\n // caller's wallet state doesn't go stale.\n await refreshAuth(client);\n\n return result;\n};\n","import { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype AddWalletParams = {\n businessAccountId?: string;\n walletId: string;\n};\n\n/**\n * Links a wallet to a business account, or omit `businessAccountId` to\n * find-or-create the per-wallet business account (the server seats the wallet's\n * owner as the first member/signer).\n *\n * Calls the SDK API directly (not the WaaS iframe): this is a server-state\n * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces\n * as a thrown error rather than stalling in the iframe bridge.\n *\n * @param [params.businessAccountId] - The business account to link to; found-or-created when omitted.\n * @param params.walletId - The ID of the wallet to link.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account detail.\n * @notInstrumented\n */\nexport const addWalletToBusinessAccount = async (\n { businessAccountId, walletId }: AddWalletParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountlinkWallet },\n client\n );\n\n const detail = await apiClient.sdkLinkBusinessAccountWallet({\n environmentId: core.environmentId,\n linkBusinessAccountWalletSdkRequest: {\n businessAccountId,\n walletId,\n },\n });\n\n // Linking mutates the wallet's businessAccount binding on its\n // verifiedCredential; refresh local auth so the change is reflected.\n await refreshAuth(client);\n\n return detail as BusinessAccountDetail;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n /**\n * Optional consumer-supplied Google Drive access token. When provided (and\n * already granted Drive scopes), the SDK uses it directly instead of falling\n * back to the stored OAuth token — avoiding a second Google consent prompt.\n *\n * Especially useful for consumers using external auth: the user's Google\n * account isn't linked in Dynamic, so there's no stored OAuth token to fall\n * back on — they obtain a Drive-scoped token themselves and pass it here.\n */\n googleDriveAccessToken?: string;\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 [params.googleDriveAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.\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 * @notInstrumented\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n {\n googleDriveAccessToken,\n password,\n walletAccount,\n }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n googleDriveAccessToken,\n password,\n walletAccount,\n });\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccount } from '../businessAccounts.types';\n\ntype CreateBusinessAccountParams = {\n /**\n * Optional developer-supplied label for the account. Not unique — multiple\n * accounts may share the same value — so use it to group accounts or map\n * them to an ID in your own system (a common B2B2B2C pattern). It's metadata,\n * never an internal key.\n */\n externalRef?: string;\n /** Arbitrary key-value metadata to store alongside the account. */\n metadata?: Record<string, unknown>;\n name?: string;\n};\n\n/**\n * Creates a new business account.\n *\n * @param [params] - Optional parameters for the business account.\n * @param [params.name] - Optional name for the business account.\n * @param [params.externalRef] - Optional developer-supplied label (not unique; accounts may share one).\n * @param [params.metadata] - Optional arbitrary key-value metadata.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The created business account.\n * @notInstrumented\n */\nexport const createBusinessAccount = async (\n params?: CreateBusinessAccountParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccount> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const result = await apiClient.sdkCreateBusinessAccount({\n createBusinessAccountSdkRequest: {\n externalRef: params?.externalRef,\n metadata: params?.metadata,\n name: params?.name,\n },\n environmentId: core.environmentId,\n });\n\n return result as unknown as BusinessAccount;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype CreateWaasOfflineRecoverySharesParams = {\n /**\n * Optional consumer-supplied Drive access token. When provided (and already\n * granted Drive scopes), the SDK uses it directly instead of falling back\n * to the stored OAuth token — avoiding a second Google consent prompt.\n */\n cloudProviderAccessToken?: string;\n mfaToken?: string;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Mints an offline-recovery share set for a WaaS wallet account.\n *\n * This mints a second, independent 2-of-2 share set: the client's share is\n * uploaded to Google Drive, and the server's share is delivered to the\n * developer's webhook. Dynamic never retains its half, so recovery works even\n * if Dynamic is fully offline.\n *\n * @param params.walletAccount - The WaaS wallet account to create offline-recovery shares for.\n * @param [params.password] - Optional password to encrypt the client share.\n * @param [params.cloudProviderAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.\n * @param [params.mfaToken] - Optional MFA token proving step-up verification, when required for this action.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the offline-recovery share set has been minted.\n * @notInstrumented\n */\nexport const createWaasOfflineRecoveryShares = async (\n {\n cloudProviderAccessToken,\n mfaToken,\n password,\n walletAccount,\n }: CreateWaasOfflineRecoverySharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.createOfflineRecoveryShares({\n cloudProviderAccessToken,\n mfaToken,\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 * @notInstrumented\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 * @notInstrumented\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 * @notInstrumented\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 * @notInstrumented\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 type { Chain } from '../../../chain';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport { getWaasWalletProviderByChain } from '../../getWaasWalletProviderByChain';\nimport type { ThresholdSignatureScheme } from '../../waas.types';\n\ntype CreateWalletForBusinessAccountParams = {\n businessAccountId: string;\n chain: Chain;\n password?: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Creates a WaaS wallet account owned directly by a business account, in one\n * step — the server seats the wallet's signer row against the business account\n * as it is minted, so no separate link call is needed.\n *\n * @example\n * ```ts\n * const wallet = await createWalletForBusinessAccount({\n * businessAccountId: 'ba-1',\n * chain: 'EVM',\n * });\n * ```\n *\n * @param params.businessAccountId - The business account that will own the wallet.\n * @param params.chain - The chain to create the wallet account for.\n * @param [params.password] - Optional password used to encrypt the user share.\n * @param [params.thresholdSignatureScheme] - The threshold signature scheme to use. (Default: TWO_OF_TWO)\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The created wallet account.\n * @notInstrumented\n */\nexport const createWalletForBusinessAccount = async (\n {\n businessAccountId,\n chain,\n password,\n thresholdSignatureScheme,\n }: CreateWalletForBusinessAccountParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderByChain({ chain }, client);\n\n const wallet = await provider.createWalletAccount({\n businessAccountId,\n password,\n thresholdSignatureScheme,\n });\n\n // Re-hydrate local auth so the new wallet's verifiedCredential is present —\n // mirrors createWaasWalletAccounts. Without it the wallet list goes stale\n // (wallets vanish until the next refresh).\n await refreshAuth(client);\n\n return wallet;\n};\n","import type { WaasPolicyRule } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n initialSignerRules?: WaasPolicyRule[];\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 [params.initialSignerRules] - Optional policy rules used to seed the delegated signer's policy layer at delegation time.\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 * @notInstrumented\n */\nexport const delegateWaasKeyShares = async (\n { initialSignerRules, password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n initialSignerRules,\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 * @notInstrumented\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 * @notInstrumented\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 { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype GetBusinessAccountParams = {\n businessAccountId: string;\n};\n\n/**\n * Retrieves a business account by ID, including its members, signers, and wallets.\n *\n * @param params.businessAccountId - The ID of the business account to retrieve.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The business account with its members, signers, and wallets.\n * @notInstrumented\n */\nexport const getBusinessAccount = async (\n { businessAccountId }: GetBusinessAccountParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const result = await apiClient.sdkGetBusinessAccountById({\n businessAccountId,\n environmentId: core.environmentId,\n });\n\n return result as unknown as BusinessAccountDetail;\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/** @notInstrumented */\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 { 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 * @notInstrumented\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 * @notInstrumented\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 { WaasWalletShareSetType } from '@dynamic-labs/sdk-api-core';\n\nimport { 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 * @notInstrumented\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 const hasDelegatedShareSet =\n verifiedCredential.walletProperties?.otherShareSets?.some(\n (shareSet) => shareSet.shareSetType === WaasWalletShareSetType.Delegated\n );\n\n return Boolean(hasDelegatedKeyShare || hasDelegatedShareSet);\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 * @notInstrumented\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 * @notInstrumented\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 { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountList } from '../businessAccounts.types';\n\ntype ListBusinessAccountsParams = {\n /**\n * Filter to business accounts whose `externalRef` is one of these values.\n * externalRef is not unique, so each value may match multiple accounts —\n * the result is always the full array of matches (the caller is a member of).\n */\n externalRefs?: string[];\n};\n\n/**\n * Lists the business accounts the current user is a member of, scoped to the\n * active project environment. Optionally filter by `externalRefs`.\n *\n * @param [params] - Optional filters.\n * @param [params.externalRefs] - Return only accounts whose externalRef is in this list.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A paginated list of business accounts.\n * @notInstrumented\n */\nexport const listBusinessAccounts = async (\n params?: ListBusinessAccountsParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountList> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const result = await apiClient.sdkListBusinessAccounts({\n environmentId: core.environmentId,\n externalRef: params?.externalRefs,\n });\n\n return result as unknown as BusinessAccountList;\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 * @notInstrumented\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 { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountMember } from '../businessAccounts.types';\n\ntype RemoveMemberParams = {\n businessAccountId: string;\n userId: string;\n};\n\n/**\n * Removes a member from a business account. Any signer rows the member held on\n * the account's wallets are torn down as part of the removal. The backend\n * refuses to remove the account's last owner.\n *\n * @param params.businessAccountId - The business account to remove the member from.\n * @param params.userId - The id of the user to remove.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The removed member.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * const member = detail.members[0];\n * await removeBusinessAccountMember({\n * businessAccountId,\n * userId: member.userId,\n * });\n * ```\n *\n * @see addBusinessAccountMember\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const removeBusinessAccountMember = async (\n { businessAccountId, userId }: RemoveMemberParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountmemberremove },\n client\n );\n\n const { member } = await apiClient.sdkRemoveBusinessAccountMember({\n businessAccountId,\n environmentId: core.environmentId,\n userId,\n });\n\n return member as BusinessAccountMember;\n};\n","import { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccountSigner } from '../businessAccounts.types';\n\ntype RemoveSignerParams = {\n businessAccountId: string;\n signerId: string;\n walletId: string;\n};\n\n/**\n * Removes a signer from a business-account wallet. This detaches the signer's\n * share set from the wallet — it does not run an MPC ceremony — so the removed\n * identity can no longer sign for that wallet. The backend refuses to remove\n * the last remaining signer on a wallet.\n *\n * @param params.businessAccountId - The business account the wallet belongs to.\n * @param params.walletId - The wallet the signer is attached to.\n * @param params.signerId - The id of the signer to remove (`BusinessAccountSigner.id`).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The removed signer.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * const signer = detail.signers[0];\n * await removeBusinessAccountSigner({\n * businessAccountId,\n * walletId: signer.walletId,\n * signerId: signer.id,\n * });\n * ```\n *\n * @see addBusinessAccountSigner\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const removeBusinessAccountSigner = async (\n { businessAccountId, walletId, signerId }: RemoveSignerParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountSigner> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountsignerremove },\n client\n );\n\n const { signer } = await apiClient.sdkRemoveBusinessAccountSigner({\n businessAccountId,\n environmentId: core.environmentId,\n signerId,\n walletId,\n });\n\n return signer as BusinessAccountSigner;\n};\n","import { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype RemoveBusinessAccountWalletParams = {\n businessAccountId: string;\n walletId: string;\n};\n\n/**\n * Removes a wallet from a business account (owner-/admin-only). The wallet and\n * all its associated signer rows are detached from the account. The backend\n * refuses to remove the last wallet on a business account.\n *\n * @param params.businessAccountId - The business account the wallet belongs to.\n * @param params.walletId - The wallet to remove (`BusinessAccountWallet.id`).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account detail.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * await removeBusinessAccountWallet({\n * businessAccountId,\n * walletId: detail.wallets[0].id,\n * });\n * ```\n *\n * @see addWalletToBusinessAccount\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const removeBusinessAccountWallet = async (\n { businessAccountId, walletId }: RemoveBusinessAccountWalletParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountwalletremove },\n client\n );\n\n const detail = await apiClient.sdkRemoveBusinessAccountWallet({\n businessAccountId,\n environmentId: core.environmentId,\n walletId,\n });\n\n // Removing a wallet detaches its businessAccount binding on the\n // verifiedCredential; refresh local auth so the change is reflected.\n await refreshAuth(client);\n\n return detail as BusinessAccountDetail;\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 * @notInstrumented\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 * @notInstrumented\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/** @notInstrumented */\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 * @notInstrumented\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 { TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport { logoutWithReason } from '../../../auth/logoutWithReason';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\n\ntype TransferBusinessAccountOwnershipParams = {\n businessAccountId: string;\n newOwnerUserId: string;\n};\n\n/**\n * Transfers ownership of a business account to another member. Owner-only: the\n * `newOwnerUserId` must already be a member, is promoted to owner, and the\n * current owner is atomically demoted to admin.\n *\n * @param params.businessAccountId - The business account whose ownership moves.\n * @param params.newOwnerUserId - The member to promote to owner.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account detail.\n *\n * @example\n * ```ts\n * const detail = await getBusinessAccount({ businessAccountId });\n * const target = detail.members.find((m) => m.role === 'admin');\n * await transferBusinessAccountOwnership({\n * businessAccountId,\n * newOwnerUserId: target.userId,\n * });\n * ```\n *\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const transferBusinessAccountOwnership = async (\n { businessAccountId, newOwnerUserId }: TransferBusinessAccountOwnershipParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccounttransferOwnership },\n client\n );\n\n const detail = await apiClient.sdkTransferBusinessAccountOwnership({\n businessAccountId,\n environmentId: core.environmentId,\n transferBusinessAccountOwnershipSdkRequest: { newOwnerUserId },\n });\n\n // Ownership transfer demotes the caller (owner -> admin) and revokes their\n // session server-side, so a token refresh would 401. Sign the caller out\n // instead — they re-authenticate into their new (admin) scope.\n await logoutWithReason(\n { reason: 'business-account-ownership-transferred' },\n client\n );\n\n return detail as BusinessAccountDetail;\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 * @notInstrumented\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 { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type { BusinessAccount } from '../businessAccounts.types';\n\ntype UpdateBusinessAccountParams = {\n businessAccountId: string;\n name: string;\n};\n\n/**\n * Renames a business account (owner-/admin-only). Calls the SDK API directly\n * (no MPC step), so a rejection surfaces as a thrown error.\n *\n * @param params.businessAccountId - The business account to rename.\n * @param params.name - The new name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account.\n *\n * @example\n * ```ts\n * await updateBusinessAccount({ businessAccountId, name: 'Acme Inc' });\n * ```\n *\n * @see getBusinessAccount\n * @notInstrumented\n */\nexport const updateBusinessAccount = async (\n { businessAccountId, name }: UpdateBusinessAccountParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccount> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const account = await apiClient.sdkUpdateBusinessAccount({\n businessAccountId,\n environmentId: core.environmentId,\n updateBusinessAccountSdkRequest: { name },\n });\n\n return account as BusinessAccount;\n};\n","import { AssignableBusinessAccountMemberRole, TokenScope } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../../client/core/getCore';\nimport { getDefaultClient } from '../../../../client/defaultClient';\nimport type { DynamicClient } from '../../../../client/types';\nimport { createApiClient } from '../../../apiClient/createApiClient';\nimport type {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n} from '../businessAccounts.types';\n\n/** Roles a member can be reassigned to — owner moves only via transferOwnership. */\ntype AssignableRole = Exclude<BusinessAccountMemberRole, 'owner'>;\n\ntype UpdateBusinessAccountMemberRoleParams = {\n businessAccountId: string;\n role: AssignableRole;\n userId: string;\n};\n\nconst ROLE_TO_API: Record<AssignableRole, AssignableBusinessAccountMemberRole> =\n {\n admin: AssignableBusinessAccountMemberRole.Admin,\n viewer: AssignableBusinessAccountMemberRole.Viewer,\n };\n\n/**\n * Changes an existing member's role between `admin` and `viewer` (owner-/admin-only).\n * Owner is not assignable here — use `transferBusinessAccountOwnership` for that.\n *\n * @param params.businessAccountId - The business account the member belongs to.\n * @param params.userId - The member whose role changes.\n * @param params.role - The new role (`admin` or `viewer`).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The updated business account member.\n *\n * @example\n * ```ts\n * await updateBusinessAccountMemberRole({\n * businessAccountId,\n * userId: member.userId,\n * role: 'admin',\n * });\n * ```\n *\n * @see transferBusinessAccountOwnership\n * @see addBusinessAccountMember\n * @notInstrumented\n */\nexport const updateBusinessAccountMemberRole = async (\n { businessAccountId, userId, role }: UpdateBusinessAccountMemberRoleParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const core = getCore(client);\n const apiClient = createApiClient(\n { elevatedAccessTokenScope: TokenScope.BusinessAccountmemberroleupdate },\n client\n );\n\n const member = await apiClient.sdkUpdateBusinessAccountMemberRole({\n businessAccountId,\n environmentId: core.environmentId,\n updateBusinessAccountMemberRoleSdkRequest: { role: ROLE_TO_API[role] },\n userId,\n });\n\n return member as BusinessAccountMember;\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 * @notInstrumented\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 MigrateFromFireblocksResponse,\n WaasPolicyRule,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport {\n TransactionBroadcastError,\n type TransactionBroadcastErrorCode,\n type TransactionBroadcastSubmissionState,\n} from '../errors/TransactionBroadcastError';\nexport type {\n BusinessAccount,\n BusinessAccountDetail,\n BusinessAccountList,\n BusinessAccountMember,\n BusinessAccountSigner,\n BusinessAccountSignerIdentifierType,\n BusinessAccountWalletSummary,\n SmsCountryCode,\n SocialProvider,\n TargetIdentity,\n} from '../modules/waas/businessAccounts/businessAccounts.types';\nexport { addBusinessAccountMember } from '../modules/waas/businessAccounts/addBusinessAccountMember';\nexport { addBusinessAccountSigner } from '../modules/waas/businessAccounts/addBusinessAccountSigner';\nexport { addWalletToBusinessAccount } from '../modules/waas/businessAccounts/addWalletToBusinessAccount';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createBusinessAccount } from '../modules/waas/businessAccounts/createBusinessAccount';\nexport { createWaasOfflineRecoveryShares } from '../modules/waas/createWaasOfflineRecoveryShares';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { createWalletForBusinessAccount } from '../modules/waas/businessAccounts/createWalletForBusinessAccount';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getBusinessAccount } from '../modules/waas/businessAccounts/getBusinessAccount';\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 { listBusinessAccounts } from '../modules/waas/businessAccounts/listBusinessAccounts';\nexport { migrateFromFireblocks } from '../modules/waas/migrateFromFireblocks';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { removeBusinessAccountMember } from '../modules/waas/businessAccounts/removeBusinessAccountMember';\nexport { removeBusinessAccountSigner } from '../modules/waas/businessAccounts/removeBusinessAccountSigner';\nexport { removeBusinessAccountWallet } from '../modules/waas/businessAccounts/removeBusinessAccountWallet';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { setWaasWalletAccountPassword } from '../modules/waas/setWaasWalletAccountPassword';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { transferBusinessAccountOwnership } from '../modules/waas/businessAccounts/transferBusinessAccountOwnership';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateBusinessAccount } from '../modules/waas/businessAccounts/updateBusinessAccount';\nexport { updateBusinessAccountMemberRole } from '../modules/waas/businessAccounts/updateBusinessAccountMemberRole';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WaasTransactionBroadcastEncoding,\n WaasTransactionBroadcastResult,\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,wBAAwB,EACnC,QACA,qBACsC;CACtC,MAAM,YAAY,QAAQ,eAAe,OAAO;CAChD,MAAM,gBAAgB,QACpB,eAAe,cAAc,eAAe,eAC7C;AACD,KAAI,CAAC,aAAa,CAAC,cACjB,OAAM,IAAI,kBACR,GAAG,OAAO,kFACX;;;;;;ACpBL,MAAaA,yBAGT;CACF,OAAO,uBAAuB;CAC9B,gBAAgB,uBAAuB;CACvC,IAAI,uBAAuB;CAC3B,aAAa,uBAAuB;CACpC,iBAAiB,uBAAuB;CACxC,gBAAgB,uBAAuB;CACxC;;;;;;;;;;;;;;;;;;;;ACyBD,MAAa,2BAA2B,OACtC,EAAE,mBAAmB,gBAAgB,QACrC,SAAwB,kBAAkB,KACP;AACnC,sBAAqB;EAAE,QAAQ;EAA4B;EAAgB,CAAC;CAE5E,MAAM,OAAO,QAAQ,OAAO;CAC5B,MAAM,YAAY,gBAChB,EAAE,0BAA0B,WAAW,0BAA0B,EACjE,OACD;CACD,MAAM,EAAE,QAAQ,YAAY,gBAAgB,gBAAgB,mBAC1D;AAkBF,QAhBe,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;;;;ACzCT,MAAa,eAAe,OAC1B,EAAE,UAAU,iBACZ,SAAS,kBAAkB,KACI;AAM/B,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,aAAa;EAC3B;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;;;;;ACJJ,MAAa,wBAAwB,OACnC,EAAE,mBAAmB,gBACrB,SAAwB,kBAAkB,KACb;CAC7B,MAAM,OAAO,QAAQ,OAAO;AAS5B,QANgB,MAFE,gBAAgB,EAAE,EAAE,OAAO,CAEb,yBAAyB;EACvD;EACA,eAAe,KAAK;EACpB,iCAAiC,EAAE,cAAM;EAC1C,CAAC;;;;;ACnBJ,MAAMC,cACJ;CACE,OAAO,oCAAoC;CAC3C,QAAQ,oCAAoC;CAC7C;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,MAAa,kCAAkC,OAC7C,EAAE,mBAAmB,QAAQ,QAC7B,SAAwB,kBAAkB,KACP;CACnC,MAAM,OAAO,QAAQ,OAAO;AAa5B,QAPe,MALG,gBAChB,EAAE,0BAA0B,WAAW,iCAAiC,EACxE,OACD,CAE8B,mCAAmC;EAChE;EACA,eAAe,KAAK;EACpB,2CAA2C,EAAE,MAAM,YAAY,OAAO;EACtE;EACD,CAAC;;;;;;;;;;;;;;;;;;ACzCJ,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/waas.native.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Ct as version, D as NoWalletProviderFoundError, St as name, V as createApiClient, _t as getDefaultClient, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, i as InvalidParamError, j as getChainFromVerifiedCredentialChain, k as formatWalletProviderKey, o as isWaasWalletAccount, s as findWaasWalletProviderByChain, xt as getCore } from "./updateAuthFromVerifyResponse-
|
|
2
|
-
import { n as getVerifiedCredentialForWalletAccount, r as __logoutWithReason_wrapped, t as getWalletProviderByKey } from "./getWalletProviderByKey-
|
|
3
|
-
import { i as __refreshAuth_wrapped, n as TransactionBroadcastError, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-
|
|
4
|
-
import { n as getWaasWalletProviderFromWalletAccount, r as NotWaasWalletProviderError, t as migrateFromFireblocks } from "./migrateFromFireblocks-
|
|
1
|
+
import { Ct as version, D as NoWalletProviderFoundError, St as name, V as createApiClient, _t as getDefaultClient, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, i as InvalidParamError, j as getChainFromVerifiedCredentialChain, k as formatWalletProviderKey, o as isWaasWalletAccount, s as findWaasWalletProviderByChain, xt as getCore } from "./updateAuthFromVerifyResponse-BIWu4Bis.native.esm.js";
|
|
2
|
+
import { n as getVerifiedCredentialForWalletAccount, r as __logoutWithReason_wrapped, t as getWalletProviderByKey } from "./getWalletProviderByKey-B7eSVPP5.native.esm.js";
|
|
3
|
+
import { i as __refreshAuth_wrapped, n as TransactionBroadcastError, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-DkcnybRZ.native.esm.js";
|
|
4
|
+
import { n as getWaasWalletProviderFromWalletAccount, r as NotWaasWalletProviderError, t as migrateFromFireblocks } from "./migrateFromFireblocks-zHTABzLP.native.esm.js";
|
|
5
5
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
6
|
-
import { AssignableBusinessAccountMemberRole, JwtVerifiedCredentialFormatEnum, TokenScope, UserIdentifierTypeEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
6
|
+
import { AssignableBusinessAccountMemberRole, JwtVerifiedCredentialFormatEnum, TokenScope, UserIdentifierTypeEnum, WaasWalletShareSetType, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
7
7
|
|
|
8
8
|
//#region src/modules/waas/businessAccounts/assertTargetIdentity.ts
|
|
9
9
|
/**
|
|
@@ -210,6 +210,33 @@ const createBusinessAccount = async (params, client = getDefaultClient()) => {
|
|
|
210
210
|
});
|
|
211
211
|
};
|
|
212
212
|
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.ts
|
|
215
|
+
/**
|
|
216
|
+
* Mints an offline-recovery share set for a WaaS wallet account.
|
|
217
|
+
*
|
|
218
|
+
* This mints a second, independent 2-of-2 share set: the client's share is
|
|
219
|
+
* uploaded to Google Drive, and the server's share is delivered to the
|
|
220
|
+
* developer's webhook. Dynamic never retains its half, so recovery works even
|
|
221
|
+
* if Dynamic is fully offline.
|
|
222
|
+
*
|
|
223
|
+
* @param params.walletAccount - The WaaS wallet account to create offline-recovery shares for.
|
|
224
|
+
* @param [params.password] - Optional password to encrypt the client share.
|
|
225
|
+
* @param [params.cloudProviderAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.
|
|
226
|
+
* @param [params.mfaToken] - Optional MFA token proving step-up verification, when required for this action.
|
|
227
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
228
|
+
* @returns A promise that resolves when the offline-recovery share set has been minted.
|
|
229
|
+
* @notInstrumented
|
|
230
|
+
*/
|
|
231
|
+
const createWaasOfflineRecoveryShares = async ({ cloudProviderAccessToken, mfaToken, password, walletAccount }, client = getDefaultClient()) => {
|
|
232
|
+
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).createOfflineRecoveryShares({
|
|
233
|
+
cloudProviderAccessToken,
|
|
234
|
+
mfaToken,
|
|
235
|
+
password,
|
|
236
|
+
walletAccount
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
|
|
213
240
|
//#endregion
|
|
214
241
|
//#region src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts
|
|
215
242
|
/**
|
|
@@ -510,7 +537,9 @@ const getWalletRecoveryState = async ({ walletAccount }, client = getDefaultClie
|
|
|
510
537
|
const hasDelegatedAccess = ({ walletAccount }, client = getDefaultClient()) => {
|
|
511
538
|
const verifiedCredential = getVerifiedCredentialForWalletAccount({ walletAccount }, client);
|
|
512
539
|
assertDefined(verifiedCredential, "Verified credential not found for Waas wallet account");
|
|
513
|
-
|
|
540
|
+
const hasDelegatedKeyShare = verifiedCredential.walletProperties?.keyShares?.some((keyShare) => keyShare.backupLocation === "delegated");
|
|
541
|
+
const hasDelegatedShareSet = verifiedCredential.walletProperties?.otherShareSets?.some((shareSet) => shareSet.shareSetType === WaasWalletShareSetType.Delegated);
|
|
542
|
+
return Boolean(hasDelegatedKeyShare || hasDelegatedShareSet);
|
|
514
543
|
};
|
|
515
544
|
|
|
516
545
|
//#endregion
|
|
@@ -923,5 +952,5 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
|
|
|
923
952
|
assertPackageVersion(name, version);
|
|
924
953
|
|
|
925
954
|
//#endregion
|
|
926
|
-
export { NotWaasWalletProviderError, TransactionBroadcastError, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getBusinessAccount, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeBusinessAccountMember, removeBusinessAccountSigner, removeBusinessAccountWallet, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccount, updateBusinessAccountMemberRole, updateWaasPassword };
|
|
955
|
+
export { NotWaasWalletProviderError, TransactionBroadcastError, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createWaasOfflineRecoveryShares, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getBusinessAccount, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeBusinessAccountMember, removeBusinessAccountSigner, removeBusinessAccountWallet, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccount, updateBusinessAccountMemberRole, updateWaasPassword };
|
|
927
956
|
//# sourceMappingURL=waas.native.esm.js.map
|