@dynamic-labs/sdk-react-core 0.18.0-RC.11 → 0.18.0-RC.12

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +8 -8
  5. package/src/lib/Main.cjs +2 -2
  6. package/src/lib/Main.js +2 -2
  7. package/src/lib/assets/index.d.ts +1 -0
  8. package/src/lib/assets/no-wallet-found.cjs +75 -0
  9. package/src/lib/assets/no-wallet-found.js +51 -0
  10. package/src/lib/components/TosAndPp/TosAndPp.cjs +18 -3
  11. package/src/lib/components/TosAndPp/TosAndPp.d.ts +1 -6
  12. package/src/lib/components/TosAndPp/TosAndPp.js +19 -4
  13. package/src/lib/components/WalletInformationCard/WalletInformationCard.cjs +33 -0
  14. package/src/lib/components/WalletInformationCard/WalletInformationCard.d.ts +11 -0
  15. package/src/lib/components/WalletInformationCard/WalletInformationCard.js +29 -0
  16. package/src/lib/components/WalletInformationCard/index.d.ts +1 -0
  17. package/src/lib/components/index.d.ts +1 -0
  18. package/src/lib/context/DynamicContext/DynamicContext.cjs +8 -7
  19. package/src/lib/context/DynamicContext/DynamicContext.d.ts +5 -1
  20. package/src/lib/context/DynamicContext/DynamicContext.js +8 -7
  21. package/src/lib/context/WalletContext/WalletContext.cjs +4 -2
  22. package/src/lib/context/WalletContext/WalletContext.d.ts +3 -1
  23. package/src/lib/context/WalletContext/WalletContext.js +4 -2
  24. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +4 -3
  25. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +4 -3
  26. package/src/lib/styles/index.shadow.cjs +1 -1
  27. package/src/lib/styles/index.shadow.js +1 -1
  28. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -2
  29. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -2
  30. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +9 -2
  31. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +5 -2
  32. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +9 -2
  33. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +5 -3
  34. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +5 -3
  35. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +14 -27
  36. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -3
  37. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +15 -28
  38. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +20 -3
  39. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
  40. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +20 -3
  41. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +8 -8
  42. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +8 -8
  43. package/src/lib/views/WalletList/{SearchInstead/SearchInstead.cjs → SearchNotFoundMessage/SearchNotFoundMessage.cjs} +2 -2
  44. package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.d.ts +8 -0
  45. package/src/lib/views/WalletList/{SearchInstead/SearchInstead.js → SearchNotFoundMessage/SearchNotFoundMessage.js} +2 -2
  46. package/src/lib/views/WalletList/SearchNotFoundMessage/index.d.ts +1 -0
  47. package/src/lib/views/WalletList/WalletList.cjs +3 -2
  48. package/src/lib/views/WalletList/WalletList.js +3 -2
  49. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +27 -8
  50. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +0 -1
  51. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +28 -9
  52. package/src/lib/views/WalletList/SearchInstead/SearchInstead.d.ts +0 -2
  53. package/src/lib/views/WalletList/SearchInstead/index.d.ts +0 -1
@@ -25,7 +25,6 @@ var shouldManuallyReconnectOnRefresh = require('../../functions/shouldManuallyRe
25
25
 
26
26
  const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, wallets, }) => {
27
27
  const [connectedWalletsInfo, setConnectedWalletsInfo, removeConnectedWalletsInfo,] = useLocalStorage.useLocalStorage(localStorage.CONNECTED_WALLETS_INFO, []);
28
- const [connectedWallet, setConnectedWallet] = React.useState(null);
29
28
  const getNextIdAvailable = React.useCallback((currentWallets) => {
30
29
  const existingIds = currentWallets.map(({ id }) => id);
31
30
  const sortedIds = existingIds
@@ -53,19 +52,23 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
53
52
  };
54
53
  })
55
54
  .filter((wc) => wc !== null), [connectedWalletsInfo, wallets]);
