@dynamic-labs/wagmi-connector 1.0.0-alpha.1 → 1.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,134 @@
1
1
 
2
+ ## [1.0.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2023-12-11)
3
+
4
+ ## [1.0.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2023-12-08)
5
+
6
+
7
+ ### Bug Fixes
8
+
9
+ * allow transaction error to read from viem error ([#4101](https://github.com/dynamic-labs/DynamicAuth/issues/4101)) ([0f46cbe](https://github.com/dynamic-labs/DynamicAuth/commit/0f46cbea1eb260c2efdeee9b62f669fb3cf4ab93))
10
+ * trigger claim flow for unclaimed embedded smart contract wallet signer ([#4108](https://github.com/dynamic-labs/DynamicAuth/issues/4108)) ([37c9013](https://github.com/dynamic-labs/DynamicAuth/commit/37c9013109f2d6a37bde041da9072c5f5fa2df67))
11
+ * WalletConnect v2 connector with non active chains ([#4085](https://github.com/dynamic-labs/DynamicAuth/issues/4085)) ([f69cbe9](https://github.com/dynamic-labs/DynamicAuth/commit/f69cbe96012563f71e89939c96f2a46926e7b394))
12
+
13
+ ## [1.0.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2023-12-07)
14
+
15
+
16
+ ### ⚠ BREAKING CHANGES
17
+
18
+ * how to migrate
19
+ Whenever you would use the property wallets from the object returned by useDynamicContext, you must now rename it to walletConnectorOptions.
20
+
21
+ ### Features
22
+
23
+ * add support for eip6963 ([#4064](https://github.com/dynamic-labs/DynamicAuth/issues/4064)) ([3f8cf0e](https://github.com/dynamic-labs/DynamicAuth/commit/3f8cf0e4250945f3a331f701d491a308fab5f7b8))
24
+ * allow AA wallets to access owner features ([#4079](https://github.com/dynamic-labs/DynamicAuth/issues/4079)) ([9efc2be](https://github.com/dynamic-labs/DynamicAuth/commit/9efc2bee87ec9193c3682863d72024b3586de724))
25
+ * introduce UserWalletsContext ([#4083](https://github.com/dynamic-labs/DynamicAuth/issues/4083)) ([b9ca7f6](https://github.com/dynamic-labs/DynamicAuth/commit/b9ca7f6b0aff4b3992325b70cc9a903ece445c7f))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * ensure zero dev provider will receive a signer ([#4084](https://github.com/dynamic-labs/DynamicAuth/issues/4084)) ([f02a540](https://github.com/dynamic-labs/DynamicAuth/commit/f02a54036d39bfc5fb0c262f292acf914e4bd653))
31
+ * render recovery section only when turnkey provider is enabled ([#4093](https://github.com/dynamic-labs/DynamicAuth/issues/4093)) ([5f29bd2](https://github.com/dynamic-labs/DynamicAuth/commit/5f29bd23ccca2e307822377be28396edc7ab1fda))
32
+ * reset selected social provider on logout ([#4078](https://github.com/dynamic-labs/DynamicAuth/issues/4078)) ([85dc611](https://github.com/dynamic-labs/DynamicAuth/commit/85dc611d9c0e733bdb9d316b008bdaa35bcc2a91))
33
+
34
+
35
+ * rename wallets > walletConnectorOptions ([#4086](https://github.com/dynamic-labs/DynamicAuth/issues/4086)) ([10a7795](https://github.com/dynamic-labs/DynamicAuth/commit/10a779567e751469a667095726da52d78facbd57))
36
+
37
+ ## [1.0.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2023-12-05)
38
+
39
+
40
+ ### ⚠ BREAKING CHANGES
41
+
42
+ * rename EthereumSmartWalletConnectors to ZeroDevSmartWalletConnectors (#4067)
43
+
44
+
45
+ ### Features
46
+
47
+ * add support for pregenerated wallets + securing them ([#3968](https://github.com/dynamic-labs/DynamicAuth/issues/3968)) ([8212b76](https://github.com/dynamic-labs/DynamicAuth/commit/8212b760ba199bd989e0ba2ad3caf97590db4861))
48
+
49
+ ## [1.0.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2023-12-05)
50
+
51
+
52
+ ### Features
53
+
54
+ * add support for Turnkey HD wallets and backwards compatiblity for private key wallets ([#4011](https://github.com/dynamic-labs/DynamicAuth/issues/4011)) ([75c5258](https://github.com/dynamic-labs/DynamicAuth/commit/75c5258da494d5d4dfa8b96655303dd9645f2269))
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * add close button to wallets list ([#4036](https://github.com/dynamic-labs/DynamicAuth/issues/4036)) ([a2b988b](https://github.com/dynamic-labs/DynamicAuth/commit/a2b988bdfc662af6f85d37a79ed6666c483aa447))
60
+ * add support for embedded wallets in connect-only ([#4041](https://github.com/dynamic-labs/DynamicAuth/issues/4041)) ([ceea635](https://github.com/dynamic-labs/DynamicAuth/commit/ceea635b69e2a0c2636b47fbd30639d69dba7a1c))
61
+ * embedded wallet invalid stored chain breaking network picker ([#4050](https://github.com/dynamic-labs/DynamicAuth/issues/4050)) ([2e2384b](https://github.com/dynamic-labs/DynamicAuth/commit/2e2384ba37407d9164cce47e23f5d5f469f7e062))
62
+ * handle insufficient funds from AA provider ([#4027](https://github.com/dynamic-labs/DynamicAuth/issues/4027)) ([6b9cc88](https://github.com/dynamic-labs/DynamicAuth/commit/6b9cc886f4f2590094bd50aba195c07a5532dfa4))
63
+ * prevent double logout caused by wagmi sync ([#4048](https://github.com/dynamic-labs/DynamicAuth/issues/4048)) ([c66c81c](https://github.com/dynamic-labs/DynamicAuth/commit/c66c81c80839aa9ce1cfae76f4afce12e34f3513))
64
+ * properly detect network switch for secondary wallets ([#4038](https://github.com/dynamic-labs/DynamicAuth/issues/4038)) ([f87174d](https://github.com/dynamic-labs/DynamicAuth/commit/f87174de0892dd057401eaf3c0bc68d974add0fc))
65
+ * **use-wallets-connected-state:** update state on wallet id change ([#4045](https://github.com/dynamic-labs/DynamicAuth/issues/4045)) ([ca3a835](https://github.com/dynamic-labs/DynamicAuth/commit/ca3a8359eae386bffa758ed646ac14af8360a7f8))
66
+ * user should be able to see the full passkey name on management view ([#4043](https://github.com/dynamic-labs/DynamicAuth/issues/4043)) ([7bc1b70](https://github.com/dynamic-labs/DynamicAuth/commit/7bc1b7043cbc9f0e21df78a57efc3e6938a99db2))
67
+ * users should be able to easily find passkey recovery ([#4058](https://github.com/dynamic-labs/DynamicAuth/issues/4058)) ([0202ae9](https://github.com/dynamic-labs/DynamicAuth/commit/0202ae98c96544dec5ac357dc77000996e32ad33))
68
+
69
+ ## [1.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2023-11-29)
70
+
71
+
72
+ ### Bug Fixes
73
+
74
+ * transaction layout show alert ([#4024](https://github.com/dynamic-labs/DynamicAuth/issues/4024)) ([52057f5](https://github.com/dynamic-labs/DynamicAuth/commit/52057f54ebc32464b2486a2328cb6310caf85208)), closes [#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)
75
+
76
+ ## [1.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2023-11-29)
77
+
78
+
79
+ ### Features
80
+
81
+ * gracefully handle uknown wallet ([#3997](https://github.com/dynamic-labs/DynamicAuth/issues/3997)) ([ce7ff6a](https://github.com/dynamic-labs/DynamicAuth/commit/ce7ff6a50a8e8947050734b61587c8cadd041dbe))
82
+
83
+
84
+ ### Bug Fixes
85
+
86
+ * remove total on sponsored transactions ([#4019](https://github.com/dynamic-labs/DynamicAuth/issues/4019)) ([d976678](https://github.com/dynamic-labs/DynamicAuth/commit/d9766787b29665fbcd7983c5d61c31a4d97c8257))
87
+ * send balance align information ([#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)) ([508dccf](https://github.com/dynamic-labs/DynamicAuth/commit/508dccfa2c6aeaed30616b6a41b30002cccb3b40))
88
+
89
+ ## [1.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-11-28)
90
+
91
+
92
+ ### Bug Fixes
93
+
94
+ * update zerodev provider initialization ([#4015](https://github.com/dynamic-labs/DynamicAuth/issues/4015)) ([8faca00](https://github.com/dynamic-labs/DynamicAuth/commit/8faca00d414677adc5fecde451ca01da53fe9641))
95
+
96
+ ## [1.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-11-28)
97
+
98
+
99
+ ### Bug Fixes
100
+
101
+ * fix solflare mobile wallet deep linking ([#3998](https://github.com/dynamic-labs/DynamicAuth/issues/3998)) ([10069ae](https://github.com/dynamic-labs/DynamicAuth/commit/10069ae9ed5d8e1978131f57c3e90680e85d2efb))
102
+ * passkey error message when reaching limit of accounts ([#4010](https://github.com/dynamic-labs/DynamicAuth/issues/4010)) ([dabce3b](https://github.com/dynamic-labs/DynamicAuth/commit/dabce3b6ada4bac75903b43d5cb125cfd5619d18))
103
+
104
+ ## [1.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2023-11-28)
105
+
106
+
107
+ ### ⚠ BREAKING CHANGES
108
+
109
+ * rename walletsByChain to bridgeChains (#3954)
110
+
111
+ ### Features
112
+
113
+ * passkey management and recovery ([#3911](https://github.com/dynamic-labs/DynamicAuth/issues/3911)) ([b692b3a](https://github.com/dynamic-labs/DynamicAuth/commit/b692b3a8697d0ffb441faae97e609b144965695d))
114
+
115
+
116
+ ### Bug Fixes
117
+
118
+ * ensure all chain rpc providers are always assigned correctly ([#3981](https://github.com/dynamic-labs/DynamicAuth/issues/3981)) ([cd2e25c](https://github.com/dynamic-labs/DynamicAuth/commit/cd2e25c4eb39791866c1ea283d61fff388cce5df))
119
+ * initialize selected chain with first evm network if no value in ls ([#3999](https://github.com/dynamic-labs/DynamicAuth/issues/3999)) ([bc9e43b](https://github.com/dynamic-labs/DynamicAuth/commit/bc9e43be9d33c75bb1236756589f63f17b230ab1))
120
+ * nextjs issues to show transaction modals ([#3964](https://github.com/dynamic-labs/DynamicAuth/issues/3964)) ([9326ac4](https://github.com/dynamic-labs/DynamicAuth/commit/9326ac49394e067ce38b17faff08b4fabf91bb3f))
121
+ * onEmbeddedWalletCreated not being called ([#3975](https://github.com/dynamic-labs/DynamicAuth/issues/3975)) ([035cebe](https://github.com/dynamic-labs/DynamicAuth/commit/035cebe02891048e62c66a7277ed7f43c27e559d))
122
+ * return linked wallets even when there's no primary wallet ([#3965](https://github.com/dynamic-labs/DynamicAuth/issues/3965)) ([27705de](https://github.com/dynamic-labs/DynamicAuth/commit/27705de4ac7e1584efd1245bb9c6a818b1c20742))
123
+ * transaction modal not throwing viem compatible exception ([#3971](https://github.com/dynamic-labs/DynamicAuth/issues/3971)) ([bedab0c](https://github.com/dynamic-labs/DynamicAuth/commit/bedab0c4448bcca5c3e696ceb276867ce55bbd85))
124
+ * **zero-dev:** ensure the sign typed data is parsed for zero dev to handle ([#3974](https://github.com/dynamic-labs/DynamicAuth/issues/3974)) ([f517738](https://github.com/dynamic-labs/DynamicAuth/commit/f517738e1abc138f882525c128cd1ee5e88b9050))
125
+ * zerodev sign message with ethers ([#3972](https://github.com/dynamic-labs/DynamicAuth/issues/3972)) ([5de3873](https://github.com/dynamic-labs/DynamicAuth/commit/5de3873daa9cbfeef6dd9123b7a319d8e6b412d5))
126
+ * **zerodev:** ensure ECDSAProvider supports sendUserOperation ([#4003](https://github.com/dynamic-labs/DynamicAuth/issues/4003)) ([c8f5886](https://github.com/dynamic-labs/DynamicAuth/commit/c8f58868fcf6912fd11a92940369faf37e3fcdde))
127
+ * **zerodev:** ensure transaction is sponsored before submission ([#3932](https://github.com/dynamic-labs/DynamicAuth/issues/3932)) ([74becb7](https://github.com/dynamic-labs/DynamicAuth/commit/74becb7ec2fd55f8b905a9c9f0bbba44a9d22513))
128
+
129
+
130
+ * rename walletsByChain to bridgeChains ([#3954](https://github.com/dynamic-labs/DynamicAuth/issues/3954)) ([a91e8fe](https://github.com/dynamic-labs/DynamicAuth/commit/a91e8fe605694ccd8a00b71aa194c0c5191f156c))
131
+
2
132
  ## [1.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2023-11-22)
3
133
 
4
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wagmi-connector",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -11,10 +11,10 @@
11
11
  "react": "^17.0.2 || ^18.0.0",
12
12
  "viem": "^1.1.0",
13
13
  "wagmi": "^1.2.0",
14
- "@dynamic-labs/rpc-providers": "1.0.0-alpha.1",
15
- "@dynamic-labs/sdk-react-core": "1.0.0-alpha.1",
16
- "@dynamic-labs/types": "1.0.0-alpha.1",
17
- "@dynamic-labs/wallet-connector-core": "1.0.0-alpha.1",
14
+ "@dynamic-labs/rpc-providers": "1.0.0-alpha.11",
15
+ "@dynamic-labs/sdk-react-core": "1.0.0-alpha.11",
16
+ "@dynamic-labs/types": "1.0.0-alpha.11",
17
+ "@dynamic-labs/wallet-connector-core": "1.0.0-alpha.11",
18
18
  "eventemitter3": "5.0.1"
19
19
  },
20
20
  "license": "MIT",
@@ -1,3 +1,4 @@
1
+ import { MutableRefObject } from 'react';
1
2
  import { Address, Connector as BaseWagmiConnector, ConnectorData, Chain } from 'wagmi';
2
3
  import { Account, Transport, WalletClient } from 'viem';
3
4
  import { WalletConnector } from '@dynamic-labs/sdk-react-core';
@@ -7,10 +8,13 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
7
8
  id: string;
8
9
  name: string;
9
10
  ready: boolean;
10
- constructor({ chains, handleLogOut, walletConnector, }: {
11
+ /** See this variable's reason in it's definition in DynamicContext */
12
+ preventWagmiSyncFromCallingLogout: MutableRefObject<boolean>;
13
+ constructor({ chains, handleLogOut, walletConnector, preventWagmiSyncFromCallingLogout, }: {
11
14
  chains: Chain[];
12
15
  handleLogOut: () => Promise<void>;
13
16
  walletConnector: WalletConnector;
17
+ preventWagmiSyncFromCallingLogout: MutableRefObject<boolean>;
14
18
  });
15
19
  _onAccountsChanged({ accounts }: {
16
20
  accounts: string[];
@@ -49,20 +53,20 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
49
53
  type: string;
50
54
  uid: string;
51
55
  addChain: (args: import("viem").AddChainParameters) => Promise<void>;
52
- deployContract: <const TAbi extends import("viem").Abi | readonly unknown[], TChainOverride extends Chain | undefined>(args: import("viem").DeployContractParameters<TAbi, Chain, Account, TChainOverride>) => Promise<`0x${string}`>;
56
+ deployContract: <const TAbi extends import("viem").Abi | readonly unknown[], TChainOverride extends Chain | undefined = undefined>(args: import("viem").DeployContractParameters<TAbi, Chain, Account, TChainOverride>) => Promise<`0x${string}`>;
53
57
  getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
54
58
  getChainId: () => Promise<number>;
55
59
  getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
56
- prepareTransactionRequest: <TChainOverride_1 extends Chain | undefined>(args: import("viem").PrepareTransactionRequestParameters<Chain, Account, TChainOverride_1>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
60
+ prepareTransactionRequest: <TChainOverride_1 extends Chain | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<Chain, Account, TChainOverride_1>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
57
61
  requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
58
62
  requestPermissions: (args: {
59
63
  [x: string]: Record<string, any>;
60
64
  eth_accounts: Record<string, any>;
61
65
  }) => Promise<import("viem").RequestPermissionsReturnType>;
62
66
  sendRawTransaction: (args: import("viem/_types/actions/wallet/sendRawTransaction").SendRawTransactionParameters) => Promise<`0x${string}`>;
63
- sendTransaction: <TChainOverride_2 extends Chain | undefined>(args: import("viem").SendTransactionParameters<Chain, Account, TChainOverride_2>) => Promise<`0x${string}`>;
67
+ sendTransaction: <TChainOverride_2 extends Chain | undefined = undefined>(args: import("viem").SendTransactionParameters<Chain, Account, TChainOverride_2>) => Promise<`0x${string}`>;
64
68
  signMessage: (args: import("viem").SignMessageParameters<Account>) => Promise<`0x${string}`>;
65
- signTransaction: <TChainOverride_3 extends Chain | undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<Chain, Account, TChainOverride_3>) => Promise<`0x${string}`>;
69
+ signTransaction: <TChainOverride_3 extends Chain | undefined = undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<Chain, Account, TChainOverride_3>) => Promise<`0x${string}`>;
66
70
  signTypedData: <const TTypedData extends {
67
71
  [x: string]: readonly import("viem").TypedDataParameter[];
68
72
  [x: `string[${string}]`]: undefined;
@@ -273,7 +277,7 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
273
277
  }, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, Account>) => Promise<`0x${string}`>;
274
278
  switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
275
279
  watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
276
- writeContract: <const TAbi_1 extends import("viem").Abi | readonly unknown[], TFunctionName extends string, TChainOverride_4 extends Chain | undefined>(args: import("viem").WriteContractParameters<TAbi_1, TFunctionName, Chain, Account, TChainOverride_4>) => Promise<`0x${string}`>;
280
+ writeContract: <const TAbi_1 extends import("viem").Abi | readonly unknown[], TFunctionName extends string, TChainOverride_4 extends Chain | undefined = undefined>(args: import("viem").WriteContractParameters<TAbi_1, TFunctionName, Chain, Account, TChainOverride_4>) => Promise<`0x${string}`>;
277
281
  extend: <const client extends {
278
282
  [x: string]: unknown;
279
283
  account?: undefined;
@@ -287,7 +291,7 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
287
291
  transport?: undefined;
288
292
  type?: undefined;
289
293
  uid?: undefined;
290
- }>(fn: (client: import("viem").Client<Transport, Chain, Account, import("viem").WalletRpcSchema, import("viem").WalletActions<Chain, Account>>) => client) => import("viem").Client<Transport, Chain, Account, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<Chain, Account>>;
294
+ } & Partial<Pick<import("viem").PublicActions, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<Transport, Chain, Account, import("viem").WalletRpcSchema, import("viem").WalletActions<Chain, Account>>) => client) => import("viem").Client<Transport, Chain, Account, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<Chain, Account>>;
291
295
  } | {
292
296
  account: {
293
297
  address: `0x${string}`;
@@ -309,14 +313,14 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
309
313
  type: string;
310
314
  uid: string;
311
315
  addChain: (args: import("viem").AddChainParameters) => Promise<void>;
312
- deployContract: <const TAbi_2 extends import("viem").Abi | readonly unknown[], TChainOverride_5 extends Chain | undefined>(args: import("viem").DeployContractParameters<TAbi_2, Chain, {
316
+ deployContract: <const TAbi_2 extends import("viem").Abi | readonly unknown[], TChainOverride_5 extends Chain | undefined = undefined>(args: import("viem").DeployContractParameters<TAbi_2, Chain, {
313
317
  address: `0x${string}`;
314
318
  type: "json-rpc";
315
319
  }, TChainOverride_5>) => Promise<`0x${string}`>;
316
320
  getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
317
321
  getChainId: () => Promise<number>;
318
322
  getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
319
- prepareTransactionRequest: <TChainOverride_6 extends Chain | undefined>(args: import("viem").PrepareTransactionRequestParameters<Chain, {
323
+ prepareTransactionRequest: <TChainOverride_6 extends Chain | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<Chain, {
320
324
  address: `0x${string}`;
321
325
  type: "json-rpc";
322
326
  }, TChainOverride_6>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
@@ -326,7 +330,7 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
326
330
  eth_accounts: Record<string, any>;
327
331
  }) => Promise<import("viem").RequestPermissionsReturnType>;
328
332
  sendRawTransaction: (args: import("viem/_types/actions/wallet/sendRawTransaction").SendRawTransactionParameters) => Promise<`0x${string}`>;
329
- sendTransaction: <TChainOverride_7 extends Chain | undefined>(args: import("viem").SendTransactionParameters<Chain, {
333
+ sendTransaction: <TChainOverride_7 extends Chain | undefined = undefined>(args: import("viem").SendTransactionParameters<Chain, {
330
334
  address: `0x${string}`;
331
335
  type: "json-rpc";
332
336
  }, TChainOverride_7>) => Promise<`0x${string}`>;
@@ -334,7 +338,7 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
334
338
  address: `0x${string}`;
335
339
  type: "json-rpc";
336
340
  }>) => Promise<`0x${string}`>;
337
- signTransaction: <TChainOverride_8 extends Chain | undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<Chain, {
341
+ signTransaction: <TChainOverride_8 extends Chain | undefined = undefined>(args: import("viem/_types/actions/wallet/signTransaction").SignTransactionParameters<Chain, {
338
342
  address: `0x${string}`;
339
343
  type: "json-rpc";
340
344
  }, TChainOverride_8>) => Promise<`0x${string}`>;
@@ -551,7 +555,7 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
551
555
  }>) => Promise<`0x${string}`>;
552
556
  switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
553
557
  watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
554
- writeContract: <const TAbi_3 extends import("viem").Abi | readonly unknown[], TFunctionName_1 extends string, TChainOverride_9 extends Chain | undefined>(args: import("viem").WriteContractParameters<TAbi_3, TFunctionName_1, Chain, {
558
+ writeContract: <const TAbi_3 extends import("viem").Abi | readonly unknown[], TFunctionName_1 extends string, TChainOverride_9 extends Chain | undefined = undefined>(args: import("viem").WriteContractParameters<TAbi_3, TFunctionName_1, Chain, {
555
559
  address: `0x${string}`;
556
560
  type: "json-rpc";
557
561
  }, TChainOverride_9>) => Promise<`0x${string}`>;
@@ -568,7 +572,7 @@ export declare class Connector extends BaseWagmiConnector<WalletClient<Transport
568
572
  transport?: undefined;
569
573
  type?: undefined;
570
574
  uid?: undefined;
571
- }>(fn: (client: import("viem").Client<import("viem").CustomTransport, Chain, {
575
+ } & Partial<Pick<import("viem").PublicActions, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").CustomTransport, Chain, {
572
576
  address: `0x${string}`;
573
577
  type: "json-rpc";
574
578
  }, import("viem").WalletRpcSchema, import("viem").WalletActions<Chain, {
@@ -3,7 +3,7 @@ import { Connector as Connector$1 } from 'wagmi';
3
3
  import { getAddress, createWalletClient, custom, toHex } from 'viem';
4
4
 
5
5
  class Connector extends Connector$1 {
6
- constructor({ chains, handleLogOut, walletConnector, }) {
6
+ constructor({ chains, handleLogOut, walletConnector, preventWagmiSyncFromCallingLogout, }) {
7
7
  super({ chains, options: undefined });
8
8
  // wagmi properties
9
9
  this.id = 'dynamic';
@@ -26,6 +26,7 @@ class Connector extends Connector$1 {
26
26
  this.handleLogOut = handleLogOut;
27
27
  this.walletConnector = walletConnector;
28
28
  this.id = `dynamic-${walletConnector.key}`;
29
+ this.preventWagmiSyncFromCallingLogout = preventWagmiSyncFromCallingLogout;
29
30
  }
30
31
  _onAccountsChanged({ accounts }) {
31
32
  this.onAccountsChanged(accounts);
@@ -56,13 +57,21 @@ class Connector extends Connector$1 {
56
57
  });
57
58
  }
58
59
  disconnect() {
59
- var _a, _b;
60
60
  return __awaiter(this, void 0, void 0, function* () {
61
61
  this.walletConnector.removeListener('accountChange', this._onAccountsChanged, this);
62
62
  this.walletConnector.removeListener('chainChange', this._onChainChanged, this);
63
63
  this.walletConnector.removeListener('disconnect', this._onDisconnect, this);
64
- yield ((_a = this.walletConnector) === null || _a === void 0 ? void 0 : _a.endSession());
65
- yield ((_b = this.handleLogOut) === null || _b === void 0 ? void 0 : _b.call(this));
64
+ if (!this.preventWagmiSyncFromCallingLogout.current) {
65
+ yield this.walletConnector.endSession();
66
+ yield this.handleLogOut();
67
+ }
68
+ /**
69
+ * In our own Dynamic Wagmi sync component, we will flip the flag to true before calling disconnect,
70
+ * and here it automatically flips back to false afterwards. This will prevent the Connector from
71
+ * calling handleLogOut when we are the ones calling disconnect, but will preserve the existing behavior
72
+ * for customers who use useDisconnect directly.
73
+ */
74
+ this.preventWagmiSyncFromCallingLogout.current = false;
66
75
  });
67
76
  }
68
77
  getAccount() {
@@ -1,12 +1,12 @@
1
- import React, { useEffect, useMemo } from 'react';
1
+ import React, { useRef, useEffect, useMemo } from 'react';
2
2
  import { configureChains, mainnet, createConfig, WagmiConfig } from 'wagmi';
3
3
  import { publicProvider } from 'wagmi/providers/public';
4
- import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
4
+ import { useDynamicContext, useUserWallets } from '@dynamic-labs/sdk-react-core';
5
5
  import { Connector } from './Connector.js';
6
- import { SyncDynamicWagmi } from './SyncDynamicWagmi.js';
6
+ import { getConnector } from './getConnector.js';
7
7
  import { getWagmiChainsFromDynamicChains } from './getWagmiChainsFromDynamicChains.js';
8
8
  import { getWagmiProvidersFromDynamicChains } from './getWagmiProvidersFromDynamicChains.js';
9
- import { getConnector } from './getConnector.js';
9
+ import { SyncDynamicWagmi } from './SyncDynamicWagmi.js';
10
10
 
11
11
  const { publicClient } = configureChains([mainnet], [publicProvider()]);
12
12
  const config = createConfig({
@@ -14,13 +14,13 @@ const config = createConfig({
14
14
  publicClient,
15
15
  });
16
16
  const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, children, }) => {
17
- const { networkConfigurations, handleLogOut, connectedWallets, linkedWallets, authMode, sendWagmiSettings, } = useDynamicContext();
17
+ const { networkConfigurations, handleLogOut, sendWagmiSettings } = useDynamicContext();
18
18
  /**
19
- * Linked wallets are only available on connect-and-sign mode and the connected wallets
20
- * are only available on connect-only mode, the wallet const represents the current available
21
- * wallets to be used when creating an wagmi connector
19
+ * This will prevent the wagmi Connector from calling handleLogOut when we are the ones calling disconnect
20
+ * as a result of a handleLogOut call (see SyncDynamicWagmi), but will preserve the existing behavior for customers.
22
21
  */
23
- const wallets = authMode === 'connect-and-sign' ? linkedWallets : connectedWallets;
22
+ const preventWagmiSyncFromCallingLogout = useRef(false);
23
+ const wallets = useUserWallets();
24
24
  useEffect(() => {
25
25
  // only send wagmi settings once, when the first time DynamicWagmiConnector renders
26
26
  sendWagmiSettings({
@@ -41,8 +41,9 @@ const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, child
41
41
  const connector = useMemo(() => getConnector(wallets, (wallet) => new Connector({
42
42
  chains,
43
43
  handleLogOut,
44
+ preventWagmiSyncFromCallingLogout,
44
45
  walletConnector: wallet.connector,
45
- })), [wallets, chains, handleLogOut]);
46
+ })), [wallets, chains, handleLogOut, preventWagmiSyncFromCallingLogout]);
46
47
  /**
47
48
  * Updating the wagmi config must be done in a useEffect because
48
49
  * when setting the public client and connectors, wagmi will fire
@@ -57,7 +58,7 @@ const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, child
57
58
  }, [connector, publicClient, webSocketPublicClient]);
58
59
  // use React.createElement to prevent bunding react/jsx-runtime,
59
60
  // which is not compatible when bundling apps using React 17
60
- return React.createElement(WagmiConfig, { config: config }, React.createElement(SyncDynamicWagmi, { connector, wallets }, children));
61
+ return React.createElement(WagmiConfig, { config: config }, React.createElement(SyncDynamicWagmi, { connector, preventWagmiSyncFromCallingLogout, wallets }, children));
61
62
  };
62
63
 
63
64
  export { DynamicWagmiConnector };
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { MutableRefObject } from 'react';
2
2
  import { Wallet } from '@dynamic-labs/sdk-react-core';
3
3
  import { Connector } from './Connector';
4
4
  export type SyncDynamicWagmiProps = React.PropsWithChildren<{
5
5
  connector: Connector | undefined;
6
6
  wallets: Wallet[];
7
+ preventWagmiSyncFromCallingLogout: MutableRefObject<boolean>;
7
8
  }>;
8
- export declare const SyncDynamicWagmi: ({ children, connector, wallets, }: SyncDynamicWagmiProps) => React.FunctionComponentElement<{
9
+ export declare const SyncDynamicWagmi: ({ children, connector, wallets, preventWagmiSyncFromCallingLogout, }: SyncDynamicWagmiProps) => React.FunctionComponentElement<{
9
10
  children?: React.ReactNode;
10
11
  }>;
@@ -2,7 +2,7 @@ import React, { useRef, useEffect } from 'react';
2
2
  import { useConfig, useConnect, useDisconnect } from 'wagmi';
3
3
  import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
4
4
 
5
- const SyncDynamicWagmi = ({ children, connector, wallets, }) => {
5
+ const SyncDynamicWagmi = ({ children, connector, wallets, preventWagmiSyncFromCallingLogout, }) => {
6
6
  const { status: clientStatus } = useConfig();
7
7
  const { connect } = useConnect();
8
8
  const { disconnect } = useDisconnect();
@@ -21,6 +21,11 @@ const SyncDynamicWagmi = ({ children, connector, wallets, }) => {
21
21
  * layouts
22
22
  */
23
23
  if (isConnected) {
24
+ /**
25
+ * This will prevent the Connector from calling handleLogOut when we are the ones calling disconnect,
26
+ * but will preserve the existing behavior for customers who use useDisconnect directly.
27
+ */
28
+ preventWagmiSyncFromCallingLogout.current = true;
24
29
  disconnect();
25
30
  lastConnectedConnectorId.current = undefined;
26
31
  }
@@ -42,6 +47,7 @@ const SyncDynamicWagmi = ({ children, connector, wallets, }) => {
42
47
  connector,
43
48
  disconnect,
44
49
  lastConnectedConnectorId,
50
+ preventWagmiSyncFromCallingLogout,
45
51
  walletConnector,
46
52
  wallets,
47
53
  ]);