@dynamic-labs-sdk/client 0.1.0-alpha.28 → 0.1.0-alpha.29

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 (32) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/NotWaasWalletAccountError.cjs.js +2 -2
  3. package/NotWaasWalletAccountError.esm.js +1 -1
  4. package/constants.cjs.js +1 -1
  5. package/constants.esm.js +1 -1
  6. package/core.cjs.js +18 -18
  7. package/core.esm.js +4 -4
  8. package/getNetworkProviderFromNetworkId.cjs.js +5 -11
  9. package/getNetworkProviderFromNetworkId.esm.js +2 -7
  10. package/{getWalletProviderByKey.cjs.js → getVerifiedCredentialForWalletAccount.cjs.js} +6 -0
  11. package/{getWalletProviderByKey.esm.js → getVerifiedCredentialForWalletAccount.esm.js} +6 -1
  12. package/index.cjs.js +57 -57
  13. package/index.esm.js +4 -4
  14. package/package.json +3 -3
  15. package/src/exports/waas.d.ts +2 -0
  16. package/src/exports/waas.d.ts.map +1 -1
  17. package/src/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
  18. package/src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.d.ts.map +1 -1
  19. package/src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.d.ts +14 -0
  20. package/src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.d.ts.map +1 -0
  21. package/src/modules/waas/hasDelegatedAccess/index.d.ts +2 -0
  22. package/src/modules/waas/hasDelegatedAccess/index.d.ts.map +1 -0
  23. package/src/modules/waas/revokeWaasDelegation/index.d.ts +2 -0
  24. package/src/modules/waas/revokeWaasDelegation/index.d.ts.map +1 -0
  25. package/src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.d.ts +16 -0
  26. package/src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.d.ts.map +1 -0
  27. package/src/modules/waas/waas.types.d.ts +4 -0
  28. package/src/modules/waas/waas.types.d.ts.map +1 -1
  29. package/waas.cjs.js +46 -9
  30. package/waas.esm.js +38 -3
  31. package/waasCore.cjs.js +12 -0
  32. package/waasCore.esm.js +12 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.0-alpha.29 (2025-11-12)
