@dynamic-labs/sdk-react-core 4.50.5 → 4.51.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 +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +88 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.js +88 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +19 -0
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +20 -1
- package/src/lib/store/stateConfig.cjs +39 -35
- package/src/lib/store/stateConfig.js +39 -35
- package/src/lib/utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs +1 -32
- package/src/lib/utils/hooks/authenticationHooks/helpers/isConnectOnly.js +1 -32
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +38 -15
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +8 -2
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +38 -15
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +10 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +10 -2
- package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.cjs +18 -18
- package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.51.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.50.5...v4.51.0) (2025-12-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **react-native:** add connectOnly option as a client prop ([#10112](https://github.com/dynamic-labs/dynamic-auth/issues/10112)) ([8cdee00](https://github.com/dynamic-labs/dynamic-auth/commit/8cdee00b249252aee74723f66b8875d6e3d70410))
|
|
8
|
+
* **react-native:** add support for metamask ([#10004](https://github.com/dynamic-labs/dynamic-auth/issues/10004)) ([dcdb52c](https://github.com/dynamic-labs/dynamic-auth/commit/dcdb52c4fd70f1b691c2235be3464e3c25f1ea8b))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add useExchangeAccounts export ([#10101](https://github.com/dynamic-labs/dynamic-auth/issues/10101)) ([d9051fa](https://github.com/dynamic-labs/dynamic-auth/commit/d9051fa2769f37989e7a38c5035d6a39a6fc38fd))
|
|
14
|
+
* ensure the flutter SDK will not get wallet version field with V3 ([#10115](https://github.com/dynamic-labs/dynamic-auth/issues/10115)) ([f3b80cc](https://github.com/dynamic-labs/dynamic-auth/commit/f3b80ccf070cc1f615c43e60c0681fe28c92e96e))
|
|
15
|
+
* **react-native:** show captcha screen when enabled during signature prompt ([#10113](https://github.com/dynamic-labs/dynamic-auth/issues/10113)) ([12edd1c](https://github.com/dynamic-labs/dynamic-auth/commit/12edd1ca9c7abe3f249930f27a2e3043a7cd3723))
|
|
16
|
+
* solana swap issue with outdated jup api ([#10119](https://github.com/dynamic-labs/dynamic-auth/issues/10119)) ([172a074](https://github.com/dynamic-labs/dynamic-auth/commit/172a074b607c8e25c3d4141e0caedff943aeec15))
|
|
17
|
+
|
|
2
18
|
### [4.50.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.50.4...v4.50.5) (2025-12-16)
|
|
3
19
|
|
|
4
20
|
|
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.
|
|
3
|
+
"version": "4.51.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.831",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.1.0-alpha.33",
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"react-international-phone": "4.5.0",
|
|
17
17
|
"bs58": "5.0.0",
|
|
18
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
19
|
-
"@dynamic-labs/iconic": "4.
|
|
20
|
-
"@dynamic-labs/locale": "4.
|
|
21
|
-
"@dynamic-labs/logger": "4.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
24
|
-
"@dynamic-labs/store": "4.
|
|
25
|
-
"@dynamic-labs/types": "4.
|
|
26
|
-
"@dynamic-labs/utils": "4.
|
|
27
|
-
"@dynamic-labs/wallet-book": "4.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
18
|
+
"@dynamic-labs/assert-package-version": "4.51.0",
|
|
19
|
+
"@dynamic-labs/iconic": "4.51.0",
|
|
20
|
+
"@dynamic-labs/locale": "4.51.0",
|
|
21
|
+
"@dynamic-labs/logger": "4.51.0",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "4.51.0",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "4.51.0",
|
|
24
|
+
"@dynamic-labs/store": "4.51.0",
|
|
25
|
+
"@dynamic-labs/types": "4.51.0",
|
|
26
|
+
"@dynamic-labs/utils": "4.51.0",
|
|
27
|
+
"@dynamic-labs/wallet-book": "4.51.0",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "4.51.0",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -168,6 +168,7 @@ var useSyncMfaFlow = require('./lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cj
|
|
|
168
168
|
var useTelegramLogin = require('./lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs');
|
|
169
169
|
var useUpgradeEmbeddedWallet = require('./lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs');
|
|
170
170
|
var useDeleteUserAccount = require('./lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.cjs');
|
|
171
|
+
var useExchangeAccounts = require('./lib/utils/hooks/useExchangeAccounts/useExchangeAccounts.cjs');
|
|
171
172
|
var usePayWithDynamic = require('./lib/utils/hooks/usePayWithDynamic/usePayWithDynamic.cjs');
|
|
172
173
|
var useGetPasskeys = require('./lib/utils/hooks/useGetPasskeys/useGetPasskeys.cjs');
|
|
173
174
|
var useDeletePasskey = require('./lib/utils/hooks/useDeletePasskey/useDeletePasskey.cjs');
|
|
@@ -322,6 +323,7 @@ exports.useSyncMfaFlow = useSyncMfaFlow.useSyncMfaFlow;
|
|
|
322
323
|
exports.useTelegramLogin = useTelegramLogin.useTelegramLogin;
|
|
323
324
|
exports.useUpgradeEmbeddedWallet = useUpgradeEmbeddedWallet.useUpgradeEmbeddedWallet;
|
|
324
325
|
exports.useDeleteUserAccount = useDeleteUserAccount.useDeleteUserAccount;
|
|
326
|
+
exports.useExchangeAccounts = useExchangeAccounts.useExchangeAccounts;
|
|
325
327
|
exports.usePayWithDynamic = usePayWithDynamic.usePayWithDynamic;
|
|
326
328
|
exports.useGetPasskeys = useGetPasskeys.useGetPasskeys;
|
|
327
329
|
exports.useDeletePasskey = useDeletePasskey.useDeletePasskey;
|
package/src/index.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ export { FilterAndSortWallets, FilterBridgeChainsName, FilterChain, FilterWallet
|
|
|
123
123
|
export {
|
|
124
124
|
/** @deprecated */
|
|
125
125
|
DynamicWidgetContextProvider, } from './lib/widgets/DynamicWidget/context';
|
|
126
|
-
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useDeletePasskey, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, usePromptMfaAuth, useUpgradeToDynamicWaasFlow, useGetMfaToken, useIsMfaRequiredForAction, useWalletDelegation, } from './lib/utils/hooks';
|
|
126
|
+
export { useWalletItemActions, useAuthenticateConnectedUser, useSocialAccounts, useEmbeddedWallet, useEmbeddedWalletAuthenticator, usePasskeyRecovery, useEmbeddedReveal, useIsLoggedIn, useDynamicModals, useMfa, useTokenBalances, useMultichainTokenBalances, useSwitchWallet, useRpcProviders, useRefreshUser, useWalletOptions, useSmartWallets, EmbeddedWalletVersion, useTelegramLogin, useUpgradeEmbeddedWallet, useEVMTransactionSimulation, useSVMTransactionSimulation, useDeleteUserAccount, useDynamicWaas, useGetPasskeys, useDeletePasskey, useRegisterPasskey, useAuthenticatePasskeyMFA, useGetUserMfaMethods, usePromptMfaAuth, useUpgradeToDynamicWaasFlow, useGetMfaToken, useIsMfaRequiredForAction, useWalletDelegation, useExchangeAccounts, } from './lib/utils/hooks';
|
|
127
127
|
export {
|
|
128
128
|
/** @deprecated use useOnramp instead */
|
|
129
129
|
useFunding, } from './lib/utils/hooks/useFunding';
|
package/src/index.js
CHANGED
|
@@ -164,6 +164,7 @@ export { useSyncMfaFlow } from './lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.
|
|
|
164
164
|
export { useTelegramLogin } from './lib/utils/hooks/useTelegramLogin/useTelegramLogin.js';
|
|
165
165
|
export { useUpgradeEmbeddedWallet } from './lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js';
|
|
166
166
|
export { useDeleteUserAccount } from './lib/utils/hooks/useDeleteUserAccount/useDeleteUserAccount.js';
|
|
167
|
+
export { useExchangeAccounts } from './lib/utils/hooks/useExchangeAccounts/useExchangeAccounts.js';
|
|
167
168
|
export { usePayWithDynamic } from './lib/utils/hooks/usePayWithDynamic/usePayWithDynamic.js';
|
|
168
169
|
export { useGetPasskeys } from './lib/utils/hooks/useGetPasskeys/useGetPasskeys.js';
|
|
169
170
|
export { useDeletePasskey } from './lib/utils/hooks/useDeletePasskey/useDeletePasskey.js';
|
|
@@ -17,16 +17,103 @@ require('../../utils/constants/values.cjs');
|
|
|
17
17
|
require('@dynamic-labs/sdk-api-core');
|
|
18
18
|
var useLocalStorage = require('../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
19
19
|
require('../../shared/consts/index.cjs');
|
|
20
|
+
require('../DynamicContext/DynamicContext.cjs');
|
|
21
|
+
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
22
|
+
require('../../events/dynamicEvents.cjs');
|
|
23
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
24
|
+
require('../ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('@dynamic-labs/multi-wallet');
|
|
26
|
+
require('react-international-phone');
|
|
27
|
+
require('../../store/state/nonce/nonce.cjs');
|
|
28
|
+
require('@dynamic-labs-sdk/client/core');
|
|
29
|
+
require('../../client/client.cjs');
|
|
30
|
+
require('@dynamic-labs-sdk/client');
|
|
31
|
+
require('../../config/ApiEndpoint.cjs');
|
|
32
|
+
require('@dynamic-labs/locale');
|
|
33
|
+
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
34
|
+
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
35
|
+
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
36
|
+
require('../AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
|
+
require('../AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
+
require('../UserWalletsContext/UserWalletsContext.cjs');
|
|
39
|
+
require('../../store/state/authMode/authMode.cjs');
|
|
40
|
+
require('../VerificationContext/VerificationContext.cjs');
|
|
41
|
+
require('react-dom');
|
|
42
|
+
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
43
|
+
require('../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
44
|
+
require('../ThemeContext/ThemeContext.cjs');
|
|
45
|
+
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
46
|
+
require('bs58');
|
|
47
|
+
require('@dynamic-labs/types');
|
|
48
|
+
require('../SocialRedirectContext/SocialRedirectContext.cjs');
|
|
49
|
+
require('../LoadingContext/LoadingContext.cjs');
|
|
50
|
+
require('../WalletContext/WalletContext.cjs');
|
|
51
|
+
require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
52
|
+
require('yup');
|
|
53
|
+
require('../MockContext/MockContext.cjs');
|
|
54
|
+
require('../../views/CollectUserDataView/useFields.cjs');
|
|
55
|
+
require('../FieldsStateContext/FieldsStateContext.cjs');
|
|
56
|
+
require('../UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
|
+
require('@dynamic-labs/rpc-providers');
|
|
58
|
+
require('../../store/state/walletOptions/walletOptions.cjs');
|
|
59
|
+
require('react-i18next');
|
|
60
|
+
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
61
|
+
require('../../components/Alert/Alert.cjs');
|
|
62
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
63
|
+
require('../../components/IconButton/IconButton.cjs');
|
|
64
|
+
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
65
|
+
require('../../components/Input/Input.cjs');
|
|
66
|
+
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
67
|
+
require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
68
|
+
require('../../components/OverlayCard/OverlayCard.cjs');
|
|
69
|
+
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
70
|
+
require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
71
|
+
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
72
|
+
require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
73
|
+
require('../../components/Popper/Popper/Popper.cjs');
|
|
74
|
+
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
75
|
+
require('react-focus-lock');
|
|
76
|
+
require('qrcode');
|
|
77
|
+
require('formik');
|
|
78
|
+
require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
|
+
require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
require('../IpConfigurationContext/IpConfigurationContext.cjs');
|
|
81
|
+
require('../ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
82
|
+
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
83
|
+
require('@hcaptcha/react-hcaptcha');
|
|
84
|
+
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
85
|
+
require('../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
86
|
+
require('../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
87
|
+
require('../ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
88
|
+
require('../FooterAnimationContext/index.cjs');
|
|
89
|
+
require('../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
90
|
+
require('../PasskeyContext/PasskeyContext.cjs');
|
|
91
|
+
require('../OnrampContext/OnrampContext.cjs');
|
|
92
|
+
require('../../store/state/sendBalances.cjs');
|
|
93
|
+
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
94
|
+
require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
95
|
+
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
96
|
+
require('../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
97
|
+
require('../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
98
|
+
require('../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
99
|
+
require('../../../index.cjs');
|
|
100
|
+
require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
101
|
+
require('../../store/state/tokenBalances.cjs');
|
|
102
|
+
require('../../store/state/multichainBalances.cjs');
|
|
103
|
+
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
104
|
+
var useInternalDynamicContext = require('../DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
20
105
|
|
|
21
106
|
const CaptchaContext = React.createContext(undefined);
|
|
22
107
|
const CaptchaContextProvider = ({ children, }) => {
|
|
23
108
|
const { pushView } = ViewContext.useViewContext();
|
|
109
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
24
110
|
const [captchaToken, setCaptchaToken, removeCaptchaToken] = useLocalStorage.useLocalStorage(localStorage.CAPTCHA_TOKEN, undefined);
|
|
25
111
|
const [captchaAuthState, setCaptchaAuthState] = React.useState();
|
|
26
112
|
const engageCaptcha = React.useCallback(({ authMethod, onCaptchaSuccess, }) => {
|
|
27
113
|
setCaptchaAuthState({ authMethod, onCaptchaSuccess });
|
|
28
114
|
pushView('captcha');
|
|
29
|
-
|
|
115
|
+
setShowAuthFlow(true);
|
|
116
|
+
}, [pushView, setCaptchaAuthState, setShowAuthFlow]);
|
|
30
117
|
const getCaptchaToken = React.useCallback(() => {
|
|
31
118
|
const token = captchaToken;
|
|
32
119
|
removeCaptchaToken();
|
|
@@ -13,16 +13,103 @@ import '../../utils/constants/values.js';
|
|
|
13
13
|
import '@dynamic-labs/sdk-api-core';
|
|
14
14
|
import { useLocalStorage } from '../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
15
15
|
import '../../shared/consts/index.js';
|
|
16
|
+
import '../DynamicContext/DynamicContext.js';
|
|
17
|
+
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
18
|
+
import '../../events/dynamicEvents.js';
|
|
19
|
+
import '../../../../_virtual/_tslib.js';
|
|
20
|
+
import '../ErrorContext/ErrorContext.js';
|
|
21
|
+
import '@dynamic-labs/multi-wallet';
|
|
22
|
+
import 'react-international-phone';
|
|
23
|
+
import '../../store/state/nonce/nonce.js';
|
|
24
|
+
import '@dynamic-labs-sdk/client/core';
|
|
25
|
+
import '../../client/client.js';
|
|
26
|
+
import '@dynamic-labs-sdk/client';
|
|
27
|
+
import '../../config/ApiEndpoint.js';
|
|
28
|
+
import '@dynamic-labs/locale';
|
|
29
|
+
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
30
|
+
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
31
|
+
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
32
|
+
import '../AccessDeniedContext/AccessDeniedContext.js';
|
|
33
|
+
import '../AccountExistsContext/AccountExistsContext.js';
|
|
34
|
+
import '../UserWalletsContext/UserWalletsContext.js';
|
|
35
|
+
import '../../store/state/authMode/authMode.js';
|
|
36
|
+
import '../VerificationContext/VerificationContext.js';
|
|
37
|
+
import 'react-dom';
|
|
38
|
+
import '../../utils/functions/compareChains/compareChains.js';
|
|
39
|
+
import '../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
40
|
+
import '../ThemeContext/ThemeContext.js';
|
|
41
|
+
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
42
|
+
import 'bs58';
|
|
43
|
+
import '@dynamic-labs/types';
|
|
44
|
+
import '../SocialRedirectContext/SocialRedirectContext.js';
|
|
45
|
+
import '../LoadingContext/LoadingContext.js';
|
|
46
|
+
import '../WalletContext/WalletContext.js';
|
|
47
|
+
import '../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
48
|
+
import 'yup';
|
|
49
|
+
import '../MockContext/MockContext.js';
|
|
50
|
+
import '../../views/CollectUserDataView/useFields.js';
|
|
51
|
+
import '../FieldsStateContext/FieldsStateContext.js';
|
|
52
|
+
import '../UserFieldEditorContext/UserFieldEditorContext.js';
|
|
53
|
+
import '@dynamic-labs/rpc-providers';
|
|
54
|
+
import '../../store/state/walletOptions/walletOptions.js';
|
|
55
|
+
import 'react-i18next';
|
|
56
|
+
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
57
|
+
import '../../components/Alert/Alert.js';
|
|
58
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
59
|
+
import '../../components/IconButton/IconButton.js';
|
|
60
|
+
import '../../components/InlineWidget/InlineWidget.js';
|
|
61
|
+
import '../../components/Input/Input.js';
|
|
62
|
+
import '../../components/IsBrowser/IsBrowser.js';
|
|
63
|
+
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
64
|
+
import '../../components/OverlayCard/OverlayCard.js';
|
|
65
|
+
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
66
|
+
import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
67
|
+
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
68
|
+
import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
69
|
+
import '../../components/Popper/Popper/Popper.js';
|
|
70
|
+
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
71
|
+
import 'react-focus-lock';
|
|
72
|
+
import 'qrcode';
|
|
73
|
+
import 'formik';
|
|
74
|
+
import '../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
75
|
+
import '../WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import '../IpConfigurationContext/IpConfigurationContext.js';
|
|
77
|
+
import '../ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
78
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
79
|
+
import '@hcaptcha/react-hcaptcha';
|
|
80
|
+
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
81
|
+
import '../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
82
|
+
import '../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
83
|
+
import '../ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
84
|
+
import '../FooterAnimationContext/index.js';
|
|
85
|
+
import '../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
86
|
+
import '../PasskeyContext/PasskeyContext.js';
|
|
87
|
+
import '../OnrampContext/OnrampContext.js';
|
|
88
|
+
import '../../store/state/sendBalances.js';
|
|
89
|
+
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
90
|
+
import '../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
91
|
+
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
92
|
+
import '../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
93
|
+
import '../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
94
|
+
import '../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
95
|
+
import '../../../index.js';
|
|
96
|
+
import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
97
|
+
import '../../store/state/tokenBalances.js';
|
|
98
|
+
import '../../store/state/multichainBalances.js';
|
|
99
|
+
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
100
|
+
import { useInternalDynamicContext } from '../DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
16
101
|
|
|
17
102
|
const CaptchaContext = createContext(undefined);
|
|
18
103
|
const CaptchaContextProvider = ({ children, }) => {
|
|
19
104
|
const { pushView } = useViewContext();
|
|
105
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
20
106
|
const [captchaToken, setCaptchaToken, removeCaptchaToken] = useLocalStorage(CAPTCHA_TOKEN, undefined);
|
|
21
107
|
const [captchaAuthState, setCaptchaAuthState] = useState();
|
|
22
108
|
const engageCaptcha = useCallback(({ authMethod, onCaptchaSuccess, }) => {
|
|
23
109
|
setCaptchaAuthState({ authMethod, onCaptchaSuccess });
|
|
24
110
|
pushView('captcha');
|
|
25
|
-
|
|
111
|
+
setShowAuthFlow(true);
|
|
112
|
+
}, [pushView, setCaptchaAuthState, setShowAuthFlow]);
|
|
26
113
|
const getCaptchaToken = useCallback(() => {
|
|
27
114
|
const token = captchaToken;
|
|
28
115
|
removeCaptchaToken();
|
|
@@ -37,6 +37,7 @@ require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
|
37
37
|
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
38
38
|
require('../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
39
39
|
var useVerifyWallet = require('../../utils/hooks/useVerifyWallet/useVerifyWallet.cjs');
|
|
40
|
+
var isConnectOnly = require('../../utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs');
|
|
40
41
|
require('../VerificationContext/VerificationContext.cjs');
|
|
41
42
|
require('react-dom');
|
|
42
43
|
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
@@ -169,6 +170,24 @@ const useResponseHandlers = () => {
|
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
// Default behavior is to link a wallet
|
|
173
|
+
// In connect-only mode, skip verification and just handle the wallet connection
|
|
174
|
+
if (isConnectOnly.isConnectOnly()) {
|
|
175
|
+
logger.logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-only mode: skipping verification', {
|
|
176
|
+
authMode: 'connect-only',
|
|
177
|
+
connectResult,
|
|
178
|
+
});
|
|
179
|
+
if (connectResult === null || connectResult === void 0 ? void 0 : connectResult.address) {
|
|
180
|
+
// connectWallet already added the wallet to the store in connect-only mode
|
|
181
|
+
// Just set the last used wallet and close the auth flow
|
|
182
|
+
utils.StorageService.setItem(localStorage.LAST_USED_WALLET, phantomRedirectConnector.key);
|
|
183
|
+
setShowAuthFlow(false);
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
logger.logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-and-sign mode: proceeding to verification', {
|
|
188
|
+
authMode: 'connect-and-sign',
|
|
189
|
+
connectResult,
|
|
190
|
+
});
|
|
172
191
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
|
|
173
192
|
pushView('pending-signature');
|
|
174
193
|
setSelectedWalletConnectorKey('phantom');
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { StorageService, PHANTOM_REDIRECT_CONNECTION_TYPE_KEY } from '@dynamic-labs/utils';
|
|
5
5
|
import { isPhantomRedirectConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { PHANTOM_SIGNATURE_STATE } from '../../utils/constants/localStorage.js';
|
|
6
|
+
import { LAST_USED_WALLET, PHANTOM_SIGNATURE_STATE } from '../../utils/constants/localStorage.js';
|
|
7
7
|
import { getSiweStatement } from '../../utils/functions/getSiweStatement/getSiweStatement.js';
|
|
8
8
|
import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
9
9
|
import '../DynamicContext/DynamicContext.js';
|
|
@@ -33,6 +33,7 @@ import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
|
33
33
|
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
34
34
|
import '../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
35
35
|
import { useVerifyWallet } from '../../utils/hooks/useVerifyWallet/useVerifyWallet.js';
|
|
36
|
+
import { isConnectOnly } from '../../utils/hooks/authenticationHooks/helpers/isConnectOnly.js';
|
|
36
37
|
import '../VerificationContext/VerificationContext.js';
|
|
37
38
|
import 'react-dom';
|
|
38
39
|
import '../../utils/functions/compareChains/compareChains.js';
|
|
@@ -165,6 +166,24 @@ const useResponseHandlers = () => {
|
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
168
|
// Default behavior is to link a wallet
|
|
169
|
+
// In connect-only mode, skip verification and just handle the wallet connection
|
|
170
|
+
if (isConnectOnly()) {
|
|
171
|
+
logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-only mode: skipping verification', {
|
|
172
|
+
authMode: 'connect-only',
|
|
173
|
+
connectResult,
|
|
174
|
+
});
|
|
175
|
+
if (connectResult === null || connectResult === void 0 ? void 0 : connectResult.address) {
|
|
176
|
+
// connectWallet already added the wallet to the store in connect-only mode
|
|
177
|
+
// Just set the last used wallet and close the auth flow
|
|
178
|
+
StorageService.setItem(LAST_USED_WALLET, phantomRedirectConnector.key);
|
|
179
|
+
setShowAuthFlow(false);
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
logger.logVerboseTroubleshootingMessage('[PhantomRedirect handleConnectResponse] Connect-and-sign mode: proceeding to verification', {
|
|
184
|
+
authMode: 'connect-and-sign',
|
|
185
|
+
connectResult,
|
|
186
|
+
});
|
|
168
187
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: true });
|
|
169
188
|
pushView('pending-signature');
|
|
170
189
|
setSelectedWalletConnectorKey('phantom');
|
|
@@ -6,41 +6,45 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns the initial state for the SdkStore
|
|
8
8
|
*/
|
|
9
|
-
const createInitialState = (dynamicContextProps) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
9
|
+
const createInitialState = (dynamicContextProps) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const initialAuthMode = (_b = (_a = dynamicContextProps.settings) === null || _a === void 0 ? void 0 : _a.initialAuthenticationMode) !== null && _b !== void 0 ? _b : 'connect-and-sign';
|
|
12
|
+
return {
|
|
13
|
+
authMode: initialAuthMode,
|
|
14
|
+
connectedWalletsInfo: [],
|
|
15
|
+
connectorsInitializing: {},
|
|
16
|
+
dynamicContextProps,
|
|
17
|
+
loadingAndLifecycle: {
|
|
18
|
+
initialWalletVerificationInProgress: false,
|
|
19
|
+
sessionValidation: false,
|
|
20
|
+
},
|
|
21
|
+
multichainTokenBalancesState: {
|
|
22
|
+
error: undefined,
|
|
23
|
+
isError: false,
|
|
24
|
+
isLoading: false,
|
|
25
|
+
multichainTokenBalances: undefined,
|
|
26
|
+
requestsKey: undefined,
|
|
27
|
+
},
|
|
28
|
+
nonce: { expiresAt: undefined, nonce: undefined },
|
|
29
|
+
primaryWalletId: undefined,
|
|
30
|
+
sendBalanceState: {
|
|
31
|
+
amount: undefined,
|
|
32
|
+
chainName: undefined,
|
|
33
|
+
nativePrice: undefined,
|
|
34
|
+
},
|
|
35
|
+
tokenBalancesState: {
|
|
36
|
+
error: undefined,
|
|
37
|
+
isError: false,
|
|
38
|
+
isLoading: false,
|
|
39
|
+
tokenBalances: undefined,
|
|
40
|
+
},
|
|
41
|
+
user: undefined,
|
|
42
|
+
walletOptions: {
|
|
43
|
+
groups: {},
|
|
44
|
+
walletConnectorOptions: [],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
};
|
|
44
48
|
/**
|
|
45
49
|
* Filters out which variables should be stored to local storage.
|
|
46
50
|
* Also allows transforming them before storage.
|
|
@@ -2,41 +2,45 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the initial state for the SdkStore
|
|
4
4
|
*/
|
|
5
|
-
const createInitialState = (dynamicContextProps) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
5
|
+
const createInitialState = (dynamicContextProps) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const initialAuthMode = (_b = (_a = dynamicContextProps.settings) === null || _a === void 0 ? void 0 : _a.initialAuthenticationMode) !== null && _b !== void 0 ? _b : 'connect-and-sign';
|
|
8
|
+
return {
|
|
9
|
+
authMode: initialAuthMode,
|
|
10
|
+
connectedWalletsInfo: [],
|
|
11
|
+
connectorsInitializing: {},
|
|
12
|
+
dynamicContextProps,
|
|
13
|
+
loadingAndLifecycle: {
|
|
14
|
+
initialWalletVerificationInProgress: false,
|
|
15
|
+
sessionValidation: false,
|
|
16
|
+
},
|
|
17
|
+
multichainTokenBalancesState: {
|
|
18
|
+
error: undefined,
|
|
19
|
+
isError: false,
|
|
20
|
+
isLoading: false,
|
|
21
|
+
multichainTokenBalances: undefined,
|
|
22
|
+
requestsKey: undefined,
|
|
23
|
+
},
|
|
24
|
+
nonce: { expiresAt: undefined, nonce: undefined },
|
|
25
|
+
primaryWalletId: undefined,
|
|
26
|
+
sendBalanceState: {
|
|
27
|
+
amount: undefined,
|
|
28
|
+
chainName: undefined,
|
|
29
|
+
nativePrice: undefined,
|
|
30
|
+
},
|
|
31
|
+
tokenBalancesState: {
|
|
32
|
+
error: undefined,
|
|
33
|
+
isError: false,
|
|
34
|
+
isLoading: false,
|
|
35
|
+
tokenBalances: undefined,
|
|
36
|
+
},
|
|
37
|
+
user: undefined,
|
|
38
|
+
walletOptions: {
|
|
39
|
+
groups: {},
|
|
40
|
+
walletConnectorOptions: [],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
40
44
|
/**
|
|
41
45
|
* Filters out which variables should be stored to local storage.
|
|
42
46
|
* Also allows transforming them before storage.
|
|
@@ -3,42 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
require('@dynamic-labs-sdk/client/core');
|
|
7
|
-
require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
require('../../../../client/client.cjs');
|
|
9
|
-
require('react');
|
|
10
|
-
require('@dynamic-labs-sdk/client');
|
|
11
|
-
require('../../../../config/ApiEndpoint.cjs');
|
|
12
|
-
require('@dynamic-labs/iconic');
|
|
13
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
-
require('react/jsx-runtime');
|
|
15
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
-
require('../../../../shared/logger.cjs');
|
|
17
|
-
require('@dynamic-labs/wallet-book');
|
|
18
|
-
require('@dynamic-labs/utils');
|
|
19
|
-
require('../../../constants/colors.cjs');
|
|
20
|
-
require('../../../constants/values.cjs');
|
|
21
|
-
require('../../../../shared/consts/index.cjs');
|
|
22
|
-
require('../../../../../../_virtual/_tslib.cjs');
|
|
23
|
-
require('@dynamic-labs/multi-wallet');
|
|
24
|
-
require('react-international-phone');
|
|
25
|
-
require('../../../../store/state/nonce/nonce.cjs');
|
|
26
|
-
require('@dynamic-labs/locale');
|
|
27
|
-
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
28
|
-
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
29
|
-
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
|
-
require('../../../../events/dynamicEvents.cjs');
|
|
31
|
-
var getUserProfile = require('../../../../client/extension/user/getUserProfile/getUserProfile.cjs');
|
|
32
6
|
var authMode = require('../../../../store/state/authMode/authMode.cjs');
|
|
33
7
|
|
|
34
8
|
const isConnectOnly = () => {
|
|
35
9
|
const authMode$1 = authMode.getAuthMode();
|
|
36
|
-
|
|
37
|
-
// we need to check for user because of connect-only (authenticated)
|
|
38
|
-
// and linking a new wallet in mutliwallet
|
|
39
|
-
const linking = user !== undefined;
|
|
40
|
-
const connectOnly = authMode$1 === 'connect-only' && !linking;
|
|
41
|
-
return connectOnly;
|
|
10
|
+
return authMode$1 === 'connect-only';
|
|
42
11
|
};
|
|
43
12
|
|
|
44
13
|
exports.isConnectOnly = isConnectOnly;
|
|
@@ -1,40 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import '@dynamic-labs-sdk/client/core';
|
|
3
|
-
import '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import '../../../../client/client.js';
|
|
5
|
-
import 'react';
|
|
6
|
-
import '@dynamic-labs-sdk/client';
|
|
7
|
-
import '../../../../config/ApiEndpoint.js';
|
|
8
|
-
import '@dynamic-labs/iconic';
|
|
9
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
-
import 'react/jsx-runtime';
|
|
11
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
-
import '../../../../shared/logger.js';
|
|
13
|
-
import '@dynamic-labs/wallet-book';
|
|
14
|
-
import '@dynamic-labs/utils';
|
|
15
|
-
import '../../../constants/colors.js';
|
|
16
|
-
import '../../../constants/values.js';
|
|
17
|
-
import '../../../../shared/consts/index.js';
|
|
18
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
19
|
-
import '@dynamic-labs/multi-wallet';
|
|
20
|
-
import 'react-international-phone';
|
|
21
|
-
import '../../../../store/state/nonce/nonce.js';
|
|
22
|
-
import '@dynamic-labs/locale';
|
|
23
|
-
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
24
|
-
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
25
|
-
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
|
-
import '../../../../events/dynamicEvents.js';
|
|
27
|
-
import { getUserProfile } from '../../../../client/extension/user/getUserProfile/getUserProfile.js';
|
|
28
2
|
import { getAuthMode } from '../../../../store/state/authMode/authMode.js';
|
|
29
3
|
|
|
30
4
|
const isConnectOnly = () => {
|
|
31
5
|
const authMode = getAuthMode();
|
|
32
|
-
|
|
33
|
-
// we need to check for user because of connect-only (authenticated)
|
|
34
|
-
// and linking a new wallet in mutliwallet
|
|
35
|
-
const linking = user !== undefined;
|
|
36
|
-
const connectOnly = authMode === 'connect-only' && !linking;
|
|
37
|
-
return connectOnly;
|
|
6
|
+
return authMode === 'connect-only';
|
|
38
7
|
};
|
|
39
8
|
|
|
40
9
|
export { isConnectOnly };
|
|
@@ -115,7 +115,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
115
115
|
const { pushView, clearStackAndPushInitialView, replaceView } = ViewContext.useViewContext();
|
|
116
116
|
const { engageCaptcha, getCaptchaToken } = CaptchaContext.useCaptchaContext();
|
|
117
117
|
const { setErrorMessage, setError, setDefaultError } = ErrorContext.useErrorContext();
|
|
118
|
-
const { connectWallet, displaySiweStatement, environmentId, projectSettings, networkValidationMode, setIsSingleWalletAccount, walletUiUtils, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
118
|
+
const { connectWallet, displaySiweStatement, environmentId, projectSettings, networkValidationMode, setIsSingleWalletAccount, setShowAuthFlow, walletUiUtils, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
119
119
|
const { handleWalletsToConnect } = useHandleWalletsToConnect.useHandleWalletsToConnect();
|
|
120
120
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
121
121
|
displaySiweStatement,
|
|
@@ -127,6 +127,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
127
127
|
if (!walletConnectorCore.isEmailWalletConnector(walletConnector) ||
|
|
128
128
|
walletConnectorCore.isBloctoConnector(walletConnector)) {
|
|
129
129
|
replaceView('pending-signature');
|
|
130
|
+
setShowAuthFlow(true);
|
|
130
131
|
}
|
|
131
132
|
else {
|
|
132
133
|
walletUiUtils.disabledConfirmationOnce();
|
|
@@ -111,7 +111,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
111
111
|
const { pushView, clearStackAndPushInitialView, replaceView } = useViewContext();
|
|
112
112
|
const { engageCaptcha, getCaptchaToken } = useCaptchaContext();
|
|
113
113
|
const { setErrorMessage, setError, setDefaultError } = useErrorContext();
|
|
114
|
-
const { connectWallet, displaySiweStatement, environmentId, projectSettings, networkValidationMode, setIsSingleWalletAccount, walletUiUtils, } = useInternalDynamicContext();
|
|
114
|
+
const { connectWallet, displaySiweStatement, environmentId, projectSettings, networkValidationMode, setIsSingleWalletAccount, setShowAuthFlow, walletUiUtils, } = useInternalDynamicContext();
|
|
115
115
|
const { handleWalletsToConnect } = useHandleWalletsToConnect();
|
|
116
116
|
const verifyWallet = useVerifyWallet({
|
|
117
117
|
displaySiweStatement,
|
|
@@ -123,6 +123,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
123
123
|
if (!isEmailWalletConnector(walletConnector) ||
|
|
124
124
|
isBloctoConnector(walletConnector)) {
|
|
125
125
|
replaceView('pending-signature');
|
|
126
|
+
setShowAuthFlow(true);
|
|
126
127
|
}
|
|
127
128
|
else {
|
|
128
129
|
walletUiUtils.disabledConfirmationOnce();
|
|
@@ -115,11 +115,12 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
115
115
|
* Otherwise, returns all pending wallets from getWalletsDelegatedStatus.
|
|
116
116
|
*/
|
|
117
117
|
const getWalletsToDelegate = (wallets, getWalletsDelegatedStatus) => {
|
|
118
|
+
const walletsWithDelegationStatus = getWalletsDelegatedStatus().filter((wallet) => wallet.status === 'pending');
|
|
118
119
|
if (wallets && wallets.length > 0) {
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
return walletsWithDelegationStatus.filter((wallet) => wallets.some((w) => w.accountAddress === wallet.address &&
|
|
121
|
+
w.chainName === wallet.chain));
|
|
121
122
|
}
|
|
122
|
-
return
|
|
123
|
+
return walletsWithDelegationStatus;
|
|
123
124
|
};
|
|
124
125
|
// Hook to trigger wallet delegation modal
|
|
125
126
|
const useWalletDelegation = () => {
|
|
@@ -222,23 +223,45 @@ const useWalletDelegation = () => {
|
|
|
222
223
|
.filter((wallet) => wallet !== null);
|
|
223
224
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials, userWallets]);
|
|
224
225
|
const delegateKeyShares = React.useCallback((wallets) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
if (!delegatedAccessEnabled) {
|
|
227
|
+
throw new Error('Wallet delegation is not enabled for this project environment. Please check the project settings.');
|
|
228
|
+
}
|
|
229
|
+
// If wallets provided, only eligible wallets are returned; otherwise get pending wallets
|
|
230
|
+
const walletsToDelegate = getWalletsToDelegate(wallets, getWalletsDelegatedStatus).map((wallet) => ({
|
|
231
|
+
accountAddress: wallet.address,
|
|
232
|
+
chainName: wallet.chain,
|
|
233
|
+
}));
|
|
234
|
+
if (walletsToDelegate.length === 0) {
|
|
235
|
+
throw new Error('No eligible wallets to delegate, only Dynamic WaaS wallets are eligible for delegation');
|
|
236
|
+
}
|
|
232
237
|
for (const wallet of walletsToDelegate) {
|
|
233
238
|
const walletConnector = getWaasWalletConnector(wallet.chainName);
|
|
234
|
-
if (!walletConnector)
|
|
239
|
+
if (!walletConnector) {
|
|
240
|
+
logger.logger.warn('Wallet connector not found, skipping delegate', {
|
|
241
|
+
accountAddress: wallet.accountAddress,
|
|
242
|
+
chainName: wallet.chainName,
|
|
243
|
+
});
|
|
235
244
|
continue;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
yield walletConnector.delegateKeyShares({
|
|
248
|
+
accountAddress: wallet.accountAddress,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
logger.logger.error('Failed to delegate key shares:', {
|
|
253
|
+
error,
|
|
254
|
+
wallet,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
239
257
|
}
|
|
240
258
|
yield refresh();
|
|
241
|
-
}), [
|
|
259
|
+
}), [
|
|
260
|
+
getWaasWalletConnector,
|
|
261
|
+
refresh,
|
|
262
|
+
getWalletsDelegatedStatus,
|
|
263
|
+
delegatedAccessEnabled,
|
|
264
|
+
]);
|
|
242
265
|
const revokeDelegation = React.useCallback((wallets) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
243
266
|
// Get current wallet statuses to check which ones are actually delegated
|
|
244
267
|
const walletsWithStatus = getWalletsDelegatedStatus();
|
|
@@ -10,7 +10,10 @@ export type WalletWithStatus = Wallet & {
|
|
|
10
10
|
* If wallets are provided and not empty, converts them to WalletWithStatus[] with pending status.
|
|
11
11
|
* Otherwise, returns all pending wallets from getWalletsDelegatedStatus.
|
|
12
12
|
*/
|
|
13
|
-
export declare const getWalletsToDelegate: (wallets:
|
|
13
|
+
export declare const getWalletsToDelegate: (wallets: {
|
|
14
|
+
chainName: ChainEnum;
|
|
15
|
+
accountAddress: string;
|
|
16
|
+
}[] | undefined, getWalletsDelegatedStatus: () => WalletWithStatus[]) => WalletWithStatus[];
|
|
14
17
|
export declare const useWalletDelegation: () => {
|
|
15
18
|
readonly clearDelegationSessionState: () => void;
|
|
16
19
|
readonly delegateKeyShares: (wallets?: {
|
|
@@ -21,7 +24,10 @@ export declare const useWalletDelegation: () => {
|
|
|
21
24
|
readonly denyWalletDelegation: (walletId: string) => Promise<void>;
|
|
22
25
|
readonly dismissDelegationPrompt: (walletId?: string) => void;
|
|
23
26
|
readonly getWalletsDelegatedStatus: () => WalletWithStatus[];
|
|
24
|
-
readonly getWalletsToDelegate: (wallets:
|
|
27
|
+
readonly getWalletsToDelegate: (wallets: {
|
|
28
|
+
chainName: ChainEnum;
|
|
29
|
+
accountAddress: string;
|
|
30
|
+
}[] | undefined, getWalletsDelegatedStatus: () => WalletWithStatus[]) => WalletWithStatus[];
|
|
25
31
|
readonly initDelegationProcess: (options?: {
|
|
26
32
|
wallets?: Wallet[];
|
|
27
33
|
}) => Promise<void>;
|
|
@@ -111,11 +111,12 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
111
111
|
* Otherwise, returns all pending wallets from getWalletsDelegatedStatus.
|
|
112
112
|
*/
|
|
113
113
|
const getWalletsToDelegate = (wallets, getWalletsDelegatedStatus) => {
|
|
114
|
+
const walletsWithDelegationStatus = getWalletsDelegatedStatus().filter((wallet) => wallet.status === 'pending');
|
|
114
115
|
if (wallets && wallets.length > 0) {
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
return walletsWithDelegationStatus.filter((wallet) => wallets.some((w) => w.accountAddress === wallet.address &&
|
|
117
|
+
w.chainName === wallet.chain));
|
|
117
118
|
}
|
|
118
|
-
return
|
|
119
|
+
return walletsWithDelegationStatus;
|
|
119
120
|
};
|
|
120
121
|
// Hook to trigger wallet delegation modal
|
|
121
122
|
const useWalletDelegation = () => {
|
|
@@ -218,23 +219,45 @@ const useWalletDelegation = () => {
|
|
|
218
219
|
.filter((wallet) => wallet !== null);
|
|
219
220
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials, userWallets]);
|
|
220
221
|
const delegateKeyShares = useCallback((wallets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
if (!delegatedAccessEnabled) {
|
|
223
|
+
throw new Error('Wallet delegation is not enabled for this project environment. Please check the project settings.');
|
|
224
|
+
}
|
|
225
|
+
// If wallets provided, only eligible wallets are returned; otherwise get pending wallets
|
|
226
|
+
const walletsToDelegate = getWalletsToDelegate(wallets, getWalletsDelegatedStatus).map((wallet) => ({
|
|
227
|
+
accountAddress: wallet.address,
|
|
228
|
+
chainName: wallet.chain,
|
|
229
|
+
}));
|
|
230
|
+
if (walletsToDelegate.length === 0) {
|
|
231
|
+
throw new Error('No eligible wallets to delegate, only Dynamic WaaS wallets are eligible for delegation');
|
|
232
|
+
}
|
|
228
233
|
for (const wallet of walletsToDelegate) {
|
|
229
234
|
const walletConnector = getWaasWalletConnector(wallet.chainName);
|
|
230
|
-
if (!walletConnector)
|
|
235
|
+
if (!walletConnector) {
|
|
236
|
+
logger.warn('Wallet connector not found, skipping delegate', {
|
|
237
|
+
accountAddress: wallet.accountAddress,
|
|
238
|
+
chainName: wallet.chainName,
|
|
239
|
+
});
|
|
231
240
|
continue;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
yield walletConnector.delegateKeyShares({
|
|
244
|
+
accountAddress: wallet.accountAddress,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
logger.error('Failed to delegate key shares:', {
|
|
249
|
+
error,
|
|
250
|
+
wallet,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
235
253
|
}
|
|
236
254
|
yield refresh();
|
|
237
|
-
}), [
|
|
255
|
+
}), [
|
|
256
|
+
getWaasWalletConnector,
|
|
257
|
+
refresh,
|
|
258
|
+
getWalletsDelegatedStatus,
|
|
259
|
+
delegatedAccessEnabled,
|
|
260
|
+
]);
|
|
238
261
|
const revokeDelegation = useCallback((wallets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
239
262
|
// Get current wallet statuses to check which ones are actually delegated
|
|
240
263
|
const walletsWithStatus = getWalletsDelegatedStatus();
|
|
@@ -48,7 +48,15 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
48
48
|
const [agreementChecked, setAgreementChecked] = React.useState(false);
|
|
49
49
|
const [selectionInitialized, setSelectionInitialized] = React.useState(false);
|
|
50
50
|
// Get waas wallets that are not yet delegated or use provided wallets override
|
|
51
|
-
const waasWallets = React.useMemo(() =>
|
|
51
|
+
const waasWallets = React.useMemo(() => {
|
|
52
|
+
const walletsToDelegate = wallets
|
|
53
|
+
? wallets.map((wallet) => ({
|
|
54
|
+
accountAddress: wallet.address,
|
|
55
|
+
chainName: wallet.chain,
|
|
56
|
+
}))
|
|
57
|
+
: undefined;
|
|
58
|
+
return getWalletsToDelegate(walletsToDelegate, getWalletsDelegatedStatus);
|
|
59
|
+
}, [wallets, getWalletsDelegatedStatus, getWalletsToDelegate]);
|
|
52
60
|
// Auto-select wallets only on initial load
|
|
53
61
|
React.useEffect(() => {
|
|
54
62
|
if (selectionInitialized)
|
|
@@ -175,7 +183,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
175
183
|
// Single wallet view
|
|
176
184
|
const displaySingleWallet = () => {
|
|
177
185
|
const [wallet] = waasWallets;
|
|
178
|
-
if (!wallet)
|
|
186
|
+
if (!wallet || !wallet.address)
|
|
179
187
|
return null;
|
|
180
188
|
return (jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-card-container', children: [jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-card', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', children: t('dyn_wallet_delegation.my_wallet') }), jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-address', children: [jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-address-dot' }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', children: [wallet.address.slice(0, 6), "...", wallet.address.slice(-4)] })] })] }), jsxRuntime.jsx(AgreementSection.AgreementSection, { checked: agreementChecked, onToggle: () => setAgreementChecked(!agreementChecked), text: t('dyn_wallet_delegation.agreement_text') })] }));
|
|
181
189
|
};
|
|
@@ -44,7 +44,15 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
44
44
|
const [agreementChecked, setAgreementChecked] = useState(false);
|
|
45
45
|
const [selectionInitialized, setSelectionInitialized] = useState(false);
|
|
46
46
|
// Get waas wallets that are not yet delegated or use provided wallets override
|
|
47
|
-
const waasWallets = useMemo(() =>
|
|
47
|
+
const waasWallets = useMemo(() => {
|
|
48
|
+
const walletsToDelegate = wallets
|
|
49
|
+
? wallets.map((wallet) => ({
|
|
50
|
+
accountAddress: wallet.address,
|
|
51
|
+
chainName: wallet.chain,
|
|
52
|
+
}))
|
|
53
|
+
: undefined;
|
|
54
|
+
return getWalletsToDelegate(walletsToDelegate, getWalletsDelegatedStatus);
|
|
55
|
+
}, [wallets, getWalletsDelegatedStatus, getWalletsToDelegate]);
|
|
48
56
|
// Auto-select wallets only on initial load
|
|
49
57
|
useEffect(() => {
|
|
50
58
|
if (selectionInitialized)
|
|
@@ -171,7 +179,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
171
179
|
// Single wallet view
|
|
172
180
|
const displaySingleWallet = () => {
|
|
173
181
|
const [wallet] = waasWallets;
|
|
174
|
-
if (!wallet)
|
|
182
|
+
if (!wallet || !wallet.address)
|
|
175
183
|
return null;
|
|
176
184
|
return (jsxs("div", { className: 'embedded-delegated-view__wallet-card-container', children: [jsxs("div", { className: 'embedded-delegated-view__wallet-card', children: [jsx(Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', children: t('dyn_wallet_delegation.my_wallet') }), jsxs("div", { className: 'embedded-delegated-view__wallet-address', children: [jsx("div", { className: 'embedded-delegated-view__wallet-address-dot' }), jsxs(Typography, { variant: 'body_small', color: 'secondary', children: [wallet.address.slice(0, 6), "...", wallet.address.slice(-4)] })] })] }), jsx(AgreementSection, { checked: agreementChecked, onToggle: () => setAgreementChecked(!agreementChecked), text: t('dyn_wallet_delegation.agreement_text') })] }));
|
|
177
185
|
};
|
|
@@ -173,27 +173,27 @@ const WalletsDelegatedSettingsView = ({ name }) => {
|
|
|
173
173
|
const handleDelegate = createHandleDelegate(delegateKeyShares);
|
|
174
174
|
const handleWalletStatusChange = createHandleWalletStatusChange(handleRevoke, handleDelegate);
|
|
175
175
|
const handleRevokeAll = createHandleRevokeAll(handleRevoke, walletsWithStatus);
|
|
176
|
-
return (jsxRuntime.jsxs("div", { className: 'wallets-delegated-settings-view', children: [jsxRuntime.jsxs("div", { className: 'header', children: [jsxRuntime.jsx(IconButton.IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'title', copykey: 'wallets_delegated.title', children: t('wallets_delegated.title') })] }), walletsWithStatus.length > 0 && (jsxRuntime.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
176
|
+
return (jsxRuntime.jsxs("div", { className: 'wallets-delegated-settings-view', "data-testid": 'wallets-delegated-settings-view', children: [' ', jsxRuntime.jsxs("div", { className: 'header', "data-testid": 'delegated-header', children: [jsxRuntime.jsx(IconButton.IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'title', copykey: 'wallets_delegated.title', "data-testid": 'delegated-title', children: t('wallets_delegated.title') })] }), walletsWithStatus.length > 0 && (jsxRuntime.jsxs("ul", { className: 'delegated-wallets-list', "data-testid": 'delegated-wallets-list', children: [' ', walletsWithStatus.map((wallet, index) => {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
return (jsxRuntime.jsxs("li", { className: 'delegated-wallets-item', "data-testid": `delegated-wallet-item-${index}`, children: [' ', jsxRuntime.jsx("div", { className: 'wallet-icon', children: jsxRuntime.jsx(WalletIconWithNetwork.WalletIconWithNetwork, { walletKey: wallet.key, Icon: null, iconUrl: (_b = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.icon, chainName: wallet.chain, iconSize: 24, showNetwork: true }) }), jsxRuntime.jsxs("div", { className: 'wallet-info', "data-testid": `wallet-info-${index}`, children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', children: shortenWalletAddress.shortenWalletAddress(wallet.address) }), jsxRuntime.jsx("div", { className: wallet.status === 'delegated'
|
|
179
|
+
? 'status-badge'
|
|
180
|
+
: 'status-badge status-badge--disconnected', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: wallet.status === 'delegated' ? 'primary' : 'secondary', children: wallet.status === 'delegated'
|
|
181
|
+
? t('connected', 'Connected')
|
|
182
|
+
: t('disconnected', 'Disconnected') }) })] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
183
|
+
yield handleWalletStatusChange(wallet);
|
|
184
|
+
}), buttonPadding: 'small', className: 'revoke-button', typographyProps: {
|
|
185
|
+
color: 'primary',
|
|
186
|
+
variant: 'body_small',
|
|
187
|
+
weight: 'medium',
|
|
188
|
+
}, children: wallet.status === 'delegated'
|
|
189
|
+
? t('revoke', 'Revoke')
|
|
190
|
+
: t('delegate', 'Delegate') })] }, wallet.id));
|
|
191
|
+
})] })), walletsWithStatus.filter((w) => w.status === 'delegated').length > 0 && (jsxRuntime.jsx("div", { className: 'revoke-all-section', "data-testid": 'revoke-all-section', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
192
192
|
yield handleRevokeAll();
|
|
193
|
-
}), buttonVariant: 'tertiary', buttonPadding: 'none', className: 'revoke-all-button', typographyProps: {
|
|
193
|
+
}), buttonVariant: 'tertiary', buttonPadding: 'none', className: 'revoke-all-button', "data-testid": 'revoke-all-button', typographyProps: {
|
|
194
194
|
variant: 'body_normal',
|
|
195
195
|
weight: 'medium',
|
|
196
|
-
}, children: t('revoke_all_wallet_access', 'Revoke all wallet access') }) })), showSuccessMessage && (jsxRuntime.jsxs("div", { className: 'success-message', children: [jsxRuntime.jsx(check.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.wallets_delegated.success', children: t('global_wallet.wallets_delegated.success', { name }) })] }))] }));
|
|
196
|
+
}, children: t('revoke_all_wallet_access', 'Revoke all wallet access') }) })), showSuccessMessage && (jsxRuntime.jsxs("div", { className: 'success-message', "data-testid": 'success-message', children: [jsxRuntime.jsx(check.ReactComponent, { "data-testid": 'success-icon' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.wallets_delegated.success', "data-testid": 'success-text', children: t('global_wallet.wallets_delegated.success', { name }) })] }))] }));
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
exports.WalletsDelegatedSettingsView = WalletsDelegatedSettingsView;
|
|
@@ -169,27 +169,27 @@ const WalletsDelegatedSettingsView = ({ name }) => {
|
|
|
169
169
|
const handleDelegate = createHandleDelegate(delegateKeyShares);
|
|
170
170
|
const handleWalletStatusChange = createHandleWalletStatusChange(handleRevoke, handleDelegate);
|
|
171
171
|
const handleRevokeAll = createHandleRevokeAll(handleRevoke, walletsWithStatus);
|
|
172
|
-
return (jsxs("div", { className: 'wallets-delegated-settings-view', children: [jsxs("div", { className: 'header', children: [jsx(IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsx(SvgArrowLeft, {}) }), jsx(Typography, { variant: 'title', color: 'primary', className: 'title', copykey: 'wallets_delegated.title', children: t('wallets_delegated.title') })] }), walletsWithStatus.length > 0 && (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
172
|
+
return (jsxs("div", { className: 'wallets-delegated-settings-view', "data-testid": 'wallets-delegated-settings-view', children: [' ', jsxs("div", { className: 'header', "data-testid": 'delegated-header', children: [jsx(IconButton, { onClick: () => setDynamicWidgetView('settings'), "data-testid": 'back-button', className: 'back-button', type: 'button', children: jsx(SvgArrowLeft, {}) }), jsx(Typography, { variant: 'title', color: 'primary', className: 'title', copykey: 'wallets_delegated.title', "data-testid": 'delegated-title', children: t('wallets_delegated.title') })] }), walletsWithStatus.length > 0 && (jsxs("ul", { className: 'delegated-wallets-list', "data-testid": 'delegated-wallets-list', children: [' ', walletsWithStatus.map((wallet, index) => {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
return (jsxs("li", { className: 'delegated-wallets-item', "data-testid": `delegated-wallet-item-${index}`, children: [' ', jsx("div", { className: 'wallet-icon', children: jsx(WalletIconWithNetwork, { walletKey: wallet.key, Icon: null, iconUrl: (_b = (_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.icon, chainName: wallet.chain, iconSize: 24, showNetwork: true }) }), jsxs("div", { className: 'wallet-info', "data-testid": `wallet-info-${index}`, children: [jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', children: shortenWalletAddress(wallet.address) }), jsx("div", { className: wallet.status === 'delegated'
|
|
175
|
+
? 'status-badge'
|
|
176
|
+
: 'status-badge status-badge--disconnected', children: jsx(Typography, { variant: 'body_small', color: wallet.status === 'delegated' ? 'primary' : 'secondary', children: wallet.status === 'delegated'
|
|
177
|
+
? t('connected', 'Connected')
|
|
178
|
+
: t('disconnected', 'Disconnected') }) })] }), jsx(TypographyButton, { onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
|
+
yield handleWalletStatusChange(wallet);
|
|
180
|
+
}), buttonPadding: 'small', className: 'revoke-button', typographyProps: {
|
|
181
|
+
color: 'primary',
|
|
182
|
+
variant: 'body_small',
|
|
183
|
+
weight: 'medium',
|
|
184
|
+
}, children: wallet.status === 'delegated'
|
|
185
|
+
? t('revoke', 'Revoke')
|
|
186
|
+
: t('delegate', 'Delegate') })] }, wallet.id));
|
|
187
|
+
})] })), walletsWithStatus.filter((w) => w.status === 'delegated').length > 0 && (jsx("div", { className: 'revoke-all-section', "data-testid": 'revoke-all-section', children: jsx(TypographyButton, { onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
188
188
|
yield handleRevokeAll();
|
|
189
|
-
}), buttonVariant: 'tertiary', buttonPadding: 'none', className: 'revoke-all-button', typographyProps: {
|
|
189
|
+
}), buttonVariant: 'tertiary', buttonPadding: 'none', className: 'revoke-all-button', "data-testid": 'revoke-all-button', typographyProps: {
|
|
190
190
|
variant: 'body_normal',
|
|
191
191
|
weight: 'medium',
|
|
192
|
-
}, children: t('revoke_all_wallet_access', 'Revoke all wallet access') }) })), showSuccessMessage && (jsxs("div", { className: 'success-message', children: [jsx(SvgCheck, {}), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.wallets_delegated.success', children: t('global_wallet.wallets_delegated.success', { name }) })] }))] }));
|
|
192
|
+
}, children: t('revoke_all_wallet_access', 'Revoke all wallet access') }) })), showSuccessMessage && (jsxs("div", { className: 'success-message', "data-testid": 'success-message', children: [jsx(SvgCheck, { "data-testid": 'success-icon' }), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'global_wallet.wallets_delegated.success', "data-testid": 'success-text', children: t('global_wallet.wallets_delegated.success', { name }) })] }))] }));
|
|
193
193
|
};
|
|
194
194
|
|
|
195
195
|
export { WalletsDelegatedSettingsView, createHandleDelegate, createHandleRevoke, createHandleRevokeAll, createHandleWalletStatusChange, WalletsDelegatedSettingsView as default, mapWalletsForDelegate, mapWalletsForRevoke };
|