55
+ const connectedWallet = connectedWallets[0] || null;
56
56
  const setConnectedStates = React.useCallback((walletConnector, address, chain) => {
57
- setConnectedWallet({
58
- address,
59
- chain,
60
- connected: true,
61
- connector: walletConnector,
62
- id: 'connect-only-wallet',
63
- });
64
57
  setConnectedWalletsInfo((currentWallets) => {
58
+ const existingWalletIndex = currentWallets.findIndex((currentWallet) => currentWallet.name === walletConnector.name);
65
59
  const exists = currentWallets.some((currentWallet) => currentWallet.walletPublicKey === address);
60
+ // this is done, to make sure we're not adding two wallets with the same address to the array
66
61
  if (exists) {
67
62
  return currentWallets;
68
63
  }
64
+ // when calling this function with a new wallet that has the same wallet connector as
65
+ // an existing one in the array, we intend to replace the existing wallet with the new one.
66
+ if (existingWalletIndex !== -1) {
67
+ const updatedWallets = [...currentWallets];
68
+ updatedWallets[existingWalletIndex] = Object.assign(Object.assign({}, updatedWallets[existingWalletIndex]), { chain, provider: getWalletProvider.getWalletProvider(walletConnector), walletPublicKey: address });
69
+ return updatedWallets;
70
+ }
71
+ // otherwise, add new wallet to connectedWalletsInfo array
69
72
  return [
70
73
  ...currentWallets,
71
74
  {
@@ -91,28 +94,13 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
91
94
  setConnectedStates(walletConnector, address, chain);
92
95
  }
93
96
  else {
94
- setConnectedWallet(null);
97
+ removeConnectedWalletsInfo();
95
98
  }
96
99
  }
97
100
  else {
98
- setConnectedWallet(null);
99
- }
100
- }), [setConnectedStates, wallets]);
101
- React.useEffect(() => {
102
- const shouldUpdateConnectedWalletsState = authMode === 'connect-only' && connectedWalletsInfo.length;
103
- if (shouldUpdateConnectedWalletsState) {
104
- connectedWalletsInfo.forEach(({ name, walletPublicKey, chain }) => {
105
- if (chain) {
106
- connectWalletByAddressAndChain(name, walletPublicKey, chain);
107
- }
108
- });
101
+ removeConnectedWalletsInfo();
109
102
  }
110
- }, [
111
- authMode,
112
- connectWalletByAddressAndChain,
113
- connectedWallets.length,
114
- connectedWalletsInfo,
115
- ]);
103
+ }), [removeConnectedWalletsInfo, setConnectedStates, wallets]);
116
104
  const shouldSkipCreatingVisit = React.useMemo(() => (authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly) ||
117
105
  connectedWallet, [authMode, connectedWallet, enableVisitTrackingOnConnectOnly]);
118
106
  const connectWallet = (walletConnector, fetchPublicAddressOpts) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -161,7 +149,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
161
149
  connectedWalletsInfo,
162
150
  getConnectedWalletById,
163
151
  removeConnectedWalletsInfo,
164
- setConnectedWallet,
165
152
  unlinkConnectedWallet,
166
153
  };
167
154
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Chain, FetchPublicAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
3
2
  import { AuthModeType, Wallet, WalletOption } from '../../../shared';
4
3
  export type ConnectedWalletConnectorType = {
@@ -20,12 +19,11 @@ type Props = {
20
19
  export declare const useConnectWallet: ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, wallets, }: Props) => {
21
20
  connectWallet: (walletConnector: WalletConnector, fetchPublicAddressOpts?: FetchPublicAddressOpts) => Promise<string>;
22
21
  connectWalletByAddressAndChain: (name: string, address: string, chain: Chain) => Promise<void>;
23
- connectedWallet: Wallet | null;
22
+ connectedWallet: Wallet;
24
23
  connectedWallets: Wallet[];
25
24
  connectedWalletsInfo: [] | ConnectedWalletConnectorType[];
26
25
  getConnectedWalletById: (walletId: string) => Wallet | undefined;
27
26
  removeConnectedWalletsInfo: () => void;
28
- setConnectedWallet: import("react").Dispatch<import("react").SetStateAction<Wallet | null>>;
29
27
  unlinkConnectedWallet: (walletId: string) => void;
30
28
  };
31
29
  export {};
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
- import { useState, useCallback, useMemo, useEffect } from 'react';
2
+ import { useCallback, useMemo } from 'react';
3
3
  import { getWalletConnectorByName, isSameAddress } from '@dynamic-labs/wallet-connector-core';
4
4
  import '@dynamic-labs/sdk-api';
5
5
  import '../../../shared/logger.js';
@@ -21,7 +21,6 @@ import { shouldManuallyReconnectOnRefresh } from '../../functions/shouldManually
21
21
 
22
22
  const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, wallets, }) => {
23
23
  const [connectedWalletsInfo, setConnectedWalletsInfo, removeConnectedWalletsInfo,] = useLocalStorage(CONNECTED_WALLETS_INFO, []);
24
- const [connectedWallet, setConnectedWallet] = useState(null);
25
24
  const getNextIdAvailable = useCallback((currentWallets) => {
26
25
  const existingIds = currentWallets.map(({ id }) => id);
27
26
  const sortedIds = existingIds
@@ -49,19 +48,23 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
49
48
  };
50
49
  })
51
50
  .filter((wc) => wc !== null), [connectedWalletsInfo, wallets]);
