@dynamic-labs-sdk/client 1.23.0 → 1.24.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 (120) hide show
  1. package/dist/{NativeModuleNotLinkedError-DIpQjh_K.native.esm.js → NativeModuleNotLinkedError-CJy_4-6r.native.esm.js} +3 -3
  2. package/dist/{NativeModuleNotLinkedError-DIpQjh_K.native.esm.js.map → NativeModuleNotLinkedError-CJy_4-6r.native.esm.js.map} +1 -1
  3. package/dist/{consumeMfaTokenIfRequiredForAction-pUcqlY3s.cjs → consumeMfaTokenIfRequiredForAction-B6nFE5IO.cjs} +2 -2
  4. package/dist/{consumeMfaTokenIfRequiredForAction-pUcqlY3s.cjs.map → consumeMfaTokenIfRequiredForAction-B6nFE5IO.cjs.map} +1 -1
  5. package/dist/{consumeMfaTokenIfRequiredForAction-jsAdDyDj.esm.js → consumeMfaTokenIfRequiredForAction-DXTH4qki.esm.js} +2 -2
  6. package/dist/{consumeMfaTokenIfRequiredForAction-jsAdDyDj.esm.js.map → consumeMfaTokenIfRequiredForAction-DXTH4qki.esm.js.map} +1 -1
  7. package/dist/core.cjs +7 -6
  8. package/dist/core.cjs.map +1 -1
  9. package/dist/core.esm.js +7 -7
  10. package/dist/core.esm.js.map +1 -1
  11. package/dist/core.native.esm.js +6 -6
  12. package/dist/core.native.esm.js.map +1 -1
  13. package/dist/exports/core.d.ts +2 -0
  14. package/dist/exports/core.d.ts.map +1 -1
  15. package/dist/exports/waas.d.ts +2 -1
  16. package/dist/exports/waas.d.ts.map +1 -1
  17. package/dist/{getNetworkProviderFromNetworkId-DPFHY3b8.cjs → getNetworkProviderFromNetworkId-CZjFA5G8.cjs} +64 -2
  18. package/dist/getNetworkProviderFromNetworkId-CZjFA5G8.cjs.map +1 -0
  19. package/dist/{getNetworkProviderFromNetworkId-DTNPpR5H.esm.js → getNetworkProviderFromNetworkId-CjdC5HjA.esm.js} +59 -3
  20. package/dist/getNetworkProviderFromNetworkId-CjdC5HjA.esm.js.map +1 -0
  21. package/dist/{getNetworkProviderFromNetworkId-YcalZlDG.native.esm.js → getNetworkProviderFromNetworkId-R8IKGc6s.native.esm.js} +59 -261
  22. package/dist/getNetworkProviderFromNetworkId-R8IKGc6s.native.esm.js.map +1 -0
  23. package/dist/{getSignedSessionId-BjhgfsJD.native.esm.js → getSignedSessionId-B6Eqmue0.native.esm.js} +3 -3
  24. package/dist/{getSignedSessionId-BjhgfsJD.native.esm.js.map → getSignedSessionId-B6Eqmue0.native.esm.js.map} +1 -1
  25. package/dist/{getSignedSessionId-Btl5p_7b.esm.js → getSignedSessionId-BYR70F5w.esm.js} +2 -2
  26. package/dist/{getSignedSessionId-Btl5p_7b.esm.js.map → getSignedSessionId-BYR70F5w.esm.js.map} +1 -1
  27. package/dist/{getSignedSessionId-VX7LkxVJ.cjs → getSignedSessionId-BpUNqL9z.cjs} +2 -2
  28. package/dist/{getSignedSessionId-VX7LkxVJ.cjs.map → getSignedSessionId-BpUNqL9z.cjs.map} +1 -1
  29. package/dist/{getWalletProviderByKey-5sZK6kAJ.esm.js → getWalletProviderByKey-BVVFLnfy.esm.js} +2 -2
  30. package/dist/{getWalletProviderByKey-5sZK6kAJ.esm.js.map → getWalletProviderByKey-BVVFLnfy.esm.js.map} +1 -1
  31. package/dist/getWalletProviderByKey-CqdhcE7y.native.esm.js +279 -0
  32. package/dist/getWalletProviderByKey-CqdhcE7y.native.esm.js.map +1 -0
  33. package/dist/{getWalletProviderByKey--K4N2u-M.cjs → getWalletProviderByKey-D2ElEmJR.cjs} +2 -2
  34. package/dist/{getWalletProviderByKey--K4N2u-M.cjs.map → getWalletProviderByKey-D2ElEmJR.cjs.map} +1 -1
  35. package/dist/index.cjs +17 -67
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.esm.js +16 -66
  38. package/dist/index.esm.js.map +1 -1
  39. package/dist/index.native.esm.js +16 -66
  40. package/dist/index.native.esm.js.map +1 -1
  41. package/dist/{isDynamicWaasEnabled-MtEVK3ov.cjs → isDynamicWaasEnabled-B7_FiTkx.cjs} +2 -2
  42. package/dist/{isDynamicWaasEnabled-MtEVK3ov.cjs.map → isDynamicWaasEnabled-B7_FiTkx.cjs.map} +1 -1
  43. package/dist/{isDynamicWaasEnabled-sI3vpWvA.esm.js → isDynamicWaasEnabled-Ck0VFh7Z.esm.js} +2 -2
  44. package/dist/{isDynamicWaasEnabled-sI3vpWvA.esm.js.map → isDynamicWaasEnabled-Ck0VFh7Z.esm.js.map} +1 -1
  45. package/dist/{isDynamicWaasEnabled-BR_pG4jM.native.esm.js → isDynamicWaasEnabled-yo_LqzH5.native.esm.js} +2 -2
  46. package/dist/{isDynamicWaasEnabled-BR_pG4jM.native.esm.js.map → isDynamicWaasEnabled-yo_LqzH5.native.esm.js.map} +1 -1
  47. package/dist/{isMfaRequiredForAction-BiPVqg49.cjs → isMfaRequiredForAction-B3FO4Zbn.cjs} +2 -2
  48. package/dist/{isMfaRequiredForAction-BiPVqg49.cjs.map → isMfaRequiredForAction-B3FO4Zbn.cjs.map} +1 -1
  49. package/dist/{isMfaRequiredForAction-DJ2UX11y.esm.js → isMfaRequiredForAction-CnO4g-V0.esm.js} +2 -2
  50. package/dist/{isMfaRequiredForAction-DJ2UX11y.esm.js.map → isMfaRequiredForAction-CnO4g-V0.esm.js.map} +1 -1
  51. package/dist/{isMfaRequiredForAction-GWZny7T2.native.esm.js → isMfaRequiredForAction-Zi7_K00W.native.esm.js} +2 -2
  52. package/dist/{isMfaRequiredForAction-GWZny7T2.native.esm.js.map → isMfaRequiredForAction-Zi7_K00W.native.esm.js.map} +1 -1
  53. package/dist/{isUserOnboardingComplete-OvzVH1rg.esm.js → isUserOnboardingComplete-DZk1nVHO.esm.js} +3 -3
  54. package/dist/{isUserOnboardingComplete-OvzVH1rg.esm.js.map → isUserOnboardingComplete-DZk1nVHO.esm.js.map} +1 -1
  55. package/dist/{isUserOnboardingComplete-Hzz6fwTk.native.esm.js → isUserOnboardingComplete-DcRl6Q1f.native.esm.js} +3 -3
  56. package/dist/{isUserOnboardingComplete-Hzz6fwTk.native.esm.js.map → isUserOnboardingComplete-DcRl6Q1f.native.esm.js.map} +1 -1
  57. package/dist/{isUserOnboardingComplete-D1hw1c5_.cjs → isUserOnboardingComplete-Dnx30meW.cjs} +3 -3
  58. package/dist/{isUserOnboardingComplete-D1hw1c5_.cjs.map → isUserOnboardingComplete-Dnx30meW.cjs.map} +1 -1
  59. package/dist/{migrateFromFireblocks-BiLoNIkA.native.esm.js → migrateFromFireblocks-COEK_Acn.native.esm.js} +13 -13
  60. package/dist/migrateFromFireblocks-COEK_Acn.native.esm.js.map +1 -0
  61. package/dist/{migrateFromFireblocks-NRfLh1JL.cjs → migrateFromFireblocks-CdSxWZav.cjs} +13 -13
  62. package/dist/migrateFromFireblocks-CdSxWZav.cjs.map +1 -0
  63. package/dist/{migrateFromFireblocks-Y5pPtmew.esm.js → migrateFromFireblocks-nkmSeZrn.esm.js} +14 -14
  64. package/dist/migrateFromFireblocks-nkmSeZrn.esm.js.map +1 -0
  65. package/dist/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.d.ts +29 -0
  66. package/dist/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.d.ts.map +1 -0
  67. package/dist/modules/auth/getActionAuthorizationTokens/index.d.ts +2 -0
  68. package/dist/modules/auth/getActionAuthorizationTokens/index.d.ts.map +1 -0
  69. package/dist/modules/auth/logoutReason.d.ts +1 -1
  70. package/dist/modules/auth/logoutReason.d.ts.map +1 -1
  71. package/dist/modules/flow/prepareFlowSigning/prepareFlowSigning.d.ts +2 -2
  72. package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts +13 -12
  73. package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts.map +1 -1
  74. package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +4 -4
  75. package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
  76. package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts +7 -2
  77. package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts.map +1 -1
  78. package/dist/modules/waas/businessAccounts/assertTargetIdentity.d.ts +14 -0
  79. package/dist/modules/waas/businessAccounts/assertTargetIdentity.d.ts.map +1 -0
  80. package/dist/modules/waas/businessAccounts/businessAccounts.constants.d.ts +5 -0
  81. package/dist/modules/waas/businessAccounts/businessAccounts.constants.d.ts.map +1 -0
  82. package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +15 -1
  83. package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -1
  84. package/dist/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.d.ts.map +1 -1
  85. package/dist/modules/waas/businessAccounts/updateBusinessAccount/index.d.ts +2 -0
  86. package/dist/modules/waas/businessAccounts/updateBusinessAccount/index.d.ts.map +1 -0
  87. package/dist/modules/waas/businessAccounts/updateBusinessAccount/updateBusinessAccount.d.ts +26 -0
  88. package/dist/modules/waas/businessAccounts/updateBusinessAccount/updateBusinessAccount.d.ts.map +1 -0
  89. package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
  90. package/dist/modules/waas/waas.types.d.ts +2 -2
  91. package/dist/modules/waas/waas.types.d.ts.map +1 -1
  92. package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts +1 -1
  93. package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts.map +1 -1
  94. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  95. package/dist/{updateAuthFromVerifyResponse-ChnvPY0m.cjs → updateAuthFromVerifyResponse-BSORoVT0.cjs} +3 -3
  96. package/dist/{updateAuthFromVerifyResponse-ChnvPY0m.cjs.map → updateAuthFromVerifyResponse-BSORoVT0.cjs.map} +1 -1
  97. package/dist/{updateAuthFromVerifyResponse-Ct1Y6O_T.esm.js → updateAuthFromVerifyResponse-D0Tt9-Z-.esm.js} +3 -3
  98. package/dist/{updateAuthFromVerifyResponse-Ct1Y6O_T.esm.js.map → updateAuthFromVerifyResponse-D0Tt9-Z-.esm.js.map} +1 -1
  99. package/dist/waas.cjs +123 -41
  100. package/dist/waas.cjs.map +1 -1
  101. package/dist/waas.esm.js +124 -43
  102. package/dist/waas.esm.js.map +1 -1
  103. package/dist/waas.native.esm.js +123 -42
  104. package/dist/waas.native.esm.js.map +1 -1
  105. package/dist/waasCore.cjs +53 -15
  106. package/dist/waasCore.cjs.map +1 -1
  107. package/dist/waasCore.esm.js +53 -15
  108. package/dist/waasCore.esm.js.map +1 -1
  109. package/dist/waasCore.native.esm.js +52 -14
  110. package/dist/waasCore.native.esm.js.map +1 -1
  111. package/ios/DynamicClientScreenshotProtection.mm +11 -0
  112. package/package.json +3 -3
  113. package/dist/getNetworkProviderFromNetworkId-DPFHY3b8.cjs.map +0 -1
  114. package/dist/getNetworkProviderFromNetworkId-DTNPpR5H.esm.js.map +0 -1
  115. package/dist/getNetworkProviderFromNetworkId-YcalZlDG.native.esm.js.map +0 -1
  116. package/dist/getWalletProviderByKey-BhcBoGMW.native.esm.js +0 -20
  117. package/dist/getWalletProviderByKey-BhcBoGMW.native.esm.js.map +0 -1
  118. package/dist/migrateFromFireblocks-BiLoNIkA.native.esm.js.map +0 -1
  119. package/dist/migrateFromFireblocks-NRfLh1JL.cjs.map +0 -1
  120. package/dist/migrateFromFireblocks-Y5pPtmew.esm.js.map +0 -1
