@dynamic-labs-sdk/client 1.21.2 → 1.22.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-Duh8DMLT.native.esm.js → NativeModuleNotLinkedError-C1P6K16j.native.esm.js} +190 -167
- package/dist/NativeModuleNotLinkedError-C1P6K16j.native.esm.js.map +1 -0
- package/dist/{consumeMfaTokenIfRequiredForAction-B2zzOTIn.cjs → consumeMfaTokenIfRequiredForAction-D1iSuzzl.cjs} +2 -2
- package/dist/{consumeMfaTokenIfRequiredForAction-B2zzOTIn.cjs.map → consumeMfaTokenIfRequiredForAction-D1iSuzzl.cjs.map} +1 -1
- package/dist/{consumeMfaTokenIfRequiredForAction-CJxVqCmj.esm.js → consumeMfaTokenIfRequiredForAction-NVOBPPQW.esm.js} +2 -2
- package/dist/{consumeMfaTokenIfRequiredForAction-CJxVqCmj.esm.js.map → consumeMfaTokenIfRequiredForAction-NVOBPPQW.esm.js.map} +1 -1
- package/dist/core.cjs +6 -6
- package/dist/core.esm.js +6 -6
- package/dist/core.native.esm.js +5 -5
- package/dist/exports/waas.d.ts +2 -3
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-_2e6e2Ro.esm.js → getNetworkProviderFromNetworkId-CkKboiVD.esm.js} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-_2e6e2Ro.esm.js.map → getNetworkProviderFromNetworkId-CkKboiVD.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-h1eFbUp8.cjs → getNetworkProviderFromNetworkId-Cn1w40Jn.cjs} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-h1eFbUp8.cjs.map → getNetworkProviderFromNetworkId-Cn1w40Jn.cjs.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-C0FLeQ5n.native.esm.js → getNetworkProviderFromNetworkId-W8EeAcf_.native.esm.js} +3 -3
- package/dist/getNetworkProviderFromNetworkId-W8EeAcf_.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-DPh7vAKs.cjs → getSignedSessionId-DXrCyLJT.cjs} +2 -2
- package/dist/{getSignedSessionId-DPh7vAKs.cjs.map → getSignedSessionId-DXrCyLJT.cjs.map} +1 -1
- package/dist/{getSignedSessionId-BZO5AD86.native.esm.js → getSignedSessionId-DgEVnuO-.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-BZO5AD86.native.esm.js.map → getSignedSessionId-DgEVnuO-.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-BhWiqoE7.esm.js → getSignedSessionId-DjHPdrA_.esm.js} +2 -2
- package/dist/{getSignedSessionId-BhWiqoE7.esm.js.map → getSignedSessionId-DjHPdrA_.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-CjaJQ7fI.esm.js → getWalletProviderByKey-BAmDpbgi.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-CjaJQ7fI.esm.js.map → getWalletProviderByKey-BAmDpbgi.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-CHwDF-wB.native.esm.js → getWalletProviderByKey-ClOKL5JG.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-CHwDF-wB.native.esm.js.map → getWalletProviderByKey-ClOKL5JG.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-V57IQFGI.cjs → getWalletProviderByKey-o0urQYPF.cjs} +2 -2
- package/dist/{getWalletProviderByKey-V57IQFGI.cjs.map → getWalletProviderByKey-o0urQYPF.cjs.map} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.esm.js +6 -6
- package/dist/index.native.esm.js +6 -6
- package/dist/{isDynamicWaasEnabled-DON8Wgtw.esm.js → isDynamicWaasEnabled-C0x4cUHe.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-DON8Wgtw.esm.js.map → isDynamicWaasEnabled-C0x4cUHe.esm.js.map} +1 -1
- package/dist/{isDynamicWaasEnabled-SALOnUiM.native.esm.js → isDynamicWaasEnabled-CF-T5TSi.native.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-SALOnUiM.native.esm.js.map → isDynamicWaasEnabled-CF-T5TSi.native.esm.js.map} +1 -1
- package/dist/{isDynamicWaasEnabled-DcvyqHqI.cjs → isDynamicWaasEnabled-DQe8Wxd0.cjs} +2 -2
- package/dist/{isDynamicWaasEnabled-DcvyqHqI.cjs.map → isDynamicWaasEnabled-DQe8Wxd0.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-Bde90-Y6.esm.js → isMfaRequiredForAction-BK_4B7Gi.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-Bde90-Y6.esm.js.map → isMfaRequiredForAction-BK_4B7Gi.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-GI_7_DG1.cjs → isMfaRequiredForAction-BcO-fQ-N.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-GI_7_DG1.cjs.map → isMfaRequiredForAction-BcO-fQ-N.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-BUupsHJw.native.esm.js → isMfaRequiredForAction-Ce0neLQQ.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BUupsHJw.native.esm.js.map → isMfaRequiredForAction-Ce0neLQQ.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-BTQbWpvO.cjs → isUserOnboardingComplete-B4hlrt5N.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-BTQbWpvO.cjs.map → isUserOnboardingComplete-B4hlrt5N.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-bsAUasR2.native.esm.js → isUserOnboardingComplete-BK7GcrpI.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-bsAUasR2.native.esm.js.map → isUserOnboardingComplete-BK7GcrpI.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-CDMV5llq.esm.js → isUserOnboardingComplete-CssbJY_7.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-CDMV5llq.esm.js.map → isUserOnboardingComplete-CssbJY_7.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CdacJXcs.native.esm.js → migrateFromFireblocks-BX9JTaOI.native.esm.js} +3 -3
- package/dist/{migrateFromFireblocks-CdacJXcs.native.esm.js.map → migrateFromFireblocks-BX9JTaOI.native.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CuKYRnBI.esm.js → migrateFromFireblocks-Btox03CB.esm.js} +4 -4
- package/dist/{migrateFromFireblocks-CuKYRnBI.esm.js.map → migrateFromFireblocks-Btox03CB.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-BKQe7GHD.cjs → migrateFromFireblocks-CIE4qLS6.cjs} +4 -4
- package/dist/{migrateFromFireblocks-BKQe7GHD.cjs.map → migrateFromFireblocks-CIE4qLS6.cjs.map} +1 -1
- package/dist/modules/apiClient/constants.d.ts +7 -0
- package/dist/modules/apiClient/constants.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts +1 -2
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/apiClient/createBaseApiClient.d.ts +16 -0
- package/dist/modules/apiClient/createBaseApiClient.d.ts.map +1 -0
- package/dist/modules/auth/logoutWithReason/logoutWithReason.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.d.ts.map +1 -1
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.d.ts +32 -0
- package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.d.ts.map +1 -0
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.d.ts +4 -1
- package/dist/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.d.ts.map +1 -1
- package/dist/modules/waas/waas.types.d.ts +2 -1
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/utils/convertVerifiedCredentialToWalletAccount/convertVerifiedCredentialToWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/walletAccount/walletAccount.types.d.ts +2 -0
- package/dist/modules/wallets/walletAccount/walletAccount.types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-U7zoE0b1.esm.js → updateAuthFromVerifyResponse-BhILXMm_.esm.js} +191 -168
- package/dist/updateAuthFromVerifyResponse-BhILXMm_.esm.js.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-Bm6bI0ds.cjs → updateAuthFromVerifyResponse-CK3pAERc.cjs} +190 -167
- package/dist/updateAuthFromVerifyResponse-CK3pAERc.cjs.map +1 -0
- package/dist/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.d.ts.map +1 -1
- package/dist/waas.cjs +56 -77
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +56 -76
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +55 -75
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +9 -8
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +9 -8
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +8 -7
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/NativeModuleNotLinkedError-Duh8DMLT.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-C0FLeQ5n.native.esm.js.map +0 -1
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.d.ts +0 -30
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.d.ts.map +0 -1
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/index.d.ts +0 -2
- package/dist/modules/waas/getEmbeddedWalletsRequiringUpgrade/index.d.ts.map +0 -1
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.d.ts +0 -23
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.d.ts.map +0 -1
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/index.d.ts +0 -2
- package/dist/modules/waas/hasEmbeddedWalletsRequiringUpgrade/index.d.ts.map +0 -1
- package/dist/updateAuthFromVerifyResponse-Bm6bI0ds.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-U7zoE0b1.esm.js.map +0 -1
package/dist/waas.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Ct as name, I as getChainFromVerifiedCredentialChain,
|
|
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 createWaasClient, n as getWaasWalletProviderFromWalletAccount, r as getWaasChainNameFromChain, t as migrateFromFireblocks } from "./migrateFromFireblocks-
|
|
1
|
+
import { Ct as name, I as getChainFromVerifiedCredentialChain, P as formatWalletProviderKey, St as getCore, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, ft as assertDefined, i as InvalidParamError, k as NoWalletProviderFoundError, o as isWaasWalletAccount, q as createApiClient, s as findWaasWalletProviderByChain, vt as getDefaultClient, wt as version } from "./updateAuthFromVerifyResponse-BhILXMm_.esm.js";
|
|
2
|
+
import { r as __refreshAuth_wrapped, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-C0x4cUHe.esm.js";
|
|
3
|
+
import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-BAmDpbgi.esm.js";
|
|
4
|
+
import "./getSignedSessionId-DjHPdrA_.esm.js";
|
|
5
|
+
import { a as NotWaasWalletProviderError, i as createWaasClient, n as getWaasWalletProviderFromWalletAccount, r as getWaasChainNameFromChain, t as migrateFromFireblocks } from "./migrateFromFireblocks-Btox03CB.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { JwtVerifiedCredentialFormatEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
|
|
@@ -88,19 +88,22 @@ const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, wall
|
|
|
88
88
|
const hasUserId = Boolean(targetSignerIdentity.userId);
|
|
89
89
|
const hasIdentifier = Boolean(targetSignerIdentity.identifier && targetSignerIdentity.identifierType);
|
|
90
90
|
if (!hasUserId && !hasIdentifier) throw new InvalidParamError("addBusinessAccountSigner: targetSignerIdentity must provide a userId, or an identifier with its identifierType");
|
|
91
|
+
if (walletAccount.businessAccountId) assertDefined(businessAccountId, "addBusinessAccountSigner: this wallet is already part of a business account");
|
|
91
92
|
let resolvedBusinessAccountId = businessAccountId;
|
|
92
93
|
if (!resolvedBusinessAccountId) {
|
|
93
94
|
const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;
|
|
94
|
-
|
|
95
|
+
assertDefined(linkWalletId, "addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account");
|
|
95
96
|
resolvedBusinessAccountId = (await getBusinessAccountsClient(client).addWalletToBusinessAccount({ walletId: linkWalletId })).id;
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
const result = await getWaasWalletProviderByChain({ chain: walletAccount.chain }, client).reshareToNewSignerShareSet({
|
|
98
99
|
businessAccountId: resolvedBusinessAccountId,
|
|
99
100
|
password,
|
|
100
101
|
signerType,
|
|
101
102
|
targetSignerIdentity,
|
|
102
103
|
walletAccount
|
|
103
104
|
});
|
|
105
|
+
await __refreshAuth_wrapped(client);
|
|
106
|
+
return result;
|
|
104
107
|
};
|
|
105
108
|
|
|
106
109
|
//#endregion
|
|
@@ -117,10 +120,12 @@ const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, wall
|
|
|
117
120
|
* @notInstrumented
|
|
118
121
|
*/
|
|
119
122
|
const addWalletToBusinessAccount = async ({ businessAccountId, walletId }, client = getDefaultClient()) => {
|
|
120
|
-
|
|
123
|
+
const detail = await getBusinessAccountsClient(client).addWalletToBusinessAccount({
|
|
121
124
|
businessAccountId,
|
|
122
125
|
walletId
|
|
123
126
|
});
|
|
127
|
+
await __refreshAuth_wrapped(client);
|
|
128
|
+
return detail;
|
|
124
129
|
};
|
|
125
130
|
|
|
126
131
|
//#endregion
|
|
@@ -309,11 +314,13 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
|
|
|
309
314
|
* @notInstrumented
|
|
310
315
|
*/
|
|
311
316
|
const createWalletForBusinessAccount = async ({ businessAccountId, chain, password, thresholdSignatureScheme }, client = getDefaultClient()) => {
|
|
312
|
-
|
|
317
|
+
const wallet = await getWaasWalletProviderByChain({ chain }, client).createWalletAccount({
|
|
313
318
|
businessAccountId,
|
|
314
319
|
password,
|
|
315
320
|
thresholdSignatureScheme
|
|
316
321
|
});
|
|
322
|
+
await __refreshAuth_wrapped(client);
|
|
323
|
+
return wallet;
|
|
317
324
|
};
|
|
318
325
|
|
|
319
326
|
//#endregion
|
|
@@ -326,12 +333,14 @@ const createWalletForBusinessAccount = async ({ businessAccountId, chain, passwo
|
|
|
326
333
|
*
|
|
327
334
|
* @param params.walletAccount - The WaaS wallet account to delegate shares for.
|
|
328
335
|
* @param [params.password] - Optional password for key share operations.
|
|
336
|
+
* @param [params.initialSignerRules] - Optional policy rules used to seed the delegated signer's policy layer at delegation time.
|
|
329
337
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
330
338
|
* @returns A promise that resolves when the key delegation is complete.
|
|
331
339
|
* @notInstrumented
|
|
332
340
|
*/
|
|
333
|
-
const delegateWaasKeyShares = async ({ password, walletAccount }, client = getDefaultClient()) => {
|
|
341
|
+
const delegateWaasKeyShares = async ({ initialSignerRules, password, walletAccount }, client = getDefaultClient()) => {
|
|
334
342
|
await getWaasWalletProviderFromWalletAccount({ walletAccount }, client).delegateKeyShares({
|
|
343
|
+
initialSignerRules,
|
|
335
344
|
password,
|
|
336
345
|
walletAccount
|
|
337
346
|
});
|
|
@@ -426,46 +435,6 @@ const getChainsMissingWaasWalletAccounts = (client = getDefaultClient()) => {
|
|
|
426
435
|
}));
|
|
427
436
|
};
|
|
428
437
|
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region src/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.ts
|
|
431
|
-
/**
|
|
432
|
-
* Provider-key substring shared by every Dynamic embedded wallet that predates
|
|
433
|
-
* Dynamic WaaS and can therefore be upgraded to it (via the Dynamic WaaS
|
|
434
|
-
* upgrade flow). A wallet account's `walletProviderKey` is a composite value
|
|
435
|
-
* (e.g. `turnkeyevm:embeddedWallet`, `turnkeyhdsolana:embeddedWallet`), so it
|
|
436
|
-
* is matched as a substring. Both the standard and HD variants contain this
|
|
437
|
-
* key, so it alone identifies all of them.
|
|
438
|
-
*/
|
|
439
|
-
const LEGACY_EMBEDDED_WALLET_PROVIDER_KEY = "turnkey";
|
|
440
|
-
/**
|
|
441
|
-
* Returns the current session's wallet accounts that are legacy Dynamic
|
|
442
|
-
* embedded wallets requiring an upgrade to Dynamic WaaS.
|
|
443
|
-
*
|
|
444
|
-
* These are earlier-generation Dynamic embedded wallets that predate Dynamic
|
|
445
|
-
* WaaS (the current TSS-MPC embedded wallet) and can be migrated to it. Use
|
|
446
|
-
* this when you need the accounts themselves — for example to show how many
|
|
447
|
-
* wallets can be upgraded and let the user act on them. It never returns
|
|
448
|
-
* already-upgraded Dynamic WaaS accounts. For a simple boolean "does this user
|
|
449
|
-
* have anything to upgrade?" check, use `hasEmbeddedWalletsRequiringUpgrade`
|
|
450
|
-
* instead.
|
|
451
|
-
*
|
|
452
|
-
* @example
|
|
453
|
-
* ```ts
|
|
454
|
-
* const walletsRequiringUpgrade = getEmbeddedWalletsRequiringUpgrade();
|
|
455
|
-
* if (walletsRequiringUpgrade.length > 0) {
|
|
456
|
-
* showUpgradePrompt(
|
|
457
|
-
* `You have ${walletsRequiringUpgrade.length} wallet(s) that can be upgraded. Upgrade now?`
|
|
458
|
-
* );
|
|
459
|
-
* }
|
|
460
|
-
* ```
|
|
461
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
462
|
-
* @returns The wallet accounts requiring an upgrade to Dynamic WaaS (empty when none).
|
|
463
|
-
* @see hasEmbeddedWalletsRequiringUpgrade
|
|
464
|
-
* @see isWaasWalletAccount
|
|
465
|
-
* @notInstrumented
|
|
466
|
-
*/
|
|
467
|
-
const getEmbeddedWalletsRequiringUpgrade = (client = getDefaultClient()) => getWalletAccounts(client).filter((walletAccount) => walletAccount.walletProviderKey.includes(LEGACY_EMBEDDED_WALLET_PROVIDER_KEY));
|
|
468
|
-
|
|
469
438
|
//#endregion
|
|
470
439
|
//#region src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts
|
|
471
440
|
/**
|
|
@@ -496,31 +465,6 @@ const hasDelegatedAccess = ({ walletAccount }, client = getDefaultClient()) => {
|
|
|
496
465
|
return !!verifiedCredential.walletProperties?.keyShares?.some((keyShare) => keyShare.backupLocation === "delegated");
|
|
497
466
|
};
|
|
498
467
|
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region src/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.ts
|
|
501
|
-
/**
|
|
502
|
-
* Returns whether the current session has any legacy Dynamic embedded wallet
|
|
503
|
-
* that requires an upgrade to Dynamic WaaS.
|
|
504
|
-
*
|
|
505
|
-
* This is a boolean convenience over {@link getEmbeddedWalletsRequiringUpgrade}
|
|
506
|
-
* for the common case where you only need to decide whether to trigger the
|
|
507
|
-
* upgrade flow (e.g. show a prompt or redirect to a migration app) rather than
|
|
508
|
-
* act on the specific accounts.
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* ```ts
|
|
512
|
-
* if (hasEmbeddedWalletsRequiringUpgrade()) {
|
|
513
|
-
* showUpgradeToWaasBanner();
|
|
514
|
-
* }
|
|
515
|
-
* ```
|
|
516
|
-
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
517
|
-
* @returns True when at least one wallet account requires an upgrade to Dynamic WaaS, false otherwise.
|
|
518
|
-
* @see getEmbeddedWalletsRequiringUpgrade
|
|
519
|
-
* @see isWaasWalletAccount
|
|
520
|
-
* @notInstrumented
|
|
521
|
-
*/
|
|
522
|
-
const hasEmbeddedWalletsRequiringUpgrade = (client = getDefaultClient()) => getEmbeddedWalletsRequiringUpgrade(client).length > 0;
|
|
523
|
-
|
|
524
468
|
//#endregion
|
|
525
469
|
//#region src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts
|
|
526
470
|
/**
|
|
@@ -739,6 +683,42 @@ const shouldAutoCreateWalletForChain = ({ chain }, client = getDefaultClient())
|
|
|
739
683
|
return getChainsMissingWaasWalletAccounts(client).includes(chain);
|
|
740
684
|
};
|
|
741
685
|
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.ts
|
|
688
|
+
/**
|
|
689
|
+
* Transfers ownership of a business account to another member. Owner-only: the
|
|
690
|
+
* `newOwnerUserId` must already be a member, is promoted to owner, and the
|
|
691
|
+
* current owner is atomically demoted to admin.
|
|
692
|
+
*
|
|
693
|
+
* @param params.businessAccountId - The business account whose ownership moves.
|
|
694
|
+
* @param params.newOwnerUserId - The member to promote to owner.
|
|
695
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
696
|
+
* @returns The updated business account detail.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```ts
|
|
700
|
+
* const detail = await getBusinessAccount({ businessAccountId });
|
|
701
|
+
* const target = detail.members.find((m) => m.role === 'admin');
|
|
702
|
+
* await transferBusinessAccountOwnership({
|
|
703
|
+
* businessAccountId,
|
|
704
|
+
* newOwnerUserId: target.userId,
|
|
705
|
+
* });
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
708
|
+
* @see getBusinessAccount
|
|
709
|
+
* @notInstrumented
|
|
710
|
+
*/
|
|
711
|
+
const transferBusinessAccountOwnership = async ({ businessAccountId, newOwnerUserId }, client = getDefaultClient()) => {
|
|
712
|
+
const core = getCore(client);
|
|
713
|
+
const detail = await createApiClient({}, client).sdkTransferBusinessAccountOwnership({
|
|
714
|
+
businessAccountId,
|
|
715
|
+
environmentId: core.environmentId,
|
|
716
|
+
transferBusinessAccountOwnershipSdkRequest: { newOwnerUserId }
|
|
717
|
+
});
|
|
718
|
+
await __refreshAuth_wrapped(client);
|
|
719
|
+
return detail;
|
|
720
|
+
};
|
|
721
|
+
|
|
742
722
|
//#endregion
|
|
743
723
|
//#region src/modules/waas/unlockWallet/unlockWallet.ts
|
|
744
724
|
/**
|
|
@@ -785,5 +765,5 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
|
|
|
785
765
|
assertPackageVersion(name, version);
|
|
786
766
|
|
|
787
767
|
//#endregion
|
|
788
|
-
export { NotWaasWalletProviderError, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getBusinessAccount, getChainsMissingWaasWalletAccounts,
|
|
768
|
+
export { NotWaasWalletProviderError, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getBusinessAccount, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeBusinessAccountMember, removeBusinessAccountSigner, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, transferBusinessAccountOwnership, unlockWallet, updateWaasPassword };
|
|
789
769
|
//# sourceMappingURL=waas.esm.js.map
|
package/dist/waas.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waas.esm.js","names":["requirement: WalletCreationRequirement","refreshAuth","refreshAuth","refreshAuth","packageName","packageVersion"],"sources":["../src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts","../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts","../src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getEmbeddedWalletsRequiringUpgrade/getEmbeddedWalletsRequiringUpgrade.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/hasEmbeddedWalletsRequiringUpgrade/hasEmbeddedWalletsRequiringUpgrade.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/unlockWallet/unlockWallet.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["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 {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n BusinessAccountSignerIdentifierType,\n} from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\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 * @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 server-side.\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 = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.addMember({\n businessAccountId,\n identifier,\n identifierType,\n role,\n userId,\n });\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 { getDefaultClient } from '../../../../client/defaultClient';\nimport { InvalidParamError } from '../../../../errors/InvalidParamError';\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 // 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 if (!linkWalletId) {\n throw new InvalidParamError(\n 'addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account'\n );\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 return provider.reshareToNewSignerShareSet({\n businessAccountId: resolvedBusinessAccountId,\n password,\n signerType,\n targetSignerIdentity,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../../client/defaultClient';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\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 * @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 = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.addWalletToBusinessAccount({\n businessAccountId,\n walletId,\n });\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 { 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 return provider.createWalletAccount({\n businessAccountId,\n password,\n thresholdSignatureScheme,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n * @notInstrumented\n */\nexport const delegateWaasKeyShares = async (\n { password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasClientKeysharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the client-side key shares for a WaaS wallet account.\n *\n * This function retrieves the cryptographic key shares that are stored\n * on the client side for backup or migration purposes.\n *\n * @param params.walletAccount - The WaaS wallet account to export shares from.\n * @param [params.password] - Optional password to encrypt the exported shares.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the exported key shares.\n * @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 { getDefaultClient } from '../../../client/defaultClient';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\nimport type { WalletAccount } from '../../wallets/walletAccount';\n\n/**\n * Provider-key substring shared by every Dynamic embedded wallet that predates\n * Dynamic WaaS and can therefore be upgraded to it (via the Dynamic WaaS\n * upgrade flow). A wallet account's `walletProviderKey` is a composite value\n * (e.g. `turnkeyevm:embeddedWallet`, `turnkeyhdsolana:embeddedWallet`), so it\n * is matched as a substring. Both the standard and HD variants contain this\n * key, so it alone identifies all of them.\n */\nconst LEGACY_EMBEDDED_WALLET_PROVIDER_KEY = 'turnkey';\n\n/**\n * Returns the current session's wallet accounts that are legacy Dynamic\n * embedded wallets requiring an upgrade to Dynamic WaaS.\n *\n * These are earlier-generation Dynamic embedded wallets that predate Dynamic\n * WaaS (the current TSS-MPC embedded wallet) and can be migrated to it. Use\n * this when you need the accounts themselves — for example to show how many\n * wallets can be upgraded and let the user act on them. It never returns\n * already-upgraded Dynamic WaaS accounts. For a simple boolean \"does this user\n * have anything to upgrade?\" check, use `hasEmbeddedWalletsRequiringUpgrade`\n * instead.\n *\n * @example\n * ```ts\n * const walletsRequiringUpgrade = getEmbeddedWalletsRequiringUpgrade();\n * if (walletsRequiringUpgrade.length > 0) {\n * showUpgradePrompt(\n * `You have ${walletsRequiringUpgrade.length} wallet(s) that can be upgraded. Upgrade now?`\n * );\n * }\n * ```\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The wallet accounts requiring an upgrade to Dynamic WaaS (empty when none).\n * @see hasEmbeddedWalletsRequiringUpgrade\n * @see isWaasWalletAccount\n * @notInstrumented\n */\nexport const getEmbeddedWalletsRequiringUpgrade = (\n client = getDefaultClient()\n): WalletAccount[] =>\n getWalletAccounts(client).filter((walletAccount) =>\n walletAccount.walletProviderKey.includes(LEGACY_EMBEDDED_WALLET_PROVIDER_KEY)\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 { getDefaultClient } from '../../../client/defaultClient';\nimport { getEmbeddedWalletsRequiringUpgrade } from '../getEmbeddedWalletsRequiringUpgrade';\n\n/**\n * Returns whether the current session has any legacy Dynamic embedded wallet\n * that requires an upgrade to Dynamic WaaS.\n *\n * This is a boolean convenience over {@link getEmbeddedWalletsRequiringUpgrade}\n * for the common case where you only need to decide whether to trigger the\n * upgrade flow (e.g. show a prompt or redirect to a migration app) rather than\n * act on the specific accounts.\n *\n * @example\n * ```ts\n * if (hasEmbeddedWalletsRequiringUpgrade()) {\n * showUpgradeToWaasBanner();\n * }\n * ```\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True when at least one wallet account requires an upgrade to Dynamic WaaS, false otherwise.\n * @see getEmbeddedWalletsRequiringUpgrade\n * @see isWaasWalletAccount\n * @notInstrumented\n */\nexport const hasEmbeddedWalletsRequiringUpgrade = (\n client = getDefaultClient()\n): boolean => getEmbeddedWalletsRequiringUpgrade(client).length > 0;\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 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 { 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 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 { getEmbeddedWalletsRequiringUpgrade } from '../modules/waas/getEmbeddedWalletsRequiringUpgrade';\nexport { getWalletRecoveryState } from '../modules/waas/getWalletRecoveryState';\nexport { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';\nexport { hasEmbeddedWalletsRequiringUpgrade } from '../modules/waas/hasEmbeddedWalletsRequiringUpgrade';\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 { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAa,6BACX,WACwB;CACxB,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;CAEpE,MAAM,cACJ,gBAAgB,IAAI,iBAAiB,qBAAqB,MACvD,UAAU,MAAM,QAClB;AAEH,KAAI,CAAC,YACH,OAAM,IAAI,kBAAkB,4CAA4C;AAa1E,QAPmB,iBACjB,EAAE,WAAW,0BAA0B,YAAY,KAAc,EAAE,EACnE,OACD,CAIiB;;;;;;;;;;;;;;;;;;;ACZpB,MAAa,2BAA2B,OACtC,EACE,mBACA,QACA,YACA,gBACA,QAEF,SAAS,kBAAkB,KACQ;AAGnC,QAFyB,0BAA0B,OAAO,CAElC,UAAU;EAChC;EACA;EACA;EACA;EACA;EACD,CAAC;;;;;;ACjCJ,MAAa,gCACX,EAAE,SACF,WACuB;CACvB,MAAM,eAAe,8BAA8B,EAAE,OAAO,EAAE,OAAO;AAErE,KAAI,CAAC,aAOH,OAAM,IAAI,2BAA2B,EACnC,mBAPsB,wBAAwB;EAC9C;EACA,aAAa,sBAAsB;EACnC,oBAAoB,mBAAmB;EACxC,CAAC,EAID,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;ACMT,MAAa,2BAA2B,OACtC,EACE,eACA,mBACA,UACA,sBACA,YACA,YAEF,SAAS,kBAAkB,KACS;CAEpC,MAAM,YAAY,QAAQ,qBAAqB,OAAO;CACtD,MAAM,gBAAgB,QACpB,qBAAqB,cAAc,qBAAqB,eACzD;AACD,KAAI,CAAC,aAAa,CAAC,cACjB,OAAM,IAAI,kBACR,iHACD;CAKH,IAAI,4BAA4B;AAChC,KAAI,CAAC,2BAA2B;EAI9B,MAAM,eAAe,YAAY,cAAc;AAC/C,MAAI,CAAC,aACH,OAAM,IAAI,kBACR,iHACD;AAMH,+BAHgB,MADS,0BAA0B,OAAO,CACnB,2BAA2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B,KACxB;AACH,eAAc,OAAO,iBAAiB,qCAAqC;CAE3E,MAAM,yBAAyB,OAAO,gBAAgB,IAAI;AAK1D,KAAI,CAFF,wBAAwB,mCAEqB,CAAC,OAAO,KACrD,QAAO;CAGT,MAAM,oDACJ,wBAAwB;AAQ1B,KAAI,EAHF,CAAC,sBAAsB,OAAO,KAAK,IACnC,mDAGA,QAAO;AAMT,QAFE,mCAAmC,OAAO,CAEN,SAAS,MAAM;;;;;;;;;;;;;;ACjCvD,MAAa,eAAe,OAC1B,EAAE,UAAU,iBACZ,SAAS,kBAAkB,KACI;AAM/B,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,aAAa;EAC3B;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;ACTJ,MAAa,qBAAqB,OAChC,EAAE,iBAAiB,aAAa,iBAChC,SAAS,kBAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,eAAe;EAC7B;EACA;EACA;EACD,CAAC;;;;;AC9BJ,qBAAqBC,MAAaC,QAAe"}
|
|
1
|
+
{"version":3,"file":"waas.esm.js","names":["refreshAuth","refreshAuth","requirement: WalletCreationRequirement","refreshAuth","refreshAuth","refreshAuth","refreshAuth","refreshAuth","packageName","packageVersion"],"sources":["../src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts","../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts","../src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.ts","../src/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.ts","../src/modules/waas/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/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["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 {\n BusinessAccountMember,\n BusinessAccountMemberRole,\n BusinessAccountSignerIdentifierType,\n} from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\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 * @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 server-side.\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 = getDefaultClient()\n): Promise<BusinessAccountMember> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n return businessAccounts.addMember({\n businessAccountId,\n identifier,\n identifierType,\n role,\n userId,\n });\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 { 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 { getDefaultClient } from '../../../../client/defaultClient';\nimport { refreshAuth } from '../../../user/refreshAuth';\nimport type { BusinessAccountDetail } from '../businessAccounts.types';\nimport { getBusinessAccountsClient } from '../getBusinessAccountsClient';\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 * @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 = getDefaultClient()\n): Promise<BusinessAccountDetail> => {\n const businessAccounts = getBusinessAccountsClient(client);\n\n const detail = await businessAccounts.addWalletToBusinessAccount({\n businessAccountId,\n 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;\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 { refreshAuth } from '../../../user/refreshAuth';\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 sessions\n // server-side; refresh local auth so the caller's role/session state stays\n // consistent instead of going stale.\n await refreshAuth(client);\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 { 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 { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../mod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