@dynamic-labs/sdk-react-core 3.0.0-alpha.63 → 3.0.0-alpha.64

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.
@@ -7,8 +7,8 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
8
  var utils = require('@dynamic-labs/utils');
9
9
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
10
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
10
11
  var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
11
- require('@dynamic-labs/sdk-api-core');
12
12
  require('../../../shared/logger.cjs');
13
13
  require('@dynamic-labs/iconic');
14
14
  require('react/jsx-runtime');
@@ -86,6 +86,11 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
86
86
  yield disconnectWallet(storedConnectedWalletInfo.id);
87
87
  return null;
88
88
  }
89
+ if (walletConnectorCore.isHardwareWalletConnector(walletConnector) &&
90
+ storedConnectedWalletInfo.hardwareWallet ===
91
+ sdkApiCore.HardwareWalletEnum.Ledger) {
92
+ walletConnector.isHardwareWalletEnabled = true;
93
+ }
89
94
  const [walletAddress] = yield walletConnector.getConnectedAccounts();
90
95
  if (!walletAddress) {
91
96
  yield disconnectWallet(storedConnectedWalletInfo.id);
@@ -141,7 +146,15 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
141
146
  // Keeps connected wallet data inside localStorage
142
147
  const applyConnectedWalletToStore = ({ walletId, walletConnectorKey, walletChain, provider, }) => {
143
148
  const updatedConnectedWalletsInfo = [...connectedWalletsInfo];
149
+ const walletConnectors = walletConnectorOptions.map((wallet) => wallet.walletConnector);
150
+ const walletConnector = walletConnectorCore.getWalletConnectorByKey(walletConnectors, walletConnectorKey);
151
+ const hardwareWallet = walletConnector &&
152
+ walletConnectorCore.isHardwareWalletConnector(walletConnector) &&
153
+ walletConnector.isHardwareWalletEnabled
154
+ ? sdkApiCore.HardwareWalletEnum.Ledger
155
+ : undefined;
144
156
  updatedConnectedWalletsInfo.push({
157
+ hardwareWallet,
145
158
  id: walletId,
146
159
  provider,
147
160
  walletChain,
@@ -1,5 +1,6 @@
1
1
  import { UserProfile } from '@dynamic-labs/types';
2
2
  import { Chain, GetAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
3
+ import { HardwareWalletEnum } from '@dynamic-labs/sdk-api-core';
3
4
  import { SetShowAuthFlow } from '../../../context/DynamicContext/hooks';
4
5
  import { ConnectWalletResult } from '../../../context/DynamicContext/types';
5
6
  import { AuthModeType, HandleConnectedWallet, WalletOption, Wallet } from '../../../shared';
@@ -8,6 +9,7 @@ export type ConnectedWalletConnectorType = {
8
9
  walletChain?: Chain;
9
10
  walletConnectorKey: string;
10
11
  provider: string;
12
+ hardwareWallet: HardwareWalletEnum | undefined;
11
13
  };
12
14
  export type UseConnectWalletProps = {
13
15
  authMode: AuthModeType;
@@ -2,9 +2,9 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useState, useCallback, useEffect } from 'react';
4
4
  import { MissingPublicAddressError } from '@dynamic-labs/utils';
5
- import { getWalletConnectorByKey, logger } from '@dynamic-labs/wallet-connector-core';
5
+ import { getWalletConnectorByKey, logger, isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
6
+ import { HardwareWalletEnum } from '@dynamic-labs/sdk-api-core';
6
7
  import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
7
- import '@dynamic-labs/sdk-api-core';
8
8
  import '../../../shared/logger.js';
9
9
  import '@dynamic-labs/iconic';
10
10
  import 'react/jsx-runtime';
@@ -82,6 +82,11 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
82
82
  yield disconnectWallet(storedConnectedWalletInfo.id);
83
83
  return null;
84
84
  }
85
+ if (isHardwareWalletConnector(walletConnector) &&
86
+ storedConnectedWalletInfo.hardwareWallet ===
87
+ HardwareWalletEnum.Ledger) {
88
+ walletConnector.isHardwareWalletEnabled = true;
89
+ }
85
90
  const [walletAddress] = yield walletConnector.getConnectedAccounts();
86
91
  if (!walletAddress) {
87
92
  yield disconnectWallet(storedConnectedWalletInfo.id);
@@ -137,7 +142,15 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
137
142
  // Keeps connected wallet data inside localStorage
138
143
  const applyConnectedWalletToStore = ({ walletId, walletConnectorKey, walletChain, provider, }) => {
139
144
  const updatedConnectedWalletsInfo = [...connectedWalletsInfo];
145
+ const walletConnectors = walletConnectorOptions.map((wallet) => wallet.walletConnector);
146
+ const walletConnector = getWalletConnectorByKey(walletConnectors, walletConnectorKey);
147
+ const hardwareWallet = walletConnector &&
148
+ isHardwareWalletConnector(walletConnector) &&
149
+ walletConnector.isHardwareWalletEnabled
150
+ ? HardwareWalletEnum.Ledger
151
+ : undefined;
140
152
  updatedConnectedWalletsInfo.push({
153
+ hardwareWallet,
141
154
  id: walletId,
142
155
  provider,
143
156
  walletChain,