51
+ const connectedWallet = connectedWallets[0] || null;
52
52
  const setConnectedStates = useCallback((walletConnector, address, chain) => {
53
- setConnectedWallet({
54
- address,
55
- chain,
56
- connected: true,
57
- connector: walletConnector,
58
- id: 'connect-only-wallet',
59
- });
60
53
  setConnectedWalletsInfo((currentWallets) => {
54
+ const existingWalletIndex = currentWallets.findIndex((currentWallet) => currentWallet.name === walletConnector.name);
61
55
  const exists = currentWallets.some((currentWallet) => currentWallet.walletPublicKey === address);
56
+ // this is done, to make sure we're not adding two wallets with the same address to the array
62
57
  if (exists) {
63
58
  return currentWallets;
64
59
  }
60
+ // when calling this function with a new wallet that has the same wallet connector as
61
+ // an existing one in the array, we intend to replace the existing wallet with the new one.
62
+ if (existingWalletIndex !== -1) {
63
+ const updatedWallets = [...currentWallets];
64
+ updatedWallets[existingWalletIndex] = Object.assign(Object.assign({}, updatedWallets[existingWalletIndex]), { chain, provider: getWalletProvider(walletConnector), walletPublicKey: address });
65
+ return updatedWallets;
66
+ }
67
+ // otherwise, add new wallet to connectedWalletsInfo array
65
68
  return [
66
69
  ...currentWallets,
67
70
  {
@@ -87,28 +90,13 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
87
90
  setConnectedStates(walletConnector, address, chain);
88
91
  }
89
92
  else {
90
- setConnectedWallet(null);
93
+ removeConnectedWalletsInfo();
91
94
  }
92
95
  }
93
96
  else {
94
- setConnectedWallet(null);
95
- }
96
- }), [setConnectedStates, wallets]);
97
- useEffect(() => {
98
- const shouldUpdateConnectedWalletsState = authMode === 'connect-only' && connectedWalletsInfo.length;
99
- if (shouldUpdateConnectedWalletsState) {
100
- connectedWalletsInfo.forEach(({ name, walletPublicKey, chain }) => {
101
- if (chain) {
102
- connectWalletByAddressAndChain(name, walletPublicKey, chain);
103
- }
104
- });
97
+ removeConnectedWalletsInfo();
105
98
  }
106
- }, [
107
- authMode,
108
- connectWalletByAddressAndChain,
109
- connectedWallets.length,
110
- connectedWalletsInfo,
111
- ]);
99
+ }), [removeConnectedWalletsInfo, setConnectedStates, wallets]);
112
100
  const shouldSkipCreatingVisit = useMemo(() => (authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly) ||
113
101
  connectedWallet, [authMode, connectedWallet, enableVisitTrackingOnConnectOnly]);
114
102
  const connectWallet = (walletConnector, fetchPublicAddressOpts) => __awaiter(void 0, void 0, void 0, function* () {
@@ -157,7 +145,6 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
157
145
  connectedWalletsInfo,
158
146
  getConnectedWalletById,
159
147
  removeConnectedWalletsInfo,
160
- setConnectedWallet,
161
148
  unlinkConnectedWallet,
162
149
  };
163
150
  };
@@ -18,7 +18,7 @@ require('ethers');
18
18
  require('../../../shared/consts/index.cjs');
19
19
 
20
20
  const orderedSecondaryWalletAddresses = (wallets) => wallets.map((wallet) => wallet.address).sort();
21
- const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, connectWalletByAddressAndChain, }) => {
21
+ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, connectWalletByAddressAndChain, authMode, }) => {
22
22
  const [loadingNetwork, setLoadingNetwork] = React.useState(true);
23
23
  const [network, setNetwork] = React.useState(undefined);
24
24
  React.useEffect(() => {
@@ -95,6 +95,10 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
95
95
  onAccountChange: (accounts) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
96
96
  const [newAddress] = accounts;
97
97
  const newWallet = secondaryWallets.find((wallet) => walletConnectorCore.isSameAddress(wallet.address, newAddress, wallet.chain));
98
+ if (authMode === 'connect-only') {
99
+ connectWalletByAddressAndChain(primaryWallet.connector.name, newAddress, primaryWallet.chain);
100
+ return;
101
+ }
98
102
  if (walletConnectorCore.isSameAddress(newAddress, primaryWallet.address, primaryWallet.chain)) {
99
103
  setMultiWalletWidgetState('idle');
100
104
  }
@@ -124,11 +128,17 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
124
128
  yield computeConnectedStateForWallets();
125
129
  }),
126
130
  onChainChange: (chain) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
127
- setNetwork(parseInt(chain));
131
+ if (primaryWallet.chain === 'starknet') {
132
+ setNetwork(chain);
133
+ }
134
+ else {
135
+ setNetwork(parseInt(chain));
136
+ }
128
137
  }),
129
138
  onDisconnect: handleLogOut,
130
139
  });
131
140
  }, [
141
+ authMode,
132
142
  primaryWallet,
133
143
  setMultiWalletWidgetState,
134
144
  multiWallet,
@@ -144,7 +154,12 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
144
154
  ]);
