@dynamic-labs/wagmi-connector 2.0.0-alpha.10 → 2.0.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,31 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.10...v2.0.0-alpha.11) (2024-03-12)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* rename FetchPublicAddressOpts to GetAddressOpts (#4910)
|
|
8
|
+
* remove use effect in useWalletEventListeners (#4843)
|
|
9
|
+
* rename fetchPublicAddress to getAddress (#4851)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Add farcaster to iconic ([#4925](https://github.com/dynamic-labs/DynamicAuth/issues/4925)) ([ab282dc](https://github.com/dynamic-labs/DynamicAuth/commit/ab282dc9cdcc0fe11f014d002b056ef4d3b34234))
|
|
14
|
+
* use transaction confirmation ui on signAndSendTransaction for solana embedded wallets ([#4909](https://github.com/dynamic-labs/DynamicAuth/issues/4909)) ([d77e89e](https://github.com/dynamic-labs/DynamicAuth/commit/d77e89ecff9dfc67ed48537f541a9995b2662e1e))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* add back connect button css variables ([#4922](https://github.com/dynamic-labs/DynamicAuth/issues/4922)) ([1119d62](https://github.com/dynamic-labs/DynamicAuth/commit/1119d62c2db6504952393060930524c3823e4a00))
|
|
20
|
+
* keep adaptive wallet list height ([#4916](https://github.com/dynamic-labs/DynamicAuth/issues/4916)) ([62aa54e](https://github.com/dynamic-labs/DynamicAuth/commit/62aa54e81d563082f7aa519f2ff2b5132e7dd83d))
|
|
21
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([17a143f](https://github.com/dynamic-labs/DynamicAuth/commit/17a143f87a77e56227b2517038c20cf67f8e08bf))
|
|
22
|
+
* update walletbook to fix zerion in-app browser detection issue ([#4917](https://github.com/dynamic-labs/DynamicAuth/issues/4917)) ([48b05d7](https://github.com/dynamic-labs/DynamicAuth/commit/48b05d78e4f7add09787b64505723d4eca34d3e0))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* remove use effect in useWalletEventListeners ([#4843](https://github.com/dynamic-labs/DynamicAuth/issues/4843)) ([2e948bb](https://github.com/dynamic-labs/DynamicAuth/commit/2e948bbca0dbdceab7460a844d0988eacd47f581))
|
|
26
|
+
* rename fetchPublicAddress to getAddress ([#4851](https://github.com/dynamic-labs/DynamicAuth/issues/4851)) ([668e7dd](https://github.com/dynamic-labs/DynamicAuth/commit/668e7dd62e1f323dbe64209b5c59c2cd0ee45d61))
|
|
27
|
+
* rename FetchPublicAddressOpts to GetAddressOpts ([#4910](https://github.com/dynamic-labs/DynamicAuth/issues/4910)) ([e5e4b1b](https://github.com/dynamic-labs/DynamicAuth/commit/e5e4b1b08a4e010afa44f8abb0bf6af7f236a86a))
|
|
28
|
+
|
|
2
29
|
## [2.0.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2024-03-08)
|
|
3
30
|
|
|
4
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wagmi-connector",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"viem": "2.7.6",
|
|
13
13
|
"wagmi": "2.5.7",
|
|
14
|
-
"@dynamic-labs/
|
|
15
|
-
"@dynamic-labs/
|
|
16
|
-
"@dynamic-labs/
|
|
17
|
-
"@dynamic-labs/
|
|
14
|
+
"@dynamic-labs/logger": "2.0.0-alpha.11",
|
|
15
|
+
"@dynamic-labs/rpc-providers": "2.0.0-alpha.11",
|
|
16
|
+
"@dynamic-labs/sdk-react-core": "2.0.0-alpha.11",
|
|
17
|
+
"@dynamic-labs/types": "2.0.0-alpha.11",
|
|
18
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.11",
|
|
18
19
|
"eventemitter3": "5.0.1"
|
|
19
20
|
},
|
|
20
21
|
"license": "MIT",
|
package/src/lib/Connector.js
CHANGED
|
@@ -42,7 +42,7 @@ const getCreateConnectorFn = (parameters) => createConnector((config) => ({
|
|
|
42
42
|
getAccounts() {
|
|
43
43
|
var _a;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const address = yield ((_a = parameters.walletConnector) === null || _a === void 0 ? void 0 : _a.
|
|
45
|
+
const address = yield ((_a = parameters.walletConnector) === null || _a === void 0 ? void 0 : _a.getAddress());
|
|
46
46
|
if (!address) {
|
|
47
47
|
throw new Error('Not connected');
|
|
48
48
|
}
|
|
@@ -5,10 +5,12 @@ import { useDynamicContext, useUserWallets } from '@dynamic-labs/sdk-react-core'
|
|
|
5
5
|
import { findAndOrderEvmWallets } from './utils/findAndOrderEvmWallets/findAndOrderEvmWallets.js';
|
|
6
6
|
import { createConnectorForFirstConnectedEvmWallet, getCreateConnectorFn } from './Connector.js';
|
|
7
7
|
import { SyncDynamicWagmi } from './SyncDynamicWagmi.js';
|
|
8
|
+
import { useChainMismatchLogger } from './useChainMismatchLogger.js';
|
|
8
9
|
|
|
9
10
|
const DynamicWagmiConnector = ({ children, }) => {
|
|
10
11
|
const config = useConfig();
|
|
11
12
|
const { handleLogOut, primaryWallet } = useDynamicContext();
|
|
13
|
+
useChainMismatchLogger();
|
|
12
14
|
/**
|
|
13
15
|
* This will prevent the wagmi Connector from calling handleLogOut when we are the ones calling disconnect
|
|
14
16
|
* as a result of a handleLogOut call (see SyncDynamicWagmi), but will preserve the existing behavior for customers.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useChainMismatchLogger: () => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useConfig } from 'wagmi';
|
|
3
|
+
import { Logger } from '@dynamic-labs/logger';
|
|
4
|
+
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
|
|
5
|
+
|
|
6
|
+
const logger = new Logger('DynamicWagmiConnector');
|
|
7
|
+
const useChainMismatchLogger = () => {
|
|
8
|
+
const config = useConfig();
|
|
9
|
+
const { networkConfigurations } = useDynamicContext();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!(networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm))
|
|
12
|
+
return;
|
|
13
|
+
const wagmiChains = config.chains;
|
|
14
|
+
const wagmiChainIds = wagmiChains.map((chain) => chain.id);
|
|
15
|
+
const dynamicChains = networkConfigurations.evm;
|
|
16
|
+
const dynamicChainIds = dynamicChains.map((chain) => chain.chainId);
|
|
17
|
+
wagmiChains.forEach((chain) => {
|
|
18
|
+
if (!dynamicChainIds.includes(chain.id)) {
|
|
19
|
+
logger.warn(`Chain (id: ${chain.id} name: ${chain.name}) is present in the Wagmi config, but is not present in the Dynamic configuration.`, 'Please make sure to enable the chain in your Dynamic Dashboard, or add it to the evmNetworks prop on DynamicContextProvider.', 'For more information, see: https://docs.dynamic.xyz/guides/frameworks/wagmi-v2#chain-configuration');
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
dynamicChains.forEach((chain) => {
|
|
23
|
+
if (!wagmiChainIds.includes(Number(chain.chainId))) {
|
|
24
|
+
logger.warn(`Chain (id: ${chain.chainId} name: ${chain.name}) is present in the Dynamic config, but is not present in the Wagmi configuration.`, 'Please make sure to add the chain to the chains prop on the Wagmi createConfig function.', 'For more information, see: https://docs.dynamic.xyz/guides/frameworks/wagmi-v2#chain-configuration');
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}, [config.chains, networkConfigurations]);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { useChainMismatchLogger };
|