@dynamic-labs/sdk-react-core 2.2.3 → 2.2.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 +10 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/context/WalletContext/WalletContext.cjs +1 -1
- package/src/lib/context/WalletContext/WalletContext.js +1 -1
- package/src/lib/events/multiWallet.d.ts +1 -0
- package/src/lib/locale/en/translation.cjs +2 -2
- package/src/lib/locale/en/translation.d.ts +1 -1
- package/src/lib/locale/en/translation.js +2 -2
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +39 -13
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +40 -14
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +27 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +27 -0
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +20 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +20 -1
- package/src/lib/views/SelectHardwareWalletView/SelectHardwareWalletView.cjs +1 -5
- package/src/lib/views/SelectHardwareWalletView/SelectHardwareWalletView.js +2 -6
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +1 -6
- package/src/lib/views/WalletGroupView/WalletGroupView.js +2 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.2.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.3...v2.2.4) (2024-06-21)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* always reconnect the wallet provider when calling getAddress ([#6097](https://github.com/dynamic-labs/DynamicAuth/issues/6097)) ([#6099](https://github.com/dynamic-labs/DynamicAuth/issues/6099)) ([428de7c](https://github.com/dynamic-labs/DynamicAuth/commit/428de7c67a61c2078566e2b967aef018282ad88a))
|
|
8
|
+
* set latest blockhash on solana transactions if tx confirmation ui is disabled ([#6102](https://github.com/dynamic-labs/DynamicAuth/issues/6102)) ([#6109](https://github.com/dynamic-labs/DynamicAuth/issues/6109)) ([01a25ed](https://github.com/dynamic-labs/DynamicAuth/commit/01a25ed37498c8046022483fdeb2ce572bd2d5c6))
|
|
9
|
+
* silently query unisat accounts ([#6101](https://github.com/dynamic-labs/DynamicAuth/issues/6101)) ([5402518](https://github.com/dynamic-labs/DynamicAuth/commit/5402518bb91c3ec02eee2f0bdd97d90a33d5d9f7))
|
|
10
|
+
* trigger sign when linking an already linked unknown wallet ([#6111](https://github.com/dynamic-labs/DynamicAuth/issues/6111)) ([9602055](https://github.com/dynamic-labs/DynamicAuth/commit/9602055527b5430e7a98e8836b585ead240bf1d7))
|
|
11
|
+
|
|
2
12
|
### [2.2.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.2...v2.2.3) (2024-06-19)
|
|
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": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "2.2.
|
|
21
|
-
"@dynamic-labs/logger": "2.2.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.2.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.2.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.2.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.2.
|
|
26
|
-
"@dynamic-labs/store": "2.2.
|
|
27
|
-
"@dynamic-labs/types": "2.2.
|
|
28
|
-
"@dynamic-labs/utils": "2.2.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.2.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.2.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.2.
|
|
20
|
+
"@dynamic-labs/iconic": "2.2.4",
|
|
21
|
+
"@dynamic-labs/logger": "2.2.4",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.2.4",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.2.4",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.2.4",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.2.4",
|
|
26
|
+
"@dynamic-labs/store": "2.2.4",
|
|
27
|
+
"@dynamic-labs/types": "2.2.4",
|
|
28
|
+
"@dynamic-labs/utils": "2.2.4",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.2.4",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.2.4",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.2.4",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
8
9
|
require('../DynamicContext/DynamicContext.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('../../shared/logger.cjs');
|
|
@@ -18,7 +19,6 @@ require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
18
19
|
require('@dynamic-labs/utils');
|
|
19
20
|
require('../../shared/consts/index.cjs');
|
|
20
21
|
require('../../events/dynamicEvents.cjs');
|
|
21
|
-
require('../../../../_virtual/_tslib.cjs');
|
|
22
22
|
require('../CaptchaContext/CaptchaContext.cjs');
|
|
23
23
|
require('../ErrorContext/ErrorContext.cjs');
|
|
24
24
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useContext, useState, useMemo } from 'react';
|
|
4
|
+
import '../../../../_virtual/_tslib.js';
|
|
4
5
|
import '../DynamicContext/DynamicContext.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '../../shared/logger.js';
|
|
@@ -14,7 +15,6 @@ import '../../shared/utils/classes/storage/localStorage.js';
|
|
|
14
15
|
import '@dynamic-labs/utils';
|
|
15
16
|
import '../../shared/consts/index.js';
|
|
16
17
|
import '../../events/dynamicEvents.js';
|
|
17
|
-
import '../../../../_virtual/_tslib.js';
|
|
18
18
|
import '../CaptchaContext/CaptchaContext.js';
|
|
19
19
|
import '../ErrorContext/ErrorContext.js';
|
|
20
20
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -1600,12 +1600,12 @@ const translation = {
|
|
|
1600
1600
|
* @default
|
|
1601
1601
|
* {
|
|
1602
1602
|
description: "This wallet supports multiple chains. Select which chain you'd like to connect to",
|
|
1603
|
-
using_hardware_wallet_toggle_label: 'Using Ledger
|
|
1603
|
+
using_hardware_wallet_toggle_label: 'Using Ledger',
|
|
1604
1604
|
}
|
|
1605
1605
|
*/
|
|
1606
1606
|
dyn_select_chain: {
|
|
1607
1607
|
description: "This wallet supports multiple chains. Select which chain you'd like to connect to",
|
|
1608
|
-
using_hardware_wallet_toggle_label: 'Using Ledger
|
|
1608
|
+
using_hardware_wallet_toggle_label: 'Using Ledger',
|
|
1609
1609
|
},
|
|
1610
1610
|
/**
|
|
1611
1611
|
* @description copy keys for Select Wallet view
|
|
@@ -1596,7 +1596,7 @@ export declare const translation: {
|
|
|
1596
1596
|
* @default
|
|
1597
1597
|
* {
|
|
1598
1598
|
description: "This wallet supports multiple chains. Select which chain you'd like to connect to",
|
|
1599
|
-
using_hardware_wallet_toggle_label: 'Using Ledger
|
|
1599
|
+
using_hardware_wallet_toggle_label: 'Using Ledger',
|
|
1600
1600
|
}
|
|
1601
1601
|
*/
|
|
1602
1602
|
dyn_select_chain: {
|
|
@@ -1596,12 +1596,12 @@ const translation = {
|
|
|
1596
1596
|
* @default
|
|
1597
1597
|
* {
|
|
1598
1598
|
description: "This wallet supports multiple chains. Select which chain you'd like to connect to",
|
|
1599
|
-
using_hardware_wallet_toggle_label: 'Using Ledger
|
|
1599
|
+
using_hardware_wallet_toggle_label: 'Using Ledger',
|
|
1600
1600
|
}
|
|
1601
1601
|
*/
|
|
1602
1602
|
dyn_select_chain: {
|
|
1603
1603
|
description: "This wallet supports multiple chains. Select which chain you'd like to connect to",
|
|
1604
|
-
using_hardware_wallet_toggle_label: 'Using Ledger
|
|
1604
|
+
using_hardware_wallet_toggle_label: 'Using Ledger',
|
|
1605
1605
|
},
|
|
1606
1606
|
/**
|
|
1607
1607
|
* @description copy keys for Select Wallet view
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
7
|
var React = require('react');
|
|
7
8
|
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
8
9
|
require('@dynamic-labs/sdk-api-core');
|
|
@@ -17,8 +18,7 @@ require('../../../constants/values.cjs');
|
|
|
17
18
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
19
|
require('@dynamic-labs/utils');
|
|
19
20
|
require('../../../../shared/consts/index.cjs');
|
|
20
|
-
require('
|
|
21
|
-
require('../../../../../../_virtual/_tslib.cjs');
|
|
21
|
+
var useDynamicEvents = require('../../events/useDynamicEvents/useDynamicEvents.cjs');
|
|
22
22
|
var useConnectAndSign = require('../../authenticationHooks/useConnectAndSign/useConnectAndSign.cjs');
|
|
23
23
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
24
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
@@ -32,6 +32,7 @@ require('viem');
|
|
|
32
32
|
require('viem/chains');
|
|
33
33
|
require('@dynamic-labs/store');
|
|
34
34
|
require('../../../../locale/locale.cjs');
|
|
35
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
35
36
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
36
37
|
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
37
38
|
require('react-dom');
|
|
@@ -82,29 +83,54 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
|
|
|
82
83
|
const useVerifyOnAwaitingSignature = () => {
|
|
83
84
|
const { awaitingSignatureState, multiWalletWidgetState, setMultiWalletWidgetState, legacyIsVerifying, setLegacyIsVerifying, selectedWalletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
84
85
|
const triggerConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
86
|
+
// this is to prevent calling runConnectAndSign multiple times
|
|
87
|
+
// due to changes in legacyIsVerifying
|
|
88
|
+
const isVerifying = React.useRef(false);
|
|
89
|
+
const runConnectAndSign = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
logger.logger.debug('runConnectAndSign', {
|
|
91
|
+
selectedWalletConnector,
|
|
92
|
+
});
|
|
93
|
+
if (!selectedWalletConnector) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
isVerifying.current = true;
|
|
97
|
+
setLegacyIsVerifying(true);
|
|
98
|
+
try {
|
|
99
|
+
yield triggerConnectAndSign({
|
|
100
|
+
walletConnector: selectedWalletConnector,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
logger.logger.error(e);
|
|
105
|
+
}
|
|
106
|
+
setMultiWalletWidgetState('idle');
|
|
107
|
+
setLegacyIsVerifying(false);
|
|
108
|
+
isVerifying.current = false;
|
|
109
|
+
}), [
|
|
110
|
+
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key,
|
|
111
|
+
setLegacyIsVerifying,
|
|
112
|
+
setMultiWalletWidgetState,
|
|
113
|
+
triggerConnectAndSign,
|
|
114
|
+
]);
|
|
85
115
|
React.useEffect(() => {
|
|
86
116
|
if (!legacyIsVerifying &&
|
|
117
|
+
!isVerifying.current &&
|
|
87
118
|
multiWalletWidgetState === 'awaiting_signature' &&
|
|
88
119
|
selectedWalletConnector &&
|
|
89
120
|
awaitingSignatureState === 'linking_new_wallet' &&
|
|
90
121
|
!requiresTwoStepAuthentication.requiresTwoStepAuthentication(selectedWalletConnector)) {
|
|
91
|
-
|
|
92
|
-
triggerConnectAndSign({ walletConnector: selectedWalletConnector })
|
|
93
|
-
.catch((e) => {
|
|
94
|
-
logger.logger.error(e);
|
|
95
|
-
})
|
|
96
|
-
.finally(() => {
|
|
97
|
-
setMultiWalletWidgetState('idle');
|
|
98
|
-
setLegacyIsVerifying(false);
|
|
99
|
-
});
|
|
122
|
+
runConnectAndSign();
|
|
100
123
|
}
|
|
101
124
|
}, [
|
|
125
|
+
runConnectAndSign,
|
|
102
126
|
awaitingSignatureState,
|
|
103
|
-
|
|
127
|
+
legacyIsVerifying,
|
|
104
128
|
multiWalletWidgetState,
|
|
129
|
+
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key,
|
|
130
|
+
setLegacyIsVerifying,
|
|
105
131
|
setMultiWalletWidgetState,
|
|
106
|
-
legacyIsVerifying,
|
|
107
132
|
]);
|
|
133
|
+
useDynamicEvents.useInternalDynamicEvents('triggerConnectAndSign', runConnectAndSign);
|
|
108
134
|
};
|
|
109
135
|
|
|
110
136
|
exports.useVerifyOnAwaitingSignature = useVerifyOnAwaitingSignature;
|
package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
3
4
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
4
5
|
import '@dynamic-labs/sdk-api-core';
|
|
5
6
|
import { logger } from '../../../../shared/logger.js';
|
|
@@ -13,8 +14,7 @@ import '../../../constants/values.js';
|
|
|
13
14
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
14
15
|
import '@dynamic-labs/utils';
|
|
15
16
|
import '../../../../shared/consts/index.js';
|
|
16
|
-
import '
|
|
17
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
17
|
+
import { useInternalDynamicEvents } from '../../events/useDynamicEvents/useDynamicEvents.js';
|
|
18
18
|
import { useConnectAndSign } from '../../authenticationHooks/useConnectAndSign/useConnectAndSign.js';
|
|
19
19
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
20
20
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
@@ -28,6 +28,7 @@ import 'viem';
|
|
|
28
28
|
import 'viem/chains';
|
|
29
29
|
import '@dynamic-labs/store';
|
|
30
30
|
import '../../../../locale/locale.js';
|
|
31
|
+
import '../../../../events/dynamicEvents.js';
|
|
31
32
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
32
33
|
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
33
34
|
import 'react-dom';
|
|
@@ -78,29 +79,54 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
78
79
|
const useVerifyOnAwaitingSignature = () => {
|
|
79
80
|
const { awaitingSignatureState, multiWalletWidgetState, setMultiWalletWidgetState, legacyIsVerifying, setLegacyIsVerifying, selectedWalletConnector, } = useInternalDynamicContext();
|
|
80
81
|
const triggerConnectAndSign = useConnectAndSign();
|
|
82
|
+
// this is to prevent calling runConnectAndSign multiple times
|
|
83
|
+
// due to changes in legacyIsVerifying
|
|
84
|
+
const isVerifying = useRef(false);
|
|
85
|
+
const runConnectAndSign = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
logger.debug('runConnectAndSign', {
|
|
87
|
+
selectedWalletConnector,
|
|
88
|
+
});
|
|
89
|
+
if (!selectedWalletConnector) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
isVerifying.current = true;
|
|
93
|
+
setLegacyIsVerifying(true);
|
|
94
|
+
try {
|
|
95
|
+
yield triggerConnectAndSign({
|
|
96
|
+
walletConnector: selectedWalletConnector,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
logger.error(e);
|
|
101
|
+
}
|
|
102
|
+
setMultiWalletWidgetState('idle');
|
|
103
|
+
setLegacyIsVerifying(false);
|
|
104
|
+
isVerifying.current = false;
|
|
105
|
+
}), [
|
|
106
|
+
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key,
|
|
107
|
+
setLegacyIsVerifying,
|
|
108
|
+
setMultiWalletWidgetState,
|
|
109
|
+
triggerConnectAndSign,
|
|
110
|
+
]);
|
|
81
111
|
useEffect(() => {
|
|
82
112
|
if (!legacyIsVerifying &&
|
|
113
|
+
!isVerifying.current &&
|
|
83
114
|
multiWalletWidgetState === 'awaiting_signature' &&
|
|
84
115
|
selectedWalletConnector &&
|
|
85
116
|
awaitingSignatureState === 'linking_new_wallet' &&
|
|
86
117
|
!requiresTwoStepAuthentication(selectedWalletConnector)) {
|
|
87
|
-
|
|
88
|
-
triggerConnectAndSign({ walletConnector: selectedWalletConnector })
|
|
89
|
-
.catch((e) => {
|
|
90
|
-
logger.error(e);
|
|
91
|
-
})
|
|
92
|
-
.finally(() => {
|
|
93
|
-
setMultiWalletWidgetState('idle');
|
|
94
|
-
setLegacyIsVerifying(false);
|
|
95
|
-
});
|
|
118
|
+
runConnectAndSign();
|
|
96
119
|
}
|
|
97
120
|
}, [
|
|
121
|
+
runConnectAndSign,
|
|
98
122
|
awaitingSignatureState,
|
|
99
|
-
|
|
123
|
+
legacyIsVerifying,
|
|
100
124
|
multiWalletWidgetState,
|
|
125
|
+
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key,
|
|
126
|
+
setLegacyIsVerifying,
|
|
101
127
|
setMultiWalletWidgetState,
|
|
102
|
-
legacyIsVerifying,
|
|
103
128
|
]);
|
|
129
|
+
useInternalDynamicEvents('triggerConnectAndSign', runConnectAndSign);
|
|
104
130
|
};
|
|
105
131
|
|
|
106
132
|
export { useVerifyOnAwaitingSignature };
|
|
@@ -19,6 +19,15 @@ require('@dynamic-labs/utils');
|
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
20
|
var useDynamicEvents = require('../events/useDynamicEvents/useDynamicEvents.cjs');
|
|
21
21
|
var useWalletConnectorEvent = require('../events/useWalletConnectorEvent/useWalletConnectorEvent.cjs');
|
|
22
|
+
require('@dynamic-labs/multi-wallet');
|
|
23
|
+
require('react-international-phone');
|
|
24
|
+
require('viem');
|
|
25
|
+
require('viem/chains');
|
|
26
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
27
|
+
require('@dynamic-labs/store');
|
|
28
|
+
require('../../../locale/locale.cjs');
|
|
29
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
30
|
+
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
22
31
|
|
|
23
32
|
const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
24
33
|
useWalletConnectorEvent.useWalletConnectorEvent(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, 'disconnect', () => {
|
|
@@ -33,7 +42,12 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
33
42
|
refreshConnectedWallet(primaryWallet.id, primaryWallet.connector);
|
|
34
43
|
});
|
|
35
44
|
const handleAccountChangeWhenAwaitingAccountSwitch = React.useCallback((isPrimaryWallet, newAddress) => {
|
|
45
|
+
logger.logger.debug('handleAccountChangeWhenAwaitingAccountSwitch', {
|
|
46
|
+
isPrimaryWallet,
|
|
47
|
+
newAddress,
|
|
48
|
+
});
|
|
36
49
|
const linkedSecondaryWallet = secondaryWallets.find((wallet) => walletConnectorCore.isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
50
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('[handleAccountChangeWhenAwaitingAccountSwitch]', { linkedSecondaryWallet });
|
|
37
51
|
// this means the user is linking a new account, so we need proof of ownership...
|
|
38
52
|
if (!linkedSecondaryWallet) {
|
|
39
53
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
@@ -42,6 +56,12 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
42
56
|
}
|
|
43
57
|
return;
|
|
44
58
|
}
|
|
59
|
+
const isTryingToUpdateUnkownWallet = linkedSecondaryWallet.connector.key === 'unknown';
|
|
60
|
+
if (isTryingToUpdateUnkownWallet) {
|
|
61
|
+
//prompt the user to connect and sign with the wallet
|
|
62
|
+
dynamicEvents.dynamicEvents.emit('triggerConnectAndSign');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
45
65
|
// ...otherwise, the user is switching primary accounts betweeen the same wallet
|
|
46
66
|
setSelectedWalletWithAction(null);
|
|
47
67
|
setPrimaryWalletId(linkedSecondaryWallet.id);
|
|
@@ -55,6 +75,13 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
55
75
|
setPrimaryWalletId,
|
|
56
76
|
]);
|
|
57
77
|
const calculatePrimaryWalletMultiWalletStateFromAccounts = React.useCallback(({ accounts }) => {
|
|
78
|
+
logger.logger.debug('calculatePrimaryWalletMultiWalletStateFromAccounts', {
|
|
79
|
+
accounts,
|
|
80
|
+
authMode,
|
|
81
|
+
multiWallet,
|
|
82
|
+
multiWalletWidgetState,
|
|
83
|
+
primaryWallet,
|
|
84
|
+
});
|
|
58
85
|
// change the api here
|
|
59
86
|
if (!primaryWallet)
|
|
60
87
|
return;
|
|
@@ -15,6 +15,15 @@ import '@dynamic-labs/utils';
|
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
16
|
import { useInternalDynamicEvents } from '../events/useDynamicEvents/useDynamicEvents.js';
|
|
17
17
|
import { useWalletConnectorEvent } from '../events/useWalletConnectorEvent/useWalletConnectorEvent.js';
|
|
18
|
+
import '@dynamic-labs/multi-wallet';
|
|
19
|
+
import 'react-international-phone';
|
|
20
|
+
import 'viem';
|
|
21
|
+
import 'viem/chains';
|
|
22
|
+
import '../../../config/ApiEndpoint.js';
|
|
23
|
+
import '@dynamic-labs/store';
|
|
24
|
+
import '../../../locale/locale.js';
|
|
25
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
26
|
+
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
18
27
|
|
|
19
28
|
const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnectorKey, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
20
29
|
useWalletConnectorEvent(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, 'disconnect', () => {
|
|
@@ -29,7 +38,12 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
29
38
|
refreshConnectedWallet(primaryWallet.id, primaryWallet.connector);
|
|
30
39
|
});
|
|
31
40
|
const handleAccountChangeWhenAwaitingAccountSwitch = useCallback((isPrimaryWallet, newAddress) => {
|
|
41
|
+
logger.debug('handleAccountChangeWhenAwaitingAccountSwitch', {
|
|
42
|
+
isPrimaryWallet,
|
|
43
|
+
newAddress,
|
|
44
|
+
});
|
|
32
45
|
const linkedSecondaryWallet = secondaryWallets.find((wallet) => isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
46
|
+
logVerboseTroubleshootingMessage('[handleAccountChangeWhenAwaitingAccountSwitch]', { linkedSecondaryWallet });
|
|
33
47
|
// this means the user is linking a new account, so we need proof of ownership...
|
|
34
48
|
if (!linkedSecondaryWallet) {
|
|
35
49
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
@@ -38,6 +52,12 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
38
52
|
}
|
|
39
53
|
return;
|
|
40
54
|
}
|
|
55
|
+
const isTryingToUpdateUnkownWallet = linkedSecondaryWallet.connector.key === 'unknown';
|
|
56
|
+
if (isTryingToUpdateUnkownWallet) {
|
|
57
|
+
//prompt the user to connect and sign with the wallet
|
|
58
|
+
dynamicEvents.emit('triggerConnectAndSign');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
41
61
|
// ...otherwise, the user is switching primary accounts betweeen the same wallet
|
|
42
62
|
setSelectedWalletWithAction(null);
|
|
43
63
|
setPrimaryWalletId(linkedSecondaryWallet.id);
|
|
@@ -51,6 +71,13 @@ const useWalletEventListeners = ({ disconnectWallet, handleLogOut, multiWallet,
|
|
|
51
71
|
setPrimaryWalletId,
|
|
52
72
|
]);
|
|
53
73
|
const calculatePrimaryWalletMultiWalletStateFromAccounts = useCallback(({ accounts }) => {
|
|
74
|
+
logger.debug('calculatePrimaryWalletMultiWalletStateFromAccounts', {
|
|
75
|
+
accounts,
|
|
76
|
+
authMode,
|
|
77
|
+
multiWallet,
|
|
78
|
+
multiWalletWidgetState,
|
|
79
|
+
primaryWallet,
|
|
80
|
+
});
|
|
54
81
|
// change the api here
|
|
55
82
|
if (!primaryWallet)
|
|
56
83
|
return;
|
|
@@ -9,7 +9,7 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
|
9
9
|
require('react');
|
|
10
10
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
11
11
|
require('@dynamic-labs/sdk-api-core');
|
|
12
|
-
require('../../../shared/logger.cjs');
|
|
12
|
+
var logger = require('../../../shared/logger.cjs');
|
|
13
13
|
require('@dynamic-labs/iconic');
|
|
14
14
|
require('react/jsx-runtime');
|
|
15
15
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -31,6 +31,7 @@ require('react-international-phone');
|
|
|
31
31
|
var requiresTwoStepAuthentication = require('../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.cjs');
|
|
32
32
|
require('viem');
|
|
33
33
|
require('viem/chains');
|
|
34
|
+
var logVerboseTroubleshootingMessage = require('../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.cjs');
|
|
34
35
|
require('@dynamic-labs/store');
|
|
35
36
|
require('../../../locale/locale.cjs');
|
|
36
37
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -90,7 +91,11 @@ const useWalletItemActions = () => {
|
|
|
90
91
|
const { onlyConnectUser } = useConnectAndSignSplitSteps.useConnectAndSignSplitSteps();
|
|
91
92
|
const connectAndSignWallet = useConnectAndSign.useConnectAndSign();
|
|
92
93
|
const handleCustodialWalletClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
logger.logger.debug('handleCustodialWalletClick', walletConnector);
|
|
93
95
|
const twoStepAuthentication = requiresTwoStepAuthentication.requiresTwoStepAuthentication(walletConnector);
|
|
96
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('[handleCustodialWalletClick]', {
|
|
97
|
+
twoStepAuthentication,
|
|
98
|
+
});
|
|
94
99
|
if (twoStepAuthentication) {
|
|
95
100
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
96
101
|
yield onlyConnectUser({
|
|
@@ -105,6 +110,7 @@ const useWalletItemActions = () => {
|
|
|
105
110
|
});
|
|
106
111
|
const handleMobileWalletClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
107
112
|
var _a;
|
|
113
|
+
logger.logger.debug('handleMobileWalletClick', walletConnector);
|
|
108
114
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
109
115
|
// We need to set to LS when about to verify phantom wallet on mobile
|
|
110
116
|
// because the deeplink interrupts this code execution and then redirects back on a new tab.
|
|
@@ -124,10 +130,12 @@ const useWalletItemActions = () => {
|
|
|
124
130
|
onlyConnectUser({ walletConnector });
|
|
125
131
|
});
|
|
126
132
|
const handleInstalledExtensionClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
logger.logger.debug('handleInstalledExtensionClick', walletConnector);
|
|
127
134
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
128
135
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
129
136
|
});
|
|
130
137
|
const handleUninstalledClick = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
+
logger.logger.debug('handleUninstalledClick', walletConnector);
|
|
131
139
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
132
140
|
if (!walletConnector.canConnectViaQrCode) {
|
|
133
141
|
setView('no-qr-not-installed');
|
|
@@ -149,8 +157,14 @@ const useWalletItemActions = () => {
|
|
|
149
157
|
setError(undefined);
|
|
150
158
|
});
|
|
151
159
|
const handleAlreadyConnectedWallet = (walletConnector) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
160
|
+
logger.logger.debug('handleAlreadyConnectedWallet', walletConnector);
|
|
152
161
|
const connectedAccounts = yield walletConnector.getConnectedAccounts();
|
|
153
162
|
const activeAccountAlreadyLinked = linkedWallets.find((wallet) => { var _a; return wallet.address.toLowerCase() === ((_a = connectedAccounts[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
|
|
163
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('[handleAlreadyConnectedWallet]', {
|
|
164
|
+
activeAccountAlreadyLinked,
|
|
165
|
+
connectedAccounts,
|
|
166
|
+
linkedWallets,
|
|
167
|
+
});
|
|
154
168
|
if (activeAccountAlreadyLinked) {
|
|
155
169
|
setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
|
|
156
170
|
}
|
|
@@ -180,6 +194,11 @@ const useWalletItemActions = () => {
|
|
|
180
194
|
const { walletConnector, isInstalledOnBrowser } = wallet;
|
|
181
195
|
const shouldEndWalletConnectorSession = walletConnector.connectedChain === 'FLOW' ||
|
|
182
196
|
walletConnectorCore.isPhantomRedirectConnector(walletConnector);
|
|
197
|
+
logVerboseTroubleshootingMessage.logVerboseTroubleshootingMessage('[handleWalletItemClick]', {
|
|
198
|
+
mockedSDK,
|
|
199
|
+
shouldEndWalletConnectorSession,
|
|
200
|
+
wallet,
|
|
201
|
+
});
|
|
183
202
|
if (mockedSDK)
|
|
184
203
|
return;
|
|
185
204
|
if (shouldEndWalletConnectorSession) {
|
|
@@ -5,7 +5,7 @@ import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core'
|
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
7
7
|
import '@dynamic-labs/sdk-api-core';
|
|
8
|
-
import '../../../shared/logger.js';
|
|
8
|
+
import { logger } from '../../../shared/logger.js';
|
|
9
9
|
import '@dynamic-labs/iconic';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
@@ -27,6 +27,7 @@ import 'react-international-phone';
|
|
|
27
27
|
import { requiresTwoStepAuthentication } from '../../functions/requiresTwoStepAuthentication/requiresTwoStepAuthentication.js';
|
|
28
28
|
import 'viem';
|
|
29
29
|
import 'viem/chains';
|
|
30
|
+
import { logVerboseTroubleshootingMessage } from '../../functions/logVerboseTroubleshootingMessage/logVerboseTroubleshootingMessage.js';
|
|
30
31
|
import '@dynamic-labs/store';
|
|
31
32
|
import '../../../locale/locale.js';
|
|
32
33
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -86,7 +87,11 @@ const useWalletItemActions = () => {
|
|
|
86
87
|
const { onlyConnectUser } = useConnectAndSignSplitSteps();
|
|
87
88
|
const connectAndSignWallet = useConnectAndSign();
|
|
88
89
|
const handleCustodialWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
logger.debug('handleCustodialWalletClick', walletConnector);
|
|
89
91
|
const twoStepAuthentication = requiresTwoStepAuthentication(walletConnector);
|
|
92
|
+
logVerboseTroubleshootingMessage('[handleCustodialWalletClick]', {
|
|
93
|
+
twoStepAuthentication,
|
|
94
|
+
});
|
|
90
95
|
if (twoStepAuthentication) {
|
|
91
96
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
92
97
|
yield onlyConnectUser({
|
|
@@ -101,6 +106,7 @@ const useWalletItemActions = () => {
|
|
|
101
106
|
});
|
|
102
107
|
const handleMobileWalletClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
108
|
var _a;
|
|
109
|
+
logger.debug('handleMobileWalletClick', walletConnector);
|
|
104
110
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
105
111
|
// We need to set to LS when about to verify phantom wallet on mobile
|
|
106
112
|
// because the deeplink interrupts this code execution and then redirects back on a new tab.
|
|
@@ -120,10 +126,12 @@ const useWalletItemActions = () => {
|
|
|
120
126
|
onlyConnectUser({ walletConnector });
|
|
121
127
|
});
|
|
122
128
|
const handleInstalledExtensionClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
logger.debug('handleInstalledExtensionClick', walletConnector);
|
|
123
130
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
124
131
|
setMultiWalletWidgetState('awaiting_signature', undefined, 'linking_new_wallet');
|
|
125
132
|
});
|
|
126
133
|
const handleUninstalledClick = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
+
logger.debug('handleUninstalledClick', walletConnector);
|
|
127
135
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
128
136
|
if (!walletConnector.canConnectViaQrCode) {
|
|
129
137
|
setView('no-qr-not-installed');
|
|
@@ -145,8 +153,14 @@ const useWalletItemActions = () => {
|
|
|
145
153
|
setError(undefined);
|
|
146
154
|
});
|
|
147
155
|
const handleAlreadyConnectedWallet = (walletConnector) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
logger.debug('handleAlreadyConnectedWallet', walletConnector);
|
|
148
157
|
const connectedAccounts = yield walletConnector.getConnectedAccounts();
|
|
149
158
|
const activeAccountAlreadyLinked = linkedWallets.find((wallet) => { var _a; return wallet.address.toLowerCase() === ((_a = connectedAccounts[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
|
|
159
|
+
logVerboseTroubleshootingMessage('[handleAlreadyConnectedWallet]', {
|
|
160
|
+
activeAccountAlreadyLinked,
|
|
161
|
+
connectedAccounts,
|
|
162
|
+
linkedWallets,
|
|
163
|
+
});
|
|
150
164
|
if (activeAccountAlreadyLinked) {
|
|
151
165
|
setMultiWalletWidgetState('awaiting_account_switch', 'linking_new_wallet');
|
|
152
166
|
}
|
|
@@ -176,6 +190,11 @@ const useWalletItemActions = () => {
|
|
|
176
190
|
const { walletConnector, isInstalledOnBrowser } = wallet;
|
|
177
191
|
const shouldEndWalletConnectorSession = walletConnector.connectedChain === 'FLOW' ||
|
|
178
192
|
isPhantomRedirectConnector(walletConnector);
|
|
193
|
+
logVerboseTroubleshootingMessage('[handleWalletItemClick]', {
|
|
194
|
+
mockedSDK,
|
|
195
|
+
shouldEndWalletConnectorSession,
|
|
196
|
+
wallet,
|
|
197
|
+
});
|
|
179
198
|
if (mockedSDK)
|
|
180
199
|
return;
|
|
181
200
|
if (shouldEndWalletConnectorSession) {
|
|
@@ -82,12 +82,8 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
|
82
82
|
var HardwareWalletToggle = require('../../components/HardwareWalletToggle/HardwareWalletToggle.cjs');
|
|
83
83
|
|
|
84
84
|
const SelectHardwareWalletView = ({ wallet, onSelectWallet, }) => {
|
|
85
|
-
var _a;
|
|
86
85
|
const { t } = reactI18next.useTranslation();
|
|
87
|
-
|
|
88
|
-
return (jsxRuntime.jsx("div", { className: 'select-hardware-wallet-view', children: jsxRuntime.jsxs("div", { className: 'select-hardware-wallet-view__container', children: [jsxRuntime.jsx(Icon.Icon, { className: 'select-hardware-wallet-view__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: wallet.key }) }), jsxRuntime.jsx(Typography.Typography, { className: 'select-hardware-wallet-view__text', as: 'p', color: 'secondary', variant: 'body_normal', copykey: 'dyn_select_hardware_wallet.description', children: t('dyn_select_hardware_wallet.description') }), walletConnectorCore.isHardwareWalletConnector(wallet.walletConnector) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(HardwareWalletToggle.HardwareWalletToggle, { connectors: [wallet.walletConnector], copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label', {
|
|
89
|
-
chainName,
|
|
90
|
-
}) }), jsxRuntime.jsx(Divider.Divider, {})] })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', onClick: () => onSelectWallet === null || onSelectWallet === void 0 ? void 0 : onSelectWallet(wallet), copykey: 'dyn_select_hardware_wallet.button', dataTestId: 'select-hardware-wallet-connect-button', children: t('dyn_select_hardware_wallet.button') })] }) }));
|
|
86
|
+
return (jsxRuntime.jsx("div", { className: 'select-hardware-wallet-view', children: jsxRuntime.jsxs("div", { className: 'select-hardware-wallet-view__container', children: [jsxRuntime.jsx(Icon.Icon, { className: 'select-hardware-wallet-view__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: wallet.key }) }), jsxRuntime.jsx(Typography.Typography, { className: 'select-hardware-wallet-view__text', as: 'p', color: 'secondary', variant: 'body_normal', copykey: 'dyn_select_hardware_wallet.description', children: t('dyn_select_hardware_wallet.description') }), walletConnectorCore.isHardwareWalletConnector(wallet.walletConnector) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(HardwareWalletToggle.HardwareWalletToggle, { connectors: [wallet.walletConnector], copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsxRuntime.jsx(Divider.Divider, {})] })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', onClick: () => onSelectWallet === null || onSelectWallet === void 0 ? void 0 : onSelectWallet(wallet), copykey: 'dyn_select_hardware_wallet.button', dataTestId: 'select-hardware-wallet-connect-button', children: t('dyn_select_hardware_wallet.button') })] }) }));
|
|
91
87
|
};
|
|
92
88
|
|
|
93
89
|
exports.SelectHardwareWalletView = SelectHardwareWalletView;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
|
-
import {
|
|
5
|
+
import { isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../events/dynamicEvents.js';
|
|
8
8
|
import '../../../../_virtual/_tslib.js';
|
|
@@ -78,12 +78,8 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
78
78
|
import { HardwareWalletToggle } from '../../components/HardwareWalletToggle/HardwareWalletToggle.js';
|
|
79
79
|
|
|
80
80
|
const SelectHardwareWalletView = ({ wallet, onSelectWallet, }) => {
|
|
81
|
-
var _a;
|
|
82
81
|
const { t } = useTranslation();
|
|
83
|
-
|
|
84
|
-
return (jsx("div", { className: 'select-hardware-wallet-view', children: jsxs("div", { className: 'select-hardware-wallet-view__container', children: [jsx(Icon, { className: 'select-hardware-wallet-view__icon', children: jsx(WalletIcon, { walletKey: wallet.key }) }), jsx(Typography, { className: 'select-hardware-wallet-view__text', as: 'p', color: 'secondary', variant: 'body_normal', copykey: 'dyn_select_hardware_wallet.description', children: t('dyn_select_hardware_wallet.description') }), isHardwareWalletConnector(wallet.walletConnector) && (jsxs(Fragment, { children: [jsx(HardwareWalletToggle, { connectors: [wallet.walletConnector], copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label', {
|
|
85
|
-
chainName,
|
|
86
|
-
}) }), jsx(Divider, {})] })), jsx(TypographyButton, { buttonVariant: 'primary', onClick: () => onSelectWallet === null || onSelectWallet === void 0 ? void 0 : onSelectWallet(wallet), copykey: 'dyn_select_hardware_wallet.button', dataTestId: 'select-hardware-wallet-connect-button', children: t('dyn_select_hardware_wallet.button') })] }) }));
|
|
82
|
+
return (jsx("div", { className: 'select-hardware-wallet-view', children: jsxs("div", { className: 'select-hardware-wallet-view__container', children: [jsx(Icon, { className: 'select-hardware-wallet-view__icon', children: jsx(WalletIcon, { walletKey: wallet.key }) }), jsx(Typography, { className: 'select-hardware-wallet-view__text', as: 'p', color: 'secondary', variant: 'body_normal', copykey: 'dyn_select_hardware_wallet.description', children: t('dyn_select_hardware_wallet.description') }), isHardwareWalletConnector(wallet.walletConnector) && (jsxs(Fragment, { children: [jsx(HardwareWalletToggle, { connectors: [wallet.walletConnector], copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsx(Divider, {})] })), jsx(TypographyButton, { buttonVariant: 'primary', onClick: () => onSelectWallet === null || onSelectWallet === void 0 ? void 0 : onSelectWallet(wallet), copykey: 'dyn_select_hardware_wallet.button', dataTestId: 'select-hardware-wallet-connect-button', children: t('dyn_select_hardware_wallet.button') })] }) }));
|
|
87
83
|
};
|
|
88
84
|
|
|
89
85
|
export { SelectHardwareWalletView };
|
|
@@ -82,7 +82,6 @@ require('../TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
|
82
82
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
83
83
|
|
|
84
84
|
const WalletGroupView = () => {
|
|
85
|
-
var _a, _b;
|
|
86
85
|
const { selectedWalletGroup } = WalletGroupContext.useWalletGroupContext();
|
|
87
86
|
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
88
87
|
const { handleWalletItemClick } = useWalletItemActions.useWalletItemActions();
|
|
@@ -94,11 +93,7 @@ const WalletGroupView = () => {
|
|
|
94
93
|
.map(({ walletConnector }) => walletConnector)
|
|
95
94
|
.filter(walletConnectorCore.isHardwareWalletConnector)
|
|
96
95
|
.filter((connector) => connector.canConnectWithHardwareWallet());
|
|
97
|
-
|
|
98
|
-
const chainName = hardwareConnectedChain && ((_b = walletConnectorCore.getChainInfo(hardwareConnectedChain)) === null || _b === void 0 ? void 0 : _b.displayName);
|
|
99
|
-
return (jsxRuntime.jsx(WalletGroupViewLayout.WalletGroupViewLayout, { icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxRuntime.jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(HardwareWalletToggle.HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label', {
|
|
100
|
-
chainName,
|
|
101
|
-
}) }), jsxRuntime.jsx(Divider.Divider, {})] })), jsxRuntime.jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
|
|
96
|
+
return (jsxRuntime.jsx(WalletGroupViewLayout.WalletGroupViewLayout, { icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxRuntime.jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(HardwareWalletToggle.HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsxRuntime.jsx(Divider.Divider, {})] })), jsxRuntime.jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
|
|
102
97
|
};
|
|
103
98
|
|
|
104
99
|
exports.WalletGroupView = WalletGroupView;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useWalletBookContext, getWalletGroup, WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
|
-
import { isHardwareWalletConnector
|
|
5
|
+
import { isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { useWalletGroupContext } from '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
import '../../events/dynamicEvents.js';
|
|
@@ -78,7 +78,6 @@ import '../TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
|
78
78
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
79
79
|
|
|
80
80
|
const WalletGroupView = () => {
|
|
81
|
-
var _a, _b;
|
|
82
81
|
const { selectedWalletGroup } = useWalletGroupContext();
|
|
83
82
|
const { walletBook } = useWalletBookContext();
|
|
84
83
|
const { handleWalletItemClick } = useWalletItemActions();
|
|
@@ -90,11 +89,7 @@ const WalletGroupView = () => {
|
|
|
90
89
|
.map(({ walletConnector }) => walletConnector)
|
|
91
90
|
.filter(isHardwareWalletConnector)
|
|
92
91
|
.filter((connector) => connector.canConnectWithHardwareWallet());
|
|
93
|
-
|
|
94
|
-
const chainName = hardwareConnectedChain && ((_b = getChainInfo(hardwareConnectedChain)) === null || _b === void 0 ? void 0 : _b.displayName);
|
|
95
|
-
return (jsx(WalletGroupViewLayout, { icon: jsx(WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxs(Fragment, { children: [jsx(HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label', {
|
|
96
|
-
chainName,
|
|
97
|
-
}) }), jsx(Divider, {})] })), jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsx(WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
|
|
92
|
+
return (jsx(WalletGroupViewLayout, { icon: jsx(WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxs(Fragment, { children: [jsx(HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsx(Divider, {})] })), jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsx(WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
|
|
98
93
|
};
|
|
99
94
|
|
|
100
95
|
export { WalletGroupView };
|