@dynamic-labs/global-wallet-client 4.10.1 → 4.10.3

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 CHANGED
@@ -1,4 +1,27 @@
1
1
 
2
+ ### [4.10.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.10.2...v4.10.3) (2025-04-04)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * dark mode vars ([#8456](https://github.com/dynamic-labs/dynamic-auth/issues/8456)) ([26c8a28](https://github.com/dynamic-labs/dynamic-auth/commit/26c8a289d151b79c73726ddf00048d83ff8d5098))
8
+ * onramp options override ([#8335](https://github.com/dynamic-labs/dynamic-auth/issues/8335)) ([731af19](https://github.com/dynamic-labs/dynamic-auth/commit/731af199df5c7743be8d7502dd7c6155a7d68128))
9
+
10
+ ### [4.10.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.10.1...v4.10.2) (2025-04-02)
11
+
12
+
13
+ ### Features
14
+
15
+ * add walletTabSelected event ([#8430](https://github.com/dynamic-labs/dynamic-auth/issues/8430)) ([01ef815](https://github.com/dynamic-labs/dynamic-auth/commit/01ef815330e6c5433f7c135f561ed86621cc2bd9))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * disconect wallets on logout ([#8399](https://github.com/dynamic-labs/dynamic-auth/issues/8399)) ([148bc0d](https://github.com/dynamic-labs/dynamic-auth/commit/148bc0dd175048fa8a9a675383e8e6d93c7d16ac))
21
+ * ensure primary wallet is still a valid credential when calling resfreshUser ([#8439](https://github.com/dynamic-labs/dynamic-auth/issues/8439)) ([2e567e5](https://github.com/dynamic-labs/dynamic-auth/commit/2e567e53ea7738d4a42f3d54bb40a294403a1c36))
22
+ * **global-wallet-client:** ensure multiple global wallets can announce in same page ([#8421](https://github.com/dynamic-labs/dynamic-auth/issues/8421)) ([c55044a](https://github.com/dynamic-labs/dynamic-auth/commit/c55044a50f2d1c9417a3a2d85851c5522834a20a))
23
+ * **global-wallet-popup:** ensure popup icon can be viewed ([#8424](https://github.com/dynamic-labs/dynamic-auth/issues/8424)) ([f960eeb](https://github.com/dynamic-labs/dynamic-auth/commit/f960eebcdd875e1ff1779cd7be946d8342bea964))
24
+
2
25
  ### [4.10.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.10.0...v4.10.1) (2025-03-31)
3
26
 
4
27
  ## [4.10.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.9.12...v4.10.0) (2025-03-30)
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.10.1";
6
+ var version = "4.10.3";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.10.1";
2
+ var version = "4.10.3";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/global-wallet-client",
3
- "version": "4.10.1",
3
+ "version": "4.10.3",
4
4
  "description": "Core package for building Dynamic's Global Wallet",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -39,12 +39,12 @@
39
39
  },
40
40
  "homepage": "https://www.dynamic.xyz/",
41
41
  "dependencies": {
42
- "@dynamic-labs/assert-package-version": "4.10.1",
43
- "@dynamic-labs/logger": "4.10.1",
44
- "@dynamic-labs/message-transport": "4.10.1",
45
- "@dynamic-labs/store": "4.10.1",
46
- "@dynamic-labs/types": "4.10.1",
47
- "@dynamic-labs/utils": "4.10.1",
42
+ "@dynamic-labs/assert-package-version": "4.10.3",
43
+ "@dynamic-labs/logger": "4.10.3",
44
+ "@dynamic-labs/message-transport": "4.10.3",
45
+ "@dynamic-labs/store": "4.10.3",
46
+ "@dynamic-labs/types": "4.10.3",
47
+ "@dynamic-labs/utils": "4.10.3",
48
48
  "eventemitter3": "5.0.1"
49
49
  },
50
50
  "peerDependencies": {
@@ -4,6 +4,9 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  const createDisconnectAction = ({ store, onDisconnect }) => () => {
7
+ if (store.getActiveConnection() === null) {
8
+ return;
9
+ }
7
10
  store.clear();
8
11
  onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
9
12
  };
@@ -1,5 +1,8 @@
1
1
  'use client'
2
2
  const createDisconnectAction = ({ store, onDisconnect }) => () => {
3
+ if (store.getActiveConnection() === null) {
4
+ return;
5
+ }
3
6
  store.clear();
4
7
  onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect();
5
8
  };
@@ -15,9 +15,12 @@ var addVersionPostfixToUrl = require('./functions/addVersionPostfixToUrl/addVers
15
15
  var isSSR = require('./functions/isSSR/isSSR.cjs');
16
16
  var fakeStorage = require('./constants/fakeStorage/fakeStorage.cjs');
17
17
  var DisconnectError = require('./errors/DisconnectError.cjs');
18
+ var logger = require('./constants/logger.cjs');
18
19
 
19
20
  const createGlobalWalletClient = ({ environmentId, popup: popupInfo, developmentOptions: { postfixPopupUrlWithVersion = true } = {}, }) => {
20
21
  const eventEmitter = createClientEventEmitter.createClientEventEmitter();
22
+ eventEmitter.on('connect', () => logger.logger.logVerboseTroubleshootingMessage('EventEmitter: connect'));
23
+ eventEmitter.on('disconnect', () => logger.logger.logVerboseTroubleshootingMessage('EventEmitter: disconnect'));
21
24
  const store = createClientStore.createClientStore({
22
25
  environmentId,
23
26
  storage: isSSR.isSSR() ? fakeStorage.fakeStorage : localStorage,
@@ -11,9 +11,12 @@ import { addVersionPostfixToUrl } from './functions/addVersionPostfixToUrl/addVe
11
11
  import { isSSR } from './functions/isSSR/isSSR.js';
12
12
  import { fakeStorage } from './constants/fakeStorage/fakeStorage.js';
13
13
  import { DisconnectError } from './errors/DisconnectError.js';
14
+ import { logger } from './constants/logger.js';
14
15
 
15
16
  const createGlobalWalletClient = ({ environmentId, popup: popupInfo, developmentOptions: { postfixPopupUrlWithVersion = true } = {}, }) => {
16
17
  const eventEmitter = createClientEventEmitter();
18
+ eventEmitter.on('connect', () => logger.logVerboseTroubleshootingMessage('EventEmitter: connect'));
19
+ eventEmitter.on('disconnect', () => logger.logVerboseTroubleshootingMessage('EventEmitter: disconnect'));
17
20
  const store = createClientStore({
18
21
  environmentId,
19
22
  storage: isSSR() ? fakeStorage : localStorage,
@@ -4,14 +4,11 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var isSSR = require('../../../functions/isSSR/isSSR.cjs');
7
+ var logger = require('../../../constants/logger.cjs');
7
8
 
8
- let lastEventHandler;
9
9
  const announceEip6963Provider = ({ info, provider, }) => {
10
10
  if (isSSR.isSSR()) {
11
- return;
12
- }
13
- if (lastEventHandler) {
14
- window.removeEventListener('eip6963:requestProvider', lastEventHandler);
11
+ return () => { };
15
12
  }
16
13
  const eip6963Event = {
17
14
  info: {
@@ -22,12 +19,16 @@ const announceEip6963Provider = ({ info, provider, }) => {
22
19
  },
23
20
  provider,
24
21
  };
25
- lastEventHandler = () => {
22
+ const lastEventHandler = () => {
23
+ logger.logger.logVerboseTroubleshootingMessage('EIP6963 announce provider', eip6963Event);
26
24
  window.dispatchEvent(new CustomEvent('eip6963:announceProvider', {
27
25
  detail: eip6963Event,
28
26
  }));
29
27
  };
30
28
  window.addEventListener('eip6963:requestProvider', lastEventHandler);
29
+ return () => {
30
+ window.removeEventListener('eip6963:requestProvider', lastEventHandler);
31
+ };
31
32
  };
32
33
 
33
34
  exports.announceEip6963Provider = announceEip6963Provider;
@@ -46,5 +46,5 @@ type AnnounceEip6963ProviderProps = {
46
46
  };
47
47
  provider: EIP1193Provider;
48
48
  };
49
- export declare const announceEip6963Provider: ({ info, provider, }: AnnounceEip6963ProviderProps) => void;
49
+ export declare const announceEip6963Provider: ({ info, provider, }: AnnounceEip6963ProviderProps) => () => void;
50
50
  export {};
@@ -1,13 +1,10 @@
1
1
  'use client'
2
2
  import { isSSR } from '../../../functions/isSSR/isSSR.js';
3
+ import { logger } from '../../../constants/logger.js';
3
4
 
4
- let lastEventHandler;
5
5
  const announceEip6963Provider = ({ info, provider, }) => {
6
6
  if (isSSR()) {
7
- return;
8
- }
9
- if (lastEventHandler) {
10
- window.removeEventListener('eip6963:requestProvider', lastEventHandler);
7
+ return () => { };
11
8
  }
12
9
  const eip6963Event = {
13
10
  info: {
@@ -18,12 +15,16 @@ const announceEip6963Provider = ({ info, provider, }) => {
18
15
  },
19
16
  provider,
20
17
  };
21
- lastEventHandler = () => {
18
+ const lastEventHandler = () => {
19
+ logger.logVerboseTroubleshootingMessage('EIP6963 announce provider', eip6963Event);
22
20
  window.dispatchEvent(new CustomEvent('eip6963:announceProvider', {
23
21
  detail: eip6963Event,
24
22
  }));
25
23
  };
26
24
  window.addEventListener('eip6963:requestProvider', lastEventHandler);
25
+ return () => {
26
+ window.removeEventListener('eip6963:requestProvider', lastEventHandler);
27
+ };
27
28
  };
28
29
 
29
30
  export { announceEip6963Provider };
@@ -9,6 +9,7 @@ var eventemitter3 = require('eventemitter3');
9
9
  var isNetworkSupported = require('../isNetworkSupported/isNetworkSupported.cjs');
10
10
  var PopupClosedError = require('../../../errors/PopupClosedError.cjs');
11
11
  var DisconnectError = require('../../../errors/DisconnectError.cjs');
12
+ var logger = require('../../../constants/logger.cjs');
12
13
 
13
14
  const createEIP1193Provider = (client) => {
14
15
  const eventEmitter = new eventemitter3.EventEmitter();
@@ -27,27 +28,43 @@ const createEIP1193Provider = (client) => {
27
28
  on: eventEmitter.on.bind(eventEmitter),
28
29
  removeListener: eventEmitter.removeListener.bind(eventEmitter),
29
30
  request: ((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ method, params }) {
30
- const methodHandlerMap = {
31
- eth_accounts: () => handleEthAccounts(client),
32
- eth_chainId: () => handleEthChainId(client),
33
- eth_requestAccounts: () => handleEthRequestAccounts(client),
34
- eth_sendTransaction: () => handleMethodInPopup({
35
- client,
36
- method: 'eth_sendTransaction',
31
+ try {
32
+ const methodHandlerMap = {
33
+ eth_accounts: () => handleEthAccounts(client),
34
+ eth_chainId: () => handleEthChainId(client),
35
+ eth_requestAccounts: () => handleEthRequestAccounts(client),
36
+ eth_sendTransaction: () => handleMethodInPopup({
37
+ client,
38
+ method: 'eth_sendTransaction',
39
+ params,
40
+ }),
41
+ personal_sign: () => handleMethodInPopup({ client, method: 'personal_sign', params }),
42
+ wallet_requestPermissions: () => handleEthRequestAccounts(client),
43
+ wallet_revokePermissions: () => handleWalletRevokePermissions(client),
44
+ wallet_switchEthereumChain: () => handleWalletSwitchEthereumChain(client, eventEmitter, params),
45
+ };
46
+ const handler = methodHandlerMap[method];
47
+ if (handler) {
48
+ const result = yield handler();
49
+ logger.logger.logVerboseTroubleshootingMessage('EIP1193Provider request', {
50
+ method,
51
+ params,
52
+ result,
53
+ });
54
+ return result;
55
+ }
56
+ throw new viem.UnsupportedProviderMethodError(new Error('Method not implemented'), {
57
+ method,
58
+ });
59
+ }
60
+ catch (error) {
61
+ logger.logger.logVerboseTroubleshootingMessage('EIP1193Provider request error', {
62
+ error,
63
+ method,
37
64
  params,
38
- }),
39
- personal_sign: () => handleMethodInPopup({ client, method: 'personal_sign', params }),
40
- wallet_requestPermissions: () => handleEthRequestAccounts(client),
41
- wallet_revokePermissions: () => handleWalletRevokePermissions(client),
42
- wallet_switchEthereumChain: () => handleWalletSwitchEthereumChain(client, eventEmitter, params),
43
- };
44
- const handler = methodHandlerMap[method];
45
- if (handler) {
46
- return handler();
65
+ });
66
+ throw error;
47
67
  }
48
- throw new viem.UnsupportedProviderMethodError(new Error('Method not implemented'), {
49
- method,
50
- });
51
68
  })),
52
69
  };
53
70
  };
@@ -5,6 +5,7 @@ import { EventEmitter } from 'eventemitter3';
5
5
  import { isNetworkSupported } from '../isNetworkSupported/isNetworkSupported.js';
6
6
  import { PopupClosedError } from '../../../errors/PopupClosedError.js';
7
7
  import { DisconnectError } from '../../../errors/DisconnectError.js';
8
+ import { logger } from '../../../constants/logger.js';
8
9
 
9
10
  const createEIP1193Provider = (client) => {
10
11
  const eventEmitter = new EventEmitter();
@@ -23,27 +24,43 @@ const createEIP1193Provider = (client) => {
23
24
  on: eventEmitter.on.bind(eventEmitter),
24
25
  removeListener: eventEmitter.removeListener.bind(eventEmitter),
25
26
  request: ((_a) => __awaiter(void 0, [_a], void 0, function* ({ method, params }) {
26
- const methodHandlerMap = {
27
- eth_accounts: () => handleEthAccounts(client),
28
- eth_chainId: () => handleEthChainId(client),
29
- eth_requestAccounts: () => handleEthRequestAccounts(client),
30
- eth_sendTransaction: () => handleMethodInPopup({
31
- client,
32
- method: 'eth_sendTransaction',
27
+ try {
28
+ const methodHandlerMap = {
29
+ eth_accounts: () => handleEthAccounts(client),
30
+ eth_chainId: () => handleEthChainId(client),
31
+ eth_requestAccounts: () => handleEthRequestAccounts(client),
32
+ eth_sendTransaction: () => handleMethodInPopup({
33
+ client,
34
+ method: 'eth_sendTransaction',
35
+ params,
36
+ }),
37
+ personal_sign: () => handleMethodInPopup({ client, method: 'personal_sign', params }),
38
+ wallet_requestPermissions: () => handleEthRequestAccounts(client),
39
+ wallet_revokePermissions: () => handleWalletRevokePermissions(client),
40
+ wallet_switchEthereumChain: () => handleWalletSwitchEthereumChain(client, eventEmitter, params),
41
+ };
42
+ const handler = methodHandlerMap[method];
43
+ if (handler) {
44
+ const result = yield handler();
45
+ logger.logVerboseTroubleshootingMessage('EIP1193Provider request', {
46
+ method,
47
+ params,
48
+ result,
49
+ });
50
+ return result;
51
+ }
52
+ throw new UnsupportedProviderMethodError(new Error('Method not implemented'), {
53
+ method,
54
+ });
55
+ }
56
+ catch (error) {
57
+ logger.logVerboseTroubleshootingMessage('EIP1193Provider request error', {
58
+ error,
59
+ method,
33
60
  params,
34
- }),
35
- personal_sign: () => handleMethodInPopup({ client, method: 'personal_sign', params }),
36
- wallet_requestPermissions: () => handleEthRequestAccounts(client),
37
- wallet_revokePermissions: () => handleWalletRevokePermissions(client),
38
- wallet_switchEthereumChain: () => handleWalletSwitchEthereumChain(client, eventEmitter, params),
39
- };
40
- const handler = methodHandlerMap[method];
41
- if (handler) {
42
- return handler();
61
+ });
62
+ throw error;
43
63
  }
44
- throw new UnsupportedProviderMethodError(new Error('Method not implemented'), {
45
- method,
46
- });
47
64
  })),
48
65
  };
49
66
  };
@@ -10,6 +10,7 @@ var onPopupClose = require('../onPopupClose/onPopupClose.cjs');
10
10
  var mergeAndEncryptParams = require('../mergeAndEncryptParams/mergeAndEncryptParams.cjs');
11
11
  var getCenteredPopupFeatures = require('../getCenteredPopupFeatures/getCenteredPopupFeatures.cjs');
12
12
  var PopupClosedError = require('../../errors/PopupClosedError.cjs');
13
+ var logger = require('../../constants/logger.cjs');
13
14
 
14
15
  const createPopupOpener = ({ environmentId, popupUrl, popupWidth = 420, popupHeight = 640, store, popupActionTimeout = 1000, // Wait page up to 1 second for new actions before closing
15
16
  onError, }) => {
@@ -17,12 +18,17 @@ onError, }) => {
17
18
  let didOpenPopup = false;
18
19
  let lastActionId = null;
19
20
  const closePopup = () => {
21
+ logger.logger.logVerboseTroubleshootingMessage('closePopup', { lastActionId });
20
22
  popup === null || popup === void 0 ? void 0 : popup.close();
21
23
  popup = null;
22
24
  didOpenPopup = false;
23
25
  lastActionId = null;
24
26
  };
25
27
  return (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ params, pathname, }) {
28
+ logger.logger.logVerboseTroubleshootingMessage('new popup action', {
29
+ params,
30
+ pathname,
31
+ });
26
32
  // Used as a unique identifier for the action
27
33
  const actionId = new Date().getTime();
28
34
  lastActionId = actionId;
@@ -79,7 +85,20 @@ onError, }) => {
79
85
  }
80
86
  didOpenPopup = true;
81
87
  return resultDeferredPromise.promise
88
+ .then((result) => {
89
+ logger.logger.logVerboseTroubleshootingMessage('popup action result', {
90
+ actionId,
91
+ lastActionId,
92
+ result,
93
+ });
94
+ return result;
95
+ })
82
96
  .catch((err) => {
97
+ logger.logger.logVerboseTroubleshootingMessage('popup action error', {
98
+ actionId,
99
+ err,
100
+ lastActionId,
101
+ });
83
102
  onError === null || onError === void 0 ? void 0 : onError(err);
84
103
  closePopup();
85
104
  throw err;
@@ -6,6 +6,7 @@ import { onPopupClose } from '../onPopupClose/onPopupClose.js';
6
6
  import { mergeAndEncryptParams } from '../mergeAndEncryptParams/mergeAndEncryptParams.js';
7
7
  import { getCenteredPopupFeatures } from '../getCenteredPopupFeatures/getCenteredPopupFeatures.js';
8
8
  import { PopupClosedError } from '../../errors/PopupClosedError.js';
9
+ import { logger } from '../../constants/logger.js';
9
10
 
10
11
  const createPopupOpener = ({ environmentId, popupUrl, popupWidth = 420, popupHeight = 640, store, popupActionTimeout = 1000, // Wait page up to 1 second for new actions before closing
11
12
  onError, }) => {
@@ -13,12 +14,17 @@ onError, }) => {
13
14
  let didOpenPopup = false;
14
15
  let lastActionId = null;
15
16
  const closePopup = () => {
17
+ logger.logVerboseTroubleshootingMessage('closePopup', { lastActionId });
16
18
  popup === null || popup === void 0 ? void 0 : popup.close();
17
19
  popup = null;
18
20
  didOpenPopup = false;
19
21
  lastActionId = null;
20
22
  };
21
23
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, pathname, }) {
24
+ logger.logVerboseTroubleshootingMessage('new popup action', {
25
+ params,
26
+ pathname,
27
+ });
22
28
  // Used as a unique identifier for the action
23
29
  const actionId = new Date().getTime();
24
30
  lastActionId = actionId;
@@ -75,7 +81,20 @@ onError, }) => {
75
81
  }
76
82
  didOpenPopup = true;
77
83
  return resultDeferredPromise.promise
84
+ .then((result) => {
85
+ logger.logVerboseTroubleshootingMessage('popup action result', {
86
+ actionId,
87
+ lastActionId,
88
+ result,
89
+ });
90
+ return result;
91
+ })
78
92
  .catch((err) => {
93
+ logger.logVerboseTroubleshootingMessage('popup action error', {
94
+ actionId,
95
+ err,
96
+ lastActionId,
97
+ });
79
98
  onError === null || onError === void 0 ? void 0 : onError(err);
80
99
  closePopup();
81
100
  throw err;
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var store = require('@dynamic-labs/store');
7
+ var logger = require('../constants/logger.cjs');
7
8
 
8
9
  const createClientStore = ({ environmentId, storage = localStorage, }) => {
9
10
  const store$1 = store.persist({
@@ -22,6 +23,7 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
22
23
  * Resets the store to its initial state
23
24
  */
24
25
  clear: () => {
26
+ logger.logger.logVerboseTroubleshootingMessage('clear store');
25
27
  store$1.setState(store$1.getInitialState());
26
28
  },
27
29
  /**
@@ -41,6 +43,7 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
41
43
  return null;
42
44
  }
43
45
  if (connection.expiresAt < Date.now()) {
46
+ logger.logger.logVerboseTroubleshootingMessage('Connection expired');
44
47
  // Clear the connection if it has expired
45
48
  store$1.setState(store$1.getInitialState());
46
49
  return null;
@@ -53,6 +56,12 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
53
56
  * @param {GlobalWalletConnection | null} connection - The connection to store, or null to clear it
54
57
  */
55
58
  setInitialConnectionState: ({ connection, wallets, ethereum, solana, }) => {
59
+ logger.logger.logVerboseTroubleshootingMessage('setInitialConnectionState', {
60
+ connection,
61
+ ethereum,
62
+ solana,
63
+ wallets,
64
+ });
56
65
  store$1.setState({ connection, ethereum, solana, wallets });
57
66
  },
58
67
  /**
@@ -75,6 +84,10 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
75
84
  store$1.setState({
76
85
  ethereum: Object.assign(Object.assign({}, ethereum), { currentNetworkId: networkId }),
77
86
  });
87
+ logger.logger.logVerboseTroubleshootingMessage('switchEthereumNetwork', {
88
+ from: Object.assign({}, ethereum),
89
+ to: store$1.getState().ethereum,
90
+ });
78
91
  },
79
92
  /**
80
93
  * Get all wallets connected to the current connection
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { persist, createStore } from '@dynamic-labs/store';
3
+ import { logger } from '../constants/logger.js';
3
4
 
4
5
  const createClientStore = ({ environmentId, storage = localStorage, }) => {
5
6
  const store = persist({
@@ -18,6 +19,7 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
18
19
  * Resets the store to its initial state
19
20
  */
20
21
  clear: () => {
22
+ logger.logVerboseTroubleshootingMessage('clear store');
21
23
  store.setState(store.getInitialState());
22
24
  },
23
25
  /**
@@ -37,6 +39,7 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
37
39
  return null;
38
40
  }
39
41
  if (connection.expiresAt < Date.now()) {
42
+ logger.logVerboseTroubleshootingMessage('Connection expired');
40
43
  // Clear the connection if it has expired
41
44
  store.setState(store.getInitialState());
42
45
  return null;
@@ -49,6 +52,12 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
49
52
  * @param {GlobalWalletConnection | null} connection - The connection to store, or null to clear it
50
53
  */
51
54
  setInitialConnectionState: ({ connection, wallets, ethereum, solana, }) => {
55
+ logger.logVerboseTroubleshootingMessage('setInitialConnectionState', {
56
+ connection,
57
+ ethereum,
58
+ solana,
59
+ wallets,
60
+ });
52
61
  store.setState({ connection, ethereum, solana, wallets });
53
62
  },
54
63
  /**
@@ -71,6 +80,10 @@ const createClientStore = ({ environmentId, storage = localStorage, }) => {
71
80
  store.setState({
72
81
  ethereum: Object.assign(Object.assign({}, ethereum), { currentNetworkId: networkId }),
73
82
  });
83
+ logger.logVerboseTroubleshootingMessage('switchEthereumNetwork', {
84
+ from: Object.assign({}, ethereum),
85
+ to: store.getState().ethereum,
86
+ });
74
87
  },
75
88
  /**
76
89
  * Get all wallets connected to the current connection