@dynamic-labs-sdk/client 1.16.0 → 1.17.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.
Files changed (112) hide show
  1. package/dist/core.cjs +53 -53
  2. package/dist/core.cjs.map +1 -1
  3. package/dist/core.esm.js +7 -7
  4. package/dist/core.esm.js.map +1 -1
  5. package/dist/core.native.esm.js +5 -5
  6. package/dist/exports/waas.d.ts +2 -1
  7. package/dist/exports/waas.d.ts.map +1 -1
  8. package/dist/exports/waasCore.d.ts +3 -2
  9. package/dist/exports/waasCore.d.ts.map +1 -1
  10. package/dist/{getNetworkProviderFromNetworkId-CregkqLB.esm.js → getNetworkProviderFromNetworkId-BVVs3arj.esm.js} +6 -7
  11. package/dist/getNetworkProviderFromNetworkId-BVVs3arj.esm.js.map +1 -0
  12. package/dist/{getNetworkProviderFromNetworkId-BURAkmc3.native.esm.js → getNetworkProviderFromNetworkId-DC1bhMuB.native.esm.js} +3 -4
  13. package/dist/{getNetworkProviderFromNetworkId-BURAkmc3.native.esm.js.map → getNetworkProviderFromNetworkId-DC1bhMuB.native.esm.js.map} +1 -1
  14. package/dist/{getNetworkProviderFromNetworkId-BpvoqbEH.cjs → getNetworkProviderFromNetworkId-DzzocxRc.cjs} +43 -44
  15. package/dist/{getNetworkProviderFromNetworkId-BpvoqbEH.cjs.map → getNetworkProviderFromNetworkId-DzzocxRc.cjs.map} +1 -1
  16. package/dist/{getSignedSessionId-Czpvp58E.esm.js → getSignedSessionId-Bnuz2Aqc.esm.js} +3 -3
  17. package/dist/{getSignedSessionId-Czpvp58E.esm.js.map → getSignedSessionId-Bnuz2Aqc.esm.js.map} +1 -1
  18. package/dist/{getSignedSessionId-C98wdvMw.cjs → getSignedSessionId-Dx0qQLMP.cjs} +11 -11
  19. package/dist/{getSignedSessionId-C98wdvMw.cjs.map → getSignedSessionId-Dx0qQLMP.cjs.map} +1 -1
  20. package/dist/{getSignedSessionId-upC71vLP.native.esm.js → getSignedSessionId-Pc_5wscD.native.esm.js} +3 -3
  21. package/dist/{getSignedSessionId-upC71vLP.native.esm.js.map → getSignedSessionId-Pc_5wscD.native.esm.js.map} +1 -1
  22. package/dist/getWalletProviderByKey-BL3u0e-d.esm.js +20 -0
  23. package/dist/getWalletProviderByKey-BL3u0e-d.esm.js.map +1 -0
  24. package/dist/getWalletProviderByKey-BLWcueTR.cjs +31 -0
  25. package/dist/getWalletProviderByKey-BLWcueTR.cjs.map +1 -0
  26. package/dist/getWalletProviderByKey-DhqKzh7g.native.esm.js +20 -0
  27. package/dist/getWalletProviderByKey-DhqKzh7g.native.esm.js.map +1 -0
  28. package/dist/index.cjs +539 -540
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.esm.js +9 -10
  31. package/dist/index.esm.js.map +1 -1
  32. package/dist/index.native.esm.js +6 -7
  33. package/dist/index.native.esm.js.map +1 -1
  34. package/dist/isDynamicWaasEnabled-BEn7FcD9.cjs +88 -0
  35. package/dist/isDynamicWaasEnabled-BEn7FcD9.cjs.map +1 -0
  36. package/dist/isDynamicWaasEnabled-CvBaMGlR.native.esm.js +70 -0
  37. package/dist/isDynamicWaasEnabled-CvBaMGlR.native.esm.js.map +1 -0
  38. package/dist/isDynamicWaasEnabled-DYy0TvLy.esm.js +70 -0
  39. package/dist/isDynamicWaasEnabled-DYy0TvLy.esm.js.map +1 -0
  40. package/dist/{isMfaRequiredForAction-CgVdSGRA.esm.js → isMfaRequiredForAction-B7wNkqQf.esm.js} +2 -2
  41. package/dist/{isMfaRequiredForAction-CgVdSGRA.esm.js.map → isMfaRequiredForAction-B7wNkqQf.esm.js.map} +1 -1
  42. package/dist/{isMfaRequiredForAction-juTvf3Pl.native.esm.js → isMfaRequiredForAction-CJ9qbBUz.native.esm.js} +2 -2
  43. package/dist/{isMfaRequiredForAction-juTvf3Pl.native.esm.js.map → isMfaRequiredForAction-CJ9qbBUz.native.esm.js.map} +1 -1
  44. package/dist/{isMfaRequiredForAction-DECknr5q.cjs → isMfaRequiredForAction-CaNdGc-m.cjs} +29 -29
  45. package/dist/{isMfaRequiredForAction-DECknr5q.cjs.map → isMfaRequiredForAction-CaNdGc-m.cjs.map} +1 -1
  46. package/dist/{isUserOnboardingComplete-DFrrp61b.esm.js → isUserOnboardingComplete-CGz-9Iyw.esm.js} +3 -3
  47. package/dist/{isUserOnboardingComplete-DFrrp61b.esm.js.map → isUserOnboardingComplete-CGz-9Iyw.esm.js.map} +1 -1
  48. package/dist/{isUserOnboardingComplete-Dtr1_Mi4.native.esm.js → isUserOnboardingComplete-FRAIuxdi.native.esm.js} +3 -3
  49. package/dist/{isUserOnboardingComplete-Dtr1_Mi4.native.esm.js.map → isUserOnboardingComplete-FRAIuxdi.native.esm.js.map} +1 -1
  50. package/dist/{isUserOnboardingComplete-DvCQh8Dj.cjs → isUserOnboardingComplete-w1IkCC_p.cjs} +13 -13
  51. package/dist/{isUserOnboardingComplete-DvCQh8Dj.cjs.map → isUserOnboardingComplete-w1IkCC_p.cjs.map} +1 -1
  52. package/dist/migrateFromFireblocks-C-IqJz3q.native.esm.js +65 -0
  53. package/dist/migrateFromFireblocks-C-IqJz3q.native.esm.js.map +1 -0
  54. package/dist/migrateFromFireblocks-CjQWJPZW.cjs +82 -0
  55. package/dist/migrateFromFireblocks-CjQWJPZW.cjs.map +1 -0
  56. package/dist/migrateFromFireblocks-DXs3odF_.esm.js +65 -0
  57. package/dist/migrateFromFireblocks-DXs3odF_.esm.js.map +1 -0
  58. package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
  59. package/dist/modules/waas/migrateFromFireblocks/index.d.ts +2 -0
  60. package/dist/modules/waas/migrateFromFireblocks/index.d.ts.map +1 -0
  61. package/dist/modules/waas/migrateFromFireblocks/migrateFromFireblocks.d.ts +52 -0
  62. package/dist/modules/waas/migrateFromFireblocks/migrateFromFireblocks.d.ts.map +1 -0
  63. package/dist/modules/waas/waas.types.d.ts +9 -1
  64. package/dist/modules/waas/waas.types.d.ts.map +1 -1
  65. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  66. package/dist/{InvalidParamError-Dn_riAvL.esm.js → updateAuthFromVerifyResponse-BdokPJ21.esm.js} +237 -3
  67. package/dist/updateAuthFromVerifyResponse-BdokPJ21.esm.js.map +1 -0
  68. package/dist/{InvalidParamError-DHriGGNI.cjs → updateAuthFromVerifyResponse-CUnvs5Af.cjs} +291 -9
  69. package/dist/updateAuthFromVerifyResponse-CUnvs5Af.cjs.map +1 -0
  70. package/dist/{InvalidParamError-DYezznCD.native.esm.js → updateAuthFromVerifyResponse-DW-tPgdV.native.esm.js} +457 -4
  71. package/dist/updateAuthFromVerifyResponse-DW-tPgdV.native.esm.js.map +1 -0
  72. package/dist/waas.cjs +53 -67
  73. package/dist/waas.cjs.map +1 -1
  74. package/dist/waas.esm.js +5 -20
  75. package/dist/waas.esm.js.map +1 -1
  76. package/dist/waas.native.esm.js +5 -20
  77. package/dist/waas.native.esm.js.map +1 -1
  78. package/dist/waasCore.cjs +40 -23
  79. package/dist/waasCore.cjs.map +1 -1
  80. package/dist/waasCore.esm.js +23 -7
  81. package/dist/waasCore.esm.js.map +1 -1
  82. package/dist/waasCore.native.esm.js +23 -7
  83. package/dist/waasCore.native.esm.js.map +1 -1
  84. package/package.json +2 -2
  85. package/dist/InvalidParamError-DHriGGNI.cjs.map +0 -1
  86. package/dist/InvalidParamError-DYezznCD.native.esm.js.map +0 -1
  87. package/dist/InvalidParamError-Dn_riAvL.esm.js.map +0 -1
  88. package/dist/getNetworkProviderFromNetworkId-CregkqLB.esm.js.map +0 -1
  89. package/dist/getWaasWalletProviderFromWalletAccount-BrskhuL8.cjs +0 -19
  90. package/dist/getWaasWalletProviderFromWalletAccount-BrskhuL8.cjs.map +0 -1
  91. package/dist/getWaasWalletProviderFromWalletAccount-DHKga3uH.native.esm.js +0 -14
  92. package/dist/getWaasWalletProviderFromWalletAccount-DHKga3uH.native.esm.js.map +0 -1
  93. package/dist/getWaasWalletProviderFromWalletAccount-Dc6QvHVt.esm.js +0 -14
  94. package/dist/getWaasWalletProviderFromWalletAccount-Dc6QvHVt.esm.js.map +0 -1
  95. package/dist/getWalletProviderByKey-DDNCUbUe.cjs +0 -321
  96. package/dist/getWalletProviderByKey-DDNCUbUe.cjs.map +0 -1
  97. package/dist/getWalletProviderByKey-DTi6MhKt.esm.js +0 -255
  98. package/dist/getWalletProviderByKey-DTi6MhKt.esm.js.map +0 -1
  99. package/dist/getWalletProviderByKey-OYhHm11_.native.esm.js +0 -474
  100. package/dist/getWalletProviderByKey-OYhHm11_.native.esm.js.map +0 -1
  101. package/dist/isDynamicWaasEnabled-Bj3v8LZ_.cjs +0 -49
  102. package/dist/isDynamicWaasEnabled-Bj3v8LZ_.cjs.map +0 -1
  103. package/dist/isDynamicWaasEnabled-CuSe2RO1.esm.js +0 -37
  104. package/dist/isDynamicWaasEnabled-CuSe2RO1.esm.js.map +0 -1
  105. package/dist/isDynamicWaasEnabled-CvD8_c7H.native.esm.js +0 -37
  106. package/dist/isDynamicWaasEnabled-CvD8_c7H.native.esm.js.map +0 -1
  107. package/dist/refreshAuth-CKHkaRJo.native.esm.js +0 -38
  108. package/dist/refreshAuth-CKHkaRJo.native.esm.js.map +0 -1
  109. package/dist/refreshAuth-Q5fxSi3Z.esm.js +0 -38
  110. package/dist/refreshAuth-Q5fxSi3Z.esm.js.map +0 -1
  111. package/dist/refreshAuth-oycoOXtD.cjs +0 -43
  112. package/dist/refreshAuth-oycoOXtD.cjs.map +0 -1