145
155
  const addSecondaryWalletEventListeners = React.useCallback((seen) => {
146
156
  const secondaryListeners = {
147
- onAccountChange: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
157
+ onAccountChange: (accounts) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
158
+ if (authMode === 'connect-only' && secondaryWallets.length) {
159
+ const [newAddress] = accounts;
160
+ connectWalletByAddressAndChain(secondaryWallets[0].connector.name, newAddress, secondaryWallets[0].chain);
161
+ return;
162
+ }
148
163
  if (multiWalletWidgetState === 'awaiting_account_switch') {
149
164
  handleAccountChangeWhenAwaitingAccountSwitch(false, (selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet.address) || '');
150
165
  }
@@ -166,7 +181,9 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
166
181
  wallet.connector.setupEventListeners(secondaryListeners);
167
182
  }
168
183
  }, [
184
+ authMode,
169
185
  computeConnectedStateForWallets,
186
+ connectWalletByAddressAndChain,
170
187
  selectedWalletConnector,
171
188
  selectedWalletWithAction,
172
189
  handleAccountChangeWhenAwaitingAccountSwitch,
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { Chain, WalletConnector } from '@dynamic-labs/wallet-connector-core';
3
- import { MultiWalletWidgetState, UserProfile, Wallet, WalletWithAction } from '../../../shared';
3
+ import { AuthModeType, MultiWalletWidgetState, UserProfile, Wallet, WalletWithAction } from '../../../shared';
4
4
  import { MultiWalletWidgetStateSetter } from '../multiWallet';
5
5
  export type UseWalletEventListenersArgs = {
6
6
  computeConnectedStateForWallets(): Promise<void>;
@@ -17,8 +17,9 @@ export type UseWalletEventListenersArgs = {
17
17
  setSelectedWalletConnector(connector: WalletConnector | null): void;
18
18
  setSelectedWalletWithAction(walletWithAction: WalletWithAction | null): void;
19
19
  user: UserProfile | undefined;
20
+ authMode: AuthModeType;
20
21
  };
21
- export declare const useWalletEventListeners: ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, connectWalletByAddressAndChain, }: UseWalletEventListenersArgs) => {
22
+ export declare const useWalletEventListeners: ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, connectWalletByAddressAndChain, authMode, }: UseWalletEventListenersArgs) => {
22
23
  loadingNetwork: boolean;
23
24
  network: string | number | undefined;
24
25
  setNetwork: import("react").Dispatch<import("react").SetStateAction<string | number | undefined>>;
@@ -14,7 +14,7 @@ import 'ethers';
14
14
  import '../../../shared/consts/index.js';
15
15
 
16
16
  const orderedSecondaryWalletAddresses = (wallets) => wallets.map((wallet) => wallet.address).sort();
17
- const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, connectWalletByAddressAndChain, }) => {
17
+ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, connectWalletByAddressAndChain, authMode, }) => {
18
18
  const [loadingNetwork, setLoadingNetwork] = useState(true);
19
19
  const [network, setNetwork] = useState(undefined);
20
20
  useEffect(() => {
@@ -91,6 +91,10 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
91
91
  onAccountChange: (accounts) => __awaiter(void 0, void 0, void 0, function* () {
92
92
  const [newAddress] = accounts;
93
93
  const newWallet = secondaryWallets.find((wallet) => isSameAddress(wallet.address, newAddress, wallet.chain));
94
+ if (authMode === 'connect-only') {
95
+ connectWalletByAddressAndChain(primaryWallet.connector.name, newAddress, primaryWallet.chain);
96
+ return;
97
+ }
94
98
  if (isSameAddress(newAddress, primaryWallet.address, primaryWallet.chain)) {
95
99
  setMultiWalletWidgetState('idle');
96
100
  }
@@ -120,11 +124,17 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
120
124
  yield computeConnectedStateForWallets();
121
125
  }),
122
126
  onChainChange: (chain) => __awaiter(void 0, void 0, void 0, function* () {
123
- setNetwork(parseInt(chain));
127
+ if (primaryWallet.chain === 'starknet') {
128
+ setNetwork(chain);
129
+ }
130
+ else {
131
+ setNetwork(parseInt(chain));
132
+ }
124
133
  }),
125
134
  onDisconnect: handleLogOut,
126
135
  });
127
136
  }, [
137
+ authMode,
128
138
  primaryWallet,
129
139
  setMultiWalletWidgetState,
130
140
  multiWallet,
@@ -140,7 +150,12 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
140
150
  ]);
