@dynamic-labs-sdk/client 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{constants-58bHSI3b.cjs.js → InvalidParamError-D1yNl3r1.cjs.js} +24 -4
- package/dist/InvalidParamError-D1yNl3r1.cjs.js.map +1 -0
- package/dist/{constants-B8WQGUki.esm.js → InvalidParamError-DMz6QY8e.esm.js} +18 -4
- package/dist/InvalidParamError-DMz6QY8e.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-DJmbtj65.esm.js → NotWaasWalletAccountError-Cp3qfAxw.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-DJmbtj65.esm.js.map → NotWaasWalletAccountError-Cp3qfAxw.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-Dq2ssnPs.cjs.js → NotWaasWalletAccountError-s2J7fQHr.cjs.js} +7 -7
- package/dist/{NotWaasWalletAccountError-Dq2ssnPs.cjs.js.map → NotWaasWalletAccountError-s2J7fQHr.cjs.js.map} +1 -1
- package/dist/client/core/createCore/createCore.d.ts.map +1 -1
- package/dist/client/core/createCore/getInitialState.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCore.d.ts +15 -0
- package/dist/client/core/types/DynamicCore.d.ts.map +1 -1
- package/dist/client/core/types/DynamicCoreConfig.d.ts +1 -1
- package/dist/client/core/types/DynamicCoreConfig.d.ts.map +1 -1
- package/dist/client/types/DynamicClientConfig.d.ts +46 -0
- package/dist/client/types/DynamicClientConfig.d.ts.map +1 -1
- package/dist/core.cjs.js +34 -32
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +8 -8
- package/dist/core.esm.js.map +1 -1
- package/dist/exports/core.d.ts +6 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +4 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +4 -1
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-DCZQS4ot.cjs.js → getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js} +129 -45
- package/dist/getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-HoSmTgsz.esm.js → getNetworkProviderFromNetworkId-CmLsKY7E.esm.js} +88 -24
- package/dist/getNetworkProviderFromNetworkId-CmLsKY7E.esm.js.map +1 -0
- package/dist/{getSignedSessionId-DZ5toWIx.cjs.js → getSignedSessionId-BO9omMlI.cjs.js} +8 -8
- package/dist/{getSignedSessionId-DZ5toWIx.cjs.js.map → getSignedSessionId-BO9omMlI.cjs.js.map} +1 -1
- package/dist/{getSignedSessionId-CWSJHTeG.esm.js → getSignedSessionId-BvQ4i928.esm.js} +3 -3
- package/dist/{getSignedSessionId-CWSJHTeG.esm.js.map → getSignedSessionId-BvQ4i928.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-bYTdp3TE.esm.js → getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js} +113 -3
- package/dist/getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-86wjRIe0.cjs.js → getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js} +140 -30
- package/dist/getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js.map +1 -0
- package/dist/index.cjs.js +326 -267
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +85 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-lt9nPT2M.esm.js → isMfaRequiredForAction-DIvUT6_k.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-lt9nPT2M.esm.js.map → isMfaRequiredForAction-DIvUT6_k.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-BeZstT1P.cjs.js → isMfaRequiredForAction-DmYvEIJH.cjs.js} +9 -9
- package/dist/{isMfaRequiredForAction-BeZstT1P.cjs.js.map → isMfaRequiredForAction-DmYvEIJH.cjs.js.map} +1 -1
- package/dist/modules/auth/decodeJwt/decodeJwt.d.ts +26 -0
- package/dist/modules/auth/decodeJwt/decodeJwt.d.ts.map +1 -0
- package/dist/modules/auth/decodeJwt/index.d.ts +2 -0
- package/dist/modules/auth/decodeJwt/index.d.ts.map +1 -0
- package/dist/modules/auth/getElevatedAccessToken/getElevatedAccessToken.d.ts +30 -0
- package/dist/modules/auth/getElevatedAccessToken/getElevatedAccessToken.d.ts.map +1 -0
- package/dist/modules/auth/getElevatedAccessToken/index.d.ts +2 -0
- package/dist/modules/auth/getElevatedAccessToken/index.d.ts.map +1 -0
- package/dist/modules/auth/state.d.ts +13 -0
- package/dist/modules/auth/state.d.ts.map +1 -1
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/elevatedAccessTokens.types.d.ts +10 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/elevatedAccessTokens.types.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/index.d.ts +2 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/index.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.d.ts +9 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/normalizeScopes/normalizeScopes.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/index.d.ts +2 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/index.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.d.ts +17 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/index.d.ts +2 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/index.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.d.ts +17 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/upsertElevatedAccessToken/upsertElevatedAccessToken.d.ts.map +1 -0
- package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
- package/dist/modules/deviceRegistration/detectDeviceRegistrationRedirect/detectDeviceRegistrationRedirect.d.ts +1 -1
- package/dist/modules/deviceRegistration/{getDeviceTokenFromUrl/getDeviceTokenFromUrl.d.ts → getDeviceRegistrationTokenFromUrl/getDeviceRegistrationTokenFromUrl.d.ts} +3 -3
- package/dist/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/getDeviceRegistrationTokenFromUrl.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/index.d.ts.map +1 -0
- package/dist/modules/user/isUserOnboardingComplete/index.d.ts +2 -0
- package/dist/modules/user/isUserOnboardingComplete/index.d.ts.map +1 -0
- package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts +12 -0
- package/dist/modules/user/isUserOnboardingComplete/isUserOnboardingComplete.d.ts.map +1 -0
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/getWalletRecoveryState/getWalletRecoveryState.d.ts +16 -0
- package/dist/modules/waas/getWalletRecoveryState/getWalletRecoveryState.d.ts.map +1 -0
- package/dist/modules/waas/getWalletRecoveryState/index.d.ts +2 -0
- package/dist/modules/waas/getWalletRecoveryState/index.d.ts.map +1 -0
- package/dist/modules/waas/unlockWallet/index.d.ts +2 -0
- package/dist/modules/waas/unlockWallet/index.d.ts.map +1 -0
- package/dist/modules/waas/unlockWallet/unlockWallet.d.ts +17 -0
- package/dist/modules/waas/unlockWallet/unlockWallet.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +8 -1
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getNetworksData/getNetworksData.d.ts +4 -0
- package/dist/modules/wallets/networks/getNetworksData/getNetworksData.d.ts.map +1 -1
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/createCrossTabBroadcast.d.ts +19 -0
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/createCrossTabBroadcast.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/index.d.ts +2 -0
- package/dist/services/crossTabBroadcast/createCrossTabBroadcast/index.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.schema.d.ts +8 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.schema.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.types.d.ts +35 -0
- package/dist/services/crossTabBroadcast/crossTabBroadcast.types.d.ts.map +1 -0
- package/dist/services/crossTabBroadcast/index.d.ts +3 -0
- package/dist/services/crossTabBroadcast/index.d.ts.map +1 -0
- package/dist/services/deviceSigner/deviceSigner.types.d.ts +21 -0
- package/dist/services/deviceSigner/deviceSigner.types.d.ts.map +1 -0
- package/dist/services/deviceSigner/index.d.ts +2 -0
- package/dist/services/deviceSigner/index.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs.js +61 -29
- package/dist/waas.cjs.js.map +1 -1
- package/dist/waas.esm.js +34 -4
- package/dist/waas.esm.js.map +1 -1
- package/dist/waasCore.cjs.js +33 -15
- package/dist/waasCore.cjs.js.map +1 -1
- package/dist/waasCore.esm.js +22 -4
- package/dist/waasCore.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/InvalidParamError-C2c9HQ4V.esm.js +0 -18
- package/dist/InvalidParamError-C2c9HQ4V.esm.js.map +0 -1
- package/dist/InvalidParamError-D2oVXYDc.cjs.js +0 -23
- package/dist/InvalidParamError-D2oVXYDc.cjs.js.map +0 -1
- package/dist/constants-58bHSI3b.cjs.js.map +0 -1
- package/dist/constants-B8WQGUki.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-DCZQS4ot.cjs.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-HoSmTgsz.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-86wjRIe0.cjs.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-bYTdp3TE.esm.js.map +0 -1
- package/dist/modules/deviceRegistration/getDeviceTokenFromUrl/getDeviceTokenFromUrl.d.ts.map +0 -1
- package/dist/modules/deviceRegistration/getDeviceTokenFromUrl/index.d.ts +0 -2
- package/dist/modules/deviceRegistration/getDeviceTokenFromUrl/index.d.ts.map +0 -1
package/dist/waas.cjs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
2
|
-
const
|
|
3
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-
|
|
1
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js');
|
|
2
|
+
const require_InvalidParamError = require('./InvalidParamError-D1yNl3r1.cjs.js');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js');
|
|
4
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-s2J7fQHr.cjs.js');
|
|
5
5
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
6
6
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
7
7
|
|
|
8
8
|
//#region src/errors/NotWaasWalletProviderError.ts
|
|
9
|
-
var NotWaasWalletProviderError = class extends
|
|
9
|
+
var NotWaasWalletProviderError = class extends require_InvalidParamError.BaseError {
|
|
10
10
|
constructor({ walletProviderKey }) {
|
|
11
11
|
super({
|
|
12
12
|
cause: null,
|
|
@@ -39,7 +39,7 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client) => {
|
|
|
39
39
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
40
40
|
* @returns A promise that resolves when the backup process is complete.
|
|
41
41
|
*/
|
|
42
|
-
const backupWaasKeySharesToGoogleDrive = async ({ password, walletAccount }, client =
|
|
42
|
+
const backupWaasKeySharesToGoogleDrive = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
43
43
|
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).backupKeySharesToGoogleDrive({
|
|
44
44
|
password,
|
|
45
45
|
walletAccount
|
|
@@ -124,7 +124,7 @@ const normalizeWalletRequirements = ({ defaultBitcoinConfig, input }) => {
|
|
|
124
124
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
125
125
|
* @returns A promise that resolves when all wallet accounts are created.
|
|
126
126
|
*/
|
|
127
|
-
const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureScheme }, client =
|
|
127
|
+
const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureScheme }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
128
128
|
const normalizedRequirements = normalizeWalletRequirements({ input: chains });
|
|
129
129
|
const supportedChains = [
|
|
130
130
|
"BTC",
|
|
@@ -138,7 +138,7 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
|
|
|
138
138
|
for (const requirement of filteredRequirements) {
|
|
139
139
|
const walletProviderKey = require_getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
|
|
140
140
|
chain: requirement.chain,
|
|
141
|
-
displayName:
|
|
141
|
+
displayName: require_InvalidParamError.DYNAMIC_WAAS_METADATA.displayName,
|
|
142
142
|
walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
|
|
143
143
|
});
|
|
144
144
|
if (!walletProviderMap.has(walletProviderKey)) {
|
|
@@ -151,7 +151,7 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
|
|
|
151
151
|
await Promise.all(filteredRequirements.map((requirement) => {
|
|
152
152
|
const walletProviderKey = require_getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
|
|
153
153
|
chain: requirement.chain,
|
|
154
|
-
displayName:
|
|
154
|
+
displayName: require_InvalidParamError.DYNAMIC_WAAS_METADATA.displayName,
|
|
155
155
|
walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
|
|
156
156
|
});
|
|
157
157
|
const walletProvider = walletProviderMap.get(walletProviderKey);
|
|
@@ -178,7 +178,7 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
|
|
|
178
178
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
179
179
|
* @returns A promise that resolves when the key delegation is complete.
|
|
180
180
|
*/
|
|
181
|
-
const delegateWaasKeyShares = async ({ password, walletAccount }, client =
|
|
181
|
+
const delegateWaasKeyShares = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
182
182
|
await getWaasWalletProviderFromWalletAccount({ walletAccount }, client).delegateKeyShares({
|
|
183
183
|
password,
|
|
184
184
|
walletAccount
|
|
@@ -199,7 +199,7 @@ const delegateWaasKeyShares = async ({ password, walletAccount }, client = requi
|
|
|
199
199
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
200
200
|
* @returns A promise that resolves to the exported key shares.
|
|
201
201
|
*/
|
|
202
|
-
const exportWaasClientKeyshares = async ({ password, walletAccount }, client =
|
|
202
|
+
const exportWaasClientKeyshares = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
203
203
|
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportClientKeyshares({
|
|
204
204
|
password,
|
|
205
205
|
walletAccount
|
|
@@ -220,7 +220,7 @@ const exportWaasClientKeyshares = async ({ password, walletAccount }, client = r
|
|
|
220
220
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
221
221
|
* @returns A promise that resolves when the private key export is complete.
|
|
222
222
|
*/
|
|
223
|
-
const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client =
|
|
223
|
+
const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
224
224
|
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportPrivateKey({
|
|
225
225
|
displayContainer,
|
|
226
226
|
password,
|
|
@@ -231,7 +231,7 @@ const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount
|
|
|
231
231
|
//#endregion
|
|
232
232
|
//#region src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts
|
|
233
233
|
const userHasEmbeddedWalletForChain = ({ user, chain }) => {
|
|
234
|
-
return user.verifiedCredentials.some((vc) => vc.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet && vc.chain &&
|
|
234
|
+
return user.verifiedCredentials.some((vc) => vc.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet && vc.chain && require_InvalidParamError.getChainFromVerifiedCredentialChain(vc.chain) === chain);
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
//#endregion
|
|
@@ -245,9 +245,9 @@ const userHasEmbeddedWalletForChain = ({ user, chain }) => {
|
|
|
245
245
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
246
246
|
* @returns True if Dynamic WaaS is enabled, false otherwise.
|
|
247
247
|
*/
|
|
248
|
-
const isDynamicWaasEnabled = (client =
|
|
248
|
+
const isDynamicWaasEnabled = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
249
249
|
const projectSettings = client.projectSettings;
|
|
250
|
-
|
|
250
|
+
require_InvalidParamError.assertDefined(projectSettings, "Project settings are not available");
|
|
251
251
|
return projectSettings.sdk.embeddedWallets?.defaultWalletVersion === _dynamic_labs_sdk_api_core.EmbeddedWalletVersionEnum.V3;
|
|
252
252
|
};
|
|
253
253
|
|
|
@@ -260,9 +260,9 @@ const isDynamicWaasEnabled = (client = require_constants.getDefaultClient()) =>
|
|
|
260
260
|
* @returns An array of all chains that have waas wallet accounts enabled
|
|
261
261
|
* but for which the current user does not yet have an embedded wallet account.
|
|
262
262
|
*/
|
|
263
|
-
const getChainsMissingWaasWalletAccounts = (client =
|
|
263
|
+
const getChainsMissingWaasWalletAccounts = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
264
264
|
const projectSettings = client.projectSettings;
|
|
265
|
-
|
|
265
|
+
require_InvalidParamError.assertDefined(projectSettings, "Project settings are not available");
|
|
266
266
|
const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;
|
|
267
267
|
const isWaasEnabled = isDynamicWaasEnabled(client);
|
|
268
268
|
const user = client.user;
|
|
@@ -273,6 +273,19 @@ const getChainsMissingWaasWalletAccounts = (client = require_constants.getDefaul
|
|
|
273
273
|
}));
|
|
274
274
|
};
|
|
275
275
|
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts
|
|
278
|
+
/**
|
|
279
|
+
* Retrieves the recovery state of a WaaS wallet account.
|
|
280
|
+
*
|
|
281
|
+
* @param params.walletAccount - The WaaS wallet account to get the recovery state for.
|
|
282
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
283
|
+
* @returns A promise that resolves with the wallet recovery state.
|
|
284
|
+
*/
|
|
285
|
+
const getWalletRecoveryState = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
286
|
+
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).getWalletRecoveryState({ walletAccount });
|
|
287
|
+
};
|
|
288
|
+
|
|
276
289
|
//#endregion
|
|
277
290
|
//#region src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts
|
|
278
291
|
/**
|
|
@@ -282,9 +295,9 @@ const getChainsMissingWaasWalletAccounts = (client = require_constants.getDefaul
|
|
|
282
295
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
283
296
|
* @returns True if the wallet account has delegated access, false otherwise.
|
|
284
297
|
*/
|
|
285
|
-
const hasDelegatedAccess = ({ walletAccount }, client =
|
|
298
|
+
const hasDelegatedAccess = ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
286
299
|
const verifiedCredential = require_getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount({ walletAccount }, client);
|
|
287
|
-
|
|
300
|
+
require_InvalidParamError.assertDefined(verifiedCredential, "Verified credential not found for Waas wallet account");
|
|
288
301
|
return !!verifiedCredential.walletProperties?.keyShares?.some((keyShare) => keyShare.backupLocation === "delegated");
|
|
289
302
|
};
|
|
290
303
|
|
|
@@ -294,7 +307,7 @@ const getWaasWalletProviderByChain = ({ chain }, client) => {
|
|
|
294
307
|
const waasProvider = require_getVerifiedCredentialForWalletAccount.findWaasWalletProviderByChain({ chain }, client);
|
|
295
308
|
if (!waasProvider) throw new require_getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError({ walletProviderKey: require_getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
|
|
296
309
|
chain,
|
|
297
|
-
displayName:
|
|
310
|
+
displayName: require_InvalidParamError.DYNAMIC_WAAS_METADATA.displayName,
|
|
298
311
|
walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
|
|
299
312
|
}) });
|
|
300
313
|
return waasProvider;
|
|
@@ -314,7 +327,7 @@ const getWaasWalletProviderByChain = ({ chain }, client) => {
|
|
|
314
327
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
315
328
|
* @returns A promise that resolves when the private key is successfully imported.
|
|
316
329
|
*/
|
|
317
|
-
const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client =
|
|
330
|
+
const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
318
331
|
return getWaasWalletProviderByChain({ chain }, client).importPrivateKey({
|
|
319
332
|
privateKey,
|
|
320
333
|
thresholdSignatureScheme
|
|
@@ -333,9 +346,9 @@ const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureSchem
|
|
|
333
346
|
* @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
334
347
|
* @returns True if the user has any password protected Waas wallets, false otherwise
|
|
335
348
|
*/
|
|
336
|
-
const isPasswordRequiredForWaasWallets = (client =
|
|
349
|
+
const isPasswordRequiredForWaasWallets = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
337
350
|
const { user } = client;
|
|
338
|
-
|
|
351
|
+
require_InvalidParamError.assertDefined(user, "User is not authenticated");
|
|
339
352
|
return user.verifiedCredentials.some((credential) => credential.walletProperties?.keyShares?.some((keyShare) => keyShare.passwordEncrypted));
|
|
340
353
|
};
|
|
341
354
|
|
|
@@ -352,7 +365,7 @@ const isPasswordRequiredForWaasWallets = (client = require_constants.getDefaultC
|
|
|
352
365
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
353
366
|
* @returns A promise that resolves when the key shares are refreshed.
|
|
354
367
|
*/
|
|
355
|
-
const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client =
|
|
368
|
+
const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
356
369
|
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).refreshWalletAccountShares({
|
|
357
370
|
password,
|
|
358
371
|
walletAccount
|
|
@@ -369,7 +382,7 @@ const refreshWaasWalletAccountShares = async ({ walletAccount, password }, clien
|
|
|
369
382
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
370
383
|
* @returns A promise that resolves when the delegation is revoked.
|
|
371
384
|
*/
|
|
372
|
-
const revokeWaasDelegation = async ({ password, walletAccount }, client =
|
|
385
|
+
const revokeWaasDelegation = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
373
386
|
await getWaasWalletProviderFromWalletAccount({ walletAccount }, client).revokeDelegation({
|
|
374
387
|
password,
|
|
375
388
|
walletAccount
|
|
@@ -396,8 +409,8 @@ const userHasExternalWallet = (user) => {
|
|
|
396
409
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
397
410
|
* @returns True if a wallet should be auto-created for the chain, false otherwise.
|
|
398
411
|
*/
|
|
399
|
-
const shouldAutoCreateWalletForChain = ({ chain }, client =
|
|
400
|
-
|
|
412
|
+
const shouldAutoCreateWalletForChain = ({ chain }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
413
|
+
require_InvalidParamError.assertDefined(client.projectSettings, "Project settings are not available");
|
|
401
414
|
const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;
|
|
402
415
|
if (!embeddedWalletSettings?.automaticEmbeddedWalletCreation || !client.user) return false;
|
|
403
416
|
const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;
|
|
@@ -405,6 +418,23 @@ const shouldAutoCreateWalletForChain = ({ chain }, client = require_constants.ge
|
|
|
405
418
|
return getChainsMissingWaasWalletAccounts(client).includes(chain);
|
|
406
419
|
};
|
|
407
420
|
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/modules/waas/unlockWallet/unlockWallet.ts
|
|
423
|
+
/**
|
|
424
|
+
* Unlocks a WaaS wallet account.
|
|
425
|
+
*
|
|
426
|
+
* @param params.walletAccount - The WaaS wallet account to unlock.
|
|
427
|
+
* @param params.password - The password to unlock the wallet.
|
|
428
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
429
|
+
* @returns A promise that resolves with the wallet information.
|
|
430
|
+
*/
|
|
431
|
+
const unlockWallet = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
432
|
+
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).unlockWallet({
|
|
433
|
+
password,
|
|
434
|
+
walletAccount
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
|
|
408
438
|
//#endregion
|
|
409
439
|
//#region src/modules/waas/updateWaasPassword/updateWaasPassword.ts
|
|
410
440
|
/**
|
|
@@ -419,7 +449,7 @@ const shouldAutoCreateWalletForChain = ({ chain }, client = require_constants.ge
|
|
|
419
449
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
420
450
|
* @returns A promise that resolves when the password is successfully updated.
|
|
421
451
|
*/
|
|
422
|
-
const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client =
|
|
452
|
+
const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
423
453
|
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).updatePassword({
|
|
424
454
|
currentPassword,
|
|
425
455
|
newPassword,
|
|
@@ -429,7 +459,7 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
|
|
|
429
459
|
|
|
430
460
|
//#endregion
|
|
431
461
|
//#region src/exports/waas.ts
|
|
432
|
-
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(
|
|
462
|
+
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_InvalidParamError.name, require_InvalidParamError.version);
|
|
433
463
|
|
|
434
464
|
//#endregion
|
|
435
465
|
exports.NotWaasWalletProviderError = NotWaasWalletProviderError;
|
|
@@ -439,6 +469,7 @@ exports.delegateWaasKeyShares = delegateWaasKeyShares;
|
|
|
439
469
|
exports.exportWaasClientKeyshares = exportWaasClientKeyshares;
|
|
440
470
|
exports.exportWaasPrivateKey = exportWaasPrivateKey;
|
|
441
471
|
exports.getChainsMissingWaasWalletAccounts = getChainsMissingWaasWalletAccounts;
|
|
472
|
+
exports.getWalletRecoveryState = getWalletRecoveryState;
|
|
442
473
|
exports.hasDelegatedAccess = hasDelegatedAccess;
|
|
443
474
|
exports.importWaasPrivateKey = importWaasPrivateKey;
|
|
444
475
|
exports.isDynamicWaasEnabled = isDynamicWaasEnabled;
|
|
@@ -449,5 +480,6 @@ exports.normalizeWalletRequirements = normalizeWalletRequirements;
|
|
|
449
480
|
exports.refreshWaasWalletAccountShares = refreshWaasWalletAccountShares;
|
|
450
481
|
exports.revokeWaasDelegation = revokeWaasDelegation;
|
|
451
482
|
exports.shouldAutoCreateWalletForChain = shouldAutoCreateWalletForChain;
|
|
483
|
+
exports.unlockWallet = unlockWallet;
|
|
452
484
|
exports.updateWaasPassword = updateWaasPassword;
|
|
453
485
|
//# sourceMappingURL=waas.cjs.js.map
|
package/dist/waas.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waas.cjs.js","names":["BaseError","getWalletProviderFromWalletAccount","isWaasWalletProvider","NotWaasWalletAccountError","getDefaultClient","requirement: WalletCreationRequirement","getDefaultClient","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getWalletProviderByKey","NoWalletProviderFoundError","isWaasWalletProvider","refreshAuth","getDefaultClient","refreshAuth","getDefaultClient","getDefaultClient","WalletProviderEnum","getChainFromVerifiedCredentialChain","getDefaultClient","EmbeddedWalletVersionEnum","getDefaultClient","getDefaultClient","getVerifiedCredentialForWalletAccount","findWaasWalletProviderByChain","NoWalletProviderFoundError","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getDefaultClient","getDefaultClient","getDefaultClient","getDefaultClient","refreshAuth","JwtVerifiedCredentialFormatEnum","WalletProviderEnum","getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts","../src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts","../src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Backs up WaaS wallet key shares to Google Drive for secure recovery.\n *\n * This function creates a backup of the wallet's cryptographic key shares\n * to Google Drive, allowing users to recover their wallet later.\n *\n * @param params.walletAccount - The WaaS wallet account to backup.\n * @param [params.password] - Optional password to encrypt the backup.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the backup process is complete.\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n { password, walletAccount }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n password,\n walletAccount,\n });\n};\n","import type { Chain } from '../../chain';\nimport type { WalletCreationRequirement } from '../waas.types';\n\n/**\n * Type guard to check if an item is a WalletCreationRequirement object.\n * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.\n *\n * @param item - The item to check, either a WalletCreationRequirement or Chain string\n * @returns True if the item is a WalletCreationRequirement object\n */\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 */\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 */\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 */\nexport const createWaasWalletAccounts = async (\n {\n chains,\n password,\n thresholdSignatureScheme,\n }: CreateWaasWalletAccountsParams,\n client = getDefaultClient()\n): Promise<void> => {\n const normalizedRequirements = normalizeWalletRequirements({ input: chains });\n\n // we need this right now so we don't try to create wallet accounts for chains\n // that we don't support Dynamic Waas yet in the JS SDK, like TRON\n const supportedChains = ['BTC', 'EVM', 'SOL', 'SUI'];\n\n const filteredRequirements = normalizedRequirements.filter((requirement) =>\n supportedChains.includes(requirement.chain)\n );\n\n if (filteredRequirements.length === 0) {\n return;\n }\n\n const walletProviderMap = new Map<\n string,\n ReturnType<typeof getWalletProviderByKey>\n >();\n\n for (const requirement of filteredRequirements) {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n if (!walletProviderMap.has(walletProviderKey)) {\n const walletProvider = getWalletProviderByKey(\n { walletProviderKey },\n client\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({\n walletProviderKey,\n });\n }\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletProviderError({\n walletProviderKey,\n });\n }\n\n walletProviderMap.set(walletProviderKey, walletProvider);\n }\n }\n\n await Promise.all(\n filteredRequirements.map((requirement) => {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const walletProvider = walletProviderMap.get(walletProviderKey);\n\n if (!walletProvider || !isWaasWalletProvider(walletProvider)) {\n return Promise.resolve();\n }\n\n return walletProvider.createWalletAccount({\n bitcoinConfig: requirement.bitcoinConfig,\n password,\n thresholdSignatureScheme,\n });\n })\n );\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n */\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 */\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 */\nexport const exportWaasPrivateKey = async (\n { displayContainer, password, walletAccount }: ExportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportPrivateKey({\n displayContainer,\n password,\n walletAccount,\n });\n};\n","import { type SdkUser, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getChainFromVerifiedCredentialChain } from '../../../utils/getChainFromVerifiedCredentialChain';\nimport type { Chain } from '../../chain/chain.types';\n\ntype UserHasEmbeddedWalletForChainProps = {\n chain: Chain;\n user: SdkUser;\n};\n\nexport const userHasEmbeddedWalletForChain = ({\n user,\n chain,\n}: UserHasEmbeddedWalletForChainProps): boolean => {\n const hasEmbeddedWalletForChain = user.verifiedCredentials.some(\n (vc) =>\n vc.walletProvider === WalletProviderEnum.EmbeddedWallet &&\n vc.chain &&\n getChainFromVerifiedCredentialChain(vc.chain) === chain\n );\n\n return hasEmbeddedWalletForChain;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain/chain.types';\nimport { userHasEmbeddedWalletForChain } from '../../wallets/userHasEmbeddedWalletForChain';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Gets all chains missing a waas wallet account for the current user.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of all chains that have waas wallet accounts enabled\n * but for which the current user does not yet have an embedded wallet account.\n */\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 { 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 */\nexport const hasDelegatedAccess = (\n { walletAccount }: HasDelegatedAccessParams,\n client = getDefaultClient()\n): boolean => {\n const verifiedCredential = getVerifiedCredentialForWalletAccount(\n { walletAccount },\n client\n );\n\n assertDefined(\n verifiedCredential,\n 'Verified credential not found for Waas wallet account'\n );\n\n const hasDelegatedKeyShare =\n verifiedCredential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.backupLocation === 'delegated'\n );\n\n return !!hasDelegatedKeyShare;\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport type { WaasWalletProvider } from '../waas.types';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain/findWaasWalletProviderByChain';\n\ntype GetWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\nexport const getWaasWalletProviderByChain = (\n { chain }: GetWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const waasProvider = findWaasWalletProviderByChain({ chain }, client);\n\n if (!waasProvider) {\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n throw new NoWalletProviderFoundError({\n walletProviderKey: waasProviderKey,\n });\n }\n\n return waasProvider;\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { Chain } from '../../chain';\nimport { getWaasWalletProviderByChain } from '../getWaasWalletProviderByChain';\n\ntype ImportWaasPrivateKeyParams = {\n chain: Chain;\n privateKey: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Imports an existing private key to create a new WaaS wallet account.\n *\n * This function allows users to import their existing private key into\n * Dynamic's WaaS infrastructure for secure management.\n *\n * @param params.chain - The chain for the imported wallet.\n * @param params.privateKey - The private key to import.\n * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key is successfully imported.\n */\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 */\nexport const isPasswordRequiredForWaasWallets = (\n client = getDefaultClient()\n): boolean => {\n const { user } = client;\n\n assertDefined(user, 'User is not authenticated');\n\n return user.verifiedCredentials.some((credential) =>\n credential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.passwordEncrypted\n )\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RefreshWaasWalletAccountSharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Refreshes the cryptographic key shares for a WaaS wallet account.\n *\n * This function generates new key shares for the wallet while maintaining\n * the same threshold signature scheme.\n *\n * @param params.walletAccount - The WaaS wallet account to refresh shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key shares are refreshed.\n */\nexport const refreshWaasWalletAccountShares = async (\n { walletAccount, password }: RefreshWaasWalletAccountSharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.refreshWalletAccountShares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RevokeWaasDelegationParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Revokes the delegation of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to revoke delegation for.\n * @param [params.password] - Optional password for delegation operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the delegation is revoked.\n */\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 {\n JwtVerifiedCredentialFormatEnum,\n type SdkUser,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\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 */\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 { 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 */\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 { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getChainsMissingWaasWalletAccounts } from '../modules/waas/getChainsMissingWaasWalletAccounts';\nexport { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';\nexport { importWaasPrivateKey } from '../modules/waas/importWaasPrivateKey';\nexport { isDynamicWaasEnabled } from '../modules/waas/isDynamicWaasEnabled';\nexport { isPasswordRequiredForWaasWallets } from '../modules/waas/isPasswordRequiredForWaasWallets';\nexport { isWalletCreationRequirement } from '../modules/waas/isWalletCreationRequirement/isWalletCreationRequirement';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { isWaasWalletAccount } from '../modules/waas/isWaasWalletAccount';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;;AAMA,IAAa,6BAAb,cAAgDA,4BAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;ACHN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiBC,iFACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAACC,mEAAqB,eAAe,CACvC,OAAM,IAAIC,4DAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;;ACNT,MAAa,mCAAmC,OAC9C,EAAE,UAAU,iBACZ,SAASC,oCAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,6BAA6B;EAC3C;EACA;EACD,CAAC;;;;;;;;;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ount","isWaasWalletProvider","NotWaasWalletAccountError","getDefaultClient","requirement: WalletCreationRequirement","getDefaultClient","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getWalletProviderByKey","NoWalletProviderFoundError","isWaasWalletProvider","refreshAuth","getDefaultClient","refreshAuth","getDefaultClient","getDefaultClient","WalletProviderEnum","getChainFromVerifiedCredentialChain","getDefaultClient","EmbeddedWalletVersionEnum","getDefaultClient","getDefaultClient","getDefaultClient","getVerifiedCredentialForWalletAccount","findWaasWalletProviderByChain","NoWalletProviderFoundError","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getDefaultClient","getDefaultClient","getDefaultClient","getDefaultClient","refreshAuth","JwtVerifiedCredentialFormatEnum","WalletProviderEnum","getDefaultClient","getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts","../src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts","../src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts","../src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts","../src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts","../src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts","../src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts","../src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts","../src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts","../src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Backs up WaaS wallet key shares to Google Drive for secure recovery.\n *\n * This function creates a backup of the wallet's cryptographic key shares\n * to Google Drive, allowing users to recover their wallet later.\n *\n * @param params.walletAccount - The WaaS wallet account to backup.\n * @param [params.password] - Optional password to encrypt the backup.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the backup process is complete.\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n { password, walletAccount }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n password,\n walletAccount,\n });\n};\n","import type { Chain } from '../../chain';\nimport type { WalletCreationRequirement } from '../waas.types';\n\n/**\n * Type guard to check if an item is a WalletCreationRequirement object.\n * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.\n *\n * @param item - The item to check, either a WalletCreationRequirement or Chain string\n * @returns True if the item is a WalletCreationRequirement object\n */\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 */\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 */\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 */\nexport const createWaasWalletAccounts = async (\n {\n chains,\n password,\n thresholdSignatureScheme,\n }: CreateWaasWalletAccountsParams,\n client = getDefaultClient()\n): Promise<void> => {\n const normalizedRequirements = normalizeWalletRequirements({ input: chains });\n\n // we need this right now so we don't try to create wallet accounts for chains\n // that we don't support Dynamic Waas yet in the JS SDK, like TRON\n const supportedChains = ['BTC', 'EVM', 'SOL', 'SUI'];\n\n const filteredRequirements = normalizedRequirements.filter((requirement) =>\n supportedChains.includes(requirement.chain)\n );\n\n if (filteredRequirements.length === 0) {\n return;\n }\n\n const walletProviderMap = new Map<\n string,\n ReturnType<typeof getWalletProviderByKey>\n >();\n\n for (const requirement of filteredRequirements) {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n if (!walletProviderMap.has(walletProviderKey)) {\n const walletProvider = getWalletProviderByKey(\n { walletProviderKey },\n client\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({\n walletProviderKey,\n });\n }\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletProviderError({\n walletProviderKey,\n });\n }\n\n walletProviderMap.set(walletProviderKey, walletProvider);\n }\n }\n\n await Promise.all(\n filteredRequirements.map((requirement) => {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const walletProvider = walletProviderMap.get(walletProviderKey);\n\n if (!walletProvider || !isWaasWalletProvider(walletProvider)) {\n return Promise.resolve();\n }\n\n return walletProvider.createWalletAccount({\n bitcoinConfig: requirement.bitcoinConfig,\n password,\n thresholdSignatureScheme,\n });\n })\n );\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n */\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 */\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 */\nexport const exportWaasPrivateKey = async (\n { displayContainer, password, walletAccount }: ExportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportPrivateKey({\n displayContainer,\n password,\n walletAccount,\n });\n};\n","import { type SdkUser, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getChainFromVerifiedCredentialChain } from '../../../utils/getChainFromVerifiedCredentialChain';\nimport type { Chain } from '../../chain/chain.types';\n\ntype UserHasEmbeddedWalletForChainProps = {\n chain: Chain;\n user: SdkUser;\n};\n\nexport const userHasEmbeddedWalletForChain = ({\n user,\n chain,\n}: UserHasEmbeddedWalletForChainProps): boolean => {\n const hasEmbeddedWalletForChain = user.verifiedCredentials.some(\n (vc) =>\n vc.walletProvider === WalletProviderEnum.EmbeddedWallet &&\n vc.chain &&\n getChainFromVerifiedCredentialChain(vc.chain) === chain\n );\n\n return hasEmbeddedWalletForChain;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain/chain.types';\nimport { userHasEmbeddedWalletForChain } from '../../wallets/userHasEmbeddedWalletForChain';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Gets all chains missing a waas wallet account for the current user.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of all chains that have waas wallet accounts enabled\n * but for which the current user does not yet have an embedded wallet account.\n */\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 */\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 */\nexport const hasDelegatedAccess = (\n { walletAccount }: HasDelegatedAccessParams,\n client = getDefaultClient()\n): boolean => {\n const verifiedCredential = getVerifiedCredentialForWalletAccount(\n { walletAccount },\n client\n );\n\n assertDefined(\n verifiedCredential,\n 'Verified credential not found for Waas wallet account'\n );\n\n const hasDelegatedKeyShare =\n verifiedCredential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.backupLocation === 'delegated'\n );\n\n return !!hasDelegatedKeyShare;\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport type { WaasWalletProvider } from '../waas.types';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain/findWaasWalletProviderByChain';\n\ntype GetWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\nexport const getWaasWalletProviderByChain = (\n { chain }: GetWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const waasProvider = findWaasWalletProviderByChain({ chain }, client);\n\n if (!waasProvider) {\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n throw new NoWalletProviderFoundError({\n walletProviderKey: waasProviderKey,\n });\n }\n\n return waasProvider;\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { Chain } from '../../chain';\nimport { getWaasWalletProviderByChain } from '../getWaasWalletProviderByChain';\n\ntype ImportWaasPrivateKeyParams = {\n chain: Chain;\n privateKey: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Imports an existing private key to create a new WaaS wallet account.\n *\n * This function allows users to import their existing private key into\n * Dynamic's WaaS infrastructure for secure management.\n *\n * @param params.chain - The chain for the imported wallet.\n * @param params.privateKey - The private key to import.\n * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key is successfully imported.\n */\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 */\nexport const isPasswordRequiredForWaasWallets = (\n client = getDefaultClient()\n): boolean => {\n const { user } = client;\n\n assertDefined(user, 'User is not authenticated');\n\n return user.verifiedCredentials.some((credential) =>\n credential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.passwordEncrypted\n )\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RefreshWaasWalletAccountSharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Refreshes the cryptographic key shares for a WaaS wallet account.\n *\n * This function generates new key shares for the wallet while maintaining\n * the same threshold signature scheme.\n *\n * @param params.walletAccount - The WaaS wallet account to refresh shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key shares are refreshed.\n */\nexport const refreshWaasWalletAccountShares = async (\n { walletAccount, password }: RefreshWaasWalletAccountSharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.refreshWalletAccountShares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RevokeWaasDelegationParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Revokes the delegation of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to revoke delegation for.\n * @param [params.password] - Optional password for delegation operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the delegation is revoked.\n */\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 {\n JwtVerifiedCredentialFormatEnum,\n type SdkUser,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\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 */\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 */\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 */\nexport const updateWaasPassword = async (\n { currentPassword, newPassword, walletAccount }: UpdateWaasPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.updatePassword({\n currentPassword,\n newPassword,\n walletAccount,\n });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport type {\n GetWalletResponse,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getChainsMissingWaasWalletAccounts } from '../modules/waas/getChainsMissingWaasWalletAccounts';\nexport { getWalletRecoveryState } from '../modules/waas/getWalletRecoveryState';\nexport { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';\nexport { importWaasPrivateKey } from '../modules/waas/importWaasPrivateKey';\nexport { isDynamicWaasEnabled } from '../modules/waas/isDynamicWaasEnabled';\nexport { isPasswordRequiredForWaasWallets } from '../modules/waas/isPasswordRequiredForWaasWallets';\nexport { isWaasWalletAccount } from '../modules/waas/isWaasWalletAccount';\nexport { isWalletCreationRequirement } from '../modules/waas/isWalletCreationRequirement/isWalletCreationRequirement';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;;AAMA,IAAa,6BAAb,cAAgDA,oCAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;ACHN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiBC,iFACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAACC,mEAAqB,eAAe,CACvC,OAAM,IAAIC,4DAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;;ACNT,MAAa,mCAAmC,OAC9C,EAAE,UAAU,iBACZ,SAASC,4CAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,6BAA6B;EAC3C;EACA;EACD,CAAC;;;;;;;;;;;;ACtBJ,MAAa,+BACX,SAEA,OAAO,SAAS,YAAY,SAAS,QAAQ,WAAW;;;;ACN1D,MAAM,+BAA+B;;;;;;;;;;;AAiBrC,MAAa,+BAA+B,EAC1C,sBACA,YACoE;AACpE,KAAI,MAAM,WAAW,EACnB,QAAO,EAAE;CAGX,MAAM,CAAC,aAAa;AAEpB,KAAI,4BAA4B,UAAU,CACxC,QAAQ,MAAsC,KAAK,gBAAgB;AACjE,MAAI,YAAY,UAAU,SAAS,CAAC,YAAY,cAC9C,QAAO;GACL,GAAG;GACH,eAAe,EAAE,aAAa,8BAA8B;GAC7D;AAGH,SAAO;GACP;AAGJ,QAAQ,MAAkB,KAAK,UAAU;EACvC,MAAMC,cAAyC,EAAE,OAAO;AAExD,MAAI,UAAU,MACZ,aAAY,gBAAgB,wBAAwB,EAClD,aAAa,8BACd;AAGH,SAAO;GACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmBJ,MAAa,2BAA2B,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C,8CAAY,OAAO;;;;;AC1B3B,MAAa,yBAAyB,SAAkB;AAOtD,QAN0B,MAAM,oBAAoB,MACjD,OACC,GAAG,WAAWC,2DAAgC,cAC9C,GAAG,mBAAmBC,8CAAmB,eAC5C;;;;;;;;;;;;;;;;ACUH,MAAa,kCACX,EAAE,SACF,SAASC,4CAAkB,KACxB;AACH,yCAAc,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,SAASC,4CAAkB,KACI;AAM/B,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,aAAa;EAC3B;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;ACTJ,MAAa,qBAAqB,OAChC,EAAE,iBAAiB,aAAa,iBAChC,SAASC,4CAAkB,KACxB;AAMH,QALiB,uCACf,EAAE,eAAe,EACjB,OACD,CAEe,eAAe;EAC7B;EACA;EACA;EACD,CAAC;;;;;mEC7BiBC,gCAAaC,kCAAe"}
|
package/dist/waas.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as isWaasWalletAccount, f as getWalletProviderFromWalletAccount, g as NoWalletProviderFoundError, n as getWalletProviderByKey, o as findWaasWalletProviderByChain, s as isWaasWalletProvider, t as getVerifiedCredentialForWalletAccount, v as formatWalletProviderKey } from "./getVerifiedCredentialForWalletAccount-
|
|
3
|
-
import { n as refreshAuth, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-
|
|
1
|
+
import { A as version, D as BaseError, i as DYNAMIC_WAAS_METADATA, k as name, s as getChainFromVerifiedCredentialChain, w as getDefaultClient, y as assertDefined } from "./InvalidParamError-DMz6QY8e.esm.js";
|
|
2
|
+
import { a as isWaasWalletAccount, f as getWalletProviderFromWalletAccount, g as NoWalletProviderFoundError, n as getWalletProviderByKey, o as findWaasWalletProviderByChain, s as isWaasWalletProvider, t as getVerifiedCredentialForWalletAccount, v as formatWalletProviderKey } from "./getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js";
|
|
3
|
+
import { n as refreshAuth, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-Cp3qfAxw.esm.js";
|
|
4
4
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
5
5
|
import { EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
6
6
|
|
|
@@ -272,6 +272,19 @@ const getChainsMissingWaasWalletAccounts = (client = getDefaultClient()) => {
|
|
|
272
272
|
}));
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts
|
|
277
|
+
/**
|
|
278
|
+
* Retrieves the recovery state of a WaaS wallet account.
|
|
279
|
+
*
|
|
280
|
+
* @param params.walletAccount - The WaaS wallet account to get the recovery state for.
|
|
281
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
282
|
+
* @returns A promise that resolves with the wallet recovery state.
|
|
283
|
+
*/
|
|
284
|
+
const getWalletRecoveryState = async ({ walletAccount }, client = getDefaultClient()) => {
|
|
285
|
+
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).getWalletRecoveryState({ walletAccount });
|
|
286
|
+
};
|
|
287
|
+
|
|
275
288
|
//#endregion
|
|
276
289
|
//#region src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts
|
|
277
290
|
/**
|
|
@@ -404,6 +417,23 @@ const shouldAutoCreateWalletForChain = ({ chain }, client = getDefaultClient())
|
|
|
404
417
|
return getChainsMissingWaasWalletAccounts(client).includes(chain);
|
|
405
418
|
};
|
|
406
419
|
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/modules/waas/unlockWallet/unlockWallet.ts
|
|
422
|
+
/**
|
|
423
|
+
* Unlocks a WaaS wallet account.
|
|
424
|
+
*
|
|
425
|
+
* @param params.walletAccount - The WaaS wallet account to unlock.
|
|
426
|
+
* @param params.password - The password to unlock the wallet.
|
|
427
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
428
|
+
* @returns A promise that resolves with the wallet information.
|
|
429
|
+
*/
|
|
430
|
+
const unlockWallet = async ({ password, walletAccount }, client = getDefaultClient()) => {
|
|
431
|
+
return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).unlockWallet({
|
|
432
|
+
password,
|
|
433
|
+
walletAccount
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
|
|
407
437
|
//#endregion
|
|
408
438
|
//#region src/modules/waas/updateWaasPassword/updateWaasPassword.ts
|
|
409
439
|
/**
|
|
@@ -431,5 +461,5 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
|
|
|
431
461
|
assertPackageVersion(name, version);
|
|
432
462
|
|
|
433
463
|
//#endregion
|
|
434
|
-
export { NotWaasWalletProviderError, backupWaasKeySharesToGoogleDrive, createWaasWalletAccounts, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getChainsMissingWaasWalletAccounts, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, normalizeWalletRequirements, refreshWaasWalletAccountShares, revokeWaasDelegation, shouldAutoCreateWalletForChain, updateWaasPassword };
|
|
464
|
+
export { NotWaasWalletProviderError, backupWaasKeySharesToGoogleDrive, createWaasWalletAccounts, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, normalizeWalletRequirements, refreshWaasWalletAccountShares, revokeWaasDelegation, shouldAutoCreateWalletForChain, unlockWallet, updateWaasPassword };
|
|
435
465
|
//# sourceMappingURL=waas.esm.js.map
|