@dynamic-labs-sdk/client 1.23.1 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{NativeModuleNotLinkedError-DLP1hpcM.native.esm.js → NativeModuleNotLinkedError-dFDBC524.native.esm.js} +3 -3
- package/dist/{NativeModuleNotLinkedError-DLP1hpcM.native.esm.js.map → NativeModuleNotLinkedError-dFDBC524.native.esm.js.map} +1 -1
- package/dist/{consumeMfaTokenIfRequiredForAction-D2oiQdpj.esm.js → consumeMfaTokenIfRequiredForAction-DdGzQwQQ.esm.js} +2 -2
- package/dist/{consumeMfaTokenIfRequiredForAction-D2oiQdpj.esm.js.map → consumeMfaTokenIfRequiredForAction-DdGzQwQQ.esm.js.map} +1 -1
- package/dist/{consumeMfaTokenIfRequiredForAction-DJAdtHe3.cjs → consumeMfaTokenIfRequiredForAction-IsOFRL68.cjs} +2 -2
- package/dist/{consumeMfaTokenIfRequiredForAction-DJAdtHe3.cjs.map → consumeMfaTokenIfRequiredForAction-IsOFRL68.cjs.map} +1 -1
- package/dist/core.cjs +7 -6
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +9 -9
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +6 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +1 -1
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BVP0ghId.cjs → getNetworkProviderFromNetworkId-CIcatN8-.cjs} +64 -2
- package/dist/getNetworkProviderFromNetworkId-CIcatN8-.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-OfuaqHXU.esm.js → getNetworkProviderFromNetworkId-CYONf9-8.esm.js} +63 -7
- package/dist/getNetworkProviderFromNetworkId-CYONf9-8.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-Bh4_-rhf.native.esm.js → getNetworkProviderFromNetworkId-nLBIQ_5p.native.esm.js} +59 -3
- package/dist/getNetworkProviderFromNetworkId-nLBIQ_5p.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-CDEQ6TMC.esm.js → getSignedSessionId-B2kslh_k.esm.js} +2 -2
- package/dist/{getSignedSessionId-CDEQ6TMC.esm.js.map → getSignedSessionId-B2kslh_k.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-2jmv21__.native.esm.js → getSignedSessionId-DV0hK3Tu.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-2jmv21__.native.esm.js.map → getSignedSessionId-DV0hK3Tu.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-_ZPqzvm5.cjs → getSignedSessionId-NZ8ndqG1.cjs} +2 -2
- package/dist/{getSignedSessionId-_ZPqzvm5.cjs.map → getSignedSessionId-NZ8ndqG1.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-0VBVdu30.native.esm.js → getWalletProviderByKey-DPZP397j.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-0VBVdu30.native.esm.js.map → getWalletProviderByKey-DPZP397j.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-BIHCI8S6.esm.js → getWalletProviderByKey-Dh3JbMi6.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-BIHCI8S6.esm.js.map → getWalletProviderByKey-Dh3JbMi6.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-F5wxlC_k.cjs → getWalletProviderByKey-DzKZXm5S.cjs} +2 -2
- package/dist/{getWalletProviderByKey-F5wxlC_k.cjs.map → getWalletProviderByKey-DzKZXm5S.cjs.map} +1 -1
- package/dist/index.cjs +17 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +19 -71
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +20 -79
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isDynamicWaasEnabled-OlDJAGIi.esm.js → isDynamicWaasEnabled-BbhbghRE.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-OlDJAGIi.esm.js.map → isDynamicWaasEnabled-BbhbghRE.esm.js.map} +1 -1
- package/dist/{isDynamicWaasEnabled-cVxCp5BV.native.esm.js → isDynamicWaasEnabled-BmB0lQJf.native.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-cVxCp5BV.native.esm.js.map → isDynamicWaasEnabled-BmB0lQJf.native.esm.js.map} +1 -1
- package/dist/{isDynamicWaasEnabled-YigU-EAT.cjs → isDynamicWaasEnabled-D2U3MRnA.cjs} +2 -2
- package/dist/{isDynamicWaasEnabled-YigU-EAT.cjs.map → isDynamicWaasEnabled-D2U3MRnA.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-Bn2HCYvZ.esm.js → isMfaRequiredForAction-DBlmv1ew.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-Bn2HCYvZ.esm.js.map → isMfaRequiredForAction-DBlmv1ew.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-BtPXuiSY.cjs → isMfaRequiredForAction-DCyorelQ.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-BtPXuiSY.cjs.map → isMfaRequiredForAction-DCyorelQ.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-DjC0wQJ4.native.esm.js → isMfaRequiredForAction-DP0kk0tY.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DjC0wQJ4.native.esm.js.map → isMfaRequiredForAction-DP0kk0tY.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-Bi7tw1lk.cjs → isUserOnboardingComplete-DygWGu6p.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-Bi7tw1lk.cjs.map → isUserOnboardingComplete-DygWGu6p.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-BCZpska8.native.esm.js → isUserOnboardingComplete-Ebw4x90F.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-BCZpska8.native.esm.js.map → isUserOnboardingComplete-Ebw4x90F.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-DScTOOg_.esm.js → isUserOnboardingComplete-WzXFgdor.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DScTOOg_.esm.js.map → isUserOnboardingComplete-WzXFgdor.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-DkQj3aYU.esm.js → migrateFromFireblocks-BkcGdF_B.esm.js} +14 -14
- package/dist/migrateFromFireblocks-BkcGdF_B.esm.js.map +1 -0
- package/dist/{migrateFromFireblocks-7aKNa_3P.native.esm.js → migrateFromFireblocks-C1yQ4dm7.native.esm.js} +13 -13
- package/dist/migrateFromFireblocks-C1yQ4dm7.native.esm.js.map +1 -0
- package/dist/{migrateFromFireblocks-BnHU2AZJ.cjs → migrateFromFireblocks-CzPWPaDr.cjs} +13 -13
- package/dist/migrateFromFireblocks-CzPWPaDr.cjs.map +1 -0
- package/dist/modules/flow/prepareFlowSigning/prepareFlowSigning.d.ts +2 -2
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts +7 -11
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +4 -4
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts +1 -1
- package/dist/modules/waas/businessAccounts/assertTargetIdentity.d.ts +14 -0
- package/dist/modules/waas/businessAccounts/assertTargetIdentity.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +15 -1
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -1
- package/dist/modules/waas/waas.types.d.ts +2 -2
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/services/openDeeplink/{createWebDeeplinkOpener/createWebDeeplinkOpener.d.ts → createDeeplinkOpener/createDeeplinkOpener.d.ts} +6 -2
- package/dist/services/openDeeplink/createDeeplinkOpener/createDeeplinkOpener.d.ts.map +1 -0
- package/dist/services/openDeeplink/createDeeplinkOpener/index.d.ts +2 -0
- package/dist/services/openDeeplink/createDeeplinkOpener/index.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-B2QePeNz.cjs → updateAuthFromVerifyResponse-B8tDJdXY.cjs} +3 -3
- package/dist/{updateAuthFromVerifyResponse-B2QePeNz.cjs.map → updateAuthFromVerifyResponse-B8tDJdXY.cjs.map} +1 -1
- package/dist/{updateAuthFromVerifyResponse-wHGRunTk.esm.js → updateAuthFromVerifyResponse-C_yGmd99.esm.js} +3 -3
- package/dist/{updateAuthFromVerifyResponse-wHGRunTk.esm.js.map → updateAuthFromVerifyResponse-C_yGmd99.esm.js.map} +1 -1
- package/dist/waas.cjs +64 -39
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +64 -39
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +63 -38
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +7 -7
- package/dist/waasCore.esm.js +7 -7
- package/dist/waasCore.native.esm.js +6 -6
- package/ios/DynamicClientScreenshotProtection.mm +11 -0
- package/package.json +3 -3
- package/dist/getNetworkProviderFromNetworkId-BVP0ghId.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-Bh4_-rhf.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-OfuaqHXU.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-7aKNa_3P.native.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-BnHU2AZJ.cjs.map +0 -1
- package/dist/migrateFromFireblocks-DkQj3aYU.esm.js.map +0 -1
- package/dist/services/openDeeplink/createWebDeeplinkOpener/createWebDeeplinkOpener.d.ts.map +0 -1
- package/dist/services/openDeeplink/createWebDeeplinkOpener/index.d.ts +0 -2
- package/dist/services/openDeeplink/createWebDeeplinkOpener/index.d.ts.map +0 -1
package/dist/waas.esm.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import { Ct as version, D as NoWalletProviderFoundError, G as createApiClient, M as formatWalletProviderKey, P as getChainFromVerifiedCredentialChain, St as name, _t as getDefaultClient, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, g as __logoutWithReason_wrapped, i as InvalidParamError, o as isWaasWalletAccount, s as findWaasWalletProviderByChain, xt as getCore } from "./updateAuthFromVerifyResponse-
|
|
2
|
-
import { r as __refreshAuth_wrapped, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-
|
|
3
|
-
import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-
|
|
4
|
-
import "./getSignedSessionId-
|
|
5
|
-
import { a as NotWaasWalletProviderError, i as
|
|
1
|
+
import { Ct as version, D as NoWalletProviderFoundError, G as createApiClient, M as formatWalletProviderKey, P as getChainFromVerifiedCredentialChain, St as name, _t as getDefaultClient, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, g as __logoutWithReason_wrapped, i as InvalidParamError, o as isWaasWalletAccount, s as findWaasWalletProviderByChain, xt as getCore } from "./updateAuthFromVerifyResponse-C_yGmd99.esm.js";
|
|
2
|
+
import { r as __refreshAuth_wrapped, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-BbhbghRE.esm.js";
|
|
3
|
+
import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-Dh3JbMi6.esm.js";
|
|
4
|
+
import "./getSignedSessionId-B2kslh_k.esm.js";
|
|
5
|
+
import { a as NotWaasWalletProviderError, i as getWaasWalletProviderFromWalletAccount, n as getWaasChainNameFromChain, r as createWaasClient, t as migrateFromFireblocks } from "./migrateFromFireblocks-BkcGdF_B.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { AssignableBusinessAccountMemberRole, JwtVerifiedCredentialFormatEnum, UserIdentifierTypeEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
|
|
9
|
+
//#region src/modules/waas/businessAccounts/assertTargetIdentity.ts
|
|
10
|
+
/**
|
|
11
|
+
* Asserts a {@link TargetIdentity} resolves to a user: a `userId`, or an
|
|
12
|
+
* `identifier` with its `identifierType`. Throws otherwise.
|
|
13
|
+
*
|
|
14
|
+
* @notInstrumented
|
|
15
|
+
*/
|
|
16
|
+
const assertTargetIdentity = ({ fnName, targetIdentity }) => {
|
|
17
|
+
const hasUserId = Boolean(targetIdentity.userId);
|
|
18
|
+
const hasIdentifier = Boolean(targetIdentity.identifier && targetIdentity.identifierType);
|
|
19
|
+
if (!hasUserId && !hasIdentifier) throw new InvalidParamError(`${fnName}: targetIdentity must provide a userId, or an identifier with its identifierType`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
9
23
|
//#region src/modules/waas/businessAccounts/businessAccounts.constants.ts
|
|
10
24
|
/** Maps the SDK's identifier-type union to the generated API enum. */
|
|
11
25
|
const IDENTIFIER_TYPE_TO_API = {
|
|
@@ -20,29 +34,35 @@ const IDENTIFIER_TYPE_TO_API = {
|
|
|
20
34
|
//#endregion
|
|
21
35
|
//#region src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts
|
|
22
36
|
/**
|
|
23
|
-
* Adds a member to an existing business account. Identify the target
|
|
24
|
-
* `userId`, or
|
|
25
|
-
* created if absent).
|
|
37
|
+
* Adds a member to an existing business account. Identify the target with a
|
|
38
|
+
* `targetIdentity`: a known `userId`, or an `identifier` + `identifierType`
|
|
39
|
+
* (e.g. an email — the user is created if absent).
|
|
26
40
|
*
|
|
27
41
|
* Calls the SDK API directly (not the WaaS iframe): this is a server-state
|
|
28
42
|
* mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces
|
|
29
43
|
* as a thrown error rather than stalling in the iframe bridge.
|
|
30
44
|
*
|
|
31
45
|
* @param params.businessAccountId - The ID of the business account.
|
|
32
|
-
* @param
|
|
33
|
-
* @param [params.identifier] - The identifier value (e.g. an email address).
|
|
34
|
-
* @param [params.identifierType] - The identifier type (e.g. `email`).
|
|
46
|
+
* @param params.targetIdentity - The member to add (userId, or identifier + identifierType).
|
|
35
47
|
* @param [params.role] - The member role (`admin` or `viewer`). Defaults to `viewer`.
|
|
36
48
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
37
49
|
* @returns The created business account member.
|
|
38
50
|
* @notInstrumented
|
|
39
51
|
*/
|
|
40
|
-
const addBusinessAccountMember = async ({ businessAccountId,
|
|
52
|
+
const addBusinessAccountMember = async ({ businessAccountId, targetIdentity, role }, client = getDefaultClient()) => {
|
|
53
|
+
assertTargetIdentity({
|
|
54
|
+
fnName: "addBusinessAccountMember",
|
|
55
|
+
targetIdentity
|
|
56
|
+
});
|
|
41
57
|
const core = getCore(client);
|
|
42
|
-
|
|
58
|
+
const apiClient = createApiClient({}, client);
|
|
59
|
+
const { userId, identifier, identifierType, socialProvider, smsCountryCode } = targetIdentity;
|
|
60
|
+
return await apiClient.sdkAddBusinessAccountMember({
|
|
43
61
|
addBusinessAccountMemberSdkRequest: {
|
|
44
62
|
identifier,
|
|
45
63
|
role: role === "admin" ? AssignableBusinessAccountMemberRole.Admin : AssignableBusinessAccountMemberRole.Viewer,
|
|
64
|
+
smsCountryCode,
|
|
65
|
+
socialProvider,
|
|
46
66
|
type: identifierType ? IDENTIFIER_TYPE_TO_API[identifierType] : void 0,
|
|
47
67
|
userId
|
|
48
68
|
},
|
|
@@ -64,24 +84,6 @@ const getWaasWalletProviderByChain = ({ chain }, client) => {
|
|
|
64
84
|
return waasProvider;
|
|
65
85
|
};
|
|
66
86
|
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts
|
|
69
|
-
/**
|
|
70
|
-
* Returns the business accounts API client for the first enabled WaaS chain.
|
|
71
|
-
*
|
|
72
|
-
* @param client - The Dynamic client instance.
|
|
73
|
-
* @returns The business accounts API client.
|
|
74
|
-
* @throws {InvalidParamError} When no WaaS chain configuration is enabled for the project.
|
|
75
|
-
* @notInstrumented
|
|
76
|
-
*/
|
|
77
|
-
const getBusinessAccountsClient = (client) => {
|
|
78
|
-
const projectSettings = client.projectSettings;
|
|
79
|
-
assertDefined(projectSettings, "Project settings are not available");
|
|
80
|
-
const chainConfig = projectSettings.sdk.embeddedWallets?.chainConfigurations?.find((chain) => chain.enabled);
|
|
81
|
-
if (!chainConfig) throw new InvalidParamError("No WaaS chain is enabled for this project");
|
|
82
|
-
return createWaasClient({ chainName: getWaasChainNameFromChain(chainConfig.name) }, client).businessAccounts;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
87
|
//#endregion
|
|
86
88
|
//#region src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts
|
|
87
89
|
/**
|
|
@@ -97,29 +99,34 @@ const getBusinessAccountsClient = (client) => {
|
|
|
97
99
|
* @param params.walletAccount - The wallet account to add the signer to.
|
|
98
100
|
* @param [params.businessAccountId] - The business account; found-or-created when omitted.
|
|
99
101
|
* @param [params.walletId] - The wallet UUID to link when finding-or-creating; defaults to `walletAccount.verifiedCredentialId`.
|
|
100
|
-
* @param params.
|
|
102
|
+
* @param params.targetIdentity - The signer to add (userId, or identifier + identifierType).
|
|
101
103
|
* @param [params.signerType] - `endUser` (default) or `server`.
|
|
102
104
|
* @param [params.password] - Password for the reshare, if the wallet is password-encrypted.
|
|
103
105
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
104
106
|
* @returns The new signer's share set id.
|
|
105
107
|
* @notInstrumented
|
|
106
108
|
*/
|
|
107
|
-
const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, walletId,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, walletId, targetIdentity, signerType, password }, client = getDefaultClient()) => {
|
|
110
|
+
assertTargetIdentity({
|
|
111
|
+
fnName: "addBusinessAccountSigner",
|
|
112
|
+
targetIdentity
|
|
113
|
+
});
|
|
111
114
|
if (walletAccount.businessAccountId) assertDefined(businessAccountId, "addBusinessAccountSigner: this wallet is already part of a business account");
|
|
112
115
|
let resolvedBusinessAccountId = businessAccountId;
|
|
113
116
|
if (!resolvedBusinessAccountId) {
|
|
114
117
|
const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;
|
|
115
118
|
assertDefined(linkWalletId, "addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account");
|
|
116
|
-
|
|
119
|
+
const core = getCore(client);
|
|
120
|
+
resolvedBusinessAccountId = (await createApiClient({}, client).sdkLinkBusinessAccountWallet({
|
|
121
|
+
environmentId: core.environmentId,
|
|
122
|
+
linkBusinessAccountWalletSdkRequest: { walletId: linkWalletId }
|
|
123
|
+
})).id;
|
|
117
124
|
}
|
|
118
125
|
const result = await getWaasWalletProviderByChain({ chain: walletAccount.chain }, client).reshareToNewSignerShareSet({
|
|
119
126
|
businessAccountId: resolvedBusinessAccountId,
|
|
120
127
|
password,
|
|
121
128
|
signerType,
|
|
122
|
-
targetSignerIdentity,
|
|
129
|
+
targetSignerIdentity: targetIdentity,
|
|
123
130
|
walletAccount
|
|
124
131
|
});
|
|
125
132
|
await __refreshAuth_wrapped(client);
|
|
@@ -129,7 +136,7 @@ const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, wall
|
|
|
129
136
|
//#endregion
|
|
130
137
|
//#region src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts
|
|
131
138
|
/**
|
|
132
|
-
* Links
|
|
139
|
+
* Links a wallet to a business account, or omit `businessAccountId` to
|
|
133
140
|
* find-or-create the per-wallet business account (the server seats the wallet's
|
|
134
141
|
* owner as the first member/signer).
|
|
135
142
|
*
|
|
@@ -179,6 +186,24 @@ const backupWaasKeySharesToGoogleDrive = async ({ googleDriveAccessToken, passwo
|
|
|
179
186
|
});
|
|
180
187
|
};
|
|
181
188
|
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts
|
|
191
|
+
/**
|
|
192
|
+
* Returns the business accounts API client for the first enabled WaaS chain.
|
|
193
|
+
*
|
|
194
|
+
* @param client - The Dynamic client instance.
|
|
195
|
+
* @returns The business accounts API client.
|
|
196
|
+
* @throws {InvalidParamError} When no WaaS chain configuration is enabled for the project.
|
|
197
|
+
* @notInstrumented
|
|
198
|
+
*/
|
|
199
|
+
const getBusinessAccountsClient = (client) => {
|
|
200
|
+
const projectSettings = client.projectSettings;
|
|
201
|
+
assertDefined(projectSettings, "Project settings are not available");
|
|
202
|
+
const chainConfig = projectSettings.sdk.embeddedWallets?.chainConfigurations?.find((chain) => chain.enabled);
|
|
203
|
+
if (!chainConfig) throw new InvalidParamError("No WaaS chain is enabled for this project");
|
|
204
|
+
return createWaasClient({ chainName: getWaasChainNameFromChain(chainConfig.name) }, client).businessAccounts;
|
|
205
|
+
};
|
|
206
|
+
|
|
182
207
|
//#endregion
|
|
183
208
|
//#region src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts
|
|
184
209
|
/**
|
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","logoutWithReason","ROLE_TO_API: Record<AssignableRole, AssignableBusinessAccountMemberRole>","packageName","packageVersion"],"sources":["../src/modules/waas/businessAccounts/businessAccounts.constants.ts","../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.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/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 { 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","import { AssignableBusinessAccountMemberRole } 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 { IDENTIFIER_TYPE_TO_API } from '../businessAccounts.constants';\nimport type {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n BusinessAccountSignerIdentifierType,\n} from '../businessAccounts.types';\n\ntype AddMemberParams = {\n businessAccountId: string;\n identifier?: string;\n identifierType?: BusinessAccountSignerIdentifierType;\n role?: BusinessAccountMemberRole;\n userId?: string;\n};\n\n/**\n * Adds a member to an existing business account. Identify the target by a known\n * `userId`, or by `identifier` + `identifierType` (e.g. an email — the user is\n * 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.userId] - The ID of the user to add as a member.\n * @param [params.identifier] - The identifier value (e.g. an email address).\n * @param [params.identifierType] - The identifier type (e.g. `email`).\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 {\n businessAccountId,\n userId,\n identifier,\n identifierType,\n role,\n }: AddMemberParams,\n client: DynamicClient = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const member = await apiClient.sdkAddBusinessAccountMember({\n addBusinessAccountMemberSdkRequest: {\n identifier,\n role:\n role === 'admin'\n ? AssignableBusinessAccountMemberRole.Admin\n : AssignableBusinessAccountMemberRole.Viewer,\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 type { DynamicClient } from '../../../../client/types/DynamicClient';\nimport { InvalidParamError } from '../../../../errors/InvalidParamError';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport type { Chain } from '../../../chain';\nimport { createWaasClient } from '../../createWaasClient';\nimport { getWaasChainNameFromChain } from '../../getWaasChainNameFromChain';\nimport type { BusinessAccountsApi } from '../businessAccounts.types';\n\n/**\n * Returns the business accounts API client for the first enabled WaaS chain.\n *\n * @param client - The Dynamic client instance.\n * @returns The business accounts API client.\n * @throws {InvalidParamError} When no WaaS chain configuration is enabled for the project.\n * @notInstrumented\n */\nexport const getBusinessAccountsClient = (\n client: DynamicClient\n): BusinessAccountsApi => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const chainConfig =\n projectSettings.sdk.embeddedWallets?.chainConfigurations?.find(\n (chain) => chain.enabled\n );\n\n if (!chainConfig) {\n throw new InvalidParamError('No WaaS chain is enabled for this project');\n }\n\n // Normalize the project chain to the WaaS chain name (e.g. SOL -> SVM), the\n // same mapping every other createWaasClient caller applies, so the wallet\n // service is addressed under the identifier it expects.\n const waasClient = createWaasClient(\n { chainName: getWaasChainNameFromChain(chainConfig.name as Chain) },\n client\n ) as unknown as {\n businessAccounts: BusinessAccountsApi;\n };\n\n return waasClient.businessAccounts;\n};\n","import { getDefaultClient } from '../../../../client/defaultClient';\nimport { InvalidParamError } from '../../../../errors/InvalidParamError';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport type { WalletAccount } from '../../../wallets/walletAccount';\nimport { getWaasWalletProviderByChain } from '../../getWaasWalletProviderByChain';\nimport type {\n BusinessAccountSignerType,\n TargetSignerIdentity,\n} from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\n\ntype AddSignerParams = {\n businessAccountId?: string;\n password?: string;\n signerType?: BusinessAccountSignerType;\n targetSignerIdentity: TargetSignerIdentity;\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.targetSignerIdentity - 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 targetSignerIdentity,\n signerType,\n password,\n }: AddSignerParams,\n client = getDefaultClient()\n): Promise<{ shareSetId: string }> => {\n // Require a resolvable target: a userId, or an identifier + its type.\n const hasUserId = Boolean(targetSignerIdentity.userId);\n const hasIdentifier = Boolean(\n targetSignerIdentity.identifier && targetSignerIdentity.identifierType\n );\n if (!hasUserId && !hasIdentifier) {\n throw new InvalidParamError(\n 'addBusinessAccountSigner: targetSignerIdentity must provide a userId, or an identifier with its identifierType'\n );\n }\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 businessAccounts = getBusinessAccountsClient(client);\n const account = await businessAccounts.addWalletToBusinessAccount({\n walletId: linkWalletId,\n });\n resolvedBusinessAccountId = account.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()`. The reshare only\n // uses the wallet's address; the local key share is keyed by that address.\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,\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 { 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 an existing wallet to a business account. 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({}, client);\n\n const detail = await apiClient.sdkLinkBusinessAccountWallet({\n environmentId: core.environmentId,\n linkBusinessAccountWalletSdkRequest: { businessAccountId, walletId },\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 { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccount } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\n\ntype CreateBusinessAccountParams = {\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 [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 = getDefaultClient()\n): Promise<BusinessAccount> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.createBusinessAccount({\n request: { name: params?.name },\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 { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\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 = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.getBusinessAccount({ businessAccountId });\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 { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccountList } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\n\n/**\n * Lists all business accounts for the current project environment.\n *\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 client = getDefaultClient()\n): Promise<BusinessAccountList> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.listBusinessAccounts();\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 { 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({}, client);\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 { 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({}, client);\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 { 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 { 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({}, client);\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 } 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({}, client);\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 type {\n BusinessAccount,\n BusinessAccountDetail,\n BusinessAccountList,\n BusinessAccountMember,\n BusinessAccountSigner,\n BusinessAccountWalletSummary,\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 { 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 WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;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A,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;AAU5B,QAPe,MAFG,gBAAgB,EAAE,EAAE,OAAO,CAEd,mCAAmC;EAChE;EACA,eAAe,KAAK;EACpB,2CAA2C,EAAE,MAAM,YAAY,OAAO;EACtE;EACD,CAAC;;;;;;;;;;;;;;;;;;ACtCJ,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","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/getBusinessAccountsClient/getBusinessAccountsClient.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/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 { AssignableBusinessAccountMemberRole } from '@dynamic-labs/sdk-api-core';\nimport type { ProviderEnum } 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({}, client);\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 { 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({}, client);\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 { 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({}, client);\n\n const detail = await apiClient.sdkLinkBusinessAccountWallet({\n environmentId: core.environmentId,\n linkBusinessAccountWalletSdkRequest: { businessAccountId, walletId },\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 type { DynamicClient } from '../../../../client/types/DynamicClient';\nimport { InvalidParamError } from '../../../../errors/InvalidParamError';\nimport { assertDefined } from '../../../../utils/assertDefined';\nimport type { Chain } from '../../../chain';\nimport { createWaasClient } from '../../createWaasClient';\nimport { getWaasChainNameFromChain } from '../../getWaasChainNameFromChain';\nimport type { BusinessAccountsApi } from '../businessAccounts.types';\n\n/**\n * Returns the business accounts API client for the first enabled WaaS chain.\n *\n * @param client - The Dynamic client instance.\n * @returns The business accounts API client.\n * @throws {InvalidParamError} When no WaaS chain configuration is enabled for the project.\n * @notInstrumented\n */\nexport const getBusinessAccountsClient = (\n client: DynamicClient\n): BusinessAccountsApi => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const chainConfig =\n projectSettings.sdk.embeddedWallets?.chainConfigurations?.find(\n (chain) => chain.enabled\n );\n\n if (!chainConfig) {\n throw new InvalidParamError('No WaaS chain is enabled for this project');\n }\n\n // Normalize the project chain to the WaaS chain name (e.g. SOL -> SVM), the\n // same mapping every other createWaasClient caller applies, so the wallet\n // service is addressed under the identifier it expects.\n const waasClient = createWaasClient(\n { chainName: getWaasChainNameFromChain(chainConfig.name as Chain) },\n client\n ) as unknown as {\n businessAccounts: BusinessAccountsApi;\n };\n\n return waasClient.businessAccounts;\n};\n","import { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccount } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\n\ntype CreateBusinessAccountParams = {\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 [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 = getDefaultClient()\n): Promise<BusinessAccount> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.createBusinessAccount({\n request: { name: params?.name },\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 { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\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 = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.getBusinessAccount({ businessAccountId });\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 { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccountList } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\n\n/**\n * Lists all business accounts for the current project environment.\n *\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 client = getDefaultClient()\n): Promise<BusinessAccountList> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.listBusinessAccounts();\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 { 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({}, client);\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 { 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({}, client);\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 { 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 { 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({}, client);\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 } 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({}, client);\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 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 { 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 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;;;;;;;;;;;;;;;;;;;;ACsBD,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,gBAAgB,EAAE,EAAE,OAAO;CAC7C,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;;;;;;AC/CJ,MAAa,gCACX,EAAE,SACF,WACuB;CACvB,MAAM,eAAe,8BAA8B,EAAE,OAAO,EAAE,OAAO;AAErE,KAAI,CAAC,aAOH,OAAM,IAAI,2B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