141
151
  const addSecondaryWalletEventListeners = useCallback((seen) => {
142
152
  const secondaryListeners = {
143
- onAccountChange: () => __awaiter(void 0, void 0, void 0, function* () {
153
+ onAccountChange: (accounts) => __awaiter(void 0, void 0, void 0, function* () {
154
+ if (authMode === 'connect-only' && secondaryWallets.length) {
155
+ const [newAddress] = accounts;
156
+ connectWalletByAddressAndChain(secondaryWallets[0].connector.name, newAddress, secondaryWallets[0].chain);
157
+ return;
158
+ }
144
159
  if (multiWalletWidgetState === 'awaiting_account_switch') {
145
160
  handleAccountChangeWhenAwaitingAccountSwitch(false, (selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet.address) || '');
146
161
  }
@@ -162,7 +177,9 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
162
177
  wallet.connector.setupEventListeners(secondaryListeners);
163
178
  }
164
179
  }, [
180
+ authMode,
165
181
  computeConnectedStateForWallets,
182
+ connectWalletByAddressAndChain,
166
183
  selectedWalletConnector,
167
184
  selectedWalletWithAction,
168
185
  handleAccountChangeWhenAwaitingAccountSwitch,
@@ -25,20 +25,20 @@ var Balance = require('../../widgets/DynamicWidget/components/Balance/Balance.cj
25
25
 
26
26
  const BridgeSummaryView = () => {
27
27
  const { primaryWallet, setShowAuthFlow, appName, walletsByChain = [], } = useInternalDynamicContext.useInternalDynamicContext();
28
- if (!primaryWallet) {
29
- throw new Error('primaryWallet should be defined');
30
- }
31
- const PrimaryWalletChainIcon = getChainIcon.getChainIcon(primaryWallet.chain);
32
- const primaryWalletChainInfo = walletConnectorCore.getChainInfo(primaryWallet.chain);
33
28
  const onClickClose = () => setShowAuthFlow(false);
34
29
  const body = React.useMemo(() => {
35
30
  const blockchainNames = walletsByChain.map(({ chain }) => { var _a; return (_a = walletConnectorCore.getChainInfo(chain)) === null || _a === void 0 ? void 0 : _a.blockchainName; });
36
31
  const [firstBlockchainName, secondBlockchainName] = blockchainNames;
37
32
  return `Congratulations on connecting both your ${firstBlockchainName} and ${secondBlockchainName} wallets`;
38
33
  }, [walletsByChain]);
39
- return (jsxRuntime.jsxs(ConnectedWalletsListLayout.ConnectedWalletsListLayout, Object.assign({ onClickClose: onClickClose, onClickAction: onClickClose, title: `Welcome to ${appName}`, body: body }, { children: [jsxRuntime.jsx(DynamicBridgeWalletCard.DynamicBridgeWalletCard, Object.assign({ networkIcon: jsxRuntime.jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsxRuntime.jsx(DynamicBridgeWalletCardBody.DynamicBridgeWalletCardBody, { walletName: primaryWallet.connector.name, walletAddress: primaryWallet.address, walletBalance:
40
- // eslint-disable-next-line react/jsx-wrap-multilines
41
- jsxRuntime.jsx(Balance.Balance, { address: primaryWallet.address, connector: primaryWallet.connector, network: primaryWallet.chain }) }) })), jsxRuntime.jsx(SecondaryWallets.MemoSecondaryWallets, { hideUnlinkAction: true })] })));
34
+ const createPrimaryWalletCard = (wallet) => {
35
+ const PrimaryWalletChainIcon = getChainIcon.getChainIcon(wallet.chain);
36
+ const primaryWalletChainInfo = walletConnectorCore.getChainInfo(wallet.chain);
37
+ return (jsxRuntime.jsx(DynamicBridgeWalletCard.DynamicBridgeWalletCard, Object.assign({ networkIcon: jsxRuntime.jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsxRuntime.jsx(DynamicBridgeWalletCardBody.DynamicBridgeWalletCardBody, { walletName: wallet.connector.name, walletAddress: wallet.address, walletBalance:
38
+ // eslint-disable-next-line react/jsx-wrap-multilines
39
+ jsxRuntime.jsx(Balance.Balance, { address: wallet.address, connector: wallet.connector, network: wallet.chain }) }) })));
40
+ };
41
+ return (jsxRuntime.jsxs(ConnectedWalletsListLayout.ConnectedWalletsListLayout, Object.assign({ onClickClose: onClickClose, onClickAction: onClickClose, title: `Welcome to ${appName}`, body: body }, { children: [primaryWallet && createPrimaryWalletCard(primaryWallet), jsxRuntime.jsx(SecondaryWallets.MemoSecondaryWallets, { hideUnlinkAction: true })] })));
42
42
  };
43
43
 
44
44
  exports.BridgeSummaryView = BridgeSummaryView;
@@ -21,20 +21,20 @@ import { Balance } from '../../widgets/DynamicWidget/components/Balance/Balance.
21
21
 
22
22
  const BridgeSummaryView = () => {
23
23
  const { primaryWallet, setShowAuthFlow, appName, walletsByChain = [], } = useInternalDynamicContext();
24
- if (!primaryWallet) {
25
- throw new Error('primaryWallet should be defined');
26
- }
27
- const PrimaryWalletChainIcon = getChainIcon(primaryWallet.chain);
28
- const primaryWalletChainInfo = getChainInfo(primaryWallet.chain);
29
24
  const onClickClose = () => setShowAuthFlow(false);
30
25
  const body = useMemo(() => {
31
26
  const blockchainNames = walletsByChain.map(({ chain }) => { var _a; return (_a = getChainInfo(chain)) === null || _a === void 0 ? void 0 : _a.blockchainName; });
32
27
  const [firstBlockchainName, secondBlockchainName] = blockchainNames;
33
28
  return `Congratulations on connecting both your ${firstBlockchainName} and ${secondBlockchainName} wallets`;
34
29
  }, [walletsByChain]);
35
- return (jsxs(ConnectedWalletsListLayout, Object.assign({ onClickClose: onClickClose, onClickAction: onClickClose, title: `Welcome to ${appName}`, body: body }, { children: [jsx(DynamicBridgeWalletCard, Object.assign({ networkIcon: jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsx(DynamicBridgeWalletCardBody, { walletName: primaryWallet.connector.name, walletAddress: primaryWallet.address, walletBalance:
36
- // eslint-disable-next-line react/jsx-wrap-multilines
37
- jsx(Balance, { address: primaryWallet.address, connector: primaryWallet.connector, network: primaryWallet.chain }) }) })), jsx(MemoSecondaryWallets, { hideUnlinkAction: true })] })));
30
+ const createPrimaryWalletCard = (wallet) => {
31
+ const PrimaryWalletChainIcon = getChainIcon(wallet.chain);
32
+ const primaryWalletChainInfo = getChainInfo(wallet.chain);
33
+ return (jsx(DynamicBridgeWalletCard, Object.assign({ networkIcon: jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsx(DynamicBridgeWalletCardBody, { walletName: wallet.connector.name, walletAddress: wallet.address, walletBalance:
34
+ // eslint-disable-next-line react/jsx-wrap-multilines
35
+ jsx(Balance, { address: wallet.address, connector: wallet.connector, network: wallet.chain }) }) })));
36
+ };
37
+ return (jsxs(ConnectedWalletsListLayout, Object.assign({ onClickClose: onClickClose, onClickAction: onClickClose, title: `Welcome to ${appName}`, body: body }, { children: [primaryWallet && createPrimaryWalletCard(primaryWallet), jsx(MemoSecondaryWallets, { hideUnlinkAction: true })] })));
38
38
  };
39
39
 
40
40
  export { BridgeSummaryView };
@@ -41,6 +41,6 @@ require('formik');
41
41
  require('yup');
42
42
  require('../../../components/InlineWidget/InlineWidget.cjs');
43
43
 
44
- const SearchInstead = () => (jsxRuntime.jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: "Don't see your wallet?" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: "Try search instead" }))] })));
44
+ const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxRuntime.jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && jsxRuntime.jsx("div", { children: image }), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: title || "Don't see your wallet?" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: subtitle || 'Try search instead' }))] })));
45
45
 
