@dynamic-labs/sdk-react-core 5.0.0-rc.3 → 5.0.0-rc.4
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/CHANGELOG.md +7 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/lib/utils/hooks/useBusinessAccounts/useBusinessAccounts.cjs +23 -8
- package/src/lib/utils/hooks/useBusinessAccounts/useBusinessAccounts.d.ts +7 -5
- package/src/lib/utils/hooks/useBusinessAccounts/useBusinessAccounts.js +23 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.0.0-rc.4](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.3...v5.0.0-rc.4) (2026-07-20)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **business-accounts:** redesign demo + fix getBusinessAccount arg shape ([#11975](https://github.com/dynamic-labs/dynamic-auth/issues/11975)) ([7c2feaf](https://github.com/dynamic-labs/dynamic-auth/commit/7c2feaf6d0e00b210d67302353b40e90fdc7c8d1))
|
|
8
|
+
|
|
2
9
|
## [5.0.0-rc.3](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.2...v5.0.0-rc.3) (2026-07-17)
|
|
3
10
|
|
|
4
11
|
## [5.0.0-rc.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2026-07-17)
|
package/package.cjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "5.0.0-rc.
|
|
6
|
+
var version = "5.0.0-rc.4";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.1082",
|
|
9
|
-
"@dynamic-labs-sdk/client": "1.
|
|
10
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
9
|
+
"@dynamic-labs-sdk/client": "1.20.0",
|
|
10
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.74",
|
|
11
11
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
13
13
|
"@marsidev/react-turnstile": "1.5.2",
|
package/package.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "5.0.0-rc.
|
|
2
|
+
var version = "5.0.0-rc.4";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.1082",
|
|
5
|
-
"@dynamic-labs-sdk/client": "1.
|
|
6
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
5
|
+
"@dynamic-labs-sdk/client": "1.20.0",
|
|
6
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.74",
|
|
7
7
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
9
9
|
"@marsidev/react-turnstile": "1.5.2",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.4",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.1082",
|
|
6
|
-
"@dynamic-labs-sdk/client": "1.
|
|
7
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
6
|
+
"@dynamic-labs-sdk/client": "1.20.0",
|
|
7
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.74",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"@marsidev/react-turnstile": "1.5.2",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"react-i18next": "13.5.0",
|
|
19
19
|
"react-international-phone": "4.5.0",
|
|
20
20
|
"yup": "0.32.11",
|
|
21
|
-
"@dynamic-labs/assert-package-version": "5.0.0-rc.
|
|
22
|
-
"@dynamic-labs/iconic": "5.0.0-rc.
|
|
23
|
-
"@dynamic-labs/locale": "5.0.0-rc.
|
|
24
|
-
"@dynamic-labs/logger": "5.0.0-rc.
|
|
25
|
-
"@dynamic-labs/multi-wallet": "5.0.0-rc.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "5.0.0-rc.
|
|
27
|
-
"@dynamic-labs/store": "5.0.0-rc.
|
|
28
|
-
"@dynamic-labs/types": "5.0.0-rc.
|
|
29
|
-
"@dynamic-labs/utils": "5.0.0-rc.
|
|
30
|
-
"@dynamic-labs/wallet-book": "5.0.0-rc.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "5.0.0-rc.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "5.0.0-rc.4",
|
|
22
|
+
"@dynamic-labs/iconic": "5.0.0-rc.4",
|
|
23
|
+
"@dynamic-labs/locale": "5.0.0-rc.4",
|
|
24
|
+
"@dynamic-labs/logger": "5.0.0-rc.4",
|
|
25
|
+
"@dynamic-labs/multi-wallet": "5.0.0-rc.4",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "5.0.0-rc.4",
|
|
27
|
+
"@dynamic-labs/store": "5.0.0-rc.4",
|
|
28
|
+
"@dynamic-labs/types": "5.0.0-rc.4",
|
|
29
|
+
"@dynamic-labs/utils": "5.0.0-rc.4",
|
|
30
|
+
"@dynamic-labs/wallet-book": "5.0.0-rc.4",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "5.0.0-rc.4",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -64,7 +64,7 @@ const useBusinessAccounts = () => {
|
|
|
64
64
|
}), [defaultChainName, getWaasWalletConnector]);
|
|
65
65
|
const createBusinessAccount = React.useCallback((...args_1) => _tslib.__awaiter(void 0, [...args_1], void 0, function* (input = {}) {
|
|
66
66
|
const client = yield getBusinessClient();
|
|
67
|
-
return client.businessAccounts.createBusinessAccount(input);
|
|
67
|
+
return client.businessAccounts.createBusinessAccount({ request: input });
|
|
68
68
|
}), [getBusinessClient]);
|
|
69
69
|
const listBusinessAccounts = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
70
70
|
const client = yield getBusinessClient();
|
|
@@ -72,9 +72,9 @@ const useBusinessAccounts = () => {
|
|
|
72
72
|
}), [getBusinessClient]);
|
|
73
73
|
const getBusinessAccount = React.useCallback((businessAccountId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
74
74
|
const client = yield getBusinessClient();
|
|
75
|
-
return client.businessAccounts.getBusinessAccount(businessAccountId);
|
|
75
|
+
return client.businessAccounts.getBusinessAccount({ businessAccountId });
|
|
76
76
|
}), [getBusinessClient]);
|
|
77
|
-
const
|
|
77
|
+
const addBusinessAccountMember = React.useCallback((input) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
78
78
|
const client = yield getBusinessClient();
|
|
79
79
|
return client.businessAccounts.addMember(input);
|
|
80
80
|
}), [getBusinessClient]);
|
|
@@ -84,20 +84,35 @@ const useBusinessAccounts = () => {
|
|
|
84
84
|
}), [getBusinessClient]);
|
|
85
85
|
// Adds a signer via the SSE reshare ceremony on the wallet's chain connector.
|
|
86
86
|
// Mints the new signer's share set and seeds it to client-keyshare-service.
|
|
87
|
-
const
|
|
87
|
+
const addBusinessAccountSigner = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, }) {
|
|
88
88
|
const connector = getWaasWalletConnector(chainName);
|
|
89
89
|
if (!connector) {
|
|
90
90
|
throw new Error(NO_CONNECTOR_ERROR);
|
|
91
91
|
}
|
|
92
|
+
// No account yet: find-or-create the per-wallet business account first
|
|
93
|
+
// (idempotent — converts the personal wallet, seating its owner as the
|
|
94
|
+
// first signer, or returns the existing one if already linked), then
|
|
95
|
+
// reshare the new signer into it.
|
|
96
|
+
let resolvedBusinessAccountId = businessAccountId;
|
|
97
|
+
if (!resolvedBusinessAccountId) {
|
|
98
|
+
if (!walletId) {
|
|
99
|
+
throw new Error('addBusinessAccountSigner requires a walletId when no businessAccountId is provided');
|
|
100
|
+
}
|
|
101
|
+
const account = yield addWalletToBusinessAccount({ walletId });
|
|
102
|
+
resolvedBusinessAccountId = account.id;
|
|
103
|
+
}
|
|
104
|
+
if (!resolvedBusinessAccountId) {
|
|
105
|
+
throw new Error('addBusinessAccountSigner could not resolve a businessAccountId');
|
|
106
|
+
}
|
|
92
107
|
return connector.addSignerViaReshare({
|
|
93
108
|
accountAddress,
|
|
94
|
-
businessAccountId,
|
|
109
|
+
businessAccountId: resolvedBusinessAccountId,
|
|
95
110
|
password,
|
|
96
111
|
signerType,
|
|
97
112
|
targetSignerIdentity,
|
|
98
113
|
walletId,
|
|
99
114
|
});
|
|
100
|
-
}), [getWaasWalletConnector]);
|
|
115
|
+
}), [addWalletToBusinessAccount, getWaasWalletConnector]);
|
|
101
116
|
const createWalletForBusinessAccount = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ businessAccountId, chainName, thresholdSignatureScheme, password, }) {
|
|
102
117
|
const chain = chainName !== null && chainName !== void 0 ? chainName : defaultChainName;
|
|
103
118
|
if (!chain) {
|
|
@@ -118,8 +133,8 @@ const useBusinessAccounts = () => {
|
|
|
118
133
|
return client.getWallets();
|
|
119
134
|
}), [getBusinessClient]);
|
|
120
135
|
return {
|
|
121
|
-
|
|
122
|
-
|
|
136
|
+
addBusinessAccountMember,
|
|
137
|
+
addBusinessAccountSigner,
|
|
123
138
|
addWalletToBusinessAccount,
|
|
124
139
|
createBusinessAccount,
|
|
125
140
|
createWalletForBusinessAccount,
|
|
@@ -6,7 +6,9 @@ export type CreateBusinessAccountInput = {
|
|
|
6
6
|
};
|
|
7
7
|
export type AddBusinessAccountMemberInput = {
|
|
8
8
|
businessAccountId: string;
|
|
9
|
-
userId
|
|
9
|
+
userId?: string;
|
|
10
|
+
identifier?: string;
|
|
11
|
+
identifierType?: BusinessAccountSignerIdentifierType;
|
|
10
12
|
role?: BusinessAccountMemberRole;
|
|
11
13
|
};
|
|
12
14
|
export type CreateWalletForBusinessAccountInput = {
|
|
@@ -16,7 +18,7 @@ export type CreateWalletForBusinessAccountInput = {
|
|
|
16
18
|
password?: string;
|
|
17
19
|
};
|
|
18
20
|
export type AddWalletToBusinessAccountInput = {
|
|
19
|
-
businessAccountId
|
|
21
|
+
businessAccountId?: string;
|
|
20
22
|
walletId: string;
|
|
21
23
|
};
|
|
22
24
|
export type BusinessAccountSignerIdentifierType = 'email' | 'phoneNumber' | 'externalUserId' | 'socialUsername' | 'socialAccountId' | 'id';
|
|
@@ -27,7 +29,7 @@ export type TargetSignerIdentity = {
|
|
|
27
29
|
identifierType?: BusinessAccountSignerIdentifierType;
|
|
28
30
|
};
|
|
29
31
|
export type AddBusinessAccountSignerInput = {
|
|
30
|
-
businessAccountId
|
|
32
|
+
businessAccountId?: string;
|
|
31
33
|
walletId?: string;
|
|
32
34
|
accountAddress: string;
|
|
33
35
|
chainName: string;
|
|
@@ -36,8 +38,8 @@ export type AddBusinessAccountSignerInput = {
|
|
|
36
38
|
password?: string;
|
|
37
39
|
};
|
|
38
40
|
export declare const useBusinessAccounts: () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
addBusinessAccountMember: (input: AddBusinessAccountMemberInput) => Promise<any>;
|
|
42
|
+
addBusinessAccountSigner: ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, }: AddBusinessAccountSignerInput) => Promise<{
|
|
41
43
|
shareSetId: string;
|
|
42
44
|
}>;
|
|
43
45
|
addWalletToBusinessAccount: (input: AddWalletToBusinessAccountInput) => Promise<any>;
|
|
@@ -60,7 +60,7 @@ const useBusinessAccounts = () => {
|
|
|
60
60
|
}), [defaultChainName, getWaasWalletConnector]);
|
|
61
61
|
const createBusinessAccount = useCallback((...args_1) => __awaiter(void 0, [...args_1], void 0, function* (input = {}) {
|
|
62
62
|
const client = yield getBusinessClient();
|
|
63
|
-
return client.businessAccounts.createBusinessAccount(input);
|
|
63
|
+
return client.businessAccounts.createBusinessAccount({ request: input });
|
|
64
64
|
}), [getBusinessClient]);
|
|
65
65
|
const listBusinessAccounts = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
66
|
const client = yield getBusinessClient();
|
|
@@ -68,9 +68,9 @@ const useBusinessAccounts = () => {
|
|
|
68
68
|
}), [getBusinessClient]);
|
|
69
69
|
const getBusinessAccount = useCallback((businessAccountId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
70
|
const client = yield getBusinessClient();
|
|
71
|
-
return client.businessAccounts.getBusinessAccount(businessAccountId);
|
|
71
|
+
return client.businessAccounts.getBusinessAccount({ businessAccountId });
|
|
72
72
|
}), [getBusinessClient]);
|
|
73
|
-
const
|
|
73
|
+
const addBusinessAccountMember = useCallback((input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
74
|
const client = yield getBusinessClient();
|
|
75
75
|
return client.businessAccounts.addMember(input);
|
|
76
76
|
}), [getBusinessClient]);
|
|
@@ -80,20 +80,35 @@ const useBusinessAccounts = () => {
|
|
|
80
80
|
}), [getBusinessClient]);
|
|
81
81
|
// Adds a signer via the SSE reshare ceremony on the wallet's chain connector.
|
|
82
82
|
// Mints the new signer's share set and seeds it to client-keyshare-service.
|
|
83
|
-
const
|
|
83
|
+
const addBusinessAccountSigner = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ accountAddress, walletId, chainName, businessAccountId, targetSignerIdentity, signerType, password, }) {
|
|
84
84
|
const connector = getWaasWalletConnector(chainName);
|
|
85
85
|
if (!connector) {
|
|
86
86
|
throw new Error(NO_CONNECTOR_ERROR);
|
|
87
87
|
}
|
|
88
|
+
// No account yet: find-or-create the per-wallet business account first
|
|
89
|
+
// (idempotent — converts the personal wallet, seating its owner as the
|
|
90
|
+
// first signer, or returns the existing one if already linked), then
|
|
91
|
+
// reshare the new signer into it.
|
|
92
|
+
let resolvedBusinessAccountId = businessAccountId;
|
|
93
|
+
if (!resolvedBusinessAccountId) {
|
|
94
|
+
if (!walletId) {
|
|
95
|
+
throw new Error('addBusinessAccountSigner requires a walletId when no businessAccountId is provided');
|
|
96
|
+
}
|
|
97
|
+
const account = yield addWalletToBusinessAccount({ walletId });
|
|
98
|
+
resolvedBusinessAccountId = account.id;
|
|
99
|
+
}
|
|
100
|
+
if (!resolvedBusinessAccountId) {
|
|
101
|
+
throw new Error('addBusinessAccountSigner could not resolve a businessAccountId');
|
|
102
|
+
}
|
|
88
103
|
return connector.addSignerViaReshare({
|
|
89
104
|
accountAddress,
|
|
90
|
-
businessAccountId,
|
|
105
|
+
businessAccountId: resolvedBusinessAccountId,
|
|
91
106
|
password,
|
|
92
107
|
signerType,
|
|
93
108
|
targetSignerIdentity,
|
|
94
109
|
walletId,
|
|
95
110
|
});
|
|
96
|
-
}), [getWaasWalletConnector]);
|
|
111
|
+
}), [addWalletToBusinessAccount, getWaasWalletConnector]);
|
|
97
112
|
const createWalletForBusinessAccount = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ businessAccountId, chainName, thresholdSignatureScheme, password, }) {
|
|
98
113
|
const chain = chainName !== null && chainName !== void 0 ? chainName : defaultChainName;
|
|
99
114
|
if (!chain) {
|
|
@@ -114,8 +129,8 @@ const useBusinessAccounts = () => {
|
|
|
114
129
|
return client.getWallets();
|
|
115
130
|
}), [getBusinessClient]);
|
|
116
131
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
addBusinessAccountMember,
|
|
133
|
+
addBusinessAccountSigner,
|
|
119
134
|
addWalletToBusinessAccount,
|
|
120
135
|
createBusinessAccount,
|
|
121
136
|
createWalletForBusinessAccount,
|