2
+
3
+ ### 🚀 Features
4
+
5
+ - add support for WaaS delegation ([#634](https://github.com/dynamic-labs/dynamic-sdk/pull/634))
6
+
1
7
  ## 0.1.0-alpha.28 (2025-11-03)
2
8
 
3
9
  ### 🩹 Fixes
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var constants = require('./constants.cjs.js');
4
- var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
4
+ var getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount.cjs.js');
5
5
 
6
6
  /**
7
7
  * Refreshes the current user's data from the server.
@@ -17,7 +17,7 @@ var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
17
17
  const response = await apiClient.refreshAuth({
18
18
  environmentId: core.environmentId
19
19
  });
20
- getWalletProviderByKey.updateAuthFromVerifyResponse({
20
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
21
21
  response
22
22
  }, client);
23
23
  };
@@ -1,5 +1,5 @@
1
1
  import { g as getDefaultClient, a as getCore, c as createApiClient, B as BaseError } from './constants.esm.js';
2
- import { u as updateAuthFromVerifyResponse } from './getWalletProviderByKey.esm.js';
2
+ import { u as updateAuthFromVerifyResponse } from './getVerifiedCredentialForWalletAccount.esm.js';
3
3
 
4
4
  /**
5
5
  * Refreshes the current user's data from the server.
package/constants.cjs.js CHANGED
@@ -4,7 +4,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
4
4
  var buffer = require('buffer');
5
5
 
6
6
  var name = "@dynamic-labs-sdk/client";
7
- var version = "0.1.0-alpha.28";
7
+ var version = "0.1.0-alpha.29";
8
8
  var dependencies = {
9
9
  "@dynamic-labs/sdk-api-core": "0.0.818"};
10
10
 
package/constants.esm.js CHANGED
@@ -2,7 +2,7 @@ import { AuthStorageEnum, SDKApi, Configuration } from '@dynamic-labs/sdk-api-co
2
2
  import { Buffer as Buffer$1 } from 'buffer';
3
3
 
4
4
  var name = "@dynamic-labs-sdk/client";
5
- var version = "0.1.0-alpha.28";
5
+ var version = "0.1.0-alpha.29";
6
6
  var dependencies = {
7
7
  "@dynamic-labs/sdk-api-core": "0.0.818"};
8
8
 
package/core.cjs.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var assertPackageVersion = require('@dynamic-labs-sdk/assert-package-version');
4
4
  var constants = require('./constants.cjs.js');
5
5
  var getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId.cjs.js');
6
- var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
6
+ var getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount.cjs.js');
7
7
  var getSignedSessionId = require('./getSignedSessionId.cjs.js');
8
8
  var z = require('zod/mini');
9
9
  var EventEmitter = require('eventemitter3');
@@ -134,7 +134,7 @@ const networkRegistryStorageKeySchema = getNetworkProviderFromNetworkId.createSt
134
134
  networkId
135
135
  };
136
136
  }
137
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
137
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
138
138
  walletProviderKey
139
139
  }, client);
140
140
  const networkProviders = getNetworkProviderFromNetworkId.getNetworkProviders(client);
@@ -159,7 +159,7 @@ const networkRegistryStorageKeySchema = getNetworkProviderFromNetworkId.createSt
159
159
  };
160
160
  };
161
161
 
162
- const getLastKnownNetworkRegistry = getWalletProviderByKey.createRuntimeServiceAccessKey('last-known-network-registry', (client)=>createLastKnownNetworkRegistry(client));
162
+ const getLastKnownNetworkRegistry = getVerifiedCredentialForWalletAccount.createRuntimeServiceAccessKey('last-known-network-registry', (client)=>createLastKnownNetworkRegistry(client));
163
163
 
164
164
  const formatWalletProviderGroupKey = (walletName)=>walletName.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
165
165
 
@@ -286,30 +286,30 @@ exports.formatSignInMessage = getNetworkProviderFromNetworkId.formatSignInMessag
286
286
  exports.getNetworkProviderBuilderRegistry = getNetworkProviderFromNetworkId.getNetworkProviderBuilderRegistry;
287
287
  exports.getNetworkProviderFromNetworkId = getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId;
288
288
  exports.getNetworkProviders = getNetworkProviderFromNetworkId.getNetworkProviders;
289
- exports.getVerifiedCredentialForWalletAccount = getNetworkProviderFromNetworkId.getVerifiedCredentialForWalletAccount;
290
289
  exports.hasExtension = getNetworkProviderFromNetworkId.hasExtension;
291
290
  exports.setCaptchaToken = getNetworkProviderFromNetworkId.setCaptchaToken;
292
291
  exports.setUnverifiedWalletAccounts = getNetworkProviderFromNetworkId.setUnverifiedWalletAccounts;
293
292
  exports.subscribeWithSelector = getNetworkProviderFromNetworkId.subscribeWithSelector;
294
293
  exports.updateWalletProviderKeysForVerifiedCredentials = getNetworkProviderFromNetworkId.updateWalletProviderKeysForVerifiedCredentials;
295
294
  exports.verifySignInMessage = getNetworkProviderFromNetworkId.verifySignInMessage;
296
- exports.InvalidWalletProviderKeyError = getWalletProviderByKey.InvalidWalletProviderKeyError;
297
- exports.NoWalletProviderFoundError = getWalletProviderByKey.NoWalletProviderFoundError;
295
+ exports.InvalidWalletProviderKeyError = getVerifiedCredentialForWalletAccount.InvalidWalletProviderKeyError;
296
+ exports.NoWalletProviderFoundError = getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError;
298
297
  Object.defineProperty(exports, "WalletProviderPriority", {
299
298
  enumerable: true,
300
- get: function () { return getWalletProviderByKey.WalletProviderPriority; }
299
+ get: function () { return getVerifiedCredentialForWalletAccount.WalletProviderPriority; }
301
300
  });
302
- exports.createRuntimeServiceAccessKey = getWalletProviderByKey.createRuntimeServiceAccessKey;
303
- exports.emitEvent = getWalletProviderByKey.emitEvent;
304
- exports.emitWalletAccountsChangedEvent = getWalletProviderByKey.emitWalletAccountsChangedEvent;
305
- exports.formatWalletAccountId = getWalletProviderByKey.formatWalletAccountId;
306
- exports.formatWalletProviderKey = getWalletProviderByKey.formatWalletProviderKey;
307
- exports.getWalletProviderFromWalletAccount = getWalletProviderByKey.getWalletProviderFromWalletAccount;
308
- exports.getWalletProviderRegistry = getWalletProviderByKey.getWalletProviderRegistry;
309
- exports.getWalletProviders = getWalletProviderByKey.getWalletProviders;
310
- exports.normalizeWalletNameWithChain = getWalletProviderByKey.normalizeWalletNameWithChain;
311
- exports.splitWalletProviderKey = getWalletProviderByKey.splitWalletProviderKey;
312
- exports.updateAuthFromVerifyResponse = getWalletProviderByKey.updateAuthFromVerifyResponse;
301
+ exports.createRuntimeServiceAccessKey = getVerifiedCredentialForWalletAccount.createRuntimeServiceAccessKey;
302
+ exports.emitEvent = getVerifiedCredentialForWalletAccount.emitEvent;
303
+ exports.emitWalletAccountsChangedEvent = getVerifiedCredentialForWalletAccount.emitWalletAccountsChangedEvent;
304
+ exports.formatWalletAccountId = getVerifiedCredentialForWalletAccount.formatWalletAccountId;
305
+ exports.formatWalletProviderKey = getVerifiedCredentialForWalletAccount.formatWalletProviderKey;
306
+ exports.getVerifiedCredentialForWalletAccount = getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount;
307
+ exports.getWalletProviderFromWalletAccount = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount;
308
+ exports.getWalletProviderRegistry = getVerifiedCredentialForWalletAccount.getWalletProviderRegistry;
309
+ exports.getWalletProviders = getVerifiedCredentialForWalletAccount.getWalletProviders;
310
+ exports.normalizeWalletNameWithChain = getVerifiedCredentialForWalletAccount.normalizeWalletNameWithChain;
311
+ exports.splitWalletProviderKey = getVerifiedCredentialForWalletAccount.splitWalletProviderKey;
312
+ exports.updateAuthFromVerifyResponse = getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse;
313
313
  exports.consumeMfaTokenIfRequiredForAction = getSignedSessionId.consumeMfaTokenIfRequiredForAction;
314
314
  exports.getSignedSessionId = getSignedSessionId.getSignedSessionId;
315
315
  exports.filterDuplicates = filterDuplicates.filterDuplicates;
package/core.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
2
2
  import { B as BaseError, a as getCore, d as assertDefined, b as getBuffer, n as name, v as version } from './constants.esm.js';
3
3
  export { A as APIError, e as CHAINS_INFO_MAP, j as ClientNotFoundError, l as DYNAMIC_ICONIC_SPRITE_URL, D as DYNAMIC_SDK_API_VERSION, V as ValueMustBeDefinedError, c as createApiClient, k as getChainFromVerifiedCredentialChain, g as getDefaultClient, i as isCookieEnabled } from './constants.esm.js';
4
- import { F as FETCH_PROJECT_SETTINGS_TRACKER_KEY, c as createStorageKeySchema, q as getNetworkProviders, N as NoNetworkProvidersError } from './getNetworkProviderFromNetworkId.esm.js';
5
- export { C as CannotTrackError, r as InvalidStorageSet, e as consumeCaptchaToken, d as createLocalStorageAdapter, a as createLogger, h as createSignInMessageStatement, b as createStorage, g as createVisit, j as formatSignInMessage, t as getNetworkProviderBuilderRegistry, m as getNetworkProviderFromNetworkId, k as getVerifiedCredentialForWalletAccount, p as hasExtension, o as setCaptchaToken, f as setUnverifiedWalletAccounts, s as subscribeWithSelector, u as updateWalletProviderKeysForVerifiedCredentials, v as verifySignInMessage } from './getNetworkProviderFromNetworkId.esm.js';
6
- import { b as getWalletProviderByKey, k as createRuntimeServiceAccessKey } from './getWalletProviderByKey.esm.js';
7
- export { I as InvalidWalletProviderKeyError, N as NoWalletProviderFoundError, W as WalletProviderPriority, e as emitEvent, c as emitWalletAccountsChangedEvent, f as formatWalletAccountId, l as formatWalletProviderKey, a as getWalletProviderFromWalletAccount, q as getWalletProviderRegistry, h as getWalletProviders, m as normalizeWalletNameWithChain, p as splitWalletProviderKey, u as updateAuthFromVerifyResponse } from './getWalletProviderByKey.esm.js';
4
+ import { F as FETCH_PROJECT_SETTINGS_TRACKER_KEY, c as createStorageKeySchema, p as getNetworkProviders, N as NoNetworkProvidersError } from './getNetworkProviderFromNetworkId.esm.js';
5
+ export { C as CannotTrackError, q as InvalidStorageSet, e as consumeCaptchaToken, d as createLocalStorageAdapter, a as createLogger, h as createSignInMessageStatement, b as createStorage, g as createVisit, j as formatSignInMessage, r as getNetworkProviderBuilderRegistry, l as getNetworkProviderFromNetworkId, o as hasExtension, n as setCaptchaToken, f as setUnverifiedWalletAccounts, s as subscribeWithSelector, u as updateWalletProviderKeysForVerifiedCredentials, v as verifySignInMessage } from './getNetworkProviderFromNetworkId.esm.js';
6
+ import { b as getWalletProviderByKey, l as createRuntimeServiceAccessKey } from './getVerifiedCredentialForWalletAccount.esm.js';
7
+ export { I as InvalidWalletProviderKeyError, N as NoWalletProviderFoundError, W as WalletProviderPriority, e as emitEvent, c as emitWalletAccountsChangedEvent, f as formatWalletAccountId, m as formatWalletProviderKey, i as getVerifiedCredentialForWalletAccount, a as getWalletProviderFromWalletAccount, r as getWalletProviderRegistry, h as getWalletProviders, p as normalizeWalletNameWithChain, q as splitWalletProviderKey, u as updateAuthFromVerifyResponse } from './getVerifiedCredentialForWalletAccount.esm.js';
8
8
  export { c as consumeMfaTokenIfRequiredForAction, g as getSignedSessionId } from './getSignedSessionId.esm.js';
9
9
  import * as z from 'zod/mini';
10
10
  import EventEmitter from 'eventemitter3';
@@ -3,7 +3,7 @@
3
3
  var constants = require('./constants.cjs.js');
4
4
  var EventEmitter = require('eventemitter3');
5
5
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
6
- var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
6
+ var getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount.cjs.js');
7
7
 
8
8
  /**
9
9
  * Shallow compare two objects.
@@ -302,11 +302,11 @@ const isCaptchaRequired = (client = constants.getDefaultClient())=>{
302
302
  */ const createVisit = async ({ walletAccount, authMode = sdkApiCore.AuthModeEnum.Only }, client)=>{
303
303
  const core = constants.getCore(client);
304
304
  const apiClient = constants.createApiClient({}, client);
305
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
305
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
306
306
  walletAccount
307
307
  }, client);
308
308
  try {
309
- const walletName = getWalletProviderByKey.normalizeWalletNameWithChain({
309
+ const walletName = getVerifiedCredentialForWalletAccount.normalizeWalletNameWithChain({
310
310
  chain: walletProvider.chain,
311
311
  displayName: walletProvider.metadata.displayName
312
312
  });
@@ -417,7 +417,7 @@ const createSignInMessageStatement = (client)=>{
417
417
  */ const verifySignInMessage = async ({ messageToSign, walletAddress, addressesWithTypes, signature, chain, walletDisplayName, walletProviderType }, client)=>{
418
418
  const core = constants.getCore(client);
419
419
  const apiClient = constants.createApiClient({}, client);
420
- const walletName = getWalletProviderByKey.normalizeWalletNameWithChain({
420
+ const walletName = getVerifiedCredentialForWalletAccount.normalizeWalletNameWithChain({
421
421
  chain,
422
422
  displayName: walletDisplayName
423
423
  });
@@ -459,11 +459,6 @@ const updateWalletProviderKeysForVerifiedCredentials = ({ keysToUpdate }, client
459
459
  });
460
460
  };
461
461
 
462
- const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client)=>{
463
- var _client_user;
464
- return (_client_user = client.user) == null ? void 0 : _client_user.verifiedCredentials.find((vc)=>vc.id === walletAccount.verifiedCredentialId);
465
- };
466
-
467
462
  /**
468
463
  * Maps the chain name from the API to the SDK chain name
469
464
  */ const getSdkChainFromApiChainName = (chainName)=>{
@@ -532,7 +527,7 @@ const createNetworkProviderBuilderRegistry = ()=>{
532
527
  };
533
528
  };
534
529
 
535
- const getNetworkProviderBuilderRegistry = getWalletProviderByKey.createRuntimeServiceAccessKey('networkProviderBuilderRegistry', createNetworkProviderBuilderRegistry);
530
+ const getNetworkProviderBuilderRegistry = getVerifiedCredentialForWalletAccount.createRuntimeServiceAccessKey('networkProviderBuilderRegistry', createNetworkProviderBuilderRegistry);
536
531
 
537
532
  /**
538
533
  * Retrieves all registered network providers for enabled chains.
@@ -577,7 +572,6 @@ exports.getNetworkProviderBuilderRegistry = getNetworkProviderBuilderRegistry;
577
572
  exports.getNetworkProviderFromNetworkId = getNetworkProviderFromNetworkId;
578
573
  exports.getNetworkProviders = getNetworkProviders;
579
574
  exports.getNetworksData = getNetworksData;
580
- exports.getVerifiedCredentialForWalletAccount = getVerifiedCredentialForWalletAccount;
581
575
  exports.hasExtension = hasExtension;
582
576
  exports.isCaptchaRequired = isCaptchaRequired;
583
577
  exports.isEqualShallow = isEqualShallow;
@@ -1,7 +1,7 @@
1
1
  import { B as BaseError, g as getDefaultClient, d as assertDefined, a as getCore, c as createApiClient, _ as _extends, e as CHAINS_INFO_MAP } from './constants.esm.js';
2
2
  import { EventEmitter } from 'eventemitter3';
3
3
  import { AuthModeEnum } from '@dynamic-labs/sdk-api-core';
4
- import { a as getWalletProviderFromWalletAccount, m as normalizeWalletNameWithChain, k as createRuntimeServiceAccessKey } from './getWalletProviderByKey.esm.js';
4
+ import { a as getWalletProviderFromWalletAccount, p as normalizeWalletNameWithChain, l as createRuntimeServiceAccessKey } from './getVerifiedCredentialForWalletAccount.esm.js';
5
5
 
6
6
  /**
7
7
  * Shallow compare two objects.
@@ -457,11 +457,6 @@ const updateWalletProviderKeysForVerifiedCredentials = ({ keysToUpdate }, client
457
457
  });
458
458
  };
459
459
 
460
- const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client)=>{
461
- var _client_user;
462
- return (_client_user = client.user) == null ? void 0 : _client_user.verifiedCredentials.find((vc)=>vc.id === walletAccount.verifiedCredentialId);
463
- };
464
-
465
460
  /**
466
461
  * Maps the chain name from the API to the SDK chain name
467
462
  */ const getSdkChainFromApiChainName = (chainName)=>{
@@ -555,4 +550,4 @@ const getNetworkProviderFromNetworkId = ({ networkId, chain }, client)=>{
555
550
  return networkProvider;
556
551
  };
557
552
 
558
- export { CannotTrackError as C, FETCH_PROJECT_SETTINGS_TRACKER_KEY as F, GENERATE_SESSION_KEYS_TRACKER_KEY as G, INITIALIZE_STORAGE_SYNC_TRACKER_KEY as I, NoNetworkProvidersError as N, REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY as R, WalletAlreadyLinkedToAnotherUserError as W, createLogger as a, createStorage as b, createStorageKeySchema as c, createLocalStorageAdapter as d, consumeCaptchaToken as e, setUnverifiedWalletAccounts as f, createVisit as g, createSignInMessageStatement as h, isEqualShallow as i, formatSignInMessage as j, getVerifiedCredentialForWalletAccount as k, getNetworksData as l, getNetworkProviderFromNetworkId as m, isCaptchaRequired as n, setCaptchaToken as o, hasExtension as p, getNetworkProviders as q, InvalidStorageSet as r, subscribeWithSelector as s, getNetworkProviderBuilderRegistry as t, updateWalletProviderKeysForVerifiedCredentials as u, verifySignInMessage as v };
553
+ export { CannotTrackError as C, FETCH_PROJECT_SETTINGS_TRACKER_KEY as F, GENERATE_SESSION_KEYS_TRACKER_KEY as G, INITIALIZE_STORAGE_SYNC_TRACKER_KEY as I, NoNetworkProvidersError as N, REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY as R, WalletAlreadyLinkedToAnotherUserError as W, createLogger as a, createStorage as b, createStorageKeySchema as c, createLocalStorageAdapter as d, consumeCaptchaToken as e, setUnverifiedWalletAccounts as f, createVisit as g, createSignInMessageStatement as h, isEqualShallow as i, formatSignInMessage as j, getNetworksData as k, getNetworkProviderFromNetworkId as l, isCaptchaRequired as m, setCaptchaToken as n, hasExtension as o, getNetworkProviders as p, InvalidStorageSet as q, getNetworkProviderBuilderRegistry as r, subscribeWithSelector as s, updateWalletProviderKeysForVerifiedCredentials as u, verifySignInMessage as v };
@@ -485,6 +485,11 @@ const getWalletProviderByKey = ({ walletProviderKey }, client)=>{
485
485
  return walletProvider;
486
486
  };
487
487
 
488
+ const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client)=>{
489
+ var _client_user;
490
+ return (_client_user = client.user) == null ? void 0 : _client_user.verifiedCredentials.find((vc)=>vc.id === walletAccount.verifiedCredentialId);
491
+ };
492
+
488
493
  exports.DYNAMIC_AUTH_COOKIE_NAME = DYNAMIC_AUTH_COOKIE_NAME;
489
494
  exports.InvalidWalletProviderKeyError = InvalidWalletProviderKeyError;
490
495
  exports.NoWalletProviderFoundError = NoWalletProviderFoundError;
@@ -494,6 +499,7 @@ exports.emitEvent = emitEvent;
494
499
  exports.emitWalletAccountsChangedEvent = emitWalletAccountsChangedEvent;
495
500
  exports.formatWalletAccountId = formatWalletAccountId;
496
501
  exports.formatWalletProviderKey = formatWalletProviderKey;
502
+ exports.getVerifiedCredentialForWalletAccount = getVerifiedCredentialForWalletAccount;
497
503
  exports.getWalletAccounts = getWalletAccounts;
498
504
  exports.getWalletProviderByKey = getWalletProviderByKey;
499
505
  exports.getWalletProviderFromWalletAccount = getWalletProviderFromWalletAccount;
@@ -483,4 +483,9 @@ const getWalletProviderByKey = ({ walletProviderKey }, client)=>{
483
483
  return walletProvider;
484
484
  };
485
485
 
486
- export { DYNAMIC_AUTH_COOKIE_NAME as D, InvalidWalletProviderKeyError as I, NoWalletProviderFoundError as N, WalletProviderPriority as W, getWalletProviderFromWalletAccount as a, getWalletProviderByKey as b, emitWalletAccountsChangedEvent as c, checkAndRaiseWalletAccountsChangedEvent as d, emitEvent as e, formatWalletAccountId as f, getWalletAccounts as g, getWalletProviders as h, onceEvent as i, onEvent as j, createRuntimeServiceAccessKey as k, formatWalletProviderKey as l, normalizeWalletNameWithChain as m, normalizeAddress as n, offEvent as o, splitWalletProviderKey as p, getWalletProviderRegistry as q, setCookie as s, updateAuthFromVerifyResponse as u };
486
+ const getVerifiedCredentialForWalletAccount = ({ walletAccount }, client)=>{
487
+ var _client_user;
488
+ return (_client_user = client.user) == null ? void 0 : _client_user.verifiedCredentials.find((vc)=>vc.id === walletAccount.verifiedCredentialId);
489
+ };
490
+
491
+ export { DYNAMIC_AUTH_COOKIE_NAME as D, InvalidWalletProviderKeyError as I, NoWalletProviderFoundError as N, WalletProviderPriority as W, getWalletProviderFromWalletAccount as a, getWalletProviderByKey as b, emitWalletAccountsChangedEvent as c, checkAndRaiseWalletAccountsChangedEvent as d, emitEvent as e, formatWalletAccountId as f, getWalletAccounts as g, getWalletProviders as h, getVerifiedCredentialForWalletAccount as i, onceEvent as j, onEvent as k, createRuntimeServiceAccessKey as l, formatWalletProviderKey as m, normalizeAddress as n, offEvent as o, normalizeWalletNameWithChain as p, splitWalletProviderKey as q, getWalletProviderRegistry as r, setCookie as s, updateAuthFromVerifyResponse as u };
package/index.cjs.js CHANGED
@@ -4,7 +4,7 @@ var assertPackageVersion = require('@dynamic-labs-sdk/assert-package-version');
4
4
  var constants = require('./constants.cjs.js');
5
5
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
6
6
  var getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId.cjs.js');
7
- var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
7
+ var getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount.cjs.js');
8
8
  var z = require('zod/mini');
9
9
  var isMfaRequiredForAction = require('./isMfaRequiredForAction.cjs.js');
10
10
  var NotWaasWalletAccountError = require('./NotWaasWalletAccountError.cjs.js');
@@ -88,7 +88,7 @@ const retryOnFail = async ({ delay = 0, fn, maxRetries })=>{
88
88
  *
89
89
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
90
90
  * @returns True if the user is signed in, false otherwise.
91
- */ const isSignedIn = (client = constants.getDefaultClient())=>Boolean(client.user || getWalletProviderByKey.getWalletAccounts(client).length > 0);
91
+ */ const isSignedIn = (client = constants.getDefaultClient())=>Boolean(client.user || getVerifiedCredentialForWalletAccount.getWalletAccounts(client).length > 0);
92
92
 
93
93
  /**
94
94
  * The schema to track the expiration time of the project settings.
@@ -218,13 +218,13 @@ const generateSessionKeys = async (client)=>{
218
218
  const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
219
219
  const core = constants.getCore(client);
220
220
  const walletProvidersMap = new Map();
221
- const walletAccounts = getWalletProviderByKey.getWalletAccounts(client);
221
+ const walletAccounts = getVerifiedCredentialForWalletAccount.getWalletAccounts(client);
222
222
  walletAccounts.forEach((walletAccount)=>{
223
223
  if (walletProvidersMap.has(walletAccount.walletProviderKey)) {
224
224
  return;
225
225
  }
226
226
  try {
227
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
227
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
228
228
  walletAccount
229
229
  }, client);
230
230
  walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);
@@ -278,7 +278,7 @@ const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
278
278
  * This deletes the auth cookie if it exists.
279
279
  * If the cookie doesn't exist, this sets a new cookie that expires immediately.
280
280
  */ if (constants.isCookieEnabled(client)) {
281
- getWalletProviderByKey.setCookie(`${getWalletProviderByKey.DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
281
+ getVerifiedCredentialForWalletAccount.setCookie(`${getVerifiedCredentialForWalletAccount.DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`);
282
282
  }
283
283
  }
284
284
  core.state.set({
@@ -291,7 +291,7 @@ const getAvailableWalletProvidersFromWalletAccounts = (client)=>{
291
291
  unverifiedWalletAccounts: [],
292
292
  user: null
293
293
  });
294
- getWalletProviderByKey.emitEvent({
294
+ getVerifiedCredentialForWalletAccount.emitEvent({
295
295
  event: 'logout'
296
296
  }, client);
297
297
  // Refetch project settings
@@ -357,7 +357,7 @@ const raiseStateEvents = (client)=>{
357
357
  eventEntries.forEach(([key, event])=>{
358
358
  // Check if this key had a change
359
359
  if (getNetworkProviderFromNetworkId.isEqualShallow(value[key], previous[key])) return;
360
- getWalletProviderByKey.emitEvent({
360
+ getVerifiedCredentialForWalletAccount.emitEvent({
361
361
  args: {
362
362
  [key]: value[key]
363
363
  },
@@ -1180,7 +1180,7 @@ class WalletProviderMethodUnavailableError extends constants.BaseError {
1180
1180
  sessionPublicKey
1181
1181
  }
1182
1182
  });
1183
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1183
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1184
1184
  response
1185
1185
  }, client);
1186
1186
  return response;
@@ -1267,7 +1267,7 @@ const serverRegisterPasskey = async ({ registration }, client)=>{
1267
1267
  const response = await serverRegisterPasskey({
1268
1268
  registration
1269
1269
  }, client);
1270
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1270
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1271
1271
  response
1272
1272
  }, client);
1273
1273
  return response;
@@ -1323,7 +1323,7 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client)=>
1323
1323
  const response = await serverSigninPasskey({
1324
1324
  authentication
1325
1325
  }, client);
1326
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1326
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1327
1327
  response
1328
1328
  }, client);
1329
1329
  return response;
@@ -1554,7 +1554,7 @@ const providersRequiringPkce = [
1554
1554
  providerType: provider
1555
1555
  });
1556
1556
  }
1557
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1557
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1558
1558
  response
1559
1559
  }, client);
1560
1560
  return response.user;
@@ -1633,7 +1633,7 @@ const providersRequiringPkce = [
1633
1633
  environmentId: core.environmentId,
1634
1634
  userFields
1635
1635
  });
1636
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1636
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1637
1637
  response
1638
1638
  }, client);
1639
1639
  if (response.emailVerification) {
@@ -1689,10 +1689,10 @@ const providersRequiringPkce = [
1689
1689
  createMfaToken: createMfaTokenOptions
1690
1690
  }
1691
1691
  });
1692
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1692
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1693
1693
  response
1694
1694
  }, client);
1695
- getWalletProviderByKey.emitEvent({
1695
+ getVerifiedCredentialForWalletAccount.emitEvent({
1696
1696
  args: {
1697
1697
  mfaToken: response.mfaToken
1698
1698
  },
@@ -1700,7 +1700,7 @@ const providersRequiringPkce = [
1700
1700
  }, client);
1701
1701
  return response;
1702
1702
  } catch (error) {
1703
- getWalletProviderByKey.emitEvent({
1703
+ getVerifiedCredentialForWalletAccount.emitEvent({
1704
1704
  args: {
1705
1705
  error
1706
1706
  },
@@ -1773,10 +1773,10 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken }, cli
1773
1773
  authentication,
1774
1774
  createMfaToken
1775
1775
  }, client);
1776
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1776
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1777
1777
  response
1778
1778
  }, client);
1779
- getWalletProviderByKey.emitEvent({
1779
+ getVerifiedCredentialForWalletAccount.emitEvent({
1780
1780
  args: {
1781
1781
  mfaToken: response.mfaToken
1782
1782
  },
@@ -1784,7 +1784,7 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken }, cli
1784
1784
  }, client);
1785
1785
  return response;
1786
1786
  } catch (error) {
1787
- getWalletProviderByKey.emitEvent({
1787
+ getVerifiedCredentialForWalletAccount.emitEvent({
1788
1788
  args: {
1789
1789
  error
1790
1790
  },
@@ -1817,10 +1817,10 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken }, cli
1817
1817
  id: deviceId
1818
1818
  }
1819
1819
  });
1820
- getWalletProviderByKey.updateAuthFromVerifyResponse({
1820
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
1821
1821
  response
1822
1822
  }, client);
1823
- getWalletProviderByKey.emitEvent({
1823
+ getVerifiedCredentialForWalletAccount.emitEvent({
1824
1824
  args: {
1825
1825
  deviceId,
1826
1826
  mfaToken: response.mfaToken
@@ -1829,7 +1829,7 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken }, cli
1829
1829
  }, client);
1830
1830
  return response;
1831
1831
  } catch (error) {
1832
- getWalletProviderByKey.emitEvent({
1832
+ getVerifiedCredentialForWalletAccount.emitEvent({
1833
1833
  args: {
1834
1834
  deviceId,
1835
1835
  error
@@ -3009,7 +3009,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
3009
3009
  otpVerification,
3010
3010
  verificationToken
3011
3011
  }, client);
3012
- getWalletProviderByKey.updateAuthFromVerifyResponse({
3012
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
3013
3013
  response
3014
3014
  }, client);
3015
3015
  return response.user;
@@ -3029,7 +3029,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
3029
3029
  * @returns A promise that resolves if the wallet is available for signing.
3030
3030
  * @throws WalletAccountNotSelectedError If the wallet account is not currently selected.
3031
3031
  */ const assertWalletAccountSigningAvailability = async ({ walletAccount }, client = constants.getDefaultClient())=>{
3032
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3032
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3033
3033
  walletAccount
3034
3034
  }, client);
3035
3035
  const { addresses } = await walletProvider.getConnectedAddresses();
@@ -3083,12 +3083,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult)=>{
3083
3083
  * @returns A promise that resolves to the connected wallet account.
3084
3084
  * @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
3085
3085
  */ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true }, client = constants.getDefaultClient())=>{
3086
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
3086
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3087
3087
  walletProviderKey
3088
3088
  }, client);
3089
3089
  assertWalletProviderMethodDefined(walletProvider, 'connect');
3090
3090
  const { addresses } = await walletProvider.connect();
3091
- const currentAddresses = getWalletProviderByKey.getWalletAccounts(client).map(({ address })=>address);
3091
+ const currentAddresses = getVerifiedCredentialForWalletAccount.getWalletAccounts(client).map(({ address })=>address);
3092
3092
  const mainAddress = (addresses == null ? void 0 : addresses.length) ? addresses[0].address : null;
3093
3093
  /**
3094
3094
  * This error is thrown in case the wallet has no addresses connected
@@ -3103,7 +3103,7 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult)=>{
3103
3103
  addresses
3104
3104
  }),
3105
3105
  chain: walletProvider.chain,
3106
- id: getWalletProviderByKey.formatWalletAccountId({
3106
+ id: getVerifiedCredentialForWalletAccount.formatWalletAccountId({
3107
3107
  address: mainAddress,
3108
3108
  chain: walletProvider.chain,
3109
3109
  walletProviderKey
@@ -3121,7 +3121,7 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult)=>{
3121
3121
  walletAccount
3122
3122
  ]
3123
3123
  }, client);
3124
- getWalletProviderByKey.emitWalletAccountsChangedEvent(client);
3124
+ getVerifiedCredentialForWalletAccount.emitWalletAccountsChangedEvent(client);
3125
3125
  /*
3126
3126
  * send information to backend to kick off background jobs
3127
3127
  * this is an async work, but does not need to be awaited
@@ -3165,7 +3165,7 @@ const getSignInMessage = async ({ walletAccount }, client)=>{
3165
3165
  environmentId: core.environmentId
3166
3166
  });
3167
3167
  constants.assertDefined(nonce, 'Failed to get nonce');
3168
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3168
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3169
3169
  walletAccount
3170
3170
  }, client);
3171
3171
  const statement = getNetworkProviderFromNetworkId.createSignInMessageStatement(client);
@@ -3195,7 +3195,7 @@ const getSignInMessage = async ({ walletAccount }, client)=>{
3195
3195
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3196
3196
  * @returns A promise that resolves to an object containing the message and signature.
3197
3197
  */ const proveWalletAccountOwnership = async ({ walletAccount }, client = constants.getDefaultClient())=>{
3198
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3198
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3199
3199
  walletAccount
3200
3200
  }, client);
3201
3201
  assertWalletProviderMethodDefined(walletProvider, 'signMessage');
@@ -3225,12 +3225,12 @@ const getSignInMessage = async ({ walletAccount }, client)=>{
3225
3225
  /**
3226
3226
  * We check before raising because the wallet account we are removing might still
3227
3227
  * be present in wallet accounts due to having been moved to verified credentials.
3228
- */ getWalletProviderByKey.checkAndRaiseWalletAccountsChangedEvent({
3228
+ */ getVerifiedCredentialForWalletAccount.checkAndRaiseWalletAccountsChangedEvent({
3229
3229
  previousState
3230
3230
  }, client);
3231
3231
  };
3232
3232
 
3233
- const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddress(left, chain) === getWalletProviderByKey.normalizeAddress(right, chain);
3233
+ const isSameAddress = (left, right, chain)=>getVerifiedCredentialForWalletAccount.normalizeAddress(left, chain) === getVerifiedCredentialForWalletAccount.normalizeAddress(right, chain);
3234
3234
 
3235
3235
  /**
3236
3236
  * Verifies ownership of a wallet account and adds it to the user's profile.
@@ -3248,7 +3248,7 @@ const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddr
3248
3248
  if (walletAccount.verifiedCredentialId) {
3249
3249
  throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
3250
3250
  }
3251
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3251
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3252
3252
  walletAccount
3253
3253
  }, client);
3254
3254
  const { messageToSign, signature } = await proveWalletAccountOwnership({
@@ -3276,7 +3276,7 @@ const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddr
3276
3276
  /**
3277
3277
  * Adds the user with the new wallet verified credential
3278
3278
  * This will add the new verified wallet account to the client`s state
3279
- */ getWalletProviderByKey.updateAuthFromVerifyResponse({
3279
+ */ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
3280
3280
  response
3281
3281
  }, client);
3282
3282
  /**
@@ -3284,7 +3284,7 @@ const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddr
3284
3284
  */ removeUnverifiedWalletAccount({
3285
3285
  unverifiedWalletAccount: walletAccount
3286
3286
  }, client);
3287
- const verifiedWalletAccount = getWalletProviderByKey.getWalletAccounts(client).find(({ address })=>isSameAddress(address, walletAccount.address, walletAccount.chain));
3287
+ const verifiedWalletAccount = getVerifiedCredentialForWalletAccount.getWalletAccounts(client).find(({ address })=>isSameAddress(address, walletAccount.address, walletAccount.chain));
3288
3288
  constants.assertDefined(verifiedWalletAccount, `Unable to find wallet account ${walletAccount.address} on chain ${walletAccount.chain} for verified credential ${walletVerifiedCredential.id}`);
3289
3289
  return verifiedWalletAccount;
3290
3290
  };
@@ -3326,7 +3326,7 @@ const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddr
3326
3326
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3327
3327
  * @returns An array of wallet provider data including chain, keys, and metadata.
3328
3328
  */ const getAvailableWalletProvidersData = (client = constants.getDefaultClient())=>{
3329
- const allWalletProviders = getWalletProviderByKey.getWalletProviders(client);
3329
+ const allWalletProviders = getVerifiedCredentialForWalletAccount.getWalletProviders(client);
3330
3330
  // This is to avoid returning the wallet providers that are connected via different means
3331
3331
  // than by the "connect" method — like the Dynamic Waas providers, AA providers, or WalletConnect providers.
3332
3332
  const filteredWalletProviders = allWalletProviders.filter((walletProvider)=>Boolean(walletProvider.connect));
@@ -3349,18 +3349,18 @@ const isSameAddress = (left, right, chain)=>getWalletProviderByKey.normalizeAddr
3349
3349
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3350
3350
  * @returns An array of connected wallet addresses.
3351
3351
  */ const getConnectedAddresses = ({ walletProviderKey }, client = constants.getDefaultClient())=>{
3352
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
3352
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3353
3353
  walletProviderKey
3354
3354
  }, client);
3355
3355
  return walletProvider.getConnectedAddresses();
3356
3356
  };
3357
3357
 
3358
3358
  const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client = constants.getDefaultClient())=>{
3359
- const smartWalletVerifiedCredential = getNetworkProviderFromNetworkId.getVerifiedCredentialForWalletAccount({
3359
+ const smartWalletVerifiedCredential = getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount({
3360
3360
  walletAccount: smartWalletAccount
3361
3361
  }, client);
3362
3362
  constants.assertDefined(smartWalletVerifiedCredential == null ? void 0 : smartWalletVerifiedCredential.signerRefId, 'Invalid smart wallet account');
3363
- return getWalletProviderByKey.getWalletAccounts(client).find((walletAccount)=>walletAccount.verifiedCredentialId === smartWalletVerifiedCredential.signerRefId);
3363
+ return getVerifiedCredentialForWalletAccount.getWalletAccounts(client).find((walletAccount)=>walletAccount.verifiedCredentialId === smartWalletVerifiedCredential.signerRefId);
3364
3364
  };
3365
3365
 
3366
3366
  const getWalletAccountAddressByType = ({ type, walletAccount })=>{
@@ -3375,7 +3375,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3375
3375
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3376
3376
  * @returns The data for the wallet provider.
3377
3377
  */ const getWalletProviderDataByKey = ({ walletProviderKey }, client = constants.getDefaultClient())=>{
3378
- const { chain, groupKey, key, metadata, walletProviderType } = getWalletProviderByKey.getWalletProviderByKey({
3378
+ const { chain, groupKey, key, metadata, walletProviderType } = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3379
3379
  walletProviderKey
3380
3380
  }, client);
3381
3381
  return {
@@ -3398,7 +3398,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3398
3398
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3399
3399
  * @returns A promise that resolves to the network data, or undefined if not found.
3400
3400
  */ const getActiveNetworkData = async ({ walletAccount }, client = constants.getDefaultClient())=>{
3401
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3401
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3402
3402
  walletAccount
3403
3403
  }, client);
3404
3404
  const { networkId } = await walletProvider.getActiveNetworkId();
@@ -3416,7 +3416,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3416
3416
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3417
3417
  * @returns A promise that resolves to the active network ID for the wallet account.
3418
3418
  */ const getActiveNetworkId = ({ walletAccount }, client = constants.getDefaultClient())=>{
3419
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3419
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3420
3420
  walletAccount
3421
3421
  }, client);
3422
3422
  return walletProvider.getActiveNetworkId();
@@ -3432,7 +3432,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3432
3432
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3433
3433
  * @returns A promise that resolves to an object containing the balance as a string or null.
3434
3434
  */ const getBalance = async ({ walletAccount }, client = constants.getDefaultClient())=>{
3435
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3435
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3436
3436
  walletAccount
3437
3437
  }, client);
3438
3438
  const { networkId } = await walletProvider.getActiveNetworkId();
@@ -3477,7 +3477,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3477
3477
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3478
3478
  * @returns True if programmatic network switching is available, false otherwise.
3479
3479
  */ const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client = constants.getDefaultClient())=>{
3480
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
3480
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3481
3481
  walletProviderKey: walletAccount.walletProviderKey
3482
3482
  }, client);
3483
3483
  return walletProvider.switchActiveNetwork !== undefined;
@@ -3495,7 +3495,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3495
3495
  * @returns A promise that resolves when the network switch is complete.
3496
3496
  * @throws NetworkSwitchingUnavailableError If the wallet provider doesn't support network switching.
3497
3497
  */ const switchActiveNetwork = async ({ networkId, walletAccount }, client = constants.getDefaultClient())=>{
3498
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
3498
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3499
3499
  walletProviderKey: walletAccount.walletProviderKey
3500
3500
  }, client);
3501
3501
  if (walletProvider.switchActiveNetwork === undefined) {
@@ -3518,7 +3518,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3518
3518
  * This information is stored in both unverified and verified wallet accounts.
3519
3519
  * This function consolidates this information to determine which wallet was most recently selected.
3520
3520
  */ const getPrimaryWalletAccount = (client = constants.getDefaultClient())=>{
3521
- const walletAccounts = getWalletProviderByKey.getWalletAccounts(client);
3521
+ const walletAccounts = getVerifiedCredentialForWalletAccount.getWalletAccounts(client);
3522
3522
  const sortedLastSelectedWalletAccounts = walletAccounts.filter((walletAccount)=>Boolean(walletAccount.lastSelectedAt)).sort((a, b)=>b.lastSelectedAt.getTime() - a.lastSelectedAt.getTime());
3523
3523
  if (sortedLastSelectedWalletAccounts.length === 0) {
3524
3524
  return null;
@@ -3543,7 +3543,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3543
3543
  walletId: walletAccount.verifiedCredentialId
3544
3544
  }
3545
3545
  });
3546
- getWalletProviderByKey.updateAuthFromVerifyResponse({
3546
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
3547
3547
  response
3548
3548
  }, client);
3549
3549
  } else {
@@ -3572,14 +3572,14 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3572
3572
  const core = constants.getCore(client);
3573
3573
  const apiClient = constants.createApiClient({}, client);
3574
3574
  try {
3575
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3575
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3576
3576
  walletAccount
3577
3577
  }, client);
3578
3578
  await (walletProvider.disconnectWalletAccount == null ? void 0 : walletProvider.disconnectWalletAccount.call(walletProvider, {
3579
3579
  walletAccount
3580
3580
  }));
3581
3581
  } catch (error) {
3582
- if (error instanceof getWalletProviderByKey.NoWalletProviderFoundError) {
3582
+ if (error instanceof getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError) {
3583
3583
  return;
3584
3584
  }
3585
3585
  throw error;
@@ -3596,7 +3596,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3596
3596
  walletId: walletAccount.verifiedCredentialId
3597
3597
  }
3598
3598
  });
3599
- getWalletProviderByKey.updateAuthFromVerifyResponse({
3599
+ getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
3600
3600
  response
3601
3601
  }, client);
3602
3602
  };
@@ -3612,7 +3612,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3612
3612
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3613
3613
  * @returns A promise that resolves to an object containing the signature.
3614
3614
  */ const signMessage = async ({ walletAccount, message }, client = constants.getDefaultClient())=>{
3615
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
3615
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
3616
3616
  walletAccount
3617
3617
  }, client);