46
- exports.SearchInstead = SearchInstead;
46
+ exports.SearchNotFoundMessage = SearchNotFoundMessage;
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from 'react';
2
+ interface Props {
3
+ title?: string;
4
+ subtitle?: string;
5
+ image?: ReactNode;
6
+ }
7
+ export declare const SearchNotFoundMessage: FC<Props>;
8
+ export {};
@@ -37,6 +37,6 @@ import 'formik';
37
37
  import 'yup';
38
38
  import '../../../components/InlineWidget/InlineWidget.js';
39
39
 
40
- const SearchInstead = () => (jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: "Don't see your wallet?" })), jsx(Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: "Try search instead" }))] })));
40
+ const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && jsx("div", { children: image }), jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: title || "Don't see your wallet?" })), jsx(Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: subtitle || 'Try search instead' }))] })));
41
41
 
42
- export { SearchInstead };
42
+ export { SearchNotFoundMessage };
@@ -0,0 +1 @@
1
+ export { SearchNotFoundMessage } from './SearchNotFoundMessage';
@@ -26,7 +26,8 @@ require('@dynamic-labs/utils');
26
26
  var localStorage = require('../../shared/utils/classes/storage/localStorage.cjs');
27
27
  require('ethers');
28
28
  require('../../shared/consts/index.cjs');
29
- var SearchInstead = require('./SearchInstead/SearchInstead.cjs');
29
+ var noWalletFound = require('../../assets/no-wallet-found.cjs');
30
+ var SearchNotFoundMessage = require('./SearchNotFoundMessage/SearchNotFoundMessage.cjs');
30
31
  var WalletListItem = require('./WalletListItem/WalletListItem.cjs');
31
32
 
32
33
  localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
@@ -77,7 +78,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
77
78
  };
78
79
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx(Search.Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('wallet-list__scroll-container', {
79
80
  'wallet-list__scroll-container--full-height': isSearchEnabled,
80
- }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key)))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchInstead.SearchInstead, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
81
+ }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try seaching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
81
82
  'wallet-list__tiny-footer--hidden': footerIsVisible,
82
83
  }), "data-testid": 'wallet-list-tiny-footer' }))] }));
83
84
  };
@@ -22,7 +22,8 @@ import '@dynamic-labs/utils';
22
22
  import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
23
23
  import 'ethers';
24
24
  import '../../shared/consts/index.js';
