@dynamic-labs-sdk/client 1.20.0 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{updateAuthFromVerifyResponse-DGrmo9MJ.native.esm.js → NativeModuleNotLinkedError-Ds_t3AZQ.native.esm.js} +33 -4
- package/dist/NativeModuleNotLinkedError-Ds_t3AZQ.native.esm.js.map +1 -0
- package/dist/client/createDynamicClient/assertClientProps/assertClientProps.d.ts +16 -0
- package/dist/client/createDynamicClient/assertClientProps/assertClientProps.d.ts.map +1 -0
- package/dist/client/createDynamicClient/assertClientProps/index.d.ts +2 -0
- package/dist/client/createDynamicClient/assertClientProps/index.d.ts.map +1 -0
- package/dist/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
- package/dist/client/types/DynamicClientConfig.d.ts +35 -0
- package/dist/client/types/DynamicClientConfig.d.ts.map +1 -1
- package/dist/consumeMfaTokenIfRequiredForAction-CWVbmQ2A.cjs +17 -0
- package/dist/consumeMfaTokenIfRequiredForAction-CWVbmQ2A.cjs.map +1 -0
- package/dist/consumeMfaTokenIfRequiredForAction-C_IvLTH6.esm.js +12 -0
- package/dist/consumeMfaTokenIfRequiredForAction-C_IvLTH6.esm.js.map +1 -0
- package/dist/core.cjs +9 -8
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +6 -5
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +5 -5
- package/dist/errors/WaasLoadFailedError.d.ts +45 -0
- package/dist/errors/WaasLoadFailedError.d.ts.map +1 -0
- package/dist/exports/index.d.ts +1 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +10 -0
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-DaVOUpiF.cjs → getNetworkProviderFromNetworkId-5V4Cf8A_.cjs} +48 -13
- package/dist/getNetworkProviderFromNetworkId-5V4Cf8A_.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BlBx4Zh2.esm.js → getNetworkProviderFromNetworkId-DhS1snCk.esm.js} +48 -13
- package/dist/getNetworkProviderFromNetworkId-DhS1snCk.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-xmoBE1cZ.native.esm.js → getNetworkProviderFromNetworkId-DudGvTmd.native.esm.js} +2 -3
- package/dist/{getNetworkProviderFromNetworkId-xmoBE1cZ.native.esm.js.map → getNetworkProviderFromNetworkId-DudGvTmd.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-3L_aMxVD.cjs → getSignedSessionId-E6FIx5aj.cjs} +2 -17
- package/dist/getSignedSessionId-E6FIx5aj.cjs.map +1 -0
- package/dist/{getSignedSessionId-DlmNVy-g.native.esm.js → getSignedSessionId-ekp3lswQ.esm.js} +3 -12
- package/dist/getSignedSessionId-ekp3lswQ.esm.js.map +1 -0
- package/dist/{getSignedSessionId-BVc-sgeN.esm.js → getSignedSessionId-xZGFa4nS.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-DlmNVy-g.native.esm.js.map → getSignedSessionId-xZGFa4nS.native.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-BilyW5Jr.cjs → getWalletProviderByKey-BwivhTYu.cjs} +2 -2
- package/dist/{getWalletProviderByKey-BilyW5Jr.cjs.map → getWalletProviderByKey-BwivhTYu.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-PIO1ygzj.esm.js → getWalletProviderByKey-CS299i1V.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-PIO1ygzj.esm.js.map → getWalletProviderByKey-CS299i1V.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-Ccx26JsF.native.esm.js → getWalletProviderByKey-CYGDw6-5.native.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-Ccx26JsF.native.esm.js.map → getWalletProviderByKey-CYGDw6-5.native.esm.js.map} +1 -1
- package/dist/index.cjs +48 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +34 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +34 -7
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isDynamicWaasEnabled-DXVcXa66.cjs → isDynamicWaasEnabled-BEVAshnS.cjs} +2 -2
- package/dist/{isDynamicWaasEnabled-DXVcXa66.cjs.map → isDynamicWaasEnabled-BEVAshnS.cjs.map} +1 -1
- package/dist/{isDynamicWaasEnabled-C4oPJ0fw.native.esm.js → isDynamicWaasEnabled-C8Fb1xHn.native.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-C4oPJ0fw.native.esm.js.map → isDynamicWaasEnabled-C8Fb1xHn.native.esm.js.map} +1 -1
- package/dist/{isDynamicWaasEnabled-JpnXC0f7.esm.js → isDynamicWaasEnabled-D5e2K02u.esm.js} +2 -2
- package/dist/{isDynamicWaasEnabled-JpnXC0f7.esm.js.map → isDynamicWaasEnabled-D5e2K02u.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-D6rt_Tzn.native.esm.js → isMfaRequiredForAction-A02NFVt8.esm.js} +3 -32
- package/dist/isMfaRequiredForAction-A02NFVt8.esm.js.map +1 -0
- package/dist/isMfaRequiredForAction-D4TSMQ4m.native.esm.js +77 -0
- package/dist/isMfaRequiredForAction-D4TSMQ4m.native.esm.js.map +1 -0
- package/dist/isMfaRequiredForAction-odpvykkm.cjs +94 -0
- package/dist/isMfaRequiredForAction-odpvykkm.cjs.map +1 -0
- package/dist/{isUserOnboardingComplete-CsoV3ae7.cjs → isUserOnboardingComplete-CEVSIxJC.cjs} +49 -3
- package/dist/isUserOnboardingComplete-CEVSIxJC.cjs.map +1 -0
- package/dist/{isUserOnboardingComplete-diGA1wlX.esm.js → isUserOnboardingComplete-Cgkw21XZ.esm.js} +44 -4
- package/dist/isUserOnboardingComplete-Cgkw21XZ.esm.js.map +1 -0
- package/dist/{isUserOnboardingComplete-DnExOJu7.native.esm.js → isUserOnboardingComplete-CvQShE05.native.esm.js} +44 -4
- package/dist/{isUserOnboardingComplete-CsoV3ae7.cjs.map → isUserOnboardingComplete-CvQShE05.native.esm.js.map} +1 -1
- package/dist/migrateFromFireblocks-BMtelH1a.native.esm.js +321 -0
- package/dist/migrateFromFireblocks-BMtelH1a.native.esm.js.map +1 -0
- package/dist/{migrateFromFireblocks-BrWXstt8.cjs → migrateFromFireblocks-CLUkVcFT.cjs} +54 -3
- package/dist/migrateFromFireblocks-CLUkVcFT.cjs.map +1 -0
- package/dist/{migrateFromFireblocks-CqL5l58Q.native.esm.js → migrateFromFireblocks-DcKrquTE.esm.js} +43 -4
- package/dist/migrateFromFireblocks-DcKrquTE.esm.js.map +1 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts +25 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountMember/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +35 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts +19 -0
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +184 -0
- package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.d.ts +16 -0
- package/dist/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/createBusinessAccount/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/createBusinessAccount/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.d.ts +36 -0
- package/dist/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/createWalletForBusinessAccount/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/createWalletForBusinessAccount/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.d.ts +15 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccount/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccount/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.d.ts +12 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountsClient/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/getBusinessAccountsClient/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.d.ts +10 -0
- package/dist/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.d.ts +33 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/index.d.ts +2 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/index.d.ts.map +1 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.d.ts +37 -0
- package/dist/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.d.ts.map +1 -0
- package/dist/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/isWaasLoadExhaustionError.d.ts +11 -0
- package/dist/modules/waas/createWaasProvider/isWaasLoadExhaustionError.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +11 -0
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/services/keychain/createKeychainService/utils/openDatabase.d.ts +9 -1
- package/dist/services/keychain/createKeychainService/utils/openDatabase.d.ts.map +1 -1
- package/dist/services/keychain/createKeychainService/utils/withDatabase/withDatabase.d.ts +2 -1
- package/dist/services/keychain/createKeychainService/utils/withDatabase/withDatabase.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{updateAuthFromVerifyResponse-B0K1VJ8b.cjs → updateAuthFromVerifyResponse-CSqnGlh3.cjs} +289 -19
- package/dist/updateAuthFromVerifyResponse-CSqnGlh3.cjs.map +1 -0
- package/dist/{updateAuthFromVerifyResponse-CVDQVEQM.esm.js → updateAuthFromVerifyResponse-C_YKKAIX.esm.js} +262 -4
- package/dist/updateAuthFromVerifyResponse-C_YKKAIX.esm.js.map +1 -0
- package/dist/utils/createTranslateRejection/createTranslateRejection.d.ts +29 -0
- package/dist/utils/createTranslateRejection/createTranslateRejection.d.ts.map +1 -0
- package/dist/utils/createTranslateRejection/index.d.ts +3 -0
- package/dist/utils/createTranslateRejection/index.d.ts.map +1 -0
- package/dist/waas.cjs +281 -17
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +273 -18
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +272 -18
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +291 -170
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +285 -164
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +273 -371
- package/dist/waasCore.native.esm.js.map +1 -1
- package/ios/DynamicClientScreenshotProtection.mm +70 -32
- package/package.json +4 -4
- package/dist/getNetworkProviderFromNetworkId-BlBx4Zh2.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-DaVOUpiF.cjs.map +0 -1
- package/dist/getSignedSessionId-3L_aMxVD.cjs.map +0 -1
- package/dist/getSignedSessionId-BVc-sgeN.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-20E6GsSc.esm.js +0 -336
- package/dist/isMfaRequiredForAction-20E6GsSc.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-9bYtZcve.cjs +0 -384
- package/dist/isMfaRequiredForAction-9bYtZcve.cjs.map +0 -1
- package/dist/isMfaRequiredForAction-D6rt_Tzn.native.esm.js.map +0 -1
- package/dist/isUserOnboardingComplete-DnExOJu7.native.esm.js.map +0 -1
- package/dist/isUserOnboardingComplete-diGA1wlX.esm.js.map +0 -1
- package/dist/migrateFromFireblocks--G-432sl.esm.js +0 -65
- package/dist/migrateFromFireblocks--G-432sl.esm.js.map +0 -1
- package/dist/migrateFromFireblocks-BrWXstt8.cjs.map +0 -1
- package/dist/migrateFromFireblocks-CqL5l58Q.native.esm.js.map +0 -1
- package/dist/updateAuthFromVerifyResponse-B0K1VJ8b.cjs.map +0 -1
- package/dist/updateAuthFromVerifyResponse-CVDQVEQM.esm.js.map +0 -1
- package/dist/updateAuthFromVerifyResponse-DGrmo9MJ.native.esm.js.map +0 -1
package/dist/waas.cjs
CHANGED
|
@@ -1,10 +1,129 @@
|
|
|
1
|
-
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-
|
|
2
|
-
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-
|
|
3
|
-
const require_getWalletProviderByKey = require('./getWalletProviderByKey-
|
|
4
|
-
|
|
1
|
+
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CSqnGlh3.cjs');
|
|
2
|
+
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-BEVAshnS.cjs');
|
|
3
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-BwivhTYu.cjs');
|
|
4
|
+
require('./getSignedSessionId-E6FIx5aj.cjs');
|
|
5
|
+
const require_migrateFromFireblocks = require('./migrateFromFireblocks-CLUkVcFT.cjs');
|
|
5
6
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
6
7
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
7
8
|
|
|
9
|
+
//#region src/modules/waas/businessAccounts/getBusinessAccountsClient/getBusinessAccountsClient.ts
|
|
10
|
+
/**
|
|
11
|
+
* Returns the business accounts API client for the first enabled WaaS chain.
|
|
12
|
+
*
|
|
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
|
+
* @notInstrumented
|
|
17
|
+
*/
|
|
18
|
+
const getBusinessAccountsClient = (client) => {
|
|
19
|
+
const projectSettings = client.projectSettings;
|
|
20
|
+
require_updateAuthFromVerifyResponse.assertDefined(projectSettings, "Project settings are not available");
|
|
21
|
+
const chainConfig = projectSettings.sdk.embeddedWallets?.chainConfigurations?.find((chain) => chain.enabled);
|
|
22
|
+
if (!chainConfig) throw new require_updateAuthFromVerifyResponse.InvalidParamError("No WaaS chain is enabled for this project");
|
|
23
|
+
return require_migrateFromFireblocks.createWaasClient({ chainName: require_migrateFromFireblocks.getWaasChainNameFromChain(chainConfig.name) }, client).businessAccounts;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts
|
|
28
|
+
/**
|
|
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).
|
|
32
|
+
*
|
|
33
|
+
* @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.
|
|
38
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
39
|
+
* @returns The created business account member.
|
|
40
|
+
* @notInstrumented
|
|
41
|
+
*/
|
|
42
|
+
const addBusinessAccountMember = async ({ businessAccountId, userId, identifier, identifierType, role }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
43
|
+
return getBusinessAccountsClient(client).addMember({
|
|
44
|
+
businessAccountId,
|
|
45
|
+
identifier,
|
|
46
|
+
identifierType,
|
|
47
|
+
role,
|
|
48
|
+
userId
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts
|
|
54
|
+
/** @notInstrumented */
|
|
55
|
+
const getWaasWalletProviderByChain = ({ chain }, client) => {
|
|
56
|
+
const waasProvider = require_updateAuthFromVerifyResponse.findWaasWalletProviderByChain({ chain }, client);
|
|
57
|
+
if (!waasProvider) throw new require_updateAuthFromVerifyResponse.NoWalletProviderFoundError({ walletProviderKey: require_updateAuthFromVerifyResponse.formatWalletProviderKey({
|
|
58
|
+
chain,
|
|
59
|
+
displayName: require_updateAuthFromVerifyResponse.DYNAMIC_WAAS_METADATA.displayName,
|
|
60
|
+
walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
|
|
61
|
+
}) });
|
|
62
|
+
return waasProvider;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts
|
|
67
|
+
/**
|
|
68
|
+
* Adds a signer to a business-account wallet via the reshare ceremony, minting
|
|
69
|
+
* the new signer's share set. Identify the target by `userId`, or `identifier`
|
|
70
|
+
* + `identifierType` (the user is created if absent).
|
|
71
|
+
*
|
|
72
|
+
* Omit `businessAccountId` to add a signer to a wallet that isn't in a business
|
|
73
|
+
* account yet: the wallet's per-account is found-or-created first (idempotent —
|
|
74
|
+
* converts the personal wallet, seating its owner as the first signer), then
|
|
75
|
+
* the new signer is reshared in.
|
|
76
|
+
*
|
|
77
|
+
* @param params.walletAccount - The wallet account to add the signer to.
|
|
78
|
+
* @param [params.businessAccountId] - The business account; found-or-created when omitted.
|
|
79
|
+
* @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).
|
|
81
|
+
* @param [params.signerType] - `endUser` (default) or `server`.
|
|
82
|
+
* @param [params.password] - Password for the reshare, if the wallet is password-encrypted.
|
|
83
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
84
|
+
* @returns The new signer's share set id.
|
|
85
|
+
* @notInstrumented
|
|
86
|
+
*/
|
|
87
|
+
const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, walletId, targetSignerIdentity, signerType, password }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
88
|
+
const hasUserId = Boolean(targetSignerIdentity.userId);
|
|
89
|
+
const hasIdentifier = Boolean(targetSignerIdentity.identifier && targetSignerIdentity.identifierType);
|
|
90
|
+
if (!hasUserId && !hasIdentifier) throw new require_updateAuthFromVerifyResponse.InvalidParamError("addBusinessAccountSigner: targetSignerIdentity must provide a userId, or an identifier with its identifierType");
|
|
91
|
+
let resolvedBusinessAccountId = businessAccountId;
|
|
92
|
+
if (!resolvedBusinessAccountId) {
|
|
93
|
+
const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;
|
|
94
|
+
if (!linkWalletId) throw new require_updateAuthFromVerifyResponse.InvalidParamError("addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account");
|
|
95
|
+
resolvedBusinessAccountId = (await getBusinessAccountsClient(client).addWalletToBusinessAccount({ walletId: linkWalletId })).id;
|
|
96
|
+
}
|
|
97
|
+
return getWaasWalletProviderByChain({ chain: walletAccount.chain }, client).reshareToNewSignerShareSet({
|
|
98
|
+
businessAccountId: resolvedBusinessAccountId,
|
|
99
|
+
password,
|
|
100
|
+
signerType,
|
|
101
|
+
targetSignerIdentity,
|
|
102
|
+
walletAccount
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts
|
|
108
|
+
/**
|
|
109
|
+
* Links an existing wallet to a business account. Omit `businessAccountId` to
|
|
110
|
+
* find-or-create the per-wallet business account (the server seats the wallet's
|
|
111
|
+
* owner as the first member/signer).
|
|
112
|
+
*
|
|
113
|
+
* @param [params.businessAccountId] - The business account to link to; found-or-created when omitted.
|
|
114
|
+
* @param params.walletId - The ID of the wallet to link.
|
|
115
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
116
|
+
* @returns The updated business account detail.
|
|
117
|
+
* @notInstrumented
|
|
118
|
+
*/
|
|
119
|
+
const addWalletToBusinessAccount = async ({ businessAccountId, walletId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
120
|
+
return getBusinessAccountsClient(client).addWalletToBusinessAccount({
|
|
121
|
+
businessAccountId,
|
|
122
|
+
walletId
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
8
127
|
//#region src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts
|
|
9
128
|
/**
|
|
10
129
|
* Backs up WaaS wallet key shares to Google Drive for secure recovery.
|
|
@@ -27,6 +146,21 @@ const backupWaasKeySharesToGoogleDrive = async ({ googleDriveAccessToken, passwo
|
|
|
27
146
|
});
|
|
28
147
|
};
|
|
29
148
|
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts
|
|
151
|
+
/**
|
|
152
|
+
* Creates a new business account.
|
|
153
|
+
*
|
|
154
|
+
* @param [params] - Optional parameters for the business account.
|
|
155
|
+
* @param [params.name] - Optional name for the business account.
|
|
156
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
157
|
+
* @returns The created business account.
|
|
158
|
+
* @notInstrumented
|
|
159
|
+
*/
|
|
160
|
+
const createBusinessAccount = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
161
|
+
return getBusinessAccountsClient(client).createBusinessAccount({ request: { name: params?.name } });
|
|
162
|
+
};
|
|
163
|
+
|
|
30
164
|
//#endregion
|
|
31
165
|
//#region src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts
|
|
32
166
|
/**
|
|
@@ -151,6 +285,37 @@ const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureSc
|
|
|
151
285
|
await require_isDynamicWaasEnabled.__refreshAuth_wrapped(client);
|
|
152
286
|
};
|
|
153
287
|
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.ts
|
|
290
|
+
/**
|
|
291
|
+
* Creates a WaaS wallet account owned directly by a business account, in one
|
|
292
|
+
* step — the server seats the wallet's signer row against the business account
|
|
293
|
+
* as it is minted, so no separate link call is needed.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* const wallet = await createWalletForBusinessAccount({
|
|
298
|
+
* businessAccountId: 'ba-1',
|
|
299
|
+
* chain: 'EVM',
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* @param params.businessAccountId - The business account that will own the wallet.
|
|
304
|
+
* @param params.chain - The chain to create the wallet account for.
|
|
305
|
+
* @param [params.password] - Optional password used to encrypt the user share.
|
|
306
|
+
* @param [params.thresholdSignatureScheme] - The threshold signature scheme to use. (Default: TWO_OF_TWO)
|
|
307
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
308
|
+
* @returns The created wallet account.
|
|
309
|
+
* @notInstrumented
|
|
310
|
+
*/
|
|
311
|
+
const createWalletForBusinessAccount = async ({ businessAccountId, chain, password, thresholdSignatureScheme }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
312
|
+
return getWaasWalletProviderByChain({ chain }, client).createWalletAccount({
|
|
313
|
+
businessAccountId,
|
|
314
|
+
password,
|
|
315
|
+
thresholdSignatureScheme
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
|
|
154
319
|
//#endregion
|
|
155
320
|
//#region src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts
|
|
156
321
|
/**
|
|
@@ -217,6 +382,20 @@ const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount
|
|
|
217
382
|
});
|
|
218
383
|
};
|
|
219
384
|
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.ts
|
|
387
|
+
/**
|
|
388
|
+
* Retrieves a business account by ID, including its members, signers, and wallets.
|
|
389
|
+
*
|
|
390
|
+
* @param params.businessAccountId - The ID of the business account to retrieve.
|
|
391
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
392
|
+
* @returns The business account with its members, signers, and wallets.
|
|
393
|
+
* @notInstrumented
|
|
394
|
+
*/
|
|
395
|
+
const getBusinessAccount = async ({ businessAccountId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
396
|
+
return getBusinessAccountsClient(client).getBusinessAccount({ businessAccountId });
|
|
397
|
+
};
|
|
398
|
+
|
|
220
399
|
//#endregion
|
|
221
400
|
//#region src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts
|
|
222
401
|
/** @notInstrumented */
|
|
@@ -342,19 +521,6 @@ const hasDelegatedAccess = ({ walletAccount }, client = require_updateAuthFromVe
|
|
|
342
521
|
*/
|
|
343
522
|
const hasEmbeddedWalletsRequiringUpgrade = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => getEmbeddedWalletsRequiringUpgrade(client).length > 0;
|
|
344
523
|
|
|
345
|
-
//#endregion
|
|
346
|
-
//#region src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts
|
|
347
|
-
/** @notInstrumented */
|
|
348
|
-
const getWaasWalletProviderByChain = ({ chain }, client) => {
|
|
349
|
-
const waasProvider = require_updateAuthFromVerifyResponse.findWaasWalletProviderByChain({ chain }, client);
|
|
350
|
-
if (!waasProvider) throw new require_updateAuthFromVerifyResponse.NoWalletProviderFoundError({ walletProviderKey: require_updateAuthFromVerifyResponse.formatWalletProviderKey({
|
|
351
|
-
chain,
|
|
352
|
-
displayName: require_updateAuthFromVerifyResponse.DYNAMIC_WAAS_METADATA.displayName,
|
|
353
|
-
walletProviderType: _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet
|
|
354
|
-
}) });
|
|
355
|
-
return waasProvider;
|
|
356
|
-
};
|
|
357
|
-
|
|
358
524
|
//#endregion
|
|
359
525
|
//#region src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts
|
|
360
526
|
/**
|
|
@@ -396,6 +562,19 @@ const isPasswordRequiredForWaasWallets = (client = require_updateAuthFromVerifyR
|
|
|
396
562
|
return user.verifiedCredentials.some((credential) => credential.walletProperties?.keyShares?.some((keyShare) => keyShare.passwordEncrypted));
|
|
397
563
|
};
|
|
398
564
|
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.ts
|
|
567
|
+
/**
|
|
568
|
+
* Lists all business accounts for the current project environment.
|
|
569
|
+
*
|
|
570
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
571
|
+
* @returns A paginated list of business accounts.
|
|
572
|
+
* @notInstrumented
|
|
573
|
+
*/
|
|
574
|
+
const listBusinessAccounts = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
575
|
+
return getBusinessAccountsClient(client).listBusinessAccounts();
|
|
576
|
+
};
|
|
577
|
+
|
|
399
578
|
//#endregion
|
|
400
579
|
//#region src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts
|
|
401
580
|
/**
|
|
@@ -417,6 +596,82 @@ const refreshWaasWalletAccountShares = async ({ walletAccount, password }, clien
|
|
|
417
596
|
});
|
|
418
597
|
};
|
|
419
598
|
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.ts
|
|
601
|
+
/**
|
|
602
|
+
* Removes a member from a business account. Any signer rows the member held on
|
|
603
|
+
* the account's wallets are torn down as part of the removal. The backend
|
|
604
|
+
* refuses to remove the account's last owner.
|
|
605
|
+
*
|
|
606
|
+
* @param params.businessAccountId - The business account to remove the member from.
|
|
607
|
+
* @param params.userId - The id of the user to remove.
|
|
608
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
609
|
+
* @returns The removed member.
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```ts
|
|
613
|
+
* const detail = await getBusinessAccount({ businessAccountId });
|
|
614
|
+
* const member = detail.members[0];
|
|
615
|
+
* await removeBusinessAccountMember({
|
|
616
|
+
* businessAccountId,
|
|
617
|
+
* userId: member.userId,
|
|
618
|
+
* });
|
|
619
|
+
* ```
|
|
620
|
+
*
|
|
621
|
+
* @see addBusinessAccountMember
|
|
622
|
+
* @see getBusinessAccount
|
|
623
|
+
* @notInstrumented
|
|
624
|
+
*/
|
|
625
|
+
const removeBusinessAccountMember = async ({ businessAccountId, userId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
626
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
627
|
+
const { member } = await require_updateAuthFromVerifyResponse.createApiClient({}, client).sdkRemoveBusinessAccountMember({
|
|
628
|
+
businessAccountId,
|
|
629
|
+
environmentId: core.environmentId,
|
|
630
|
+
userId
|
|
631
|
+
});
|
|
632
|
+
return member;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.ts
|
|
637
|
+
/**
|
|
638
|
+
* Removes a signer from a business-account wallet. This detaches the signer's
|
|
639
|
+
* share set from the wallet — it does not run an MPC ceremony — so the removed
|
|
640
|
+
* identity can no longer sign for that wallet. The backend refuses to remove
|
|
641
|
+
* the last remaining signer on a wallet.
|
|
642
|
+
*
|
|
643
|
+
* @param params.businessAccountId - The business account the wallet belongs to.
|
|
644
|
+
* @param params.walletId - The wallet the signer is attached to.
|
|
645
|
+
* @param params.signerId - The id of the signer to remove (`BusinessAccountSigner.id`).
|
|
646
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
647
|
+
* @returns The removed signer.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* const detail = await getBusinessAccount({ businessAccountId });
|
|
652
|
+
* const signer = detail.signers[0];
|
|
653
|
+
* await removeBusinessAccountSigner({
|
|
654
|
+
* businessAccountId,
|
|
655
|
+
* walletId: signer.walletId,
|
|
656
|
+
* signerId: signer.id,
|
|
657
|
+
* });
|
|
658
|
+
* ```
|
|
659
|
+
*
|
|
660
|
+
* @see addBusinessAccountSigner
|
|
661
|
+
* @see getBusinessAccount
|
|
662
|
+
* @notInstrumented
|
|
663
|
+
*/
|
|
664
|
+
const removeBusinessAccountSigner = async ({ businessAccountId, walletId, signerId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
665
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
666
|
+
const { signer } = await require_updateAuthFromVerifyResponse.createApiClient({}, client).sdkRemoveBusinessAccountSigner({
|
|
667
|
+
businessAccountId,
|
|
668
|
+
environmentId: core.environmentId,
|
|
669
|
+
signerId,
|
|
670
|
+
walletId
|
|
671
|
+
});
|
|
672
|
+
return signer;
|
|
673
|
+
};
|
|
674
|
+
|
|
420
675
|
//#endregion
|
|
421
676
|
//#region src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts
|
|
422
677
|
/**
|
|
@@ -531,11 +786,17 @@ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount
|
|
|
531
786
|
|
|
532
787
|
//#endregion
|
|
533
788
|
exports.NotWaasWalletProviderError = require_migrateFromFireblocks.NotWaasWalletProviderError;
|
|
789
|
+
exports.addBusinessAccountMember = addBusinessAccountMember;
|
|
790
|
+
exports.addBusinessAccountSigner = addBusinessAccountSigner;
|
|
791
|
+
exports.addWalletToBusinessAccount = addWalletToBusinessAccount;
|
|
534
792
|
exports.backupWaasKeySharesToGoogleDrive = backupWaasKeySharesToGoogleDrive;
|
|
793
|
+
exports.createBusinessAccount = createBusinessAccount;
|
|
535
794
|
exports.createWaasWalletAccounts = createWaasWalletAccounts;
|
|
795
|
+
exports.createWalletForBusinessAccount = createWalletForBusinessAccount;
|
|
536
796
|
exports.delegateWaasKeyShares = delegateWaasKeyShares;
|
|
537
797
|
exports.exportWaasClientKeyshares = exportWaasClientKeyshares;
|
|
538
798
|
exports.exportWaasPrivateKey = exportWaasPrivateKey;
|
|
799
|
+
exports.getBusinessAccount = getBusinessAccount;
|
|
539
800
|
exports.getChainsMissingWaasWalletAccounts = getChainsMissingWaasWalletAccounts;
|
|
540
801
|
exports.getEmbeddedWalletsRequiringUpgrade = getEmbeddedWalletsRequiringUpgrade;
|
|
541
802
|
exports.getWalletRecoveryState = getWalletRecoveryState;
|
|
@@ -546,9 +807,12 @@ exports.isDynamicWaasEnabled = require_isDynamicWaasEnabled.isDynamicWaasEnabled
|
|
|
546
807
|
exports.isPasswordRequiredForWaasWallets = isPasswordRequiredForWaasWallets;
|
|
547
808
|
exports.isWaasWalletAccount = require_updateAuthFromVerifyResponse.isWaasWalletAccount;
|
|
548
809
|
exports.isWalletCreationRequirement = isWalletCreationRequirement;
|
|
810
|
+
exports.listBusinessAccounts = listBusinessAccounts;
|
|
549
811
|
exports.migrateFromFireblocks = require_migrateFromFireblocks.migrateFromFireblocks;
|
|
550
812
|
exports.normalizeWalletRequirements = normalizeWalletRequirements;
|
|
551
813
|
exports.refreshWaasWalletAccountShares = refreshWaasWalletAccountShares;
|
|
814
|
+
exports.removeBusinessAccountMember = removeBusinessAccountMember;
|
|
815
|
+
exports.removeBusinessAccountSigner = removeBusinessAccountSigner;
|
|
552
816
|
exports.revokeWaasDelegation = revokeWaasDelegation;
|
|
553
817
|
exports.setWaasWalletAccountPassword = setWaasWalletAccountPassword;
|
|
554
818
|
exports.shouldAutoCreateWalletForChain = shouldAutoCreateWalletForChain;
|