3618
3618
  assertWalletProviderMethodDefined(walletProvider, 'signMessage');
@@ -3636,7 +3636,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3636
3636
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3637
3637
  * @returns The matching wallet account, or undefined if not found.
3638
3638
  */ const getWalletAccountFromAddress = ({ address, chain }, client = constants.getDefaultClient())=>{
3639
- const walletAccounts = getWalletProviderByKey.getWalletAccounts(client);
3639
+ const walletAccounts = getVerifiedCredentialForWalletAccount.getWalletAccounts(client);
3640
3640
  return walletAccounts.find((walletAccount)=>walletAccount.address === address && walletAccount.chain === chain);
3641
3641
  };
3642
3642
 
@@ -3650,7 +3650,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3650
3650
  * @param params.walletProviderKey - The unique key identifying the wallet provider to remove the listener from.
3651
3651
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3652
3652
  */ const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client = constants.getDefaultClient())=>{
3653
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
3653
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3654
3654
  walletProviderKey
3655
3655
  }, client);
3656
3656
  assertWalletProviderMethodDefined(walletProvider, 'events');
@@ -3668,7 +3668,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount })=>{
3668
3668
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
3669
3669
  * @returns A function that can be called to remove the listener.
3670
3670
  */ const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client = constants.getDefaultClient())=>{
3671
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
3671
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
3672
3672
  walletProviderKey
3673
3673
  }, client);