package/dist/waas.cjs CHANGED
@@ -1,26 +1,11 @@
1
- const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-DECknr5q.cjs');
2
- const require_InvalidParamError = require('./InvalidParamError-DHriGGNI.cjs');
3
- const require_getWalletProviderByKey = require('./getWalletProviderByKey-DDNCUbUe.cjs');
4
- const require_refreshAuth = require('./refreshAuth-oycoOXtD.cjs');
5
- const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-Bj3v8LZ_.cjs');
6
- const require_getWaasWalletProviderFromWalletAccount = require('./getWaasWalletProviderFromWalletAccount-BrskhuL8.cjs');
1
+ const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-CaNdGc-m.cjs');
2
+ const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CUnvs5Af.cjs');
3
+ const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-BEn7FcD9.cjs');
4
+ const require_getWalletProviderByKey = require('./getWalletProviderByKey-BLWcueTR.cjs');
5
+ const require_migrateFromFireblocks = require('./migrateFromFireblocks-CjQWJPZW.cjs');
7
6
  let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
8
7
  let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
9
8
 
10
- //#region src/errors/NotWaasWalletProviderError.ts
11
- var NotWaasWalletProviderError = class extends require_InvalidParamError.BaseError {
12
- constructor({ walletProviderKey }) {
13
- super({
14
- cause: null,
15
- code: "not_waas_wallet_provider_error",
16
- docsUrl: null,
17
- name: "NotWaasWalletProviderError",
18
- shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`
19
- });
20
- }
21
- };
22
-
23
- //#endregion
24
9
  //#region src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts
25
10
  /**
26
11
  * Backs up WaaS wallet key shares to Google Drive for secure recovery.
@@ -35,8 +20,8 @@ var NotWaasWalletProviderError = class extends require_InvalidParamError.BaseErr
35
20
  * @returns A promise that resolves when the backup process is complete.
36
21
  * @notInstrumented
37
22
  */
38
- const backupWaasKeySharesToGoogleDrive = async ({ googleDriveAccessToken, password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
39
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).backupKeySharesToGoogleDrive({
23
+ const backupWaasKeySharesToGoogleDrive = async ({ googleDriveAccessToken, password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
24
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).backupKeySharesToGoogleDrive({
40
25
  googleDriveAccessToken,
41
26
  password,
42
27
  walletAccount
@@ -124,7 +109,7 @@ const normalizeWalletRequirements = ({ defaultBitcoinConfig, input }) => {
124
109
  * @returns A promise that resolves when all wallet accounts are created.
125
110
  * @notInstrumented
126
111
  */
127
- const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureScheme }, client = require_InvalidParamError.getDefaultClient()) => {
112
+ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureScheme }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
128
113
  const normalizedRequirements = normalizeWalletRequirements({ input: chains });
129
114
  const supportedChains = [
130
115
  "BTC",
@@ -138,33 +123,33 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
138
123
  if (filteredRequirements.length === 0) return;
139
124
  const walletProviderMap = /* @__PURE__ */ new Map();
140
125
  for (const requirement of filteredRequirements) {
141
- const walletProviderKey = require_InvalidParamError.formatWalletProviderKey({
126
+ const walletProviderKey = require_updateAuthFromVerifyResponse.formatWalletProviderKey({
142
127
  chain: requirement.chain,
143
- displayName: require_InvalidParamError.DYNAMIC_WAAS_METADATA.displayName,
128
+ displayName: require_updateAuthFromVerifyResponse.DYNAMIC_WAAS_METADATA.displayName,
144
129
  walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
145
130
  });
146
131
  if (!walletProviderMap.has(walletProviderKey)) {
147
132
  const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
148
- if (!walletProvider) throw new require_InvalidParamError.NoWalletProviderFoundError({ walletProviderKey });
149
- if (!require_InvalidParamError.isWaasWalletProvider(walletProvider)) throw new NotWaasWalletProviderError({ walletProviderKey });
133
+ if (!walletProvider) throw new require_updateAuthFromVerifyResponse.NoWalletProviderFoundError({ walletProviderKey });
134
+ if (!require_updateAuthFromVerifyResponse.isWaasWalletProvider(walletProvider)) throw new require_migrateFromFireblocks.NotWaasWalletProviderError({ walletProviderKey });
150
135
  walletProviderMap.set(walletProviderKey, walletProvider);
151
136
  }
152
137
  }
153
138
  await Promise.all(filteredRequirements.map((requirement) => {
154
- const walletProviderKey = require_InvalidParamError.formatWalletProviderKey({
139
+ const walletProviderKey = require_updateAuthFromVerifyResponse.formatWalletProviderKey({
155
140
  chain: requirement.chain,
156
- displayName: require_InvalidParamError.DYNAMIC_WAAS_METADATA.displayName,
141
+ displayName: require_updateAuthFromVerifyResponse.DYNAMIC_WAAS_METADATA.displayName,
157
142
  walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
158
143
  });
159
144
  const walletProvider = walletProviderMap.get(walletProviderKey);
160
- if (!walletProvider || !require_InvalidParamError.isWaasWalletProvider(walletProvider)) return Promise.resolve();
145
+ if (!walletProvider || !require_updateAuthFromVerifyResponse.isWaasWalletProvider(walletProvider)) return Promise.resolve();
161
146
  return walletProvider.createWalletAccount({
162
147
  bitcoinConfig: requirement.bitcoinConfig,
163
148
  password,
164
149
  thresholdSignatureScheme
165
150
  });
166
151
  }));
167
- await require_refreshAuth.__refreshAuth_wrapped(client);
152
+ await require_isDynamicWaasEnabled.__refreshAuth_wrapped(client);
168
153
  };
169
154
 
170
155
  //#endregion
@@ -181,12 +166,12 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
181
166
  * @returns A promise that resolves when the key delegation is complete.
182
167
  * @notInstrumented
183
168
  */
184
- const delegateWaasKeyShares = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
185
- await require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).delegateKeyShares({
169
+ const delegateWaasKeyShares = async ({ password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
170
+ await require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).delegateKeyShares({
186
171
  password,
187
172
  walletAccount
188
173
  });
189
- await require_refreshAuth.__refreshAuth_wrapped(client);
174
+ await require_isDynamicWaasEnabled.__refreshAuth_wrapped(client);
190
175
  };
191
176
 
192
177
  //#endregion
@@ -203,8 +188,8 @@ const delegateWaasKeyShares = async ({ password, walletAccount }, client = requi
203
188
  * @returns A promise that resolves to the exported key shares.
204
189
  * @notInstrumented
205
190
  */
206
- const exportWaasClientKeyshares = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
207
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportClientKeyshares({
191
+ const exportWaasClientKeyshares = async ({ password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
192
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportClientKeyshares({
208
193
  password,
209
194
  walletAccount
210
195
  });
@@ -225,8 +210,8 @@ const exportWaasClientKeyshares = async ({ password, walletAccount }, client = r
225
210
  * @returns A promise that resolves when the private key export is complete.
226
211
  * @notInstrumented
227
212
  */
228
- const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
229
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportPrivateKey({
213
+ const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
214
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportPrivateKey({
230
215
  displayContainer,
231
216
  password,
232
217
  walletAccount
@@ -237,7 +222,7 @@ const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount
237
222
  //#region src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts
238
223
  /** @notInstrumented */
239
224
  const userHasEmbeddedWalletForChain = ({ user, chain }) => {
240
- return user.verifiedCredentials.some((vc) => vc.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet && vc.chain && require_InvalidParamError.getChainFromVerifiedCredentialChain(vc.chain) === chain);
225
+ return user.verifiedCredentials.some((vc) => vc.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet && vc.chain && require_updateAuthFromVerifyResponse.getChainFromVerifiedCredentialChain(vc.chain) === chain);
241
226
  };
242
227
 
243
228
  //#endregion
@@ -250,9 +235,9 @@ const userHasEmbeddedWalletForChain = ({ user, chain }) => {
250
235
  * but for which the current user does not yet have an embedded wallet account.
251
236
  * @notInstrumented
252
237
  */
253
- const getChainsMissingWaasWalletAccounts = (client = require_InvalidParamError.getDefaultClient()) => {
238
+ const getChainsMissingWaasWalletAccounts = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
254
239
  const projectSettings = client.projectSettings;
255
- require_InvalidParamError.assertDefined(projectSettings, "Project settings are not available");
240
+ require_updateAuthFromVerifyResponse.assertDefined(projectSettings, "Project settings are not available");
256
241
  const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;
257
242
  const isWaasEnabled = require_isDynamicWaasEnabled.isDynamicWaasEnabled(client);
258
243
  const user = client.user;
@@ -273,8 +258,8 @@ const getChainsMissingWaasWalletAccounts = (client = require_InvalidParamError.g
273
258
  * @returns A promise that resolves with the wallet recovery state.
274
259
  * @notInstrumented
275
260
  */
276
- const getWalletRecoveryState = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
277
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).getWalletRecoveryState({ walletAccount });
261
+ const getWalletRecoveryState = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
262
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).getWalletRecoveryState({ walletAccount });
278
263
  };
279
264
 
280
265
  //#endregion
@@ -287,9 +272,9 @@ const getWalletRecoveryState = async ({ walletAccount }, client = require_Invali
287
272
  * @returns True if the wallet account has delegated access, false otherwise.
288
273
  * @notInstrumented
289
274
  */
290
- const hasDelegatedAccess = ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
275
+ const hasDelegatedAccess = ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
291
276
  const verifiedCredential = require_getWalletProviderByKey.getVerifiedCredentialForWalletAccount({ walletAccount }, client);
292
- require_InvalidParamError.assertDefined(verifiedCredential, "Verified credential not found for Waas wallet account");
277
+ require_updateAuthFromVerifyResponse.assertDefined(verifiedCredential, "Verified credential not found for Waas wallet account");
293
278
  return !!verifiedCredential.walletProperties?.keyShares?.some((keyShare) => keyShare.backupLocation === "delegated");
294
279
  };
295
280
 
@@ -297,10 +282,10 @@ const hasDelegatedAccess = ({ walletAccount }, client = require_InvalidParamErro
297
282
  //#region src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts
298
283
  /** @notInstrumented */
299
284
  const getWaasWalletProviderByChain = ({ chain }, client) => {
300
- const waasProvider = require_getWalletProviderByKey.findWaasWalletProviderByChain({ chain }, client);
301
- if (!waasProvider) throw new require_InvalidParamError.NoWalletProviderFoundError({ walletProviderKey: require_InvalidParamError.formatWalletProviderKey({
285
+ const waasProvider = require_updateAuthFromVerifyResponse.findWaasWalletProviderByChain({ chain }, client);
286
+ if (!waasProvider) throw new require_updateAuthFromVerifyResponse.NoWalletProviderFoundError({ walletProviderKey: require_updateAuthFromVerifyResponse.formatWalletProviderKey({
302
287
  chain,
303
- displayName: require_InvalidParamError.DYNAMIC_WAAS_METADATA.displayName,
288
+ displayName: require_updateAuthFromVerifyResponse.DYNAMIC_WAAS_METADATA.displayName,
304
289
  walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
305
290
  }) });
306
291
  return waasProvider;
@@ -321,7 +306,7 @@ const getWaasWalletProviderByChain = ({ chain }, client) => {
321
306
  * @returns A promise that resolves when the private key is successfully imported.
322
307
  * @notInstrumented
323
308
  */
324
- const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client = require_InvalidParamError.getDefaultClient()) => {
309
+ const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
325
310
  return getWaasWalletProviderByChain({ chain }, client).importPrivateKey({
326
311
  privateKey,
327
312
  thresholdSignatureScheme
@@ -341,9 +326,9 @@ const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureSchem
341
326
  * @returns True if the user has any password protected Waas wallets, false otherwise
342
327
  * @notInstrumented
343
328
  */
344
- const isPasswordRequiredForWaasWallets = (client = require_InvalidParamError.getDefaultClient()) => {
329
+ const isPasswordRequiredForWaasWallets = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
345
330
  const { user } = client;
346
- require_InvalidParamError.assertDefined(user, "User is not authenticated");
331
+ require_updateAuthFromVerifyResponse.assertDefined(user, "User is not authenticated");
347
332
  return user.verifiedCredentials.some((credential) => credential.walletProperties?.keyShares?.some((keyShare) => keyShare.passwordEncrypted));
348
333
  };
349
334
 
@@ -361,8 +346,8 @@ const isPasswordRequiredForWaasWallets = (client = require_InvalidParamError.get
361
346
  * @returns A promise that resolves when the key shares are refreshed.
362
347
  * @notInstrumented
363
348
  */
364
- const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client = require_InvalidParamError.getDefaultClient()) => {
365
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).refreshWalletAccountShares({
349
+ const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
350
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).refreshWalletAccountShares({
366
351
  password,
367
352
  walletAccount
368
353
  });
@@ -379,12 +364,12 @@ const refreshWaasWalletAccountShares = async ({ walletAccount, password }, clien
379
364
  * @returns A promise that resolves when the delegation is revoked.
380
365
  * @notInstrumented
381
366
  */
382
- const revokeWaasDelegation = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
383
- await require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).revokeDelegation({
367
+ const revokeWaasDelegation = async ({ password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
368
+ await require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).revokeDelegation({
384
369
  password,
385
370
  walletAccount
386
371
  });
387
- await require_refreshAuth.__refreshAuth_wrapped(client);
372
+ await require_isDynamicWaasEnabled.__refreshAuth_wrapped(client);
388
373
  };
389
374
 
390
375
  //#endregion
@@ -398,8 +383,8 @@ const revokeWaasDelegation = async ({ password, walletAccount }, client = requir
398
383
  * @returns A promise that resolves when the password is successfully set.
399
384
  * @notInstrumented
400
385
  */
401
- const setWaasWalletAccountPassword = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
402
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).setWaasWalletAccountPassword({
386
+ const setWaasWalletAccountPassword = async ({ password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
387
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).setWaasWalletAccountPassword({
403
388
  password,
404
389
  walletAccount
405
390
  });
@@ -426,8 +411,8 @@ const userHasExternalWallet = (user) => {
426
411
  * @returns True if a wallet should be auto-created for the chain, false otherwise.
427
412
  * @notInstrumented
428
413
  */
429
- const shouldAutoCreateWalletForChain = ({ chain }, client = require_InvalidParamError.getDefaultClient()) => {
430
- require_InvalidParamError.assertDefined(client.projectSettings, "Project settings are not available");
414
+ const shouldAutoCreateWalletForChain = ({ chain }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
415
+ require_updateAuthFromVerifyResponse.assertDefined(client.projectSettings, "Project settings are not available");
431
416
  const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;
432
417
  if (!embeddedWalletSettings?.automaticEmbeddedWalletCreation || !client.user) return false;
433
418
  const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;
@@ -446,8 +431,8 @@ const shouldAutoCreateWalletForChain = ({ chain }, client = require_InvalidParam
446
431
  * @returns A promise that resolves with the wallet information.
447
432
  * @notInstrumented
448
433
  */
449
- const unlockWallet = async ({ password, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
450
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).unlockWallet({
434
+ const unlockWallet = async ({ password, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
435
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).unlockWallet({
451
436
  password,
452
437
  walletAccount
453
438
  });
@@ -468,8 +453,8 @@ const unlockWallet = async ({ password, walletAccount }, client = require_Invali
468
453
  * @returns A promise that resolves when the password is successfully updated.
469
454
  * @notInstrumented
470
455
  */
471
- const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
472
- return require_getWaasWalletProviderFromWalletAccount.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).updatePassword({
456
+ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
457
+ return require_migrateFromFireblocks.getWaasWalletProviderFromWalletAccount({ walletAccount }, client).updatePassword({
473
458
  currentPassword,
474
459
  newPassword,
475
460
  walletAccount
@@ -478,10 +463,10 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
478
463
 
479
464
  //#endregion
480
465
  //#region src/exports/waas.ts
481
- (0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_InvalidParamError.name, require_InvalidParamError.version);
466
+ (0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_updateAuthFromVerifyResponse.name, require_updateAuthFromVerifyResponse.version);
482
467
 
483
468
  //#endregion
484
- exports.NotWaasWalletProviderError = NotWaasWalletProviderError;
469
+ exports.NotWaasWalletProviderError = require_migrateFromFireblocks.NotWaasWalletProviderError;
485
470
  exports.backupWaasKeySharesToGoogleDrive = backupWaasKeySharesToGoogleDrive;
486
471
  exports.createWaasWalletAccounts = createWaasWalletAccounts;
487
472
  exports.delegateWaasKeyShares = delegateWaasKeyShares;
@@ -493,8 +478,9 @@ exports.hasDelegatedAccess = hasDelegatedAccess;
493
478
  exports.importWaasPrivateKey = importWaasPrivateKey;
494
479
  exports.isDynamicWaasEnabled = require_isDynamicWaasEnabled.isDynamicWaasEnabled;
495
480
  exports.isPasswordRequiredForWaasWallets = isPasswordRequiredForWaasWallets;
496
- exports.isWaasWalletAccount = require_getWalletProviderByKey.isWaasWalletAccount;
481
+ exports.isWaasWalletAccount = require_updateAuthFromVerifyResponse.isWaasWalletAccount;
497
482
  exports.isWalletCreationRequirement = isWalletCreationRequirement;
483
+ exports.migrateFromFireblocks = require_migrateFromFireblocks.migrateFromFireblocks;
498
484
  exports.normalizeWalletRequirements = normalizeWalletRequirements;
499
485
  exports.refreshWaasWalletAccountShares = refreshWaasWalletAccountShares;
500
486
  exports.revokeWaasDelegation = revokeWaasDelegation;
package/dist/waas.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"waas.cjs","names":["BaseError","getDefaultClient","getWaasWalletProviderFromWalletAccount","requirement: WalletCreationRequirement","getDefaultClient","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getWalletProviderByKey","NoWalletProviderFoundError","isWaasWalletProvider","refreshAuth","getDefaultClient","getWaasWalletProviderFromWalletAccount","refreshAuth","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getWaasWalletProviderFromWalletAccount","WalletProviderEnum","getChainFromVerifiedCredentialChain","getDefaultClient","isDynamicWaasEnabled","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getVerifiedCredentialForWalletAccount","findWaasWalletProviderByChain","NoWalletProviderFoundError","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getDefaultClient","getDefaultClient","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getWaasWalletProviderFromWalletAccount","refreshAuth","getDefaultClient","getWaasWalletProviderFromWalletAccount","JwtVerifiedCredentialFormatEnum","WalletProviderEnum","getDefaultClient","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getWaasWalletProviderFromWalletAccount","packageName","packageVersion"],"sources":["../src/errors/NotWaasWalletProviderError.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/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts","../src/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.ts","../src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts","../src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n /**\n * Optional consumer-supplied Google Drive access token. When provided (and\n * already granted Drive scopes), the SDK uses it directly instead of falling\n * back to the stored OAuth token — avoiding a second Google consent prompt.\n *\n * Especially useful for consumers using external auth: the user's Google\n * account isn't linked in Dynamic, so there's no stored OAuth token to fall\n * back on — they obtain a Drive-scoped token themselves and pass it here.\n */\n googleDriveAccessToken?: string;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Backs up WaaS wallet key shares to Google Drive for secure recovery.\n *\n * This function creates a backup of the wallet's cryptographic key shares\n * to Google Drive, allowing users to recover their wallet later.\n *\n * @param params.walletAccount - The WaaS wallet account to backup.\n * @param [params.password] - Optional password to encrypt the backup.\n * @param [params.googleDriveAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the backup process is complete.\n * @notInstrumented\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n {\n googleDriveAccessToken,\n password,\n walletAccount,\n }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n googleDriveAccessToken,\n password,\n walletAccount,\n });\n};\n","import type { Chain } from '../../chain';\nimport type { WalletCreationRequirement } from '../waas.types';\n\n/**\n * Type guard to check if an item is a WalletCreationRequirement object.\n * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.\n *\n * @param item - The item to check, either a WalletCreationRequirement or Chain string\n * @returns True if the item is a WalletCreationRequirement object\n * @notInstrumented\n */\nexport const isWalletCreationRequirement = (\n item: WalletCreationRequirement | Chain\n): item is WalletCreationRequirement =>\n typeof item === 'object' && item !== null && 'chain' in item;\n","import type { Chain } from '../../chain';\nimport { isWalletCreationRequirement } from '../isWalletCreationRequirement/isWalletCreationRequirement';\nimport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../waas.types';\n\nconst DEFAULT_BITCOIN_ADDRESS_TYPE = 'native_segwit' as const;\n\ntype NormalizeWalletRequirementsParams = {\n defaultBitcoinConfig?: WalletCreationBitcoinConfig;\n input: WalletCreationRequirement[] | Chain[];\n};\n\n/**\n * Normalizes wallet creation input from either legacy Chain[] format\n * or new WalletCreationRequirement[] format to WalletCreationRequirement[].\n *\n * For BTC chains without explicit bitcoinConfig, defaults to native_segwit.\n *\n * @param params.input - Either an array of Chain strings or WalletCreationRequirement objects\n * @param params.defaultBitcoinConfig - Optional default bitcoin config to use for BTC chains when converting from legacy format\n * @returns Array of WalletCreationRequirement objects\n * @notInstrumented\n */\nexport const normalizeWalletRequirements = ({\n defaultBitcoinConfig,\n input,\n}: NormalizeWalletRequirementsParams): WalletCreationRequirement[] => {\n if (input.length === 0) {\n return [];\n }\n\n const [firstItem] = input;\n\n if (isWalletCreationRequirement(firstItem)) {\n return (input as WalletCreationRequirement[]).map((requirement) => {\n if (requirement.chain === 'BTC' && !requirement.bitcoinConfig) {\n return {\n ...requirement,\n bitcoinConfig: { addressType: DEFAULT_BITCOIN_ADDRESS_TYPE },\n };\n }\n\n return requirement;\n });\n }\n\n return (input as Chain[]).map((chain) => {\n const requirement: WalletCreationRequirement = { chain };\n\n if (chain === 'BTC') {\n requirement.bitcoinConfig = defaultBitcoinConfig ?? {\n addressType: DEFAULT_BITCOIN_ADDRESS_TYPE,\n };\n }\n\n return requirement;\n });\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviderByKey } from '../../wallets/getWalletProviderByKey';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport { normalizeWalletRequirements } from '../normalizeWalletRequirements/normalizeWalletRequirements';\nimport type { WalletCreationRequirement } from '../waas.types';\n\ntype CreateWaasWalletAccountsParams = {\n /**\n * For which chains to create wallet accounts.\n * Accepts either an array of chain strings (legacy format) or an array of\n * WalletCreationRequirement objects for chain-specific configuration.\n *\n * For Bitcoin, you can specify the address type ('native_segwit' or 'taproot').\n * If not specified, defaults to 'native_segwit'.\n *\n * If a chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n * @notInstrumented\n */\n chains: Chain[] | WalletCreationRequirement[];\n /**\n * The optional password to use for the wallet accounts.\n * It's used to encrypt the user shares.\n * The same password must be used for all waas wallet accounts created for the same user.\n */\n password?: string;\n /**\n * The threshold signature scheme to use for the wallet accounts.\n * If not provided, TWO_OF_TWO will be used.\n */\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Creates wallet accounts for the specified chains.\n *\n * This function creates wallet accounts for the specified chains.\n * If the same chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n *\n * @example\n * ```ts\n * // Legacy format - will create wallet accounts for EVM and SOL, BTC defaults to native_segwit\n * await createWaasWalletAccounts({ chains: ['EVM', 'SOL', 'BTC'] });\n *\n * // New format with chain-specific config\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * { chain: 'EVM' },\n * ]\n * });\n *\n * // Create both BTC address types\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'native_segwit' } },\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * ]\n * });\n * ```\n *\n * @param params.chains - The chains to create wallet accounts for.\n * @param params.password - The optional password to use for the wallet accounts.\n * @param params.thresholdSignatureScheme - The threshold signature scheme to use for the wallet accounts. (Default: TWO_OF_TWO)\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when all wallet accounts are created.\n * @notInstrumented\n */\nexport const createWaasWalletAccounts = async (\n {\n chains,\n password,\n thresholdSignatureScheme,\n }: CreateWaasWalletAccountsParams,\n client = getDefaultClient()\n): Promise<void> => {\n const normalizedRequirements = normalizeWalletRequirements({ input: chains });\n\n // we need this right now so we don't try to create wallet accounts for chains\n // that we don't support Dynamic Waas yet in the JS SDK\n const supportedChains = ['BTC', 'EVM', 'SOL', 'SUI', 'TON', 'TRON'];\n\n const filteredRequirements = normalizedRequirements.filter((requirement) =>\n supportedChains.includes(requirement.chain)\n );\n\n if (filteredRequirements.length === 0) {\n return;\n }\n\n const walletProviderMap = new Map<\n string,\n ReturnType<typeof getWalletProviderByKey>\n >();\n\n for (const requirement of filteredRequirements) {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n if (!walletProviderMap.has(walletProviderKey)) {\n const walletProvider = getWalletProviderByKey(\n { walletProviderKey },\n client\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({\n walletProviderKey,\n });\n }\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletProviderError({\n walletProviderKey,\n });\n }\n\n walletProviderMap.set(walletProviderKey, walletProvider);\n }\n }\n\n await Promise.all(\n filteredRequirements.map((requirement) => {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const walletProvider = walletProviderMap.get(walletProviderKey);\n\n if (!walletProvider || !isWaasWalletProvider(walletProvider)) {\n return Promise.resolve();\n }\n\n return walletProvider.createWalletAccount({\n bitcoinConfig: requirement.bitcoinConfig,\n password,\n thresholdSignatureScheme,\n });\n })\n );\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n * @notInstrumented\n */\nexport const delegateWaasKeyShares = async (\n { password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasClientKeysharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the client-side key shares for a WaaS wallet account.\n *\n * This function retrieves the cryptographic key shares that are stored\n * on the client side for backup or migration purposes.\n *\n * @param params.walletAccount - The WaaS wallet account to export shares from.\n * @param [params.password] - Optional password to encrypt the exported shares.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the exported key shares.\n * @notInstrumented\n */\nexport const exportWaasClientKeyshares = async (\n { password, walletAccount }: ExportWaasClientKeysharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportClientKeyshares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasPrivateKeyParams = {\n displayContainer: HTMLElement;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the private key for a WaaS wallet account with secure display.\n *\n * This function reveals the private key for a WaaS wallet and displays it\n * securely within an iframe dynamically inserted into the specified HTML container element.\n *\n * @param params.walletAccount - The WaaS wallet account to export the private key from.\n * @param params.displayContainer - The HTML element where the iframe will be injected.\n * @param [params.password] - Optional password to decrypt the private key.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key export is complete.\n * @notInstrumented\n */\nexport const exportWaasPrivateKey = async (\n { displayContainer, password, walletAccount }: ExportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportPrivateKey({\n displayContainer,\n password,\n walletAccount,\n });\n};\n","import { type SdkUser, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getChainFromVerifiedCredentialChain } from '../../../utils/getChainFromVerifiedCredentialChain';\nimport type { Chain } from '../../chain/chain.types';\n\ntype UserHasEmbeddedWalletForChainProps = {\n chain: Chain;\n user: SdkUser;\n};\n\n/** @notInstrumented */\nexport const userHasEmbeddedWalletForChain = ({\n user,\n chain,\n}: UserHasEmbeddedWalletForChainProps): boolean => {\n const hasEmbeddedWalletForChain = user.verifiedCredentials.some(\n (vc) =>\n vc.walletProvider === WalletProviderEnum.EmbeddedWallet &&\n vc.chain &&\n getChainFromVerifiedCredentialChain(vc.chain) === chain\n );\n\n return hasEmbeddedWalletForChain;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain/chain.types';\nimport { userHasEmbeddedWalletForChain } from '../../wallets/userHasEmbeddedWalletForChain';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Gets all chains missing a waas wallet account for the current user.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of all chains that have waas wallet accounts enabled\n * but for which the current user does not yet have an embedded wallet account.\n * @notInstrumented\n */\nexport const getChainsMissingWaasWalletAccounts = (\n client = getDefaultClient()\n): Chain[] => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const isWaasEnabled = isDynamicWaasEnabled(client);\n\n const user = client.user;\n\n if (!user || !isWaasEnabled) {\n return [];\n }\n\n const enabledChainForWaas: Chain[] = (\n embeddedWalletSettings?.chainConfigurations?.filter(\n (chain) => chain.enabled\n ) ?? []\n ).map((chain) => chain.name as Chain);\n\n // For each enabled chain, if user does NOT have an embedded wallet, add to missing\n return enabledChainForWaas.filter(\n (chain) => !userHasEmbeddedWalletForChain({ chain, user })\n );\n};\n","import type { WalletRecoveryState } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype GetWalletRecoveryStateParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Retrieves the recovery state of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to get the recovery state for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet recovery state.\n * @notInstrumented\n */\nexport const getWalletRecoveryState = async (\n { walletAccount }: GetWalletRecoveryStateParams,\n client: DynamicClient = getDefaultClient()\n): Promise<WalletRecoveryState> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.getWalletRecoveryState({\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getVerifiedCredentialForWalletAccount } from '../../wallets/utils/getVerifiedCredentialForWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\n\ntype HasDelegatedAccessParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Checks if a WaaS wallet account has delegated access.\n *\n * @param params.walletAccount - The WaaS wallet account to check for delegated access.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the wallet account has delegated access, false otherwise.\n * @notInstrumented\n */\nexport const hasDelegatedAccess = (\n { walletAccount }: HasDelegatedAccessParams,\n client = getDefaultClient()\n): boolean => {\n const verifiedCredential = getVerifiedCredentialForWalletAccount(\n { walletAccount },\n client\n );\n\n assertDefined(\n verifiedCredential,\n 'Verified credential not found for Waas wallet account'\n );\n\n const hasDelegatedKeyShare =\n verifiedCredential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.backupLocation === 'delegated'\n );\n\n return !!hasDelegatedKeyShare;\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport type { WaasWalletProvider } from '../waas.types';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain/findWaasWalletProviderByChain';\n\ntype GetWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderByChain = (\n { chain }: GetWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const waasProvider = findWaasWalletProviderByChain({ chain }, client);\n\n if (!waasProvider) {\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n throw new NoWalletProviderFoundError({\n walletProviderKey: waasProviderKey,\n });\n }\n\n return waasProvider;\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { Chain } from '../../chain';\nimport { getWaasWalletProviderByChain } from '../getWaasWalletProviderByChain';\n\ntype ImportWaasPrivateKeyParams = {\n chain: Chain;\n privateKey: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Imports an existing private key to create a new WaaS wallet account.\n *\n * This function allows users to import their existing private key into\n * Dynamic's WaaS infrastructure for secure management.\n *\n * @param params.chain - The chain for the imported wallet.\n * @param params.privateKey - The private key to import.\n * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key is successfully imported.\n * @notInstrumented\n */\nexport const importWaasPrivateKey = async (\n { chain, privateKey, thresholdSignatureScheme }: ImportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderByChain({ chain }, client);\n\n return provider.importPrivateKey({\n privateKey,\n thresholdSignatureScheme,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user Waas wallets are password protected.\n *\n * If the user's Waas wallets are password protected, it means that user's will have to be prompted for a\n * password for the first wallet action that happens on each session.\n * The password is also required for creating any new Waas wallets.\n *\n * @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user has any password protected Waas wallets, false otherwise\n * @notInstrumented\n */\nexport const isPasswordRequiredForWaasWallets = (\n client = getDefaultClient()\n): boolean => {\n const { user } = client;\n\n assertDefined(user, 'User is not authenticated');\n\n return user.verifiedCredentials.some((credential) =>\n credential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.passwordEncrypted\n )\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RefreshWaasWalletAccountSharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Refreshes the cryptographic key shares for a WaaS wallet account.\n *\n * This function generates new key shares for the wallet while maintaining\n * the same threshold signature scheme.\n *\n * @param params.walletAccount - The WaaS wallet account to refresh shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key shares are refreshed.\n * @notInstrumented\n */\nexport const refreshWaasWalletAccountShares = async (\n { walletAccount, password }: RefreshWaasWalletAccountSharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.refreshWalletAccountShares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RevokeWaasDelegationParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Revokes the delegation of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to revoke delegation for.\n * @param [params.password] - Optional password for delegation operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the delegation is revoked.\n * @notInstrumented\n */\nexport const revokeWaasDelegation = async (\n { password, walletAccount }: RevokeWaasDelegationParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.revokeDelegation({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype SetWaasWalletAccountPasswordParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Sets a password for a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to set the password for.\n * @param params.password - The password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully set.\n * @notInstrumented\n */\nexport const setWaasWalletAccountPassword = async (\n { password, walletAccount }: SetWaasWalletAccountPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.setWaasWalletAccountPassword({\n password,\n walletAccount,\n });\n};\n","import {\n JwtVerifiedCredentialFormatEnum,\n type SdkUser,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\n/** @notInstrumented */\nexport const userHasExternalWallet = (user: SdkUser) => {\n const hasExternalWallet = user?.verifiedCredentials.some(\n (vc) =>\n vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&\n vc.walletProvider !== WalletProviderEnum.EmbeddedWallet\n );\n\n return hasExternalWallet;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain';\nimport { userHasExternalWallet } from '../../wallets/userHasExternalWallet';\nimport { getChainsMissingWaasWalletAccounts } from '../getChainsMissingWaasWalletAccounts';\n\ntype ShouldAutoCreateWalletForChainParams = {\n chain: Chain;\n};\n\n/**\n * Checks if a WaaS wallet should be automatically created for the specified blockchain.\n *\n * This function determines whether the current user configuration and project\n * settings require automatic wallet creation for the given chain, considering\n * whether the user already has an embedded wallet for the enabled chains or an external wallet.\n *\n * @param params.chain - The blockchain network to check.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if a wallet should be auto-created for the chain, false otherwise.\n * @notInstrumented\n */\nexport const shouldAutoCreateWalletForChain = (\n { chain }: ShouldAutoCreateWalletForChainParams,\n client = getDefaultClient()\n) => {\n assertDefined(client.projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;\n\n const automaticEmbeddedWalletCreationEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreation;\n\n if (!automaticEmbeddedWalletCreationEnabled || !client.user) {\n return false;\n }\n\n const automaticEmbeddedWalletCreationForExternalEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;\n\n // If user has an external wallet (e.g metamask, phantom, etc), should only\n // create if automaticEmbeddedWalletCreationForExternalEnabled is true\n const shouldCreateDynamicWaasWallet =\n !userHasExternalWallet(client.user) ||\n automaticEmbeddedWalletCreationForExternalEnabled;\n\n if (!shouldCreateDynamicWaasWallet) {\n return false;\n }\n\n const chainsMissingAutoCreatedWallet =\n getChainsMissingWaasWalletAccounts(client);\n\n return chainsMissingAutoCreatedWallet.includes(chain);\n};\n","import type { GetWalletResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UnlockWalletParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Unlocks a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to unlock.\n * @param params.password - The password to unlock the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet information.\n * @notInstrumented\n */\nexport const unlockWallet = async (\n { password, walletAccount }: UnlockWalletParams,\n client = getDefaultClient()\n): Promise<GetWalletResponse> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.unlockWallet({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UpdateWaasPasswordParams = {\n currentPassword: string;\n newPassword: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Updates the password for a WaaS wallet account.\n *\n * This function changes the password used to encrypt and protect the\n * cryptographic key shares for the specified wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to update the password for.\n * @param params.currentPassword - The current password for the wallet.\n * @param params.newPassword - The new password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully updated.\n * @notInstrumented\n */\nexport const updateWaasPassword = async (\n { currentPassword, newPassword, walletAccount }: UpdateWaasPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.updatePassword({\n currentPassword,\n newPassword,\n walletAccount,\n });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport type {\n GetWalletResponse,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport { backupWaasKeySharesToGoogleDrive } from '../modules/waas/backupWaasKeySharesToGoogleDrive';\nexport { createWaasWalletAccounts } from '../modules/waas/createWaasWalletAccounts';\nexport { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';\nexport { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';\nexport { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';\nexport { getChainsMissingWaasWalletAccounts } from '../modules/waas/getChainsMissingWaasWalletAccounts';\nexport { getWalletRecoveryState } from '../modules/waas/getWalletRecoveryState';\nexport { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';\nexport { importWaasPrivateKey } from '../modules/waas/importWaasPrivateKey';\nexport { isDynamicWaasEnabled } from '../modules/waas/isDynamicWaasEnabled';\nexport { isPasswordRequiredForWaasWallets } from '../modules/waas/isPasswordRequiredForWaasWallets';\nexport { isWaasWalletAccount } from '../modules/waas/isWaasWalletAccount';\nexport { isWalletCreationRequirement } from '../modules/waas/isWalletCreationRequirement/isWalletCreationRequirement';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { setWaasWalletAccountPassword } from '../modules/waas/setWaasWalletAccountPassword';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mapp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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,QALiBC,sFACf,EAAE,eAAe,EACjB,OACD,CAEe,aAAa;EAC3B;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;ACTJ,MAAa,qBAAqB,OAChC,EAAE,iBAAiB,aAAa,iBAChC,SAASC,4CAAkB,KACxB;AAMH,QALiBC,sFACf,EAAE,eAAe,EACjB,OACD,CAEe,eAAe;EAC7B;EACA;EACA;EACD,CAAC;;;;;mEC9BiBC,gCAAaC,kCAAe"}
1
+ {"version":3,"file":"waas.cjs","names":["getDefaultClient","getWaasWalletProviderFromWalletAccount","requirement: WalletCreationRequirement","getDefaultClient","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getWalletProviderByKey","NoWalletProviderFoundError","isWaasWalletProvider","NotWaasWalletProviderError","refreshAuth","getDefaultClient","getWaasWalletProviderFromWalletAccount","refreshAuth","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getWaasWalletProviderFromWalletAccount","WalletProviderEnum","getChainFromVerifiedCredentialChain","getDefaultClient","isDynamicWaasEnabled","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getVerifiedCredentialForWalletAccount","findWaasWalletProviderByChain","NoWalletProviderFoundError","formatWalletProviderKey","DYNAMIC_WAAS_METADATA","WalletProviderEnum","getDefaultClient","getDefaultClient","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getWaasWalletProviderFromWalletAccount","refreshAuth","getDefaultClient","getWaasWalletProviderFromWalletAccount","JwtVerifiedCredentialFormatEnum","WalletProviderEnum","getDefaultClient","getDefaultClient","getWaasWalletProviderFromWalletAccount","getDefaultClient","getWaasWalletProviderFromWalletAccount","packageName","packageVersion"],"sources":["../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/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts","../src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts","../src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts","../src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts","../src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts","../src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts","../src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts","../src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts","../src/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.ts","../src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts","../src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts","../src/modules/waas/unlockWallet/unlockWallet.ts","../src/modules/waas/updateWaasPassword/updateWaasPassword.ts","../src/exports/waas.ts"],"sourcesContent":["import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype BackupWaasKeySharesToGoogleDriveParams = {\n /**\n * Optional consumer-supplied Google Drive access token. When provided (and\n * already granted Drive scopes), the SDK uses it directly instead of falling\n * back to the stored OAuth token — avoiding a second Google consent prompt.\n *\n * Especially useful for consumers using external auth: the user's Google\n * account isn't linked in Dynamic, so there's no stored OAuth token to fall\n * back on — they obtain a Drive-scoped token themselves and pass it here.\n */\n googleDriveAccessToken?: string;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Backs up WaaS wallet key shares to Google Drive for secure recovery.\n *\n * This function creates a backup of the wallet's cryptographic key shares\n * to Google Drive, allowing users to recover their wallet later.\n *\n * @param params.walletAccount - The WaaS wallet account to backup.\n * @param [params.password] - Optional password to encrypt the backup.\n * @param [params.googleDriveAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the backup process is complete.\n * @notInstrumented\n */\nexport const backupWaasKeySharesToGoogleDrive = async (\n {\n googleDriveAccessToken,\n password,\n walletAccount,\n }: BackupWaasKeySharesToGoogleDriveParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.backupKeySharesToGoogleDrive({\n googleDriveAccessToken,\n password,\n walletAccount,\n });\n};\n","import type { Chain } from '../../chain';\nimport type { WalletCreationRequirement } from '../waas.types';\n\n/**\n * Type guard to check if an item is a WalletCreationRequirement object.\n * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.\n *\n * @param item - The item to check, either a WalletCreationRequirement or Chain string\n * @returns True if the item is a WalletCreationRequirement object\n * @notInstrumented\n */\nexport const isWalletCreationRequirement = (\n item: WalletCreationRequirement | Chain\n): item is WalletCreationRequirement =>\n typeof item === 'object' && item !== null && 'chain' in item;\n","import type { Chain } from '../../chain';\nimport { isWalletCreationRequirement } from '../isWalletCreationRequirement/isWalletCreationRequirement';\nimport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../waas.types';\n\nconst DEFAULT_BITCOIN_ADDRESS_TYPE = 'native_segwit' as const;\n\ntype NormalizeWalletRequirementsParams = {\n defaultBitcoinConfig?: WalletCreationBitcoinConfig;\n input: WalletCreationRequirement[] | Chain[];\n};\n\n/**\n * Normalizes wallet creation input from either legacy Chain[] format\n * or new WalletCreationRequirement[] format to WalletCreationRequirement[].\n *\n * For BTC chains without explicit bitcoinConfig, defaults to native_segwit.\n *\n * @param params.input - Either an array of Chain strings or WalletCreationRequirement objects\n * @param params.defaultBitcoinConfig - Optional default bitcoin config to use for BTC chains when converting from legacy format\n * @returns Array of WalletCreationRequirement objects\n * @notInstrumented\n */\nexport const normalizeWalletRequirements = ({\n defaultBitcoinConfig,\n input,\n}: NormalizeWalletRequirementsParams): WalletCreationRequirement[] => {\n if (input.length === 0) {\n return [];\n }\n\n const [firstItem] = input;\n\n if (isWalletCreationRequirement(firstItem)) {\n return (input as WalletCreationRequirement[]).map((requirement) => {\n if (requirement.chain === 'BTC' && !requirement.bitcoinConfig) {\n return {\n ...requirement,\n bitcoinConfig: { addressType: DEFAULT_BITCOIN_ADDRESS_TYPE },\n };\n }\n\n return requirement;\n });\n }\n\n return (input as Chain[]).map((chain) => {\n const requirement: WalletCreationRequirement = { chain };\n\n if (chain === 'BTC') {\n requirement.bitcoinConfig = defaultBitcoinConfig ?? {\n addressType: DEFAULT_BITCOIN_ADDRESS_TYPE,\n };\n }\n\n return requirement;\n });\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviderByKey } from '../../wallets/getWalletProviderByKey';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport { normalizeWalletRequirements } from '../normalizeWalletRequirements/normalizeWalletRequirements';\nimport type { WalletCreationRequirement } from '../waas.types';\n\ntype CreateWaasWalletAccountsParams = {\n /**\n * For which chains to create wallet accounts.\n * Accepts either an array of chain strings (legacy format) or an array of\n * WalletCreationRequirement objects for chain-specific configuration.\n *\n * For Bitcoin, you can specify the address type ('native_segwit' or 'taproot').\n * If not specified, defaults to 'native_segwit'.\n *\n * If a chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n * @notInstrumented\n */\n chains: Chain[] | WalletCreationRequirement[];\n /**\n * The optional password to use for the wallet accounts.\n * It's used to encrypt the user shares.\n * The same password must be used for all waas wallet accounts created for the same user.\n */\n password?: string;\n /**\n * The threshold signature scheme to use for the wallet accounts.\n * If not provided, TWO_OF_TWO will be used.\n */\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Creates wallet accounts for the specified chains.\n *\n * This function creates wallet accounts for the specified chains.\n * If the same chain is passed multiple times, just as many wallet accounts will be created\n * for that chain.\n *\n * @example\n * ```ts\n * // Legacy format - will create wallet accounts for EVM and SOL, BTC defaults to native_segwit\n * await createWaasWalletAccounts({ chains: ['EVM', 'SOL', 'BTC'] });\n *\n * // New format with chain-specific config\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * { chain: 'EVM' },\n * ]\n * });\n *\n * // Create both BTC address types\n * await createWaasWalletAccounts({\n * chains: [\n * { chain: 'BTC', bitcoinConfig: { addressType: 'native_segwit' } },\n * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },\n * ]\n * });\n * ```\n *\n * @param params.chains - The chains to create wallet accounts for.\n * @param params.password - The optional password to use for the wallet accounts.\n * @param params.thresholdSignatureScheme - The threshold signature scheme to use for the wallet accounts. (Default: TWO_OF_TWO)\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when all wallet accounts are created.\n * @notInstrumented\n */\nexport const createWaasWalletAccounts = async (\n {\n chains,\n password,\n thresholdSignatureScheme,\n }: CreateWaasWalletAccountsParams,\n client = getDefaultClient()\n): Promise<void> => {\n const normalizedRequirements = normalizeWalletRequirements({ input: chains });\n\n // we need this right now so we don't try to create wallet accounts for chains\n // that we don't support Dynamic Waas yet in the JS SDK\n const supportedChains = ['BTC', 'EVM', 'SOL', 'SUI', 'TON', 'TRON'];\n\n const filteredRequirements = normalizedRequirements.filter((requirement) =>\n supportedChains.includes(requirement.chain)\n );\n\n if (filteredRequirements.length === 0) {\n return;\n }\n\n const walletProviderMap = new Map<\n string,\n ReturnType<typeof getWalletProviderByKey>\n >();\n\n for (const requirement of filteredRequirements) {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n if (!walletProviderMap.has(walletProviderKey)) {\n const walletProvider = getWalletProviderByKey(\n { walletProviderKey },\n client\n );\n\n if (!walletProvider) {\n throw new NoWalletProviderFoundError({\n walletProviderKey,\n });\n }\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletProviderError({\n walletProviderKey,\n });\n }\n\n walletProviderMap.set(walletProviderKey, walletProvider);\n }\n }\n\n await Promise.all(\n filteredRequirements.map((requirement) => {\n const walletProviderKey = formatWalletProviderKey({\n chain: requirement.chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n const walletProvider = walletProviderMap.get(walletProviderKey);\n\n if (!walletProvider || !isWaasWalletProvider(walletProvider)) {\n return Promise.resolve();\n }\n\n return walletProvider.createWalletAccount({\n bitcoinConfig: requirement.bitcoinConfig,\n password,\n thresholdSignatureScheme,\n });\n })\n );\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype DelegateWaasKeySharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Delegates cryptographic key shares for a WaaS wallet account.\n *\n * This function allows the delegation of key management responsibilities,\n * enabling distributed key management for enhanced security.\n *\n * @param params.walletAccount - The WaaS wallet account to delegate shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key delegation is complete.\n * @notInstrumented\n */\nexport const delegateWaasKeyShares = async (\n { password, walletAccount }: DelegateWaasKeySharesParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.delegateKeyShares({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasClientKeysharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the client-side key shares for a WaaS wallet account.\n *\n * This function retrieves the cryptographic key shares that are stored\n * on the client side for backup or migration purposes.\n *\n * @param params.walletAccount - The WaaS wallet account to export shares from.\n * @param [params.password] - Optional password to encrypt the exported shares.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the exported key shares.\n * @notInstrumented\n */\nexport const exportWaasClientKeyshares = async (\n { password, walletAccount }: ExportWaasClientKeysharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportClientKeyshares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype ExportWaasPrivateKeyParams = {\n displayContainer: HTMLElement;\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Exports the private key for a WaaS wallet account with secure display.\n *\n * This function reveals the private key for a WaaS wallet and displays it\n * securely within an iframe dynamically inserted into the specified HTML container element.\n *\n * @param params.walletAccount - The WaaS wallet account to export the private key from.\n * @param params.displayContainer - The HTML element where the iframe will be injected.\n * @param [params.password] - Optional password to decrypt the private key.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key export is complete.\n * @notInstrumented\n */\nexport const exportWaasPrivateKey = async (\n { displayContainer, password, walletAccount }: ExportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.exportPrivateKey({\n displayContainer,\n password,\n walletAccount,\n });\n};\n","import { type SdkUser, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getChainFromVerifiedCredentialChain } from '../../../utils/getChainFromVerifiedCredentialChain';\nimport type { Chain } from '../../chain/chain.types';\n\ntype UserHasEmbeddedWalletForChainProps = {\n chain: Chain;\n user: SdkUser;\n};\n\n/** @notInstrumented */\nexport const userHasEmbeddedWalletForChain = ({\n user,\n chain,\n}: UserHasEmbeddedWalletForChainProps): boolean => {\n const hasEmbeddedWalletForChain = user.verifiedCredentials.some(\n (vc) =>\n vc.walletProvider === WalletProviderEnum.EmbeddedWallet &&\n vc.chain &&\n getChainFromVerifiedCredentialChain(vc.chain) === chain\n );\n\n return hasEmbeddedWalletForChain;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain/chain.types';\nimport { userHasEmbeddedWalletForChain } from '../../wallets/userHasEmbeddedWalletForChain';\nimport { isDynamicWaasEnabled } from '../isDynamicWaasEnabled';\n\n/**\n * Gets all chains missing a waas wallet account for the current user.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An array of all chains that have waas wallet accounts enabled\n * but for which the current user does not yet have an embedded wallet account.\n * @notInstrumented\n */\nexport const getChainsMissingWaasWalletAccounts = (\n client = getDefaultClient()\n): Chain[] => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const isWaasEnabled = isDynamicWaasEnabled(client);\n\n const user = client.user;\n\n if (!user || !isWaasEnabled) {\n return [];\n }\n\n const enabledChainForWaas: Chain[] = (\n embeddedWalletSettings?.chainConfigurations?.filter(\n (chain) => chain.enabled\n ) ?? []\n ).map((chain) => chain.name as Chain);\n\n // For each enabled chain, if user does NOT have an embedded wallet, add to missing\n return enabledChainForWaas.filter(\n (chain) => !userHasEmbeddedWalletForChain({ chain, user })\n );\n};\n","import type { WalletRecoveryState } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype GetWalletRecoveryStateParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Retrieves the recovery state of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to get the recovery state for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet recovery state.\n * @notInstrumented\n */\nexport const getWalletRecoveryState = async (\n { walletAccount }: GetWalletRecoveryStateParams,\n client: DynamicClient = getDefaultClient()\n): Promise<WalletRecoveryState> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.getWalletRecoveryState({\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport { getVerifiedCredentialForWalletAccount } from '../../wallets/utils/getVerifiedCredentialForWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\n\ntype HasDelegatedAccessParams = {\n walletAccount: WalletAccount;\n};\n\n/**\n * Checks if a WaaS wallet account has delegated access.\n *\n * @param params.walletAccount - The WaaS wallet account to check for delegated access.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the wallet account has delegated access, false otherwise.\n * @notInstrumented\n */\nexport const hasDelegatedAccess = (\n { walletAccount }: HasDelegatedAccessParams,\n client = getDefaultClient()\n): boolean => {\n const verifiedCredential = getVerifiedCredentialForWalletAccount(\n { walletAccount },\n client\n );\n\n assertDefined(\n verifiedCredential,\n 'Verified credential not found for Waas wallet account'\n );\n\n const hasDelegatedKeyShare =\n verifiedCredential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.backupLocation === 'delegated'\n );\n\n return !!hasDelegatedKeyShare;\n};\n","import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport type { Chain } from '../../chain';\nimport { formatWalletProviderKey } from '../../wallets/utils/formatWalletProviderKey';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport type { WaasWalletProvider } from '../waas.types';\nimport { findWaasWalletProviderByChain } from '../findWaasWalletProviderByChain/findWaasWalletProviderByChain';\n\ntype GetWaasWalletProviderByChainParams = {\n chain: Chain;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderByChain = (\n { chain }: GetWaasWalletProviderByChainParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const waasProvider = findWaasWalletProviderByChain({ chain }, client);\n\n if (!waasProvider) {\n const waasProviderKey = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType: WalletProviderEnum.EmbeddedWallet,\n });\n\n throw new NoWalletProviderFoundError({\n walletProviderKey: waasProviderKey,\n });\n }\n\n return waasProvider;\n};\n","import type { ThresholdSignatureScheme } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { Chain } from '../../chain';\nimport { getWaasWalletProviderByChain } from '../getWaasWalletProviderByChain';\n\ntype ImportWaasPrivateKeyParams = {\n chain: Chain;\n privateKey: string;\n thresholdSignatureScheme?: ThresholdSignatureScheme;\n};\n\n/**\n * Imports an existing private key to create a new WaaS wallet account.\n *\n * This function allows users to import their existing private key into\n * Dynamic's WaaS infrastructure for secure management.\n *\n * @param params.chain - The chain for the imported wallet.\n * @param params.privateKey - The private key to import.\n * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the private key is successfully imported.\n * @notInstrumented\n */\nexport const importWaasPrivateKey = async (\n { chain, privateKey, thresholdSignatureScheme }: ImportWaasPrivateKeyParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderByChain({ chain }, client);\n\n return provider.importPrivateKey({\n privateKey,\n thresholdSignatureScheme,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if the user Waas wallets are password protected.\n *\n * If the user's Waas wallets are password protected, it means that user's will have to be prompted for a\n * password for the first wallet action that happens on each session.\n * The password is also required for creating any new Waas wallets.\n *\n * @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user has any password protected Waas wallets, false otherwise\n * @notInstrumented\n */\nexport const isPasswordRequiredForWaasWallets = (\n client = getDefaultClient()\n): boolean => {\n const { user } = client;\n\n assertDefined(user, 'User is not authenticated');\n\n return user.verifiedCredentials.some((credential) =>\n credential.walletProperties?.keyShares?.some(\n (keyShare) => keyShare.passwordEncrypted\n )\n );\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RefreshWaasWalletAccountSharesParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Refreshes the cryptographic key shares for a WaaS wallet account.\n *\n * This function generates new key shares for the wallet while maintaining\n * the same threshold signature scheme.\n *\n * @param params.walletAccount - The WaaS wallet account to refresh shares for.\n * @param [params.password] - Optional password for key share operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the key shares are refreshed.\n * @notInstrumented\n */\nexport const refreshWaasWalletAccountShares = async (\n { walletAccount, password }: RefreshWaasWalletAccountSharesParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.refreshWalletAccountShares({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype RevokeWaasDelegationParams = {\n password?: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Revokes the delegation of a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to revoke delegation for.\n * @param [params.password] - Optional password for delegation operations.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the delegation is revoked.\n * @notInstrumented\n */\nexport const revokeWaasDelegation = async (\n { password, walletAccount }: RevokeWaasDelegationParams,\n client = getDefaultClient()\n): Promise<void> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n await provider.revokeDelegation({\n password,\n walletAccount,\n });\n\n await refreshAuth(client);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype SetWaasWalletAccountPasswordParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Sets a password for a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to set the password for.\n * @param params.password - The password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully set.\n * @notInstrumented\n */\nexport const setWaasWalletAccountPassword = async (\n { password, walletAccount }: SetWaasWalletAccountPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.setWaasWalletAccountPassword({\n password,\n walletAccount,\n });\n};\n","import {\n JwtVerifiedCredentialFormatEnum,\n type SdkUser,\n WalletProviderEnum,\n} from '@dynamic-labs/sdk-api-core';\n\n/** @notInstrumented */\nexport const userHasExternalWallet = (user: SdkUser) => {\n const hasExternalWallet = user?.verifiedCredentials.some(\n (vc) =>\n vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&\n vc.walletProvider !== WalletProviderEnum.EmbeddedWallet\n );\n\n return hasExternalWallet;\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { Chain } from '../../chain';\nimport { userHasExternalWallet } from '../../wallets/userHasExternalWallet';\nimport { getChainsMissingWaasWalletAccounts } from '../getChainsMissingWaasWalletAccounts';\n\ntype ShouldAutoCreateWalletForChainParams = {\n chain: Chain;\n};\n\n/**\n * Checks if a WaaS wallet should be automatically created for the specified blockchain.\n *\n * This function determines whether the current user configuration and project\n * settings require automatic wallet creation for the given chain, considering\n * whether the user already has an embedded wallet for the enabled chains or an external wallet.\n *\n * @param params.chain - The blockchain network to check.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if a wallet should be auto-created for the chain, false otherwise.\n * @notInstrumented\n */\nexport const shouldAutoCreateWalletForChain = (\n { chain }: ShouldAutoCreateWalletForChainParams,\n client = getDefaultClient()\n) => {\n assertDefined(client.projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;\n\n const automaticEmbeddedWalletCreationEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreation;\n\n if (!automaticEmbeddedWalletCreationEnabled || !client.user) {\n return false;\n }\n\n const automaticEmbeddedWalletCreationForExternalEnabled =\n embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;\n\n // If user has an external wallet (e.g metamask, phantom, etc), should only\n // create if automaticEmbeddedWalletCreationForExternalEnabled is true\n const shouldCreateDynamicWaasWallet =\n !userHasExternalWallet(client.user) ||\n automaticEmbeddedWalletCreationForExternalEnabled;\n\n if (!shouldCreateDynamicWaasWallet) {\n return false;\n }\n\n const chainsMissingAutoCreatedWallet =\n getChainsMissingWaasWalletAccounts(client);\n\n return chainsMissingAutoCreatedWallet.includes(chain);\n};\n","import type { GetWalletResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UnlockWalletParams = {\n password: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Unlocks a WaaS wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to unlock.\n * @param params.password - The password to unlock the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves with the wallet information.\n * @notInstrumented\n */\nexport const unlockWallet = async (\n { password, walletAccount }: UnlockWalletParams,\n client = getDefaultClient()\n): Promise<GetWalletResponse> => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.unlockWallet({\n password,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { getWaasWalletProviderFromWalletAccount } from '../getWaasWalletProviderFromWalletAccount';\n\ntype UpdateWaasPasswordParams = {\n currentPassword: string;\n newPassword: string;\n walletAccount: WalletAccount;\n};\n\n/**\n * Updates the password for a WaaS wallet account.\n *\n * This function changes the password used to encrypt and protect the\n * cryptographic key shares for the specified wallet account.\n *\n * @param params.walletAccount - The WaaS wallet account to update the password for.\n * @param params.currentPassword - The current password for the wallet.\n * @param params.newPassword - The new password to set for the wallet.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves when the password is successfully updated.\n * @notInstrumented\n */\nexport const updateWaasPassword = async (\n { currentPassword, newPassword, walletAccount }: UpdateWaasPasswordParams,\n client = getDefaultClient()\n) => {\n const provider = getWaasWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n return provider.updatePassword({\n currentPassword,\n newPassword,\n walletAccount,\n });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport type {\n GetWalletResponse,\n MigrateFromFireblocksResponse,\n WalletRecoveryState,\n} from '@dynamic-labs-wallet/browser-wallet-client';\nexport { NotWaasWalletProviderError } from '../errors/NotWaasWalletProviderError';\nexport { 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 { migrateFromFireblocks } from '../modules/waas/migrateFromFireblocks';\nexport { normalizeWalletRequirements } from '../modules/waas/normalizeWalletRequirements/normalizeWalletRequirements';\nexport { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';\nexport { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';\nexport { setWaasWalletAccountPassword } from '../modules/waas/setWaasWalletAccountPassword';\nexport { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';\nexport { unlockWallet } from '../modules/waas/unlockWallet';\nexport { updateWaasPassword } from '../modules/waas/updateWaasPassword';\nexport type {\n WalletCreationBitcoinConfig,\n WalletCreationRequirement,\n} from '../modules/waas/waas.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,mCAAmC,OAC9C,EACE,wBACA,UACA,iBAEF,SAASA,uDAAkB,KACxB;AAMH,QALiBC,qEACf,EAAE,eAAe,EACjB,OACD,CAEe,6BAA6B;EAC3C;EACA;EACA;EACD,CAAC;;;;;;;;;;;;;ACtCJ,MAAa,+BACX,SAEA,OAAO,SAAS,YAAY,SAAS,QAAQ,WAAW;;;;ACP1D,MAAM,+BAA+B;;;;;;;;;;;;AAkBrC,MAAa,+BAA+B,EAC1C,sBACA,YACoE;AACpE,KAAI,MAAM,WAAW,EACnB,QAAO,EAAE;CAGX,MAAM,CAAC,aAAa;AAEpB,KAAI,4BAA4B,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;EACD,CAAC;;;;;mEC9BiBC,2CAAaC,6CAAe"}
package/dist/waas.esm.js CHANGED
@@ -1,25 +1,10 @@
1
- import { E as getChainFromVerifiedCredentialChain, Q as assertDefined, a as DYNAMIC_WAAS_METADATA, at as getDefaultClient, ct as BaseError, dt as version, n as isWaasWalletProvider, ut as name, w as formatWalletProviderKey, x as NoWalletProviderFoundError } from "./InvalidParamError-Dn_riAvL.esm.js";
2
- import { c as findWaasWalletProviderByChain, n as getVerifiedCredentialForWalletAccount, s as isWaasWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-DTi6MhKt.esm.js";
3
- import { t as __refreshAuth_wrapped } from "./refreshAuth-Q5fxSi3Z.esm.js";
4
- import { t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-CuSe2RO1.esm.js";
5
- import { t as getWaasWalletProviderFromWalletAccount } from "./getWaasWalletProviderFromWalletAccount-Dc6QvHVt.esm.js";
1
+ import { A as NoWalletProviderFoundError, M as formatWalletProviderKey, P as getChainFromVerifiedCredentialChain, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, o as isWaasWalletAccount, ot as assertDefined, pt as getDefaultClient, s as findWaasWalletProviderByChain, vt as name, yt as version } from "./updateAuthFromVerifyResponse-BdokPJ21.esm.js";
2
+ import { r as __refreshAuth_wrapped, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-DYy0TvLy.esm.js";
3
+ import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-BL3u0e-d.esm.js";
4
+ import { n as getWaasWalletProviderFromWalletAccount, r as NotWaasWalletProviderError, t as migrateFromFireblocks } from "./migrateFromFireblocks-DXs3odF_.esm.js";
6
5
  import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
7
6
  import { JwtVerifiedCredentialFormatEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
8
7
 
9
- //#region src/errors/NotWaasWalletProviderError.ts
10
- var NotWaasWalletProviderError = class extends BaseError {
11
- constructor({ walletProviderKey }) {
12
- super({
13
- cause: null,
14
- code: "not_waas_wallet_provider_error",
15
- docsUrl: null,
16
- name: "NotWaasWalletProviderError",
17
- shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`
18
- });
19
- }
20
- };
21
-
22
- //#endregion
23
8
  //#region src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts
24
9
  /**
25
10
  * Backs up WaaS wallet key shares to Google Drive for secure recovery.
@@ -480,5 +465,5 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
480
465
  assertPackageVersion(name, version);
481
466
 
482
467
  //#endregion
483
- export { NotWaasWalletProviderError, backupWaasKeySharesToGoogleDrive, createWaasWalletAccounts, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, normalizeWalletRequirements, refreshWaasWalletAccountShares, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, unlockWallet, updateWaasPassword };
468
+ export { NotWaasWalletProviderError, backupWaasKeySharesToGoogleDrive, createWaasWalletAccounts, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, unlockWallet, updateWaasPassword };
484
469
  //# sourceMappingURL=waas.esm.js.map