@dynamic-labs/sdk-react-core 4.4.1 → 4.4.2-preview.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/CHANGELOG.md +10 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +12 -6
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +12 -6
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +38 -18
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +39 -19
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +8 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +8 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +9 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.4.2-preview.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.1...v4.4.2-preview.0) (2025-01-28)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for 7702 on ZeroDevConnector ([a8c850a](https://github.com/dynamic-labs/dynamic-auth/commit/a8c850ab192d6113ad55a01a594d5d90ab0fbfa6))
|
|
8
|
+
* implement experimental_signAuthorization method in TurnkeyEVMWalletConnector ([#7866](https://github.com/dynamic-labs/dynamic-auth/issues/7866)) ([96853fa](https://github.com/dynamic-labs/dynamic-auth/commit/96853fae170ca2f81cc01ccd6d9886446876412b))
|
|
9
|
+
* implement experimental_signAuthorization method in TurnkeyEVMWalletConnector ([#7866](https://github.com/dynamic-labs/dynamic-auth/issues/7866)) ([d988e88](https://github.com/dynamic-labs/dynamic-auth/commit/d988e88eccd0b04ba5710c8aa437f5dfffeb1d74))
|
|
10
|
+
* implement experimental_signAuthorization method in TurnkeyEVMWalletConnector ([#7866](https://github.com/dynamic-labs/dynamic-auth/issues/7866)) ([597f837](https://github.com/dynamic-labs/dynamic-auth/commit/597f8375bacef1e6a9a064604074c6920955a3e2))
|
|
11
|
+
|
|
2
12
|
### [4.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.0...v4.4.1) (2025-01-27)
|
|
3
13
|
|
|
4
14
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2-preview.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.599",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"react-i18next": "13.5.0",
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
|
-
"@dynamic-labs/assert-package-version": "4.4.
|
|
17
|
-
"@dynamic-labs/iconic": "4.4.
|
|
18
|
-
"@dynamic-labs/logger": "4.4.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "4.4.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "4.4.
|
|
21
|
-
"@dynamic-labs/store": "4.4.
|
|
22
|
-
"@dynamic-labs/types": "4.4.
|
|
23
|
-
"@dynamic-labs/utils": "4.4.
|
|
24
|
-
"@dynamic-labs/wallet-book": "4.4.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "4.4.
|
|
16
|
+
"@dynamic-labs/assert-package-version": "4.4.2-preview.0",
|
|
17
|
+
"@dynamic-labs/iconic": "4.4.2-preview.0",
|
|
18
|
+
"@dynamic-labs/logger": "4.4.2-preview.0",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "4.4.2-preview.0",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "4.4.2-preview.0",
|
|
21
|
+
"@dynamic-labs/store": "4.4.2-preview.0",
|
|
22
|
+
"@dynamic-labs/types": "4.4.2-preview.0",
|
|
23
|
+
"@dynamic-labs/utils": "4.4.2-preview.0",
|
|
24
|
+
"@dynamic-labs/wallet-book": "4.4.2-preview.0",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "4.4.2-preview.0",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
@@ -152,6 +152,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
152
152
|
updatePrimaryWalletId.updatePrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
|
+
console.log('useCreateDynamicEmbeddedWalletMutation');
|
|
155
156
|
yield smartWallet.initializeSmartWallet({
|
|
156
157
|
account: smartWallet$1,
|
|
157
158
|
primaryWalletId: smartWallet$1.id,
|
|
@@ -148,6 +148,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
148
148
|
updatePrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
|
+
console.log('useCreateDynamicEmbeddedWalletMutation');
|
|
151
152
|
yield initializeSmartWallet({
|
|
152
153
|
account: smartWallet,
|
|
153
154
|
primaryWalletId: smartWallet.id,
|
|
@@ -167,6 +167,7 @@ const useTurnkey = () => {
|
|
|
167
167
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(user.verifiedCredentials);
|
|
168
168
|
const smartWallet$1 = smartWallet.findSmartWallet(embeddedWalletVerifiedCredential, user.verifiedCredentials);
|
|
169
169
|
if (smartWallet$1) {
|
|
170
|
+
console.log('useTurnKey');
|
|
170
171
|
yield smartWallet.initializeSmartWallet({
|
|
171
172
|
account: smartWallet$1,
|
|
172
173
|
primaryWalletId: smartWallet$1.id,
|
|
@@ -163,6 +163,7 @@ const useTurnkey = () => {
|
|
|
163
163
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(user.verifiedCredentials);
|
|
164
164
|
const smartWallet = findSmartWallet(embeddedWalletVerifiedCredential, user.verifiedCredentials);
|
|
165
165
|
if (smartWallet) {
|
|
166
|
+
console.log('useTurnKey');
|
|
166
167
|
yield initializeSmartWallet({
|
|
167
168
|
account: smartWallet,
|
|
168
169
|
primaryWalletId: smartWallet.id,
|
|
@@ -10,6 +10,7 @@ var shouldManuallyReconnectOnRefresh = require('../../../../functions/shouldManu
|
|
|
10
10
|
var convertLegacyPhantomLedgerConnector = require('../convertLegacyPhantomLedgerConnector/convertLegacyPhantomLedgerConnector.cjs');
|
|
11
11
|
var smartWallet = require('../smartWallet/smartWallet.cjs');
|
|
12
12
|
|
|
13
|
+
let count = 0;
|
|
13
14
|
const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, primaryWalletId, separateSmartWalletAndSigner, }) => {
|
|
14
15
|
// wallet state should be null while loading all the wallets or when there is no user
|
|
15
16
|
if (!walletConnectorOptions || !user) {
|
|
@@ -43,12 +44,17 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
|
|
|
43
44
|
}
|
|
44
45
|
if (account.address && account.chain) {
|
|
45
46
|
if (account.walletProvider === sdkApiCore.WalletProviderEnum.SmartContractWallet) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
// super hacky way to initialize the smart wallet only once, happening a lot of rerenders
|
|
48
|
+
if (count === 0) {
|
|
49
|
+
count++;
|
|
50
|
+
smartWallet.initializeSmartWallet({
|
|
51
|
+
account,
|
|
52
|
+
isEip7702: true,
|
|
53
|
+
primaryWalletId,
|
|
54
|
+
verifiedCredentials: user.verifiedCredentials,
|
|
55
|
+
walletConnectorOptions,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
return wallet.walletConnector.createWallet({
|
|
54
60
|
additionalAddresses: account.walletAdditionalAddresses,
|
|
@@ -6,6 +6,7 @@ import { shouldManuallyReconnectOnRefresh } from '../../../../functions/shouldMa
|
|
|
6
6
|
import { convertLegacyPhantomLedgerConnector } from '../convertLegacyPhantomLedgerConnector/convertLegacyPhantomLedgerConnector.js';
|
|
7
7
|
import { isOwnerOfASmartWallet, initializeSmartWallet } from '../smartWallet/smartWallet.js';
|
|
8
8
|
|
|
9
|
+
let count = 0;
|
|
9
10
|
const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, primaryWalletId, separateSmartWalletAndSigner, }) => {
|
|
10
11
|
// wallet state should be null while loading all the wallets or when there is no user
|
|
11
12
|
if (!walletConnectorOptions || !user) {
|
|
@@ -39,12 +40,17 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
|
|
|
39
40
|
}
|
|
40
41
|
if (account.address && account.chain) {
|
|
41
42
|
if (account.walletProvider === WalletProviderEnum.SmartContractWallet) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
// super hacky way to initialize the smart wallet only once, happening a lot of rerenders
|
|
44
|
+
if (count === 0) {
|
|
45
|
+
count++;
|
|
46
|
+
initializeSmartWallet({
|
|
47
|
+
account,
|
|
48
|
+
isEip7702: true,
|
|
49
|
+
primaryWalletId,
|
|
50
|
+
verifiedCredentials: user.verifiedCredentials,
|
|
51
|
+
walletConnectorOptions,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
return wallet.walletConnector.createWallet({
|
|
50
56
|
additionalAddresses: account.walletAdditionalAddresses,
|
|
@@ -13,8 +13,17 @@ var findWalletOptionFor = require('../../../../functions/findWalletOptionFor/fin
|
|
|
13
13
|
const findOwner = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.id === account.signerRefId);
|
|
14
14
|
const findSmartWallet = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.signerRefId === account.id);
|
|
15
15
|
const isOwnerOfASmartWallet = (account, verifiedCredentials) => Boolean(findSmartWallet(account, verifiedCredentials));
|
|
16
|
-
const initializeSmartWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ account, verifiedCredentials, walletConnectorOptions, primaryWalletId, }) {
|
|
17
|
-
var _b, _c, _d, _e, _f;
|
|
16
|
+
const initializeSmartWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ account, verifiedCredentials, walletConnectorOptions, primaryWalletId, isEip7702 = false, }) {
|
|
17
|
+
var _b, _c, _d, _e, _f, _g;
|
|
18
|
+
const smartWallet = findWalletOptionFor.findWalletOptionFor(account, walletConnectorOptions);
|
|
19
|
+
if (!smartWallet) {
|
|
20
|
+
throw new Error('could not find smart wallet from wallet options');
|
|
21
|
+
}
|
|
22
|
+
const connector = smartWallet.walletConnector;
|
|
23
|
+
if (!walletConnectorCore.isAccountAbstractionConnector(connector)) {
|
|
24
|
+
throw new Error('could not initialize smart wallet');
|
|
25
|
+
}
|
|
26
|
+
// Existing implementation for regular ZeroDev
|
|
18
27
|
const owner = findOwner(account, verifiedCredentials);
|
|
19
28
|
if (!owner) {
|
|
20
29
|
throw new Error('could not find associated eoa account for smart wallet');
|
|
@@ -23,6 +32,9 @@ const initializeSmartWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, fun
|
|
|
23
32
|
if (!ownerWallet) {
|
|
24
33
|
throw new Error('could not find owner wallet from wallet options');
|
|
25
34
|
}
|
|
35
|
+
if ((!isEip7702 && !owner.address) || !account.address) {
|
|
36
|
+
throw new Error('could not find owner or smart wallet address');
|
|
37
|
+
}
|
|
26
38
|
if (ownerWallet && walletConnectorCore.isTurnkeyWalletConnector(ownerWallet.walletConnector)) {
|
|
27
39
|
const sortedVcs = (_c = (_b = ownerWallet.walletConnector) === null || _b === void 0 ? void 0 : _b.verifiedCredentials) === null || _c === void 0 ? void 0 : _c.reduce((acc, vc) => {
|
|
28
40
|
if (vc.smartWalletRefAddress &&
|
|
@@ -37,26 +49,34 @@ const initializeSmartWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, fun
|
|
|
37
49
|
ownerWallet.walletConnector.setVerifiedCredentials(sortedVcs);
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
let eoaAddress, eoaConnector, shouldSetEoaConnector;
|
|
53
|
+
if (isEip7702) {
|
|
54
|
+
eoaAddress = (_d = verifiedCredentials.find((vc) => vc.walletName === 'turnkeyhd')) === null || _d === void 0 ? void 0 : _d.address;
|
|
55
|
+
if (!eoaAddress) {
|
|
56
|
+
throw new Error('could not find eoa address');
|
|
57
|
+
}
|
|
58
|
+
eoaConnector = walletConnectorCore.isTurnkeyWalletConnector(connector)
|
|
59
|
+
? connector
|
|
60
|
+
: ownerWallet.walletConnector;
|
|
61
|
+
shouldSetEoaConnector = true;
|
|
47
62
|
}
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
else {
|
|
64
|
+
if (!owner.address) {
|
|
65
|
+
throw new Error('could not find owner address');
|
|
66
|
+
}
|
|
67
|
+
eoaAddress = owner.address;
|
|
68
|
+
eoaConnector = ownerWallet.walletConnector;
|
|
69
|
+
shouldSetEoaConnector =
|
|
70
|
+
primaryWalletId === owner.id || primaryWalletId === account.id;
|
|
50
71
|
}
|
|
51
|
-
const shouldSetEoaConnector = primaryWalletId === owner.id || primaryWalletId === account.id;
|
|
52
72
|
yield connector.registerEoa({
|
|
53
|
-
ecdsaProviderType: (
|
|
54
|
-
entryPointVersion: (
|
|
55
|
-
eoaAddress
|
|
56
|
-
eoaConnector
|
|
57
|
-
kernelVersion: (
|
|
73
|
+
ecdsaProviderType: (_e = account.walletProperties) === null || _e === void 0 ? void 0 : _e.ecdsaProviderType,
|
|
74
|
+
entryPointVersion: (_f = account.walletProperties) === null || _f === void 0 ? void 0 : _f.entryPointVersion,
|
|
75
|
+
eoaAddress,
|
|
76
|
+
eoaConnector,
|
|
77
|
+
kernelVersion: (_g = account.walletProperties) === null || _g === void 0 ? void 0 : _g.kernelVersion,
|
|
58
78
|
shouldSetEoaConnector,
|
|
59
|
-
smartWalletAddress:
|
|
79
|
+
smartWalletAddress: eoaAddress,
|
|
60
80
|
});
|
|
61
81
|
});
|
|
62
82
|
|
|
@@ -3,9 +3,10 @@ import { WalletOption } from '../../../../../shared';
|
|
|
3
3
|
export declare const findOwner: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => JwtVerifiedCredential | undefined;
|
|
4
4
|
export declare const findSmartWallet: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => JwtVerifiedCredential | undefined;
|
|
5
5
|
export declare const isOwnerOfASmartWallet: (account: JwtVerifiedCredential, verifiedCredentials: JwtVerifiedCredential[]) => boolean;
|
|
6
|
-
export declare const initializeSmartWallet: ({ account, verifiedCredentials, walletConnectorOptions, primaryWalletId, }: {
|
|
6
|
+
export declare const initializeSmartWallet: ({ account, verifiedCredentials, walletConnectorOptions, primaryWalletId, isEip7702, }: {
|
|
7
7
|
account: JwtVerifiedCredential;
|
|
8
8
|
verifiedCredentials: JwtVerifiedCredential[];
|
|
9
9
|
walletConnectorOptions: WalletOption[];
|
|
10
10
|
primaryWalletId?: string;
|
|
11
|
+
isEip7702?: boolean;
|
|
11
12
|
}) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { isTurnkeyWalletConnector, isSameAddress
|
|
3
|
+
import { isAccountAbstractionConnector, isTurnkeyWalletConnector, isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { VerifiedCredentialNameToChainEnum } from '../../../../constants/values.js';
|
|
5
5
|
import { findWalletOptionFor } from '../../../../functions/findWalletOptionFor/findWalletOptionFor.js';
|
|
6
6
|
|
|
@@ -9,8 +9,17 @@ import { findWalletOptionFor } from '../../../../functions/findWalletOptionFor/f
|
|
|
9
9
|
const findOwner = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.id === account.signerRefId);
|
|
10
10
|
const findSmartWallet = (account, verifiedCredentials) => verifiedCredentials.find((credential) => credential.signerRefId === account.id);
|
|
11
11
|
const isOwnerOfASmartWallet = (account, verifiedCredentials) => Boolean(findSmartWallet(account, verifiedCredentials));
|
|
12
|
-
const initializeSmartWallet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ account, verifiedCredentials, walletConnectorOptions, primaryWalletId, }) {
|
|
13
|
-
var _b, _c, _d, _e, _f;
|
|
12
|
+
const initializeSmartWallet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ account, verifiedCredentials, walletConnectorOptions, primaryWalletId, isEip7702 = false, }) {
|
|
13
|
+
var _b, _c, _d, _e, _f, _g;
|
|
14
|
+
const smartWallet = findWalletOptionFor(account, walletConnectorOptions);
|
|
15
|
+
if (!smartWallet) {
|
|
16
|
+
throw new Error('could not find smart wallet from wallet options');
|
|
17
|
+
}
|
|
18
|
+
const connector = smartWallet.walletConnector;
|
|
19
|
+
if (!isAccountAbstractionConnector(connector)) {
|
|
20
|
+
throw new Error('could not initialize smart wallet');
|
|
21
|
+
}
|
|
22
|
+
// Existing implementation for regular ZeroDev
|
|
14
23
|
const owner = findOwner(account, verifiedCredentials);
|
|
15
24
|
if (!owner) {
|
|
16
25
|
throw new Error('could not find associated eoa account for smart wallet');
|
|
@@ -19,6 +28,9 @@ const initializeSmartWallet = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
19
28
|
if (!ownerWallet) {
|
|
20
29
|
throw new Error('could not find owner wallet from wallet options');
|
|
21
30
|
}
|
|
31
|
+
if ((!isEip7702 && !owner.address) || !account.address) {
|
|
32
|
+
throw new Error('could not find owner or smart wallet address');
|
|
33
|
+
}
|
|
22
34
|
if (ownerWallet && isTurnkeyWalletConnector(ownerWallet.walletConnector)) {
|
|
23
35
|
const sortedVcs = (_c = (_b = ownerWallet.walletConnector) === null || _b === void 0 ? void 0 : _b.verifiedCredentials) === null || _c === void 0 ? void 0 : _c.reduce((acc, vc) => {
|
|
24
36
|
if (vc.smartWalletRefAddress &&
|
|
@@ -33,26 +45,34 @@ const initializeSmartWallet = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
33
45
|
ownerWallet.walletConnector.setVerifiedCredentials(sortedVcs);
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
let eoaAddress, eoaConnector, shouldSetEoaConnector;
|
|
49
|
+
if (isEip7702) {
|
|
50
|
+
eoaAddress = (_d = verifiedCredentials.find((vc) => vc.walletName === 'turnkeyhd')) === null || _d === void 0 ? void 0 : _d.address;
|
|
51
|
+
if (!eoaAddress) {
|
|
52
|
+
throw new Error('could not find eoa address');
|
|
53
|
+
}
|
|
54
|
+
eoaConnector = isTurnkeyWalletConnector(connector)
|
|
55
|
+
? connector
|
|
56
|
+
: ownerWallet.walletConnector;
|
|
57
|
+
shouldSetEoaConnector = true;
|
|
43
58
|
}
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
else {
|
|
60
|
+
if (!owner.address) {
|
|
61
|
+
throw new Error('could not find owner address');
|
|
62
|
+
}
|
|
63
|
+
eoaAddress = owner.address;
|
|
64
|
+
eoaConnector = ownerWallet.walletConnector;
|
|
65
|
+
shouldSetEoaConnector =
|
|
66
|
+
primaryWalletId === owner.id || primaryWalletId === account.id;
|
|
46
67
|
}
|
|
47
|
-
const shouldSetEoaConnector = primaryWalletId === owner.id || primaryWalletId === account.id;
|
|
48
68
|
yield connector.registerEoa({
|
|
49
|
-
ecdsaProviderType: (
|
|
50
|
-
entryPointVersion: (
|
|
51
|
-
eoaAddress
|
|
52
|
-
eoaConnector
|
|
53
|
-
kernelVersion: (
|
|
69
|
+
ecdsaProviderType: (_e = account.walletProperties) === null || _e === void 0 ? void 0 : _e.ecdsaProviderType,
|
|
70
|
+
entryPointVersion: (_f = account.walletProperties) === null || _f === void 0 ? void 0 : _f.entryPointVersion,
|
|
71
|
+
eoaAddress,
|
|
72
|
+
eoaConnector,
|
|
73
|
+
kernelVersion: (_g = account.walletProperties) === null || _g === void 0 ? void 0 : _g.kernelVersion,
|
|
54
74
|
shouldSetEoaConnector,
|
|
55
|
-
smartWalletAddress:
|
|
75
|
+
smartWalletAddress: eoaAddress,
|
|
56
76
|
});
|
|
57
77
|
});
|
|
58
78
|
|
|
@@ -101,9 +101,16 @@ require('../../../../components/Popper/Popper/Popper.cjs');
|
|
|
101
101
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
102
102
|
|
|
103
103
|
const AccountControl = ({ className }) => {
|
|
104
|
+
var _a;
|
|
104
105
|
const { primaryWallet, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
105
106
|
const { isOpen, setIsOpen } = DynamicWidgetContext.useWidgetContext();
|
|
106
|
-
|
|
107
|
+
let address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
108
|
+
if (primaryWallet && ((_a = primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.key) === 'zerodev') {
|
|
109
|
+
const zerodevWallet = primaryWallet.connector;
|
|
110
|
+
if (zerodevWallet.isEip7702Mode) {
|
|
111
|
+
address = zerodevWallet.eoaAddress;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
107
114
|
const nameService = useFetchNameService.useFetchNameService(address);
|
|
108
115
|
const renderUserIdentifier = () => {
|
|
109
116
|
if (nameService === null || nameService === void 0 ? void 0 : nameService.name) {
|
|
@@ -97,9 +97,16 @@ import '../../../../components/Popper/Popper/Popper.js';
|
|
|
97
97
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
98
98
|
|
|
99
99
|
const AccountControl = ({ className }) => {
|
|
100
|
+
var _a;
|
|
100
101
|
const { primaryWallet, user } = useInternalDynamicContext();
|
|
101
102
|
const { isOpen, setIsOpen } = useWidgetContext();
|
|
102
|
-
|
|
103
|
+
let address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
104
|
+
if (primaryWallet && ((_a = primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.key) === 'zerodev') {
|
|
105
|
+
const zerodevWallet = primaryWallet.connector;
|
|
106
|
+
if (zerodevWallet.isEip7702Mode) {
|
|
107
|
+
address = zerodevWallet.eoaAddress;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
103
110
|
const nameService = useFetchNameService(address);
|
|
104
111
|
const renderUserIdentifier = () => {
|
|
105
112
|
if (nameService === null || nameService === void 0 ? void 0 : nameService.name) {
|
|
@@ -111,11 +111,19 @@ const getNameIfNoIcon = (wallet) => {
|
|
|
111
111
|
: undefined;
|
|
112
112
|
};
|
|
113
113
|
const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth = false, isLoading = false, }) => {
|
|
114
|
+
var _a;
|
|
114
115
|
const { showAlert } = PasskeyContext.usePasskeyContext();
|
|
115
116
|
const header = nameServiceName || getNameIfNoIcon(wallet);
|
|
117
|
+
let address = wallet === null || wallet === void 0 ? void 0 : wallet.address;
|
|
118
|
+
if (wallet && ((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === 'zerodev') {
|
|
119
|
+
const zerodevWallet = wallet.connector;
|
|
120
|
+
if (zerodevWallet.isEip7702Mode) {
|
|
121
|
+
address = zerodevWallet.eoaAddress;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
116
124
|
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { className: fullWidth
|
|
117
125
|
? 'active-wallet-information__handle--full-width'
|
|
118
|
-
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: header }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(
|
|
126
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: header }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress.shortenWalletAddress(address, 4, 4)) })] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: menuOption, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu', iconOverride: showAlert() ? (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { Icon: () => jsxRuntime.jsx(gear.ReactComponent, { width: 16, height: 16 }), variant: 'yellow' })) : (jsxRuntime.jsx(gear.ReactComponent, { width: 16, height: 16 })) })] }));
|
|
119
127
|
};
|
|
120
128
|
|
|
121
129
|
exports.ActiveWalletAddress = ActiveWalletAddress;
|
|
@@ -107,11 +107,19 @@ const getNameIfNoIcon = (wallet) => {
|
|
|
107
107
|
: undefined;
|
|
108
108
|
};
|
|
109
109
|
const ActiveWalletAddress = ({ wallet, nameServiceName, menuOption, fullWidth = false, isLoading = false, }) => {
|
|
110
|
+
var _a;
|
|
110
111
|
const { showAlert } = usePasskeyContext();
|
|
111
112
|
const header = nameServiceName || getNameIfNoIcon(wallet);
|
|
113
|
+
let address = wallet === null || wallet === void 0 ? void 0 : wallet.address;
|
|
114
|
+
if (wallet && ((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === 'zerodev') {
|
|
115
|
+
const zerodevWallet = wallet.connector;
|
|
116
|
+
if (zerodevWallet.isEip7702Mode) {
|
|
117
|
+
address = zerodevWallet.eoaAddress;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
112
120
|
return (jsxs("div", { className: 'active-wallet-information__address-container', children: [jsxs("div", { children: [jsx(Typography, { className: fullWidth
|
|
113
121
|
? 'active-wallet-information__handle--full-width'
|
|
114
|
-
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: header }), jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(
|
|
122
|
+
: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: header }), jsx(Typography, { className: 'active-wallet-information__address', weight: header ? 'regular' : 'medium', variant: header ? 'body_small' : 'body_normal', color: header ? 'secondary' : 'primary', children: isLoading ? (jsx(Skeleton, { className: 'active-wallet-information__address-skeleton' })) : (shortenWalletAddress(address, 4, 4)) })] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: menuOption, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu', iconOverride: showAlert() ? (jsx(IconWithStatus, { Icon: () => jsx(SvgGear, { width: 16, height: 16 }), variant: 'yellow' })) : (jsx(SvgGear, { width: 16, height: 16 })) })] }));
|
|
115
123
|
};
|
|
116
124
|
|
|
117
125
|
export { ActiveWalletAddress, getNameIfNoIcon };
|