@dynamic-labs/multi-wallet 0.16.21 → 0.16.23

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,17 @@
1
1
 
2
+ ### [0.16.23](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.22...v0.16.23) (2023-06-09)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * don't remove network config from ls if there's a connected wallet ([#2283](https://github.com/dynamic-labs/DynamicAuth/issues/2283)) ([cb955c2](https://github.com/dynamic-labs/DynamicAuth/commit/cb955c2b0f48ac582cc763fe81b888219cf94c82))
8
+
9
+ ### [0.16.22](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.21...v0.16.22) (2023-06-06)
10
+
11
+ ### Bug Fixes
12
+
13
+ * load primary wallet on first render ([#2263](https://github.com/dynamic-labs/DynamicAuth/pull/2263)) ([8079097](https://github.com/dynamic-labs/DynamicAuth/commit/8079097ade98ab3e302d14dc971792531cd2286d))
14
+ *
2
15
  ### [0.16.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.20...v0.16.21) (2023-06-05)
3
16
 
4
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/multi-wallet",
3
- "version": "0.16.21",
3
+ "version": "0.16.23",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -28,8 +28,8 @@
28
28
  "magic-sdk": "^16.0.1",
29
29
  "@keplr-wallet/provider": "0.11.56",
30
30
  "@keplr-wallet/types": "^0.11.51",
31
- "@dynamic-labs/logger": "0.16.21",
32
- "@dynamic-labs/wallet-connector-core": "0.16.21"
31
+ "@dynamic-labs/logger": "0.16.23",
32
+ "@dynamic-labs/wallet-connector-core": "0.16.23"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@walletconnect/types": "^2.2.1"
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib = require('tslib');
6
5
  var walletBook = require('@dynamic-labs/wallet-book');
7
6
  var phantom = require('./wallets/solana/phantom.cjs');
8
7
  var coinbase = require('./wallets/ethereum/coinbase.cjs');
@@ -34,6 +33,7 @@ var getWalletConnectConnector = require('./wallets/getWalletConnectConnector.cjs
34
33
  var initializeWalletProviders = require('./wallets/initializeWalletProviders.cjs');
35
34
  var Dawn = require('./wallets/ethereum/injected/Dawn.cjs');
36
35
  var PhantomEvm = require('./wallets/ethereum/injected/PhantomEvm.cjs');
36
+ require('tslib');
37
37
  require('ethers');
38
38
  require('./utils/logger.cjs');
39
39
  require('./wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs');
@@ -75,7 +75,7 @@ const getSupportedWallets = ({ appLogoUrl, appName, isWalletConnectV2Enabled, ne
75
75
  skipMemo: false,
76
76
  vendorCredentials: {},
77
77
  walletConnectProjectId: '',
78
- }) => tslib.__awaiter(void 0, void 0, void 0, function* () {
78
+ }) => {
79
79
  if (!skipMemo && wallets.length > 0) {
80
80
  return wallets;
81
81
  }
@@ -160,7 +160,7 @@ const getSupportedWallets = ({ appLogoUrl, appName, isWalletConnectV2Enabled, ne
160
160
  : []),
161
161
  ...filtered,
162
162
  ];
163
- yield initializeWalletProviders.initializeWalletProviders({
163
+ initializeWalletProviders.initializeWalletProviders({
164
164
  evmNetworks: evmNetworkConfigs,
165
165
  isWalletConnectV2Enabled,
166
166
  walletConnectProjectId,
@@ -169,7 +169,7 @@ const getSupportedWallets = ({ appLogoUrl, appName, isWalletConnectV2Enabled, ne
169
169
  const filteredWallets = filterWalletsForPlatform(allWallets);
170
170
  wallets = applyLinksOverrides(filteredWallets);
171
171
  return wallets;
172
- });
172
+ };
173
173
  const applyLinksOverrides = (wallets) => wallets.map((wallet) => {
174
174
  const metadata = walletBook.getWalletBookWallet(wallet.name);
175
175
  if (metadata.switchNetworkOnlyFromWallet !== undefined) {
@@ -248,8 +248,8 @@ const getSupportedChainsForWalletConnector = (walletConnector) => {
248
248
  });
249
249
  return [...chainSet];
250
250
  };
251
- const getEnabledWallets = (props) => tslib.__awaiter(void 0, void 0, void 0, function* () {
252
- const supportedWallets = yield getSupportedWallets(props.getSupportedWalletOpts);
251
+ const getEnabledWallets = (props) => {
252
+ const supportedWallets = getSupportedWallets(props.getSupportedWalletOpts);
253
253
  const isKeplrWalletEnabled = (wallet) => wallet.name.includes('Keplr') &&
254
254
  props.enabledNetworks.includes(wallet.networkId) &&
255
255
  wallet.isInstalledOnBrowser() === props.installed;
@@ -258,7 +258,7 @@ const getEnabledWallets = (props) => tslib.__awaiter(void 0, void 0, void 0, fun
258
258
  wallet.isInstalledOnBrowser() === props.installed) ||
259
259
  wallet.key === 'magiclink');
260
260
  return allEnabledWallets;
261
- });
261
+ };
262
262
 
263
263
  exports.phantomLedgerWalletName = phantomLedger.walletName;
264
264
  exports.filteredWalletConnectWallets = filteredWalletConnectWallets;
@@ -9,4 +9,4 @@ export declare const getEnabledWallets: (props: {
9
9
  enabledNetworks: number[];
10
10
  getSupportedWalletOpts: GetSupportedWalletsOpts;
11
11
  installed: boolean;
12
- }) => Promise<WalletConnector[]>;
12
+ }) => WalletConnector[];
@@ -1,4 +1,3 @@
1
- import { __awaiter } from 'tslib';
2
1
  import { getWalletBookWallet, getWalletLinks } from '@dynamic-labs/wallet-book';
3
2
  import Phantom from './wallets/solana/phantom.js';
4
3
  import Coinbase from './wallets/ethereum/coinbase.js';
@@ -31,6 +30,7 @@ import { getWalletConnectConnector } from './wallets/getWalletConnectConnector.j
31
30
  import { initializeWalletProviders } from './wallets/initializeWalletProviders.js';
32
31
  import Dawn from './wallets/ethereum/injected/Dawn.js';
33
32
  import PhantomEvm from './wallets/ethereum/injected/PhantomEvm.js';
33
+ import 'tslib';
34
34
  import 'ethers';
35
35
  import './utils/logger.js';
36
36
  import './wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js';
@@ -72,7 +72,7 @@ const getSupportedWallets = ({ appLogoUrl, appName, isWalletConnectV2Enabled, ne
72
72
  skipMemo: false,
73
73
  vendorCredentials: {},
74
74
  walletConnectProjectId: '',
75
- }) => __awaiter(void 0, void 0, void 0, function* () {
75
+ }) => {
76
76
  if (!skipMemo && wallets.length > 0) {
77
77
  return wallets;
78
78
  }
@@ -157,7 +157,7 @@ const getSupportedWallets = ({ appLogoUrl, appName, isWalletConnectV2Enabled, ne
157
157
  : []),
158
158
  ...filtered,
159
159
  ];
160
- yield initializeWalletProviders({
160
+ initializeWalletProviders({
161
161
  evmNetworks: evmNetworkConfigs,
162
162
  isWalletConnectV2Enabled,
163
163
  walletConnectProjectId,
@@ -166,7 +166,7 @@ const getSupportedWallets = ({ appLogoUrl, appName, isWalletConnectV2Enabled, ne
166
166
  const filteredWallets = filterWalletsForPlatform(allWallets);
167
167
  wallets = applyLinksOverrides(filteredWallets);
168
168
  return wallets;
169
- });
169
+ };
170
170
  const applyLinksOverrides = (wallets) => wallets.map((wallet) => {
171
171
  const metadata = getWalletBookWallet(wallet.name);
172
172
  if (metadata.switchNetworkOnlyFromWallet !== undefined) {
@@ -245,8 +245,8 @@ const getSupportedChainsForWalletConnector = (walletConnector) => {
245
245
  });
246
246
  return [...chainSet];
247
247
  };
248
- const getEnabledWallets = (props) => __awaiter(void 0, void 0, void 0, function* () {
249
- const supportedWallets = yield getSupportedWallets(props.getSupportedWalletOpts);
248
+ const getEnabledWallets = (props) => {
249
+ const supportedWallets = getSupportedWallets(props.getSupportedWalletOpts);
250
250
  const isKeplrWalletEnabled = (wallet) => wallet.name.includes('Keplr') &&
251
251
  props.enabledNetworks.includes(wallet.networkId) &&
252
252
  wallet.isInstalledOnBrowser() === props.installed;
@@ -255,6 +255,6 @@ const getEnabledWallets = (props) => __awaiter(void 0, void 0, void 0, function*
255
255
  wallet.isInstalledOnBrowser() === props.installed) ||
256
256
  wallet.key === 'magiclink');
257
257
  return allEnabledWallets;
258
- });
258
+ };
259
259
 
260
260
  export { filteredWalletConnectWallets, getEnabledWallets, getSupportedChainsForWalletConnector, getSupportedWallets };
package/src/types.d.ts CHANGED
@@ -39,7 +39,7 @@ export type GetSupportedWalletsOpts = {
39
39
  walletConnectProjectId: string | undefined;
40
40
  walletUiUtils?: WalletUiUtils;
41
41
  };
42
- export type GetSupportedWallets = (opts?: GetSupportedWalletsOpts) => Promise<WalletConnector[]>;
42
+ export type GetSupportedWallets = (opts?: GetSupportedWalletsOpts) => WalletConnector[];
43
43
  export type WalletUiUtils = {
44
44
  enableInternalSign: () => void;
45
45
  sendTransaction: (props: {
@@ -82,7 +82,7 @@ class EthProvider {
82
82
  networks: this.evmNetworks,
83
83
  });
84
84
  if (!network) {
85
- throw new errors.DynamicError('Could not find network');
85
+ throw new errors.DynamicError(`Could not find network mapping for chain ${networkName ? networkName : networkChainId}`);
86
86
  }
87
87
  if (!this.supportsNetworkSwitching()) {
88
88
  throw new errors.DynamicError('Network switching is not supported');
@@ -78,7 +78,7 @@ class EthProvider {
78
78
  networks: this.evmNetworks,
79
79
  });
80
80
  if (!network) {
81
- throw new DynamicError('Could not find network');
81
+ throw new DynamicError(`Could not find network mapping for chain ${networkName ? networkName : networkChainId}`);
82
82
  }
83
83
  if (!this.supportsNetworkSwitching()) {
84
84
  throw new DynamicError('Network switching is not supported');