3674
3674
  assertWalletProviderMethodDefined(walletProvider, 'events');
@@ -3723,10 +3723,10 @@ exports.getNetworksData = getNetworkProviderFromNetworkId.getNetworksData;
3723
3723
  exports.hasExtension = getNetworkProviderFromNetworkId.hasExtension;
3724
3724
  exports.isCaptchaRequired = getNetworkProviderFromNetworkId.isCaptchaRequired;
3725
3725
  exports.setCaptchaToken = getNetworkProviderFromNetworkId.setCaptchaToken;
3726
- exports.getWalletAccounts = getWalletProviderByKey.getWalletAccounts;
3727
- exports.offEvent = getWalletProviderByKey.offEvent;
3728
- exports.onEvent = getWalletProviderByKey.onEvent;
3729
- exports.onceEvent = getWalletProviderByKey.onceEvent;
3726
+ exports.getWalletAccounts = getVerifiedCredentialForWalletAccount.getWalletAccounts;
3727
+ exports.offEvent = getVerifiedCredentialForWalletAccount.offEvent;
3728
+ exports.onEvent = getVerifiedCredentialForWalletAccount.onEvent;
3729
+ exports.onceEvent = getVerifiedCredentialForWalletAccount.onceEvent;
3730
3730
  exports.consumeMfaToken = isMfaRequiredForAction.consumeMfaToken;