package/dist/waas.esm.js CHANGED
@@ -1,51 +1,73 @@
1
- import { Ct as version, D as NoWalletProviderFoundError, G as createApiClient, M as formatWalletProviderKey, P as getChainFromVerifiedCredentialChain, St as name, _t as getDefaultClient, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, i as InvalidParamError, o as isWaasWalletAccount, s as findWaasWalletProviderByChain, xt as getCore } from "./updateAuthFromVerifyResponse-Ct1Y6O_T.esm.js";
2
- import { r as __refreshAuth_wrapped, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-sI3vpWvA.esm.js";
3
- import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-5sZK6kAJ.esm.js";
4
- import "./getSignedSessionId-Btl5p_7b.esm.js";
5
- import { a as NotWaasWalletProviderError, i as createWaasClient, n as getWaasWalletProviderFromWalletAccount, r as getWaasChainNameFromChain, t as migrateFromFireblocks } from "./migrateFromFireblocks-Y5pPtmew.esm.js";
1
+ import { Ct as version, D as NoWalletProviderFoundError, G as createApiClient, M as formatWalletProviderKey, P as getChainFromVerifiedCredentialChain, St as name, _t as getDefaultClient, c as isWaasWalletProvider, d as DYNAMIC_WAAS_METADATA, dt as assertDefined, g as __logoutWithReason_wrapped, i as InvalidParamError, o as isWaasWalletAccount, s as findWaasWalletProviderByChain, xt as getCore } from "./updateAuthFromVerifyResponse-D0Tt9-Z-.esm.js";
2
+ import { r as __refreshAuth_wrapped, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-Ck0VFh7Z.esm.js";
3
+ import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-BVVFLnfy.esm.js";
4
+ import "./getSignedSessionId-BYR70F5w.esm.js";
5
+ import { a as NotWaasWalletProviderError, i as getWaasWalletProviderFromWalletAccount, n as getWaasChainNameFromChain, r as createWaasClient, t as migrateFromFireblocks } from "./migrateFromFireblocks-nkmSeZrn.esm.js";
6
6
  import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
7
- import { AssignableBusinessAccountMemberRole, JwtVerifiedCredentialFormatEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
7
+ import { AssignableBusinessAccountMemberRole, JwtVerifiedCredentialFormatEnum, UserIdentifierTypeEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
8
8
 
9
- //#region src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts
9
+ //#region src/modules/waas/businessAccounts/assertTargetIdentity.ts
10
10
  /**
11
- * Returns the business accounts API client for the first enabled WaaS chain.
11
+ * Asserts a {@link TargetIdentity} resolves to a user: a `userId`, or an
12
+ * `identifier` with its `identifierType`. Throws otherwise.
12
13
  *
13
- * @param client - The Dynamic client instance.
14
- * @returns The business accounts API client.
15
- * @throws {InvalidParamError} When no WaaS chain configuration is enabled for the project.
16
14
  * @notInstrumented
17
15
  */
18
- const getBusinessAccountsClient = (client) => {
19
- const projectSettings = client.projectSettings;
20
- assertDefined(projectSettings, "Project settings are not available");
21
- const chainConfig = projectSettings.sdk.embeddedWallets?.chainConfigurations?.find((chain) => chain.enabled);
22
- if (!chainConfig) throw new InvalidParamError("No WaaS chain is enabled for this project");
23
- return createWaasClient({ chainName: getWaasChainNameFromChain(chainConfig.name) }, client).businessAccounts;
16
+ const assertTargetIdentity = ({ fnName, targetIdentity }) => {
17
+ const hasUserId = Boolean(targetIdentity.userId);
18
+ const hasIdentifier = Boolean(targetIdentity.identifier && targetIdentity.identifierType);
19
+ if (!hasUserId && !hasIdentifier) throw new InvalidParamError(`${fnName}: targetIdentity must provide a userId, or an identifier with its identifierType`);
20
+ };
21
+
22
+ //#endregion
23
+ //#region src/modules/waas/businessAccounts/businessAccounts.constants.ts
24
+ /** Maps the SDK's identifier-type union to the generated API enum. */
25
+ const IDENTIFIER_TYPE_TO_API = {
26
+ email: UserIdentifierTypeEnum.Email,
27
+ externalUserId: UserIdentifierTypeEnum.ExternalUserId,
28
+ id: UserIdentifierTypeEnum.Id,
29
+ phoneNumber: UserIdentifierTypeEnum.PhoneNumber,
30
+ socialAccountId: UserIdentifierTypeEnum.SocialAccountId,
31
+ socialUsername: UserIdentifierTypeEnum.SocialUsername
24
32
  };
25
33
 
26
34
  //#endregion
27
35
  //#region src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts
28
36
  /**
29
- * Adds a member to an existing business account. Identify the target by a known
30
- * `userId`, or by `identifier` + `identifierType` (e.g. an email — the user is
31
- * created if absent).
37
+ * Adds a member to an existing business account. Identify the target with a
38
+ * `targetIdentity`: a known `userId`, or an `identifier` + `identifierType`
39
+ * (e.g. an email — the user is created if absent).
40
+ *
41
+ * Calls the SDK API directly (not the WaaS iframe): this is a server-state
42
+ * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces
43
+ * as a thrown error rather than stalling in the iframe bridge.
32
44
  *
33
45
  * @param params.businessAccountId - The ID of the business account.
34
- * @param [params.userId] - The ID of the user to add as a member.
35
- * @param [params.identifier] - The identifier value (e.g. an email address).
36
- * @param [params.identifierType] - The identifier type (e.g. `email`).
37
- * @param [params.role] - The member role (`admin` or `viewer`). Defaults server-side.
46
+ * @param params.targetIdentity - The member to add (userId, or identifier + identifierType).
47
+ * @param [params.role] - The member role (`admin` or `viewer`). Defaults to `viewer`.
38
48
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
39
49
  * @returns The created business account member.
40
50
  * @notInstrumented
41
51
  */
42
- const addBusinessAccountMember = async ({ businessAccountId, userId, identifier, identifierType, role }, client = getDefaultClient()) => {
43
- return getBusinessAccountsClient(client).addMember({
52
+ const addBusinessAccountMember = async ({ businessAccountId, targetIdentity, role }, client = getDefaultClient()) => {
53
+ assertTargetIdentity({
54
+ fnName: "addBusinessAccountMember",
55
+ targetIdentity
56
+ });
57
+ const core = getCore(client);
58
+ const apiClient = createApiClient({}, client);
59
+ const { userId, identifier, identifierType, socialProvider, smsCountryCode } = targetIdentity;
60
+ return await apiClient.sdkAddBusinessAccountMember({
61
+ addBusinessAccountMemberSdkRequest: {
62
+ identifier,
63
+ role: role === "admin" ? AssignableBusinessAccountMemberRole.Admin : AssignableBusinessAccountMemberRole.Viewer,
64
+ smsCountryCode,
65
+ socialProvider,
66
+ type: identifierType ? IDENTIFIER_TYPE_TO_API[identifierType] : void 0,
67
+ userId
68
+ },
44
69
  businessAccountId,
45
- identifier,
46
- identifierType,
47
- role,
48
- userId
70
+ environmentId: core.environmentId
49
71
  });
50
72
  };
51
73
 
@@ -77,29 +99,34 @@ const getWaasWalletProviderByChain = ({ chain }, client) => {
77
99
  * @param params.walletAccount - The wallet account to add the signer to.
78
100
  * @param [params.businessAccountId] - The business account; found-or-created when omitted.
79
101
  * @param [params.walletId] - The wallet UUID to link when finding-or-creating; defaults to `walletAccount.verifiedCredentialId`.
80
- * @param params.targetSignerIdentity - The signer to add (userId, or identifier + identifierType).
102
+ * @param params.targetIdentity - The signer to add (userId, or identifier + identifierType).
81
103
  * @param [params.signerType] - `endUser` (default) or `server`.
82
104
  * @param [params.password] - Password for the reshare, if the wallet is password-encrypted.
83
105
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
84
106
  * @returns The new signer's share set id.
85
107
  * @notInstrumented
86
108
  */
87
- const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, walletId, targetSignerIdentity, signerType, password }, client = getDefaultClient()) => {
88
- const hasUserId = Boolean(targetSignerIdentity.userId);
89
- const hasIdentifier = Boolean(targetSignerIdentity.identifier && targetSignerIdentity.identifierType);
90
- if (!hasUserId && !hasIdentifier) throw new InvalidParamError("addBusinessAccountSigner: targetSignerIdentity must provide a userId, or an identifier with its identifierType");
109
+ const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, walletId, targetIdentity, signerType, password }, client = getDefaultClient()) => {
110
+ assertTargetIdentity({
111
+ fnName: "addBusinessAccountSigner",
112
+ targetIdentity
113
+ });
91
114
  if (walletAccount.businessAccountId) assertDefined(businessAccountId, "addBusinessAccountSigner: this wallet is already part of a business account");
92
115
  let resolvedBusinessAccountId = businessAccountId;
93
116
  if (!resolvedBusinessAccountId) {
94
117
  const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;
95
118
  assertDefined(linkWalletId, "addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account");
96
- resolvedBusinessAccountId = (await getBusinessAccountsClient(client).addWalletToBusinessAccount({ walletId: linkWalletId })).id;
119
+ const core = getCore(client);
120
+ resolvedBusinessAccountId = (await createApiClient({}, client).sdkLinkBusinessAccountWallet({
121
+ environmentId: core.environmentId,
122
+ linkBusinessAccountWalletSdkRequest: { walletId: linkWalletId }
123
+ })).id;
97
124
  }
98
125
  const result = await getWaasWalletProviderByChain({ chain: walletAccount.chain }, client).reshareToNewSignerShareSet({
99
126
  businessAccountId: resolvedBusinessAccountId,
100
127
  password,
101
128
  signerType,
102
- targetSignerIdentity,
129
+ targetSignerIdentity: targetIdentity,
103
130
  walletAccount
104
131
  });
105
132
  await __refreshAuth_wrapped(client);
@@ -109,10 +136,14 @@ const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, wall
109
136
  //#endregion
110
137
  //#region src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts
111
138
  /**
112
- * Links an existing wallet to a business account. Omit `businessAccountId` to
139
+ * Links a wallet to a business account, or omit `businessAccountId` to
113
140
  * find-or-create the per-wallet business account (the server seats the wallet's
114
141
  * owner as the first member/signer).
115
142
  *
143
+ * Calls the SDK API directly (not the WaaS iframe): this is a server-state
144
+ * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces
145
+ * as a thrown error rather than stalling in the iframe bridge.
146
+ *
116
147
  * @param [params.businessAccountId] - The business account to link to; found-or-created when omitted.
117
148
  * @param params.walletId - The ID of the wallet to link.
118
149
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
@@ -120,9 +151,13 @@ const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, wall
120
151
  * @notInstrumented
121
152
  */
122
153
  const addWalletToBusinessAccount = async ({ businessAccountId, walletId }, client = getDefaultClient()) => {
123
- const detail = await getBusinessAccountsClient(client).addWalletToBusinessAccount({
124
- businessAccountId,
125
- walletId
154
+ const core = getCore(client);
155
+ const detail = await createApiClient({}, client).sdkLinkBusinessAccountWallet({
156
+ environmentId: core.environmentId,
157
+ linkBusinessAccountWalletSdkRequest: {
158
+ businessAccountId,
159
+ walletId
160
+ }
126
161
  });
127
162
  await __refreshAuth_wrapped(client);
128
163
  return detail;
@@ -151,6 +186,24 @@ const backupWaasKeySharesToGoogleDrive = async ({ googleDriveAccessToken, passwo
151
186
  });
152
187
  };
153
188
 
189
+ //#endregion
190
+ //#region src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts
191
+ /**
192
+ * Returns the business accounts API client for the first enabled WaaS chain.
193
+ *
194
+ * @param client - The Dynamic client instance.
195
+ * @returns The business accounts API client.
196
+ * @throws {InvalidParamError} When no WaaS chain configuration is enabled for the project.
197
+ * @notInstrumented
198
+ */
199
+ const getBusinessAccountsClient = (client) => {
200
+ const projectSettings = client.projectSettings;
201
+ assertDefined(projectSettings, "Project settings are not available");
202
+ const chainConfig = projectSettings.sdk.embeddedWallets?.chainConfigurations?.find((chain) => chain.enabled);
203
+ if (!chainConfig) throw new InvalidParamError("No WaaS chain is enabled for this project");
204
+ return createWaasClient({ chainName: getWaasChainNameFromChain(chainConfig.name) }, client).businessAccounts;
205
+ };
206
+
154
207
  //#endregion
155
208
  //#region src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts
156
209
  /**
@@ -715,7 +768,7 @@ const transferBusinessAccountOwnership = async ({ businessAccountId, newOwnerUse
715
768
  environmentId: core.environmentId,
716
769
  transferBusinessAccountOwnershipSdkRequest: { newOwnerUserId }
717
770
  });
718
- await __refreshAuth_wrapped(client);
771
+ await __logoutWithReason_wrapped({ reason: "business-account-ownership-transferred" }, client);
719
772
  return detail;
720
773
  };
721
774
 
@@ -737,6 +790,34 @@ const unlockWallet = async ({ password, walletAccount }, client = getDefaultClie
737
790
  });
738
791
  };
739
792
 
793
+ //#endregion
794
+ //#region src/modules/waas/businessAccounts/updateBusinessAccount/updateBusinessAccount.ts
795
+ /**
796
+ * Renames a business account (owner-/admin-only). Calls the SDK API directly
797
+ * (no MPC step), so a rejection surfaces as a thrown error.
798
+ *
799
+ * @param params.businessAccountId - The business account to rename.
800
+ * @param params.name - The new name.
801
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
802
+ * @returns The updated business account.
803
+ *
804
+ * @example
805
+ * ```ts
806
+ * await updateBusinessAccount({ businessAccountId, name: 'Acme Inc' });
807
+ * ```
808
+ *
809
+ * @see getBusinessAccount
810
+ * @notInstrumented
811
+ */
812
+ const updateBusinessAccount = async ({ businessAccountId, name: name$1 }, client = getDefaultClient()) => {
813
+ const core = getCore(client);
814
+ return await createApiClient({}, client).sdkUpdateBusinessAccount({
815
+ businessAccountId,
816
+ environmentId: core.environmentId,
817
+ updateBusinessAccountSdkRequest: { name: name$1 }
818
+ });
819
+ };
820
+
740
821
  //#endregion
741
822
  //#region src/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.ts
742
823
  const ROLE_TO_API = {
@@ -804,5 +885,5 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
804
885
  assertPackageVersion(name, version);
805
886
 
806
887
  //#endregion
807
- export { NotWaasWalletProviderError, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getBusinessAccount, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeBusinessAccountMember, removeBusinessAccountSigner, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccountMemberRole, updateWaasPassword };
888
+ export { NotWaasWalletProviderError, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, createBusinessAccount, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, exportWaasClientKeyshares, exportWaasPrivateKey, getBusinessAccount, getChainsMissingWaasWalletAccounts, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeBusinessAccountMember, removeBusinessAccountSigner, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccount, updateBusinessAccountMemberRole, updateWaasPassword };
808
889
  //# sourceMappingURL=waas.esm.js.map