25
- import { SearchInstead } from './SearchInstead/SearchInstead.js';
25
+ import { ReactComponent as SvgNoWalletFound } from '../../assets/no-wallet-found.js';
26
+ import { SearchNotFoundMessage } from './SearchNotFoundMessage/SearchNotFoundMessage.js';
26
27
  import { WalletListItem } from './WalletListItem/WalletListItem.js';
27
28
 
28
29
  LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
@@ -73,7 +74,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
73
74
  };
74
75
  return (jsxs(Fragment, { children: [jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsx(ErrorContainer, { children: error }), !projectSettings ? (jsx(Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsx(Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxs("div", Object.assign({ className: classNames('wallet-list__scroll-container', {
75
76
  'wallet-list__scroll-container--full-height': isSearchEnabled,
76
- }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key)))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchInstead, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
77
+ }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try seaching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
77
78
  'wallet-list__tiny-footer--hidden': footerIsVisible,
78
79
  }), "data-testid": 'wallet-list-tiny-footer' }))] }));
79
80
  };
@@ -5,14 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var walletBook = require('@dynamic-labs/wallet-book');
7
7
  require('react');
8
- var Typography = require('../../../../components/Typography/Typography.cjs');
9
8
  require('@dynamic-labs/sdk-api');
10
9
  require('../../../../shared/logger.cjs');
11
10
  require('@dynamic-labs/iconic');
12
11
  require('@dynamic-labs/wallet-connector-core');
13
12
  require('../../../../context/ViewContext/ViewContext.cjs');
14
- var unlink = require('../../../../shared/assets/unlink.cjs');
15
- var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
16
13
  require('@dynamic-labs/utils');
17
14
  require('../../../../utils/constants/colors.cjs');
18
15
  require('../../../../shared/utils/classes/storage/localStorage.cjs');
@@ -33,8 +30,6 @@ require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagic
33
30
  require('../../../../context/ErrorContext/ErrorContext.cjs');
34
31
  require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
35
32
  require('../../../../components/IconButton/IconButton.cjs');
36
- var StatusDot = require('../../../../components/StatusDot/StatusDot.cjs');
37
- var Button = require('../../../../components/Button/Button.cjs');
38
33
  require('../../../../components/Alert/Alert.cjs');
39
34
  require('../../../../context/MockContext/MockContext.cjs');
40
35
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
@@ -44,9 +39,33 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
44
39
  require('formik');
45
40
  require('yup');
46
41
  require('../../../../components/InlineWidget/InlineWidget.cjs');
42
+ var WalletInformationCard = require('../../../../components/WalletInformationCard/WalletInformationCard.cjs');
43
+ var DotsMenu = require('../../../DynamicWidget/components/DotsMenu/DotsMenu.cjs');
44
+ var useFetchNameService = require('../../../DynamicWidget/hooks/useFetchNameService/useFetchNameService.cjs');
47
45
 
48
- const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance, walletCurrency, walletName, onUnlinkClick, }) => (jsxRuntime.jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__body' }, { children: [jsxRuntime.jsx(walletBook.WalletIcon, { className: 'dynamic-bridge-wallet-card__wallet-icon', walletName: walletName }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__wallet-address' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) })), jsxRuntime.jsx(StatusDot.StatusDot, { variant: 'green' })] })), jsxRuntime.jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__balance' }, { children: [walletBalance, jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'medium', as: 'span', color: 'secondary' }, { children: walletCurrency }))] }))] }), onUnlinkClick && (jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'dynamic-bridge-wallet-card__unlink-button', buttonPadding: 'none', buttonVariant: 'secondary', typographyProps: {
49
- color: 'secondary',
50
- }, startSlot: jsxRuntime.jsx(unlink.ReactComponent, {}), onClick: onUnlinkClick }, { children: "Unlink" })))] })));
46
+ const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance, walletName, onUnlinkClick }) => {
47
+ const nameService = useFetchNameService.useFetchNameService(walletAddress);
48
+ const options = [
49
+ {
50
+ Icon: null,
51
+ callback: () => (nameService === null || nameService === void 0 ? void 0 : nameService.name) && navigator.clipboard.writeText(nameService === null || nameService === void 0 ? void 0 : nameService.name),
52
+ hide: !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
53
+ text: 'Copy ENS',
54
+ },
55
+ {
56
+ Icon: null,
57
+ callback: () => walletAddress && navigator.clipboard.writeText(walletAddress),
58
+ hide: !walletAddress,
59
+ text: 'Copy wallet address',
60
+ },
61
+ {
62
+ Icon: null,
63
+ callback: () => onUnlinkClick === null || onUnlinkClick === void 0 ? void 0 : onUnlinkClick(),
64
+ hide: !onUnlinkClick,
65
+ text: 'Disconnect',
66
+ },
67
+ ];
68
+ return (jsxRuntime.jsx(WalletInformationCard.WalletInformationCard, { ens: nameService === null || nameService === void 0 ? void 0 : nameService.name, address: walletAddress, icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletName }), balance: walletBalance, menu: jsxRuntime.jsx(DotsMenu.DotsMenu, { options: options }) }));
69
+ };
51
70
 