3731
3731
  exports.getMfaMethods = isMfaRequiredForAction.getMfaMethods;
3732
3732
  exports.isMfaRequiredForAction = isMfaRequiredForAction.isMfaRequiredForAction;
package/index.esm.js CHANGED
@@ -3,10 +3,10 @@ import { B as BaseError, g as getDefaultClient, a as getCore, c as createApiClie
3
3
  export { I as InvalidExternalAuthError, M as MfaInvalidOtpError, f as MfaRateLimitedError, h as SandboxMaximumThresholdReachedError } from './constants.esm.js';
4
4
  import { JwtVerifiedCredentialFormatEnum, ProviderEnum, MfaBackupCodeAcknowledgement, AuthModeEnum } from '@dynamic-labs/sdk-api-core';
5
5
  export { MFAAction } from '@dynamic-labs/sdk-api-core';
6
- import { c as createStorageKeySchema, s as subscribeWithSelector, i as isEqualShallow, I as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, F as FETCH_PROJECT_SETTINGS_TRACKER_KEY, G as GENERATE_SESSION_KEYS_TRACKER_KEY, R as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, C as CannotTrackError, a as createLogger, b as createStorage, d as createLocalStorageAdapter, e as consumeCaptchaToken, f as setUnverifiedWalletAccounts, g as createVisit, h as createSignInMessageStatement, j as formatSignInMessage, v as verifySignInMessage, u as updateWalletProviderKeysForVerifiedCredentials, k as getVerifiedCredentialForWalletAccount, l as getNetworksData, m as getNetworkProviderFromNetworkId } from './getNetworkProviderFromNetworkId.esm.js';
7
- export { N as NoNetworkProvidersError, W as WalletAlreadyLinkedToAnotherUserError, p as hasExtension, n as isCaptchaRequired, o as setCaptchaToken } from './getNetworkProviderFromNetworkId.esm.js';
8
- import { g as getWalletAccounts, a as getWalletProviderFromWalletAccount, s as setCookie, e as emitEvent, D as DYNAMIC_AUTH_COOKIE_NAME, u as updateAuthFromVerifyResponse, b as getWalletProviderByKey, f as formatWalletAccountId, c as emitWalletAccountsChangedEvent, d as checkAndRaiseWalletAccountsChangedEvent, n as normalizeAddress, h as getWalletProviders, N as NoWalletProviderFoundError } from './getWalletProviderByKey.esm.js';
9
- export { o as offEvent, j as onEvent, i as onceEvent } from './getWalletProviderByKey.esm.js';
6
+ import { c as createStorageKeySchema, s as subscribeWithSelector, i as isEqualShallow, I as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, F as FETCH_PROJECT_SETTINGS_TRACKER_KEY, G as GENERATE_SESSION_KEYS_TRACKER_KEY, R as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, C as CannotTrackError, a as createLogger, b as createStorage, d as createLocalStorageAdapter, e as consumeCaptchaToken, f as setUnverifiedWalletAccounts, g as createVisit, h as createSignInMessageStatement, j as formatSignInMessage, v as verifySignInMessage, u as updateWalletProviderKeysForVerifiedCredentials, k as getNetworksData, l as getNetworkProviderFromNetworkId } from './getNetworkProviderFromNetworkId.esm.js';
7
+ export { N as NoNetworkProvidersError, W as WalletAlreadyLinkedToAnotherUserError, o as hasExtension, m as isCaptchaRequired, n as setCaptchaToken } from './getNetworkProviderFromNetworkId.esm.js';
8
+ import { g as getWalletAccounts, a as getWalletProviderFromWalletAccount, s as setCookie, e as emitEvent, D as DYNAMIC_AUTH_COOKIE_NAME, u as updateAuthFromVerifyResponse, b as getWalletProviderByKey, f as formatWalletAccountId, c as emitWalletAccountsChangedEvent, d as checkAndRaiseWalletAccountsChangedEvent, n as normalizeAddress, h as getWalletProviders, i as getVerifiedCredentialForWalletAccount, N as NoWalletProviderFoundError } from './getVerifiedCredentialForWalletAccount.esm.js';
9
+ export { o as offEvent, k as onEvent, j as onceEvent } from './getVerifiedCredentialForWalletAccount.esm.js';
10
10
  import * as z from 'zod/mini';
11
11
  import { b as bufferToHex } from './isMfaRequiredForAction.esm.js';
12
12
  export { c as consumeMfaToken, g as getMfaMethods, i as isMfaRequiredForAction } from './isMfaRequiredForAction.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs-sdk/client",
3
- "version": "0.1.0-alpha.28",
3
+ "version": "0.1.0-alpha.29",
4
4
  "type": "module",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.28",
32
+ "@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.29",
33
33
  "@dynamic-labs/sdk-api-core": "0.0.818",
34
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.187",
34
+ "@dynamic-labs-wallet/browser-wallet-client": "0.0.190",
35
35
  "@simplewebauthn/browser": "13.1.0",
36
36
  "buffer": "6.0.3",
37
37
  "eventemitter3": "5.0.1",
@@ -5,10 +5,12 @@ export { delegateWaasKeyShares } from '../modules/waas/delegateWaasKeyShares';
5
5
  export { exportWaasClientKeyshares } from '../modules/waas/exportWaasClientKeyshares';
6
6
  export { exportWaasPrivateKey } from '../modules/waas/exportWaasPrivateKey';
7
7
  export { getChainsMissingWaasWalletAccounts } from '../modules/waas/getChainsMissingWaasWalletAccounts';
8
+ export { hasDelegatedAccess } from '../modules/waas/hasDelegatedAccess';
8
9
  export { importWaasPrivateKey } from '../modules/waas/importWaasPrivateKey';
9
10
  export { isDynamicWaasEnabled } from '../modules/waas/isDynamicWaasEnabled';
10
11
  export { isWaasWalletAccount } from '../modules/waas/isWaasWalletAccount';
11
12
  export { refreshWaasWalletAccountShares } from '../modules/waas/refreshWaasWalletAccountShares';
13
+ export { revokeWaasDelegation } from '../modules/waas/revokeWaasDelegation';
12
14
  export { shouldAutoCreateWalletForChain } from '../modules/waas/shouldAutoCreateWalletForChain';
13
15
  export { updateWaasPassword } from '../modules/waas/updateWaasPassword';
14
16
  //# sourceMappingURL=waas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waas.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/exports/waas.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"waas.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/exports/waas.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createWaasProvider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/createWaasProvider/createWaasProvider.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BAG5B,wBAAwB,KAAG,YA6Q7B,CAAC"}
1
+ {"version":3,"file":"createWaasProvider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/createWaasProvider/createWaasProvider.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BAG5B,wBAAwB,KAAG,YA8R7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"delegateWaasKeyShares.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,2BAA2B,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,gCACH,2BAA2B,qEAYzD,CAAC"}
1
+ {"version":3,"file":"delegateWaasKeyShares.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,2BAA2B,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,gCACH,2BAA2B,wDAEvD,OAAO,CAAC,IAAI,CAYd,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { WalletAccount } from '../../wallets/walletAccount';
2
+ type HasDelegatedAccessParams = {
3
+ walletAccount: WalletAccount;
4
+ };
5
+ /**
6
+ * Checks if a WaaS wallet account has delegated access.
7
+ *
8
+ * @param params.walletAccount - The WaaS wallet account to check for delegated access.
9
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
10
+ * @returns True if the wallet account has delegated access, false otherwise.
11
+ */
12
+ export declare const hasDelegatedAccess: ({ walletAccount }: HasDelegatedAccessParams, client?: import("../../../exports").DynamicClient) => boolean;
13
+ export {};
14
+ //# sourceMappingURL=hasDelegatedAccess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasDelegatedAccess.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,KAAK,wBAAwB,GAAG;IAC9B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,sBACV,wBAAwB,wDAE1C,OAiBF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { hasDelegatedAccess } from './hasDelegatedAccess';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/hasDelegatedAccess/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { revokeWaasDelegation } from './revokeWaasDelegation';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/revokeWaasDelegation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { WalletAccount } from '../../wallets/walletAccount';
2
+ type RevokeWaasDelegationParams = {
3
+ password?: string;
4
+ walletAccount: WalletAccount;
5
+ };
6
+ /**
7
+ * Revokes the delegation of a WaaS wallet account.
8
+ *
9
+ * @param params.walletAccount - The WaaS wallet account to revoke delegation for.
10
+ * @param [params.password] - Optional password for delegation operations.
11
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
12
+ * @returns A promise that resolves when the delegation is revoked.
13
+ */
14
+ export declare const revokeWaasDelegation: ({ password, walletAccount }: RevokeWaasDelegationParams, client?: import("../../../exports").DynamicClient) => Promise<void>;
15
+ export {};
16
+ //# sourceMappingURL=revokeWaasDelegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revokeWaasDelegation.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,gCACF,0BAA0B,wDAEtD,OAAO,CAAC,IAAI,CAYd,CAAC"}
@@ -35,6 +35,10 @@ export type WaasProvider = {
35
35
  password?: string;
36
36
  walletAccount: WalletAccount;
37
37
  }) => Promise<void>;
38
+ revokeDelegation: (args: {
39
+ password?: string;
40
+ walletAccount: WalletAccount;
41
+ }) => Promise<void>;
38
42
  signMessage: (args: {
39
43
  message: string;
40
44
  walletAccount: WalletAccount;
@@ -1 +1 @@
1
- {"version":3,"file":"waas.types.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/waas/waas.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG;IACzB,4BAA4B,EAAE,CAAC,IAAI,EAAE;QACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,mBAAmB,CAAC,IAAI,CAAC,EAAE;QACzB,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;KAC/C,CAAC,CAAC;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,qBAAqB,EAAE,CAAC,IAAI,EAAE;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,gBAAgB,EAAE,WAAW,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,aAAa,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClD,gBAAgB,CAAC,IAAI,EAAE;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;KACrD,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,0BAA0B,EAAE,CAAC,IAAI,EAAE;QACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,WAAW,EAAE,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,cAAc,EAAE,CAAC,IAAI,EAAE;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,yBAAyB,EAAE,CAAC,IAAI,EAAE;QAChC,qBAAqB,EAAE,MAAM,CAAC;QAC9B,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,cAAc,EAAE,CAAC,IAAI,EAAE;QACrB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAC7C,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"waas.types.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/waas/waas.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG;IACzB,4BAA4B,EAAE,CAAC,IAAI,EAAE;QACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,mBAAmB,CAAC,IAAI,CAAC,EAAE;QACzB,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;KAC/C,CAAC,CAAC;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,qBAAqB,EAAE,CAAC,IAAI,EAAE;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,gBAAgB,EAAE,WAAW,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,aAAa,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClD,gBAAgB,CAAC,IAAI,EAAE;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;KACrD,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,0BAA0B,EAAE,CAAC,IAAI,EAAE;QACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,WAAW,EAAE,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,cAAc,EAAE,CAAC,IAAI,EAAE;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,yBAAyB,EAAE,CAAC,IAAI,EAAE;QAChC,qBAAqB,EAAE,MAAM,CAAC;QAC9B,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,cAAc,EAAE,CAAC,IAAI,EAAE;QACrB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAC7C,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC"}
package/waas.cjs.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var assertPackageVersion = require('@dynamic-labs-sdk/assert-package-version');
4
4
  var constants = require('./constants.cjs.js');
5
5
  var NotWaasWalletAccountError = require('./NotWaasWalletAccountError.cjs.js');
6
- var getWalletProviderByKey = require('./getWalletProviderByKey.cjs.js');
6
+ var getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount.cjs.js');
7
7
  var constants$1 = require('./constants.cjs2.js');
8
8
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
9
  var filterDuplicates = require('./filterDuplicates.cjs.js');
@@ -26,7 +26,7 @@ const isWaasWalletProvider = (walletProvider)=>{
26
26
  };
27
27
 
28
28
  const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
29
- const walletProvider = getWalletProviderByKey.getWalletProviderFromWalletAccount({
29
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
30
30
  walletAccount
31
31
  }, client);
32
32
  if (!isWaasWalletProvider(walletProvider)) {
@@ -80,17 +80,17 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
80
80
  if (filteredSupportedChains.length === 0) {
81
81
  return;
82
82
  }
83
- const walletProviderKeys = filteredSupportedChains.map((chain)=>getWalletProviderByKey.formatWalletProviderKey({
83
+ const walletProviderKeys = filteredSupportedChains.map((chain)=>getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
84
84
  chain,
85
85
  displayName: constants$1.DYNAMIC_WAAS_METADATA.displayName,
86
86
  walletProviderType: sdkApiCore.WalletProviderEnum.EmbeddedWallet
87
87
  }));
88
88
  const walletProviderEntries = filterDuplicates.filterDuplicates(walletProviderKeys).map((walletProviderKey)=>{
89
- const walletProvider = getWalletProviderByKey.getWalletProviderByKey({
89
+ const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
90
90
  walletProviderKey
91
91
  }, client);
92
92
  if (!walletProvider) {
93
- throw new getWalletProviderByKey.NoWalletProviderFoundError({
93
+ throw new getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError({
94
94
  walletProviderKey
95
95
  });
96
96
  }
@@ -123,10 +123,11 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
123
123
  const provider = getWaasWalletProviderFromWalletAccount({
124
124
  walletAccount
125
125
  }, client);
126
- return provider.delegateKeyShares({
126
+ await provider.delegateKeyShares({
127
127
  password,
128
128
  walletAccount
129
129
  });
130
+ await NotWaasWalletAccountError.refreshUser(client);
130
131
  };
131
132
 
132
133
  /**
@@ -217,16 +218,32 @@ const userHasEmbeddedWalletForChain = ({ user, chain })=>{
217
218
  }));
218
219
  };
219
220
 
221
+ /**
222
+ * Checks if a WaaS wallet account has delegated access.
223
+ *
224
+ * @param params.walletAccount - The WaaS wallet account to check for delegated access.
225
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
226
+ * @returns True if the wallet account has delegated access, false otherwise.
227
+ */ const hasDelegatedAccess = ({ walletAccount }, client = constants.getDefaultClient())=>{
228
+ var _verifiedCredential_walletProperties_keyShares, _verifiedCredential_walletProperties;
229
+ const verifiedCredential = getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount({
230
+ walletAccount
231
+ }, client);
232
+ constants.assertDefined(verifiedCredential, 'Verified credential not found for Waas wallet account');
233
+ const hasDelegatedKeyShare = (_verifiedCredential_walletProperties = verifiedCredential.walletProperties) == null ? void 0 : (_verifiedCredential_walletProperties_keyShares = _verifiedCredential_walletProperties.keyShares) == null ? void 0 : _verifiedCredential_walletProperties_keyShares.some((keyShare)=>keyShare.backupLocation === 'delegated');
234
+ return !!hasDelegatedKeyShare;
235
+ };
236
+
220
237
  const getWaasWalletProviderByChain = ({ chain }, client)=>{
221
- const providers = getWalletProviderByKey.getWalletProviders(client);
222
- const waasProviderKey = getWalletProviderByKey.formatWalletProviderKey({
238
+ const providers = getVerifiedCredentialForWalletAccount.getWalletProviders(client);
239
+ const waasProviderKey = getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
223
240
  chain,
224
241
  displayName: constants$1.DYNAMIC_WAAS_METADATA.displayName,
225
242
  walletProviderType: sdkApiCore.WalletProviderEnum.EmbeddedWallet
226
243
  });
227
244
  const waasProvider = providers.find((provider)=>provider.key === waasProviderKey && provider.chain === chain);
228
245
  if (!waasProvider || !isWaasWalletProvider(waasProvider)) {
229
- throw new getWalletProviderByKey.NoWalletProviderFoundError({
246
+ throw new getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError({
230
247
  walletProviderKey: waasProviderKey
231
248
  });
232
249
  }
@@ -284,6 +301,24 @@ const getWaasWalletProviderByChain = ({ chain }, client)=>{
284
301
  });
285
302
  };
286
303
 
304
+ /**
305
+ * Revokes the delegation of a WaaS wallet account.
306
+ *
307
+ * @param params.walletAccount - The WaaS wallet account to revoke delegation for.
308
+ * @param [params.password] - Optional password for delegation operations.
309
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
310
+ * @returns A promise that resolves when the delegation is revoked.
311
+ */ const revokeWaasDelegation = async ({ password, walletAccount }, client = constants.getDefaultClient())=>{
312
+ const provider = getWaasWalletProviderFromWalletAccount({
313
+ walletAccount
314
+ }, client);
315
+ await provider.revokeDelegation({
316
+ password,
317
+ walletAccount
318
+ });
319
+ await NotWaasWalletAccountError.refreshUser(client);
320
+ };
321
+
287
322
  const userHasExternalWallet = (user)=>{
288
323
  const hasExternalWallet = user == null ? void 0 : user.verifiedCredentials.some((vc)=>vc.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain && vc.walletProvider !== sdkApiCore.WalletProviderEnum.EmbeddedWallet);
289
324
  return hasExternalWallet;
@@ -348,9 +383,11 @@ exports.delegateWaasKeyShares = delegateWaasKeyShares;
348
383
  exports.exportWaasClientKeyshares = exportWaasClientKeyshares;
349
384
  exports.exportWaasPrivateKey = exportWaasPrivateKey;
350
385
  exports.getChainsMissingWaasWalletAccounts = getChainsMissingWaasWalletAccounts;
386
+ exports.hasDelegatedAccess = hasDelegatedAccess;
351
387
  exports.importWaasPrivateKey = importWaasPrivateKey;
352
388
  exports.isDynamicWaasEnabled = isDynamicWaasEnabled;
353
389
  exports.isWaasWalletAccount = isWaasWalletAccount;
354
390
  exports.refreshWaasWalletAccountShares = refreshWaasWalletAccountShares;
391
+ exports.revokeWaasDelegation = revokeWaasDelegation;
355
392
  exports.shouldAutoCreateWalletForChain = shouldAutoCreateWalletForChain;
356
393
  exports.updateWaasPassword = updateWaasPassword;
package/waas.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';
2
2
  import { B as BaseError, g as getDefaultClient, k as getChainFromVerifiedCredentialChain, d as assertDefined, n as name, v as version } from './constants.esm.js';
3
3
  import { N as NotWaasWalletAccountError, r as refreshUser } from './NotWaasWalletAccountError.esm.js';
4
- import { a as getWalletProviderFromWalletAccount, l as formatWalletProviderKey, b as getWalletProviderByKey, N as NoWalletProviderFoundError, h as getWalletProviders } from './getWalletProviderByKey.esm.js';
4
+ import { a as getWalletProviderFromWalletAccount, m as formatWalletProviderKey, b as getWalletProviderByKey, N as NoWalletProviderFoundError, i as getVerifiedCredentialForWalletAccount, h as getWalletProviders } from './getVerifiedCredentialForWalletAccount.esm.js';
5
5
  import { D as DYNAMIC_WAAS_METADATA } from './constants.esm2.js';
6
6
  import { WalletProviderEnum, EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
7
7
  import { f as filterDuplicates } from './filterDuplicates.esm.js';
@@ -121,10 +121,11 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
121
121
  const provider = getWaasWalletProviderFromWalletAccount({
122
122
  walletAccount
123
123
  }, client);
124
- return provider.delegateKeyShares({
124
+ await provider.delegateKeyShares({
125
125
  password,
126
126
  walletAccount
127
127
  });
128
+ await refreshUser(client);
128
129
  };
129
130
 
130
131
  /**
@@ -215,6 +216,22 @@ const userHasEmbeddedWalletForChain = ({ user, chain })=>{
215
216
  }));
216
217
  };
217
218
 
219
+ /**
220
+ * Checks if a WaaS wallet account has delegated access.
221
+ *
222
+ * @param params.walletAccount - The WaaS wallet account to check for delegated access.
223
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
224
+ * @returns True if the wallet account has delegated access, false otherwise.
225
+ */ const hasDelegatedAccess = ({ walletAccount }, client = getDefaultClient())=>{
226
+ var _verifiedCredential_walletProperties_keyShares, _verifiedCredential_walletProperties;
227
+ const verifiedCredential = getVerifiedCredentialForWalletAccount({
228
+ walletAccount
229
+ }, client);
230
+ assertDefined(verifiedCredential, 'Verified credential not found for Waas wallet account');
231
+ const hasDelegatedKeyShare = (_verifiedCredential_walletProperties = verifiedCredential.walletProperties) == null ? void 0 : (_verifiedCredential_walletProperties_keyShares = _verifiedCredential_walletProperties.keyShares) == null ? void 0 : _verifiedCredential_walletProperties_keyShares.some((keyShare)=>keyShare.backupLocation === 'delegated');
232
+ return !!hasDelegatedKeyShare;
233
+ };
234
+
218
235
  const getWaasWalletProviderByChain = ({ chain }, client)=>{
219
236
  const providers = getWalletProviders(client);
220
237
  const waasProviderKey = formatWalletProviderKey({
@@ -282,6 +299,24 @@ const getWaasWalletProviderByChain = ({ chain }, client)=>{
282
299
  });
283
300
  };
284
301
 
302
+ /**
303
+ * Revokes the delegation of a WaaS wallet account.
304
+ *
305
+ * @param params.walletAccount - The WaaS wallet account to revoke delegation for.
306
+ * @param [params.password] - Optional password for delegation operations.
307
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
308
+ * @returns A promise that resolves when the delegation is revoked.
309
+ */ const revokeWaasDelegation = async ({ password, walletAccount }, client = getDefaultClient())=>{
310
+ const provider = getWaasWalletProviderFromWalletAccount({
311
+ walletAccount
312
+ }, client);
313
+ await provider.revokeDelegation({
314
+ password,
315
+ walletAccount
316
+ });
317
+ await refreshUser(client);
318
+ };
319
+
285
320
  const userHasExternalWallet = (user)=>{
286
321
  const hasExternalWallet = user == null ? void 0 : user.verifiedCredentials.some((vc)=>vc.format === JwtVerifiedCredentialFormatEnum.Blockchain && vc.walletProvider !== WalletProviderEnum.EmbeddedWallet);
287
322
  return hasExternalWallet;
@@ -339,4 +374,4 @@ const userHasExternalWallet = (user)=>{
339
374
 
340
375
  assertPackageVersion(name, version);
341
376
 
342
- export { NotWaasWalletProviderError, backupWaasKeySharesToGoogleDrive, createWaasWalletAccounts, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getChainsMissingWaasWalletAccounts, importWaasPrivateKey, isDynamicWaasEnabled, isWaasWalletAccount, refreshWaasWalletAccountShares, shouldAutoCreateWalletForChain, updateWaasPassword };
377
+ export { NotWaasWalletProviderError, backupWaasKeySharesToGoogleDrive, createWaasWalletAccounts, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getChainsMissingWaasWalletAccounts, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isWaasWalletAccount, refreshWaasWalletAccountShares, revokeWaasDelegation, shouldAutoCreateWalletForChain, updateWaasPassword };
package/waasCore.cjs.js CHANGED
@@ -134,6 +134,17 @@ const createWaasProvider = ({ sdkClient, chain })=>{
134
134
  signedSessionId
135
135
  });
136
136
  };
137
+ const revokeDelegation = async ({ password, walletAccount })=>{
138
+ const { signature: signedSessionId } = await getSignedSessionId.getSignedSessionId(sdkClient);
139
+ const waasClient = await getWaasClient();
140
+ var _sdkClient_token;
141
+ return waasClient.revokeDelegation({
142
+ accountAddress: walletAccount.address,
143
+ authToken: (_sdkClient_token = sdkClient.token) != null ? _sdkClient_token : undefined,
144
+ password,
145
+ signedSessionId
146
+ });
147
+ };
137
148
  const signRawMessage = async ({ message, password, walletAccount })=>{
138
149
  if (message.length !== RAW_MESSAGE_MESSAGE_REQUIRED_LENGTH) {
139
150
  throw new InvalidParamError.InvalidParamError(`Message must be ${RAW_MESSAGE_MESSAGE_REQUIRED_LENGTH} characters long`);
@@ -221,6 +232,7 @@ const createWaasProvider = ({ sdkClient, chain })=>{
221
232
  getWaasClient,
222
233
  importPrivateKey,
223
234
  refreshWalletAccountShares,
235
+ revokeDelegation,
224
236
  signMessage,
225
237
  signRawMessage,
226
238
  signSerializedTransaction,
package/waasCore.esm.js CHANGED
@@ -132,6 +132,17 @@ const createWaasProvider = ({ sdkClient, chain })=>{
132
132
  signedSessionId
133
133
  });
134
134
  };
135
+ const revokeDelegation = async ({ password, walletAccount })=>{
136
+ const { signature: signedSessionId } = await getSignedSessionId(sdkClient);
137
+ const waasClient = await getWaasClient();
138
+ var _sdkClient_token;
139
+ return waasClient.revokeDelegation({
140
+ accountAddress: walletAccount.address,
141
+ authToken: (_sdkClient_token = sdkClient.token) != null ? _sdkClient_token : undefined,
142
+ password,
143
+ signedSessionId
144
+ });
145
+ };
135
146
  const signRawMessage = async ({ message, password, walletAccount })=>{
136
147
  if (message.length !== RAW_MESSAGE_MESSAGE_REQUIRED_LENGTH) {
137
148
  throw new InvalidParamError(`Message must be ${RAW_MESSAGE_MESSAGE_REQUIRED_LENGTH} characters long`);
@@ -219,6 +230,7 @@ const createWaasProvider = ({ sdkClient, chain })=>{
219
230
  getWaasClient,
220
231
  importPrivateKey,
221
232
  refreshWalletAccountShares,
233
+ revokeDelegation,
222
234
  signMessage,
223
235
  signRawMessage,
224
236
  signSerializedTransaction,