@dynamic-labs/wagmi-connector 1.1.0-alpha.1 → 1.1.0-alpha.11

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,127 @@
1
1
 
2
+ ## [1.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.10...v1.1.0-alpha.11) (2024-01-17)
3
+
4
+
5
+ ### Features
6
+
7
+ * add Leather wallet and BtcKit connector ([#4335](https://github.com/dynamic-labs/DynamicAuth/issues/4335)) ([fe3316b](https://github.com/dynamic-labs/DynamicAuth/commit/fe3316b5be9ef17eea885e99cf925ccd0f271da7))
8
+ * add solana injected wallet configuration to walletbook ([#4375](https://github.com/dynamic-labs/DynamicAuth/issues/4375)) ([3677ce5](https://github.com/dynamic-labs/DynamicAuth/commit/3677ce5ff40d0c00bfaf0daa0d5d67bc40706ee0))
9
+ * add support for unisat wallet ([#4355](https://github.com/dynamic-labs/DynamicAuth/issues/4355)) ([5b7d6b0](https://github.com/dynamic-labs/DynamicAuth/commit/5b7d6b0a9ea84811a8252b3cdf30a3a8e410180c))
10
+ * add walletbook configurations for solana injected wallets ([#4360](https://github.com/dynamic-labs/DynamicAuth/issues/4360)) ([cdc8e5f](https://github.com/dynamic-labs/DynamicAuth/commit/cdc8e5f4878cb84e26e5b33299aa8547b84b6667))
11
+ * passkey renaming frontend ([#4331](https://github.com/dynamic-labs/DynamicAuth/issues/4331)) ([4551013](https://github.com/dynamic-labs/DynamicAuth/commit/4551013d577c914cb3aedfe458ab9eaa018aceb4))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * correctly update wallets connected flag after wallet switch ([#4397](https://github.com/dynamic-labs/DynamicAuth/issues/4397)) ([543a830](https://github.com/dynamic-labs/DynamicAuth/commit/543a830574f0d5a78fedbb9b18233e8dfbaddd86))
17
+ * export modal header ([#4401](https://github.com/dynamic-labs/DynamicAuth/issues/4401)) ([77cf016](https://github.com/dynamic-labs/DynamicAuth/commit/77cf016fc742458988864647870149a56e991ee4))
18
+ * trigger onAuthSuccess before embedded wallet creation ([4aa341a](https://github.com/dynamic-labs/DynamicAuth/commit/4aa341a1d08332a121daddb7c2dcb09a804a4de7))
19
+ * ui issues on react 17 ([#4373](https://github.com/dynamic-labs/DynamicAuth/issues/4373)) ([93096d6](https://github.com/dynamic-labs/DynamicAuth/commit/93096d6017816a4f0ed299bf618b130d90c81514))
20
+
21
+ ## [1.1.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.9...v1.1.0-alpha.10) (2024-01-06)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * pass flow network to magic client ([#4322](https://github.com/dynamic-labs/DynamicAuth/issues/4322)) ([f3adccf](https://github.com/dynamic-labs/DynamicAuth/commit/f3adccf9f8d835f6b04e4767acd0fbd2ac238379))
27
+ * prevent error message when mobile wallet app is open ([#4301](https://github.com/dynamic-labs/DynamicAuth/issues/4301)) ([2a66dcf](https://github.com/dynamic-labs/DynamicAuth/commit/2a66dcfaf8100b3d910c559d35d8b731b1cb380e))
28
+ * turnkeyWalletConnector is not an email otp connector and uses dynamic otp ([#4313](https://github.com/dynamic-labs/DynamicAuth/issues/4313)) ([e4ea56f](https://github.com/dynamic-labs/DynamicAuth/commit/e4ea56f40fdf97b3f5440b016ebd95501089cebe))
29
+
30
+ ## [1.1.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.8...v1.1.0-alpha.9) (2024-01-04)
31
+
32
+
33
+ ### Features
34
+
35
+ * add solana magic support ([#4258](https://github.com/dynamic-labs/DynamicAuth/issues/4258)) ([da726aa](https://github.com/dynamic-labs/DynamicAuth/commit/da726aa78466c52ee3e1f18952e4351cde754cbc))
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * edge case with unlinking wallet ([#4285](https://github.com/dynamic-labs/DynamicAuth/issues/4285)) ([1057fe4](https://github.com/dynamic-labs/DynamicAuth/commit/1057fe47599381f5d9dc39ce4cbeca2041c70319))
41
+ * remove normalizeWalletName from DynamicAuth ([5592817](https://github.com/dynamic-labs/DynamicAuth/commit/5592817b62e345319e04cca9a98276ffad87cfc2))
42
+ * **useFetchBalance:** ensure the latest wallet balance is fetched ([#4288](https://github.com/dynamic-labs/DynamicAuth/issues/4288)) ([25dd035](https://github.com/dynamic-labs/DynamicAuth/commit/25dd035cf8893b7cd28f550026134ba0eecda142))
43
+
44
+ ## [1.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.7...v1.1.0-alpha.8) (2024-01-03)
45
+
46
+
47
+ ### Features
48
+
49
+ * add new sdk view section for text ([#4280](https://github.com/dynamic-labs/DynamicAuth/issues/4280)) ([457ae38](https://github.com/dynamic-labs/DynamicAuth/commit/457ae38cd2be8dae078f40b54ffc4704299d4ed9))
50
+ * add new setShowLinkNewWalletModal method ([f46447a](https://github.com/dynamic-labs/DynamicAuth/commit/f46447ab606f4fdbf55e5fef21dd98f8f2650e90))
51
+ * add pk export for hd wallets ([#4266](https://github.com/dynamic-labs/DynamicAuth/issues/4266)) ([44aac69](https://github.com/dynamic-labs/DynamicAuth/commit/44aac69580ed44e66eab971f87cb6061a3fadc90))
52
+ * add starknet support for sopelia ([#4248](https://github.com/dynamic-labs/DynamicAuth/issues/4248)) ([f9a0980](https://github.com/dynamic-labs/DynamicAuth/commit/f9a0980c3cd2d6d95c5dd17b179fbd0931f08b1a))
53
+ * enable hardware wallet for solana wallets ([#4275](https://github.com/dynamic-labs/DynamicAuth/issues/4275)) ([704b380](https://github.com/dynamic-labs/DynamicAuth/commit/704b380186618a5a5793e88f36ccbe84b59a2e4a))
54
+
55
+
56
+ ### Bug Fixes
57
+
58
+ * phantom solana not connecting on mobile ([#4284](https://github.com/dynamic-labs/DynamicAuth/issues/4284)) ([6ad75f1](https://github.com/dynamic-labs/DynamicAuth/commit/6ad75f152896459f5cf658227f998c246b6a572b))
59
+ * use bitcoin payment address for onramp ([#4273](https://github.com/dynamic-labs/DynamicAuth/issues/4273)) ([a2f54e8](https://github.com/dynamic-labs/DynamicAuth/commit/a2f54e812a11a91ee488eca64f14b5eeea1a8874))
60
+
61
+ ## [1.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2023-12-28)
62
+
63
+
64
+ ### Features
65
+
66
+ * better coinbase deeplinking ux ([#4164](https://github.com/dynamic-labs/DynamicAuth/issues/4164)) ([5252608](https://github.com/dynamic-labs/DynamicAuth/commit/525260851900a33a52f129def338963400344205))
67
+
68
+
69
+ ### Bug Fixes
70
+
71
+ * don't prompt for connect when selecting bitcoin wallet if already connected ([#4265](https://github.com/dynamic-labs/DynamicAuth/issues/4265)) ([adef402](https://github.com/dynamic-labs/DynamicAuth/commit/adef402ef94270a17fab896a8585a7f2eacd3681))
72
+
73
+ ## [1.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.5...v1.1.0-alpha.6) (2023-12-27)
74
+
75
+
76
+ ### Features
77
+
78
+ * add multi-wallet-prompts-widget ([#4166](https://github.com/dynamic-labs/DynamicAuth/issues/4166)) ([151e3d2](https://github.com/dynamic-labs/DynamicAuth/commit/151e3d2e7bebbf18448e4af8eecbf660f713cd3d))
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * coinbase solana signMessage ([#4254](https://github.com/dynamic-labs/DynamicAuth/issues/4254)) ([f0300a9](https://github.com/dynamic-labs/DynamicAuth/commit/f0300a93ed6c9ba9dfab613820d8cedbe72abb87))
84
+ * make useConnectWithEmailOtp work cross views ([#4252](https://github.com/dynamic-labs/DynamicAuth/issues/4252)) ([a097119](https://github.com/dynamic-labs/DynamicAuth/commit/a097119556c38a22f338a783f79d512b99203cf5))
85
+
86
+ ## [1.1.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.4...v1.1.0-alpha.5) (2023-12-21)
87
+
88
+
89
+ ### Features
90
+
91
+ * add support for xverse wallet ([#4245](https://github.com/dynamic-labs/DynamicAuth/issues/4245)) ([7b68546](https://github.com/dynamic-labs/DynamicAuth/commit/7b6854684412007bcb33896555900936395176df))
92
+ * **gvty-526:** add embedded reveal ([#4233](https://github.com/dynamic-labs/DynamicAuth/issues/4233)) ([c2d0f90](https://github.com/dynamic-labs/DynamicAuth/commit/c2d0f903f4a4646f86c71834540fd49d51a4a7ae))
93
+
94
+ ## [1.1.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.3...v1.1.0-alpha.4) (2023-12-21)
95
+
96
+
97
+ ### Features
98
+
99
+ * add bitcoin integration ([#4216](https://github.com/dynamic-labs/DynamicAuth/issues/4216)) ([9584f1c](https://github.com/dynamic-labs/DynamicAuth/commit/9584f1cc3133835049ad1c53da980192263b8f21))
100
+ * add default footer to wallet list when tos and pp not enabled ([#4224](https://github.com/dynamic-labs/DynamicAuth/issues/4224)) ([0ad81c4](https://github.com/dynamic-labs/DynamicAuth/commit/0ad81c409bcb4aafb0dc565685525d620a95efce))
101
+ * adds useConnectWithEmailOtp ([#4234](https://github.com/dynamic-labs/DynamicAuth/issues/4234)) ([4a4e50a](https://github.com/dynamic-labs/DynamicAuth/commit/4a4e50ac8651c2a249d5125ae6bcf49aaf49be8c))
102
+
103
+ ## [1.1.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.2...v1.1.0-alpha.3) (2023-12-19)
104
+
105
+
106
+ ### Features
107
+
108
+ * add Flow support in magic wallet connector ([#4158](https://github.com/dynamic-labs/DynamicAuth/issues/4158)) ([fbbaea7](https://github.com/dynamic-labs/DynamicAuth/commit/fbbaea76b36ceb693f6bd4f2404dfa1204e61492))
109
+ * add showDynamicUserProfile to DynamicContext ([#4214](https://github.com/dynamic-labs/DynamicAuth/issues/4214)) ([2aeb8e3](https://github.com/dynamic-labs/DynamicAuth/commit/2aeb8e3c45a3d9f87bd9196ea9b46927e02eb633))
110
+
111
+
112
+ ### Bug Fixes
113
+
114
+ * add shortname to braveevm to allow for lookups by name as well as key ([#4213](https://github.com/dynamic-labs/DynamicAuth/issues/4213)) ([969b089](https://github.com/dynamic-labs/DynamicAuth/commit/969b089be516fb57fcdc941f908c078998eb4ec0))
115
+ * solflare connect ([#4215](https://github.com/dynamic-labs/DynamicAuth/issues/4215)) ([9a4164e](https://github.com/dynamic-labs/DynamicAuth/commit/9a4164e53198f33ef7201cd4e1eff745a09e9701))
116
+ * wagmi attempt to connect to primary wallet first ([#4206](https://github.com/dynamic-labs/DynamicAuth/issues/4206)) ([9e5fc8e](https://github.com/dynamic-labs/DynamicAuth/commit/9e5fc8ef026628935ac32d3bb0c22bda35057e5d))
117
+
118
+ ## [1.1.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.1...v1.1.0-alpha.2) (2023-12-18)
119
+
120
+
121
+ ### Bug Fixes
122
+
123
+ * increase timeout when fetching wallet network ([#4197](https://github.com/dynamic-labs/DynamicAuth/issues/4197)) ([bd43d45](https://github.com/dynamic-labs/DynamicAuth/commit/bd43d452dccf36f68bd012e5737480599b93c3b5))
124
+
2
125
  ## [1.1.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.0...v1.1.0-alpha.1) (2023-12-15)
3
126
 
4
127
  ## [1.1.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.14...v1.1.0-alpha.0) (2023-12-12)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wagmi-connector",
3
- "version": "1.1.0-alpha.1",
3
+ "version": "1.1.0-alpha.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -10,10 +10,10 @@
10
10
  "react": "^17.0.2 || ^18.0.0",
11
11
  "viem": "^1.19.13",
12
12
  "wagmi": "^1.4.12",
13
- "@dynamic-labs/rpc-providers": "1.1.0-alpha.1",
14
- "@dynamic-labs/sdk-react-core": "1.1.0-alpha.1",
15
- "@dynamic-labs/types": "1.1.0-alpha.1",
16
- "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.1",
13
+ "@dynamic-labs/rpc-providers": "1.1.0-alpha.11",
14
+ "@dynamic-labs/sdk-react-core": "1.1.0-alpha.11",
15
+ "@dynamic-labs/types": "1.1.0-alpha.11",
16
+ "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.11",
17
17
  "eventemitter3": "5.0.1"
18
18
  },
19
19
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import React, { useRef, useEffect, useMemo } from 'react';
1
+ import React, { useRef, useMemo, useEffect } from 'react';
2
2
  import { configureChains, mainnet, createConfig, WagmiConfig } from 'wagmi';
3
3
  import { publicProvider } from 'wagmi/providers/public';
4
4
  import { useDynamicContext, useUserWallets } from '@dynamic-labs/sdk-react-core';
@@ -7,6 +7,7 @@ import { getConnector } from './getConnector.js';
7
7
  import { getWagmiChainsFromDynamicChains } from './getWagmiChainsFromDynamicChains.js';
8
8
  import { getWagmiProvidersFromDynamicChains } from './getWagmiProvidersFromDynamicChains.js';
9
9
  import { SyncDynamicWagmi } from './SyncDynamicWagmi.js';
10
+ import { findAndOrderEvmWallets } from './utils/findAndOrderEvmWallets/findAndOrderEvmWallets.js';
10
11
 
11
12
  const { publicClient } = configureChains([mainnet], [publicProvider()]);
12
13
  const config = createConfig({
@@ -14,13 +15,15 @@ const config = createConfig({
14
15
  publicClient,
15
16
  });
16
17
  const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, children, }) => {
17
- const { networkConfigurations, handleLogOut, sendWagmiSettings } = useDynamicContext();
18
+ const { networkConfigurations, handleLogOut, sendWagmiSettings, primaryWallet, } = useDynamicContext();
18
19
  /**
19
20
  * This will prevent the wagmi Connector from calling handleLogOut when we are the ones calling disconnect
20
21
  * as a result of a handleLogOut call (see SyncDynamicWagmi), but will preserve the existing behavior for customers.
21
22
  */
22
23
  const preventWagmiSyncFromCallingLogout = useRef(false);
23
- const wallets = useUserWallets();
24
+ // Sort places the primary wallet as the first wallet to attempt to connect with
25
+ const wallets = useUserWallets().sort((wallet) => wallet.address === (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ? -1 : 1);
26
+ const evmWallets = useMemo(() => findAndOrderEvmWallets(primaryWallet, wallets), [primaryWallet, wallets]);
24
27
  useEffect(() => {
25
28
  // only send wagmi settings once, when the first time DynamicWagmiConnector renders
26
29
  sendWagmiSettings({
@@ -38,12 +41,12 @@ const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, child
38
41
  const mappedProviders = getWagmiProvidersFromDynamicChains(evmNetworks);
39
42
  return configureChains(mappedChains, mappedProviders);
40
43
  }, [customerSuppliedEvmNetworks, networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm]);
41
- const connector = useMemo(() => getConnector(wallets, (wallet) => new Connector({
44
+ const connector = useMemo(() => getConnector(evmWallets, (wallet) => new Connector({
42
45
  chains,
43
46
  handleLogOut,
44
47
  preventWagmiSyncFromCallingLogout,
45
48
  walletConnector: wallet.connector,
46
- })), [wallets, chains, handleLogOut, preventWagmiSyncFromCallingLogout]);
49
+ })), [evmWallets, chains, handleLogOut, preventWagmiSyncFromCallingLogout]);
47
50
  /**
48
51
  * Updating the wagmi config must be done in a useEffect because
49
52
  * when setting the public client and connectors, wagmi will fire
@@ -0,0 +1,2 @@
1
+ import { Wallet } from '@dynamic-labs/sdk-react-core';
2
+ export declare const findAndOrderEvmWallets: (primaryWallet: Wallet | null, wallets: Wallet[]) => Wallet[];
@@ -0,0 +1,13 @@
1
+ const evmWalletsFilter = (wallet) => wallet.connector.connectedChain === 'EVM';
2
+ const findAndOrderEvmWallets = (primaryWallet, wallets) => {
3
+ const isPrimaryWalletEvm = (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain) === 'EVM';
4
+ if (isPrimaryWalletEvm) {
5
+ const secondaryEvmWallets = wallets
6
+ .filter(evmWalletsFilter)
7
+ .filter((wallet) => wallet.address !== primaryWallet.address);
8
+ return [primaryWallet, ...secondaryEvmWallets];
9
+ }
10
+ return wallets.filter(evmWalletsFilter);
11
+ };
12
+
13
+ export { findAndOrderEvmWallets };
@@ -0,0 +1 @@
1
+ export { findAndOrderEvmWallets } from './findAndOrderEvmWallets';
@@ -1 +1,2 @@
1
1
  export * from './resolveRpcUrlFromEvmNetworks';
2
+ export * from './findAndOrderEvmWallets';