52
71
  exports.DynamicBridgeWalletCardBody = DynamicBridgeWalletCardBody;
@@ -2,7 +2,6 @@ import { FC, ReactElement } from 'react';
2
2
  export type DynamicBridgeWalletCardBodyProps = {
3
3
  walletName: string;
4
4
  walletAddress: string;
5
- walletCurrency?: string;
6
5
  walletBalance?: ReactElement;
7
6
  onUnlinkClick?: () => void;
8
7
  };
@@ -1,14 +1,11 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { WalletIcon } from '@dynamic-labs/wallet-book';
3
3
  import 'react';
4
- import { Typography } from '../../../../components/Typography/Typography.js';
5
4
  import '@dynamic-labs/sdk-api';
6
5
  import '../../../../shared/logger.js';
7
6
  import '@dynamic-labs/iconic';
8
7
  import '@dynamic-labs/wallet-connector-core';
9
8
  import '../../../../context/ViewContext/ViewContext.js';
10
- import { ReactComponent as SvgUnlink } from '../../../../shared/assets/unlink.js';
11
- import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
12
9
  import '@dynamic-labs/utils';
13
10
  import '../../../../utils/constants/colors.js';
14
11
  import '../../../../shared/utils/classes/storage/localStorage.js';
@@ -29,8 +26,6 @@ import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicI
29
26
  import '../../../../context/ErrorContext/ErrorContext.js';
30
27
  import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
31
28
  import '../../../../components/IconButton/IconButton.js';
32
- import { StatusDot } from '../../../../components/StatusDot/StatusDot.js';
33
- import { Button } from '../../../../components/Button/Button.js';
34
29
  import '../../../../components/Alert/Alert.js';
35
30
  import '../../../../context/MockContext/MockContext.js';
36
31
  import '../../../../context/CaptchaContext/CaptchaContext.js';
@@ -40,9 +35,33 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
40
35
  import 'formik';
41
36
  import 'yup';
42
37
  import '../../../../components/InlineWidget/InlineWidget.js';
38
+ import { WalletInformationCard } from '../../../../components/WalletInformationCard/WalletInformationCard.js';
39
+ import { DotsMenu } from '../../../DynamicWidget/components/DotsMenu/DotsMenu.js';
40
+ import { useFetchNameService } from '../../../DynamicWidget/hooks/useFetchNameService/useFetchNameService.js';
43
41
 
44
- const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance, walletCurrency, walletName, onUnlinkClick, }) => (jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__body' }, { children: [jsx(WalletIcon, { className: 'dynamic-bridge-wallet-card__wallet-icon', walletName: walletName }), jsxs("div", { children: [jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__wallet-address' }, { children: [jsx(Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: shortenWalletAddress(walletAddress, 3, 3) })), jsx(StatusDot, { variant: 'green' })] })), jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__balance' }, { children: [walletBalance, jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'medium', as: 'span', color: 'secondary' }, { children: walletCurrency }))] }))] }), onUnlinkClick && (jsx(Button, Object.assign({ buttonClassName: 'dynamic-bridge-wallet-card__unlink-button', buttonPadding: 'none', buttonVariant: 'secondary', typographyProps: {
45
- color: 'secondary',
46
- }, startSlot: jsx(SvgUnlink, {}), onClick: onUnlinkClick }, { children: "Unlink" })))] })));
42
+ const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance, walletName, onUnlinkClick }) => {
43
+ const nameService = useFetchNameService(walletAddress);
44
+ const options = [
45
+ {
46
+ Icon: null,
47
+ callback: () => (nameService === null || nameService === void 0 ? void 0 : nameService.name) && navigator.clipboard.writeText(nameService === null || nameService === void 0 ? void 0 : nameService.name),
48
+ hide: !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
49
+ text: 'Copy ENS',
50
+ },
51
+ {
52
+ Icon: null,
53
+ callback: () => walletAddress && navigator.clipboard.writeText(walletAddress),
54
+ hide: !walletAddress,
55
+ text: 'Copy wallet address',
56
+ },
57
+ {
58
+ Icon: null,
59
+ callback: () => onUnlinkClick === null || onUnlinkClick === void 0 ? void 0 : onUnlinkClick(),
60
+ hide: !onUnlinkClick,
61
+ text: 'Disconnect',
62
+ },
63
+ ];
64
+ return (jsx(WalletInformationCard, { ens: nameService === null || nameService === void 0 ? void 0 : nameService.name, address: walletAddress, icon: jsx(WalletIcon, { walletName: walletName }), balance: walletBalance, menu: jsx(DotsMenu, { options: options }) }));
65
+ };
47
66
 
48
67
  export { DynamicBridgeWalletCardBody };
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const SearchInstead: () => JSX.Element;
@@ -1 +0,0 @@
1
- export { SearchInstead } from './SearchInstead';