@web3auth/no-modal 11.0.0-beta.0 → 11.0.0-beta.2

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.
Files changed (101) hide show
  1. package/dist/lib.cjs/account-linking/index.js +8 -0
  2. package/dist/lib.cjs/account-linking/react.js +95 -0
  3. package/dist/lib.cjs/account-linking/rest.js +54 -0
  4. package/dist/lib.cjs/account-linking/vue.js +98 -0
  5. package/dist/lib.cjs/base/analytics.js +17 -2
  6. package/dist/lib.cjs/base/connector/constants.js +2 -0
  7. package/dist/lib.cjs/base/errors/index.js +48 -0
  8. package/dist/lib.cjs/base/utils.js +15 -3
  9. package/dist/lib.cjs/connectors/auth-connector/authConnector.js +501 -70
  10. package/dist/lib.cjs/connectors/base-evm-connector/baseEvmConnector.js +42 -23
  11. package/dist/lib.cjs/connectors/base-solana-connector/baseSolanaConnector.js +41 -24
  12. package/dist/lib.cjs/connectors/metamask-connector/metamaskConnector.js +76 -45
  13. package/dist/lib.cjs/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +41 -13
  14. package/dist/lib.cjs/index.js +20 -13
  15. package/dist/lib.cjs/noModal.js +834 -117
  16. package/dist/lib.cjs/plugins/wallet-services-plugin/plugin.js +1 -1
  17. package/dist/lib.cjs/providers/base-provider/baseProvider.js +65 -33
  18. package/dist/lib.cjs/react/context/useWeb3AuthInnerContextValue.js +43 -20
  19. package/dist/lib.cjs/react/hooks/useWallets.js +51 -0
  20. package/dist/lib.cjs/react/hooks/useWeb3AuthConnect.js +2 -2
  21. package/dist/lib.cjs/react/index.js +2 -0
  22. package/dist/lib.cjs/react/solana/hooks/useSolanaWallet.js +2 -2
  23. package/dist/lib.cjs/react/solana/provider.js +7 -1
  24. package/dist/lib.cjs/react/wagmi/provider.js +37 -5
  25. package/dist/lib.cjs/types/account-linking/index.d.ts +2 -0
  26. package/dist/lib.cjs/types/account-linking/interfaces.d.ts +90 -0
  27. package/dist/lib.cjs/types/account-linking/react.d.ts +19 -0
  28. package/dist/lib.cjs/types/account-linking/rest.d.ts +9 -0
  29. package/dist/lib.cjs/types/account-linking/vue.d.ts +20 -0
  30. package/dist/lib.cjs/types/base/analytics.d.ts +9 -0
  31. package/dist/lib.cjs/types/base/connector/baseConnector.d.ts +5 -0
  32. package/dist/lib.cjs/types/base/connector/constants.d.ts +2 -0
  33. package/dist/lib.cjs/types/base/connector/interfaces.d.ts +51 -6
  34. package/dist/lib.cjs/types/base/core/IWeb3Auth.d.ts +39 -2
  35. package/dist/lib.cjs/types/base/errors/index.d.ts +13 -0
  36. package/dist/lib.cjs/types/base/interfaces.d.ts +3 -1
  37. package/dist/lib.cjs/types/base/utils.d.ts +7 -1
  38. package/dist/lib.cjs/types/connectors/auth-connector/authConnector.d.ts +33 -3
  39. package/dist/lib.cjs/types/connectors/auth-connector/interface.d.ts +77 -2
  40. package/dist/lib.cjs/types/connectors/base-evm-connector/baseEvmConnector.d.ts +6 -0
  41. package/dist/lib.cjs/types/connectors/base-solana-connector/baseSolanaConnector.d.ts +6 -0
  42. package/dist/lib.cjs/types/index.d.ts +1 -0
  43. package/dist/lib.cjs/types/noModal.d.ts +104 -5
  44. package/dist/lib.cjs/types/providers/base-provider/baseProvider.d.ts +7 -0
  45. package/dist/lib.cjs/types/react/hooks/index.d.ts +1 -0
  46. package/dist/lib.cjs/types/react/hooks/useWallets.d.ts +8 -0
  47. package/dist/lib.cjs/types/vue/composables/index.d.ts +1 -0
  48. package/dist/lib.cjs/types/vue/composables/useWallets.d.ts +9 -0
  49. package/dist/lib.cjs/vue/composables/useWallets.js +52 -0
  50. package/dist/lib.cjs/vue/composables/useWeb3AuthConnect.js +2 -2
  51. package/dist/lib.cjs/vue/index.js +2 -0
  52. package/dist/lib.cjs/vue/solana/composables/useSolanaWallet.js +2 -2
  53. package/dist/lib.cjs/vue/solana/provider.js +50 -23
  54. package/dist/lib.cjs/vue/useWeb3AuthInnerContextValue.js +13 -4
  55. package/dist/lib.cjs/vue/wagmi/provider.js +35 -7
  56. package/dist/lib.esm/account-linking/index.js +1 -0
  57. package/dist/lib.esm/account-linking/react.js +74 -0
  58. package/dist/lib.esm/account-linking/rest.js +51 -0
  59. package/dist/lib.esm/account-linking/vue.js +78 -0
  60. package/dist/lib.esm/base/analytics.js +17 -2
  61. package/dist/lib.esm/base/connector/constants.js +2 -0
  62. package/dist/lib.esm/base/errors/index.js +48 -1
  63. package/dist/lib.esm/base/utils.js +16 -4
  64. package/dist/lib.esm/connectors/auth-connector/authConnector.js +462 -31
  65. package/dist/lib.esm/connectors/base-evm-connector/baseEvmConnector.js +43 -24
  66. package/dist/lib.esm/connectors/base-solana-connector/baseSolanaConnector.js +43 -26
  67. package/dist/lib.esm/connectors/coinbase-connector/coinbaseConnector.js +2 -2
  68. package/dist/lib.esm/connectors/injected-evm-connector/injectedEvmConnector.js +2 -2
  69. package/dist/lib.esm/connectors/injected-solana-connector/walletStandardConnector.js +3 -3
  70. package/dist/lib.esm/connectors/metamask-connector/metamaskConnector.js +80 -49
  71. package/dist/lib.esm/connectors/wallet-connect-v2-connector/WalletConnectV2Provider.js +2 -2
  72. package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +43 -15
  73. package/dist/lib.esm/connectors/wallet-connect-v2-connector/wcSolanaWallet.js +1 -1
  74. package/dist/lib.esm/index.js +4 -3
  75. package/dist/lib.esm/noModal.js +851 -126
  76. package/dist/lib.esm/plugins/wallet-services-plugin/plugin.js +3 -3
  77. package/dist/lib.esm/providers/base-provider/baseProvider.js +68 -38
  78. package/dist/lib.esm/react/context/useWeb3AuthInnerContextValue.js +45 -21
  79. package/dist/lib.esm/react/hooks/useWallets.js +33 -0
  80. package/dist/lib.esm/react/hooks/useWeb3AuthConnect.js +2 -2
  81. package/dist/lib.esm/react/index.js +1 -0
  82. package/dist/lib.esm/react/solana/hooks/useSolanaWallet.js +2 -2
  83. package/dist/lib.esm/react/solana/provider.js +9 -2
  84. package/dist/lib.esm/react/wagmi/provider.js +39 -7
  85. package/dist/lib.esm/vue/composables/useCheckout.js +1 -1
  86. package/dist/lib.esm/vue/composables/useFunding.js +1 -1
  87. package/dist/lib.esm/vue/composables/useReceive.js +1 -1
  88. package/dist/lib.esm/vue/composables/useSwap.js +1 -1
  89. package/dist/lib.esm/vue/composables/useWalletConnectScanner.js +1 -1
  90. package/dist/lib.esm/vue/composables/useWalletUI.js +1 -1
  91. package/dist/lib.esm/vue/composables/useWallets.js +35 -0
  92. package/dist/lib.esm/vue/composables/useWeb3AuthConnect.js +2 -2
  93. package/dist/lib.esm/vue/index.js +1 -0
  94. package/dist/lib.esm/vue/solana/composables/useSignAndSendTransaction.js +1 -1
  95. package/dist/lib.esm/vue/solana/composables/useSignMessage.js +1 -1
  96. package/dist/lib.esm/vue/solana/composables/useSignTransaction.js +1 -1
  97. package/dist/lib.esm/vue/solana/composables/useSolanaWallet.js +2 -2
  98. package/dist/lib.esm/vue/solana/provider.js +51 -24
  99. package/dist/lib.esm/vue/useWeb3AuthInnerContextValue.js +12 -3
  100. package/dist/lib.esm/vue/wagmi/provider.js +36 -8
  101. package/package.json +44 -20
@@ -1,8 +1,8 @@
1
1
  import { ref } from 'vue';
2
2
  import { useSolanaWallet } from './useSolanaWallet.js';
3
3
  import { WalletInitializationError } from '../../../base/errors/index.js';
4
- import { walletSignMessage } from '../../../base/wallet/solana.js';
5
4
  import { log } from '../../../base/loglevel.js';
5
+ import { walletSignMessage } from '../../../base/wallet/solana.js';
6
6
 
7
7
  const useSignMessage = () => {
8
8
  const {
@@ -1,8 +1,8 @@
1
1
  import { ref } from 'vue';
2
2
  import { useSolanaWallet } from './useSolanaWallet.js';
3
3
  import { WalletInitializationError } from '../../../base/errors/index.js';
4
- import { walletSignTransaction } from '../../../base/wallet/solana.js';
5
4
  import { log } from '../../../base/loglevel.js';
5
+ import { walletSignTransaction } from '../../../base/wallet/solana.js';
6
6
 
7
7
  const useSignTransaction = () => {
8
8
  const {
@@ -49,12 +49,12 @@ const useSolanaWallet = () => {
49
49
  };
50
50
  onScopeDispose(teardownWalletListeners);
51
51
  const getPrivateKey = async () => {
52
- var _connection$value2, _web3Auth$value$conne;
52
+ var _connection$value2, _web3Auth$value$prima;
53
53
  if (!web3Auth.value) throw new Error("Web3Auth not initialized");
54
54
  if (((_connection$value2 = connection.value) === null || _connection$value2 === void 0 ? void 0 : _connection$value2.connectorName) !== WALLET_CONNECTORS.AUTH) {
55
55
  throw new Error("getPrivateKey is only supported with the Auth connector");
56
56
  }
57
- const provider = (_web3Auth$value$conne = web3Auth.value.connectedConnector) === null || _web3Auth$value$conne === void 0 ? void 0 : _web3Auth$value$conne.provider;
57
+ const provider = (_web3Auth$value$prima = web3Auth.value.primaryConnector) === null || _web3Auth$value$prima === void 0 ? void 0 : _web3Auth$value$prima.provider;
58
58
  if (!provider) throw new Error("Provider not available");
59
59
  const privateKey = await provider.request({
60
60
  method: SOLANA_METHOD_TYPES.SOLANA_PRIVATE_KEY
@@ -3,6 +3,7 @@ import { defineComponent, ref, provide, watch, h, Fragment } from 'vue';
3
3
  import { CHAIN_NAMESPACES } from '@toruslabs/base-controllers';
4
4
  import { SOLANA_CLIENT_KEY } from './constants.js';
5
5
  import { useWeb3Auth } from '../composables/useWeb3Auth.js';
6
+ import { useChain } from '../composables/useChain.js';
6
7
  import { log } from '../../base/loglevel.js';
7
8
 
8
9
  const disposeClient = async client => {
@@ -29,59 +30,85 @@ const SolanaProvider = defineComponent({
29
30
  connection,
30
31
  web3Auth
31
32
  } = useWeb3Auth();
33
+ const {
34
+ chainId
35
+ } = useChain();
32
36
  const clientRef = ref(null);
37
+ // Holds the token for the newest requested sync run. Older async runs compare against it
38
+ // before publishing results so a slower reconnect cannot overwrite a newer chain/account update.
39
+ let activeSyncToken = null;
33
40
 
34
41
  // provide the client to the app
35
42
  provide(SOLANA_CLIENT_KEY, clientRef);
36
-
37
- // watch for changes in the connection and chain namespace
38
- watch([isConnected, connection], async ([newIsConnected, newConnection]) => {
39
- if (!newIsConnected || !(newConnection !== null && newConnection !== void 0 && newConnection.solanaWallet)) {
40
- if (clientRef.value) {
41
- await disposeClient(clientRef.value);
42
- clientRef.value = null;
43
+ const syncClient = async () => {
44
+ var _web3Auth$value, _web3Auth$value2;
45
+ // Only the latest async, `syncing` run should be allowed to attach its client.
46
+ // A fresh Symbol gives each run a unique identity without relying on counters.
47
+ const syncToken = Symbol("solana-client-sync");
48
+ activeSyncToken = syncToken;
49
+ const newIsConnected = isConnected.value;
50
+ const newConnection = connection.value;
51
+ const currentChain = (_web3Auth$value = web3Auth.value) === null || _web3Auth$value === void 0 ? void 0 : _web3Auth$value.currentChain;
52
+ if (!newIsConnected || !(newConnection !== null && newConnection !== void 0 && newConnection.solanaWallet) || (currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) !== CHAIN_NAMESPACES.SOLANA ||
53
+ // only reconnect for the primary connector
54
+ newConnection.connectorName !== ((_web3Auth$value2 = web3Auth.value) === null || _web3Auth$value2 === void 0 ? void 0 : _web3Auth$value2.primaryConnectorName)) {
55
+ const prevClient = clientRef.value;
56
+ clientRef.value = null;
57
+ if (prevClient) {
58
+ await disposeClient(prevClient);
43
59
  }
44
60
  return;
45
61
  }
46
- const currentChain = web3Auth.value.currentChain;
47
- let chainConfig;
48
- if ((currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) === CHAIN_NAMESPACES.SOLANA) {
49
- chainConfig = currentChain;
50
- } else {
51
- // use the 1st Solana chain if current chain is not solana
52
- chainConfig = web3Auth.value.coreOptions.chains.find(c => c.chainNamespace === CHAIN_NAMESPACES.SOLANA);
53
- if (!chainConfig) return;
54
- }
55
62
  const prevClient = clientRef.value;
63
+ clientRef.value = null;
64
+ if (prevClient) {
65
+ await disposeClient(prevClient);
66
+ }
67
+ let client = null;
56
68
  try {
57
69
  // create a wallet standard connector from connected wallet
58
- const solanaWalletId = "wallet-standard:" + connection.value.connectorName;
59
- const connector = createWalletStandardConnector(connection.value.solanaWallet, {
70
+ const solanaWalletId = "wallet-standard:" + newConnection.connectorName;
71
+ const connector = createWalletStandardConnector(newConnection.solanaWallet, {
60
72
  id: solanaWalletId,
61
- name: connection.value.connectorName
73
+ name: newConnection.connectorName
62
74
  });
63
75
 
64
76
  // create a solana client
65
77
  const {
66
78
  rpcTarget,
67
79
  wsTarget
68
- } = chainConfig;
69
- const client = createClient({
80
+ } = currentChain;
81
+ client = createClient({
70
82
  endpoint: rpcTarget,
71
83
  websocketEndpoint: wsTarget,
72
84
  walletConnectors: [connector]
73
85
  });
74
- clientRef.value = client;
75
- if (prevClient) await disposeClient(prevClient);
76
86
 
77
87
  // connect the client to the wallet
78
88
  await client.actions.connectWallet(solanaWalletId, {
79
89
  autoConnect: true
80
90
  });
91
+ // If another sync started while connectWallet was in flight, this client is stale.
92
+ if (activeSyncToken !== syncToken) {
93
+ await disposeClient(client);
94
+ return;
95
+ }
96
+ clientRef.value = client;
81
97
  } catch (err) {
98
+ if (client) {
99
+ await disposeClient(client);
100
+ }
82
101
  log.error("Failed to create or connect Solana client", err);
83
- clientRef.value = null;
102
+ // Only clear the shared ref when this failing run is still the newest one.
103
+ if (activeSyncToken === syncToken) {
104
+ clientRef.value = null;
105
+ }
84
106
  }
107
+ };
108
+
109
+ // watch for changes in the connection and active chain
110
+ watch([isConnected, connection, chainId], () => {
111
+ void syncClient();
85
112
  }, {
86
113
  immediate: true
87
114
  });
@@ -1,9 +1,9 @@
1
1
  import { shallowRef, ref, watch } from 'vue';
2
2
  import { ANALYTICS_INTEGRATION_TYPE } from '../base/analytics.js';
3
3
  import { log } from '../base/loglevel.js';
4
- import { CONNECTOR_EVENTS, CONNECTOR_STATUS } from '../base/connector/constants.js';
5
4
  import { LOGIN_MODE } from '../base/constants.js';
6
5
  import { WalletInitializationError } from '../base/errors/index.js';
6
+ import { CONNECTOR_EVENTS, CONNECTOR_STATUS } from '../base/connector/constants.js';
7
7
 
8
8
  function useWeb3AuthInnerContextValue({
9
9
  Web3AuthConstructor,
@@ -92,7 +92,7 @@ function useWeb3AuthInnerContextValue({
92
92
  var _currentChain$chainNa, _currentChain;
93
93
  if (!isInitialized.value) isInitialized.value = true;
94
94
  isConnected.value = true;
95
- connection.value = newWeb3Auth.connection;
95
+ connection.value = web3Auth.value.connection;
96
96
  chainId.value = web3Auth.value.currentChainId;
97
97
  chainNamespace.value = (_currentChain$chainNa = (_currentChain = web3Auth.value.currentChain) === null || _currentChain === void 0 ? void 0 : _currentChain.chainNamespace) !== null && _currentChain$chainNa !== void 0 ? _currentChain$chainNa : null;
98
98
  }
@@ -110,7 +110,7 @@ function useWeb3AuthInnerContextValue({
110
110
  var _currentChain$chainNa2, _currentChain2;
111
111
  if (!isInitialized.value) isInitialized.value = true;
112
112
  isConnected.value = true;
113
- connection.value = newWeb3Auth.connection;
113
+ connection.value = web3Auth.value.connection;
114
114
  chainId.value = web3Auth.value.currentChainId;
115
115
  chainNamespace.value = (_currentChain$chainNa2 = (_currentChain2 = web3Auth.value.currentChain) === null || _currentChain2 === void 0 ? void 0 : _currentChain2.chainNamespace) !== null && _currentChain$chainNa2 !== void 0 ? _currentChain$chainNa2 : null;
116
116
  if (web3Auth.value.status === CONNECTOR_STATUS.AUTHORIZED) {
@@ -134,6 +134,13 @@ function useWeb3AuthInnerContextValue({
134
134
  const mfaEnabledListener = () => {
135
135
  isMFAEnabled.value = true;
136
136
  };
137
+ const connectionUpdatedListener = () => {
138
+ var _currentChain$chainNa3, _currentChain3;
139
+ status.value = web3Auth.value.status;
140
+ connection.value = web3Auth.value.connection;
141
+ chainId.value = web3Auth.value.currentChainId;
142
+ chainNamespace.value = (_currentChain$chainNa3 = (_currentChain3 = web3Auth.value.currentChain) === null || _currentChain3 === void 0 ? void 0 : _currentChain3.chainNamespace) !== null && _currentChain$chainNa3 !== void 0 ? _currentChain$chainNa3 : null;
143
+ };
137
144
  if (prevWeb3Auth && newWeb3Auth !== prevWeb3Auth) {
138
145
  prevWeb3Auth.removeListener(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
139
146
  prevWeb3Auth.removeListener(CONNECTOR_EVENTS.READY, readyListener);
@@ -144,6 +151,7 @@ function useWeb3AuthInnerContextValue({
144
151
  prevWeb3Auth.removeListener(CONNECTOR_EVENTS.ERRORED, errorListener);
145
152
  prevWeb3Auth.removeListener(CONNECTOR_EVENTS.REHYDRATION_ERROR, errorListener);
146
153
  prevWeb3Auth.removeListener(CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
154
+ prevWeb3Auth.removeListener(CONNECTOR_EVENTS.CONNECTION_UPDATED, connectionUpdatedListener);
147
155
  if (prevWeb3Auth.loginMode === LOGIN_MODE.MODAL) {
148
156
  prevWeb3Auth.removeListener(CONNECTOR_EVENTS.CONSENT_ACCEPTED, consentAcceptedListener);
149
157
  }
@@ -159,6 +167,7 @@ function useWeb3AuthInnerContextValue({
159
167
  newWeb3Auth.on(CONNECTOR_EVENTS.ERRORED, errorListener);
160
168
  newWeb3Auth.on(CONNECTOR_EVENTS.REHYDRATION_ERROR, errorListener);
161
169
  newWeb3Auth.on(CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
170
+ newWeb3Auth.on(CONNECTOR_EVENTS.CONNECTION_UPDATED, connectionUpdatedListener);
162
171
  if (newWeb3Auth.loginMode === LOGIN_MODE.MODAL) {
163
172
  newWeb3Auth.on(CONNECTOR_EVENTS.CONSENT_ACCEPTED, consentAcceptedListener);
164
173
  }
@@ -7,8 +7,8 @@ import { defineChain, webSocket, http, fallback } from 'viem';
7
7
  import { defineComponent, h, shallowRef, ref, watch, provide } from 'vue';
8
8
  import { log } from '../../base/loglevel.js';
9
9
  import { defaultWagmiConfig } from './constants.js';
10
- import { useWeb3AuthDisconnect } from '../composables/useWeb3AuthDisconnect.js';
11
10
  import { useWeb3Auth } from '../composables/useWeb3Auth.js';
11
+ import { useWeb3AuthDisconnect } from '../composables/useWeb3AuthDisconnect.js';
12
12
  import { CHAIN_NAMESPACES } from '@toruslabs/base-controllers';
13
13
  import { WalletInitializationError } from '../../base/errors/index.js';
14
14
 
@@ -78,7 +78,8 @@ const Web3AuthWagmiProvider = defineComponent({
78
78
  setup() {
79
79
  const {
80
80
  isConnected,
81
- connection
81
+ connection,
82
+ chainNamespace
82
83
  } = useWeb3Auth();
83
84
  const {
84
85
  disconnect
@@ -87,10 +88,15 @@ const Web3AuthWagmiProvider = defineComponent({
87
88
  const {
88
89
  mutate: reconnect
89
90
  } = useReconnect();
91
+ const lastSyncedProvider = shallowRef(null);
92
+ const lastSyncedConnectorName = ref(null);
93
+ const suppressWagmiDisconnect = ref(false);
90
94
  useConnectionEffect({
91
95
  onDisconnect: async () => {
92
96
  log.info("Disconnected from wagmi");
93
- if (isConnected.value) await disconnect();
97
+ const isSuppressed = suppressWagmiDisconnect.value;
98
+ suppressWagmiDisconnect.value = false;
99
+ if (!isSuppressed && isConnected.value) await disconnect();
94
100
  const connector = getWeb3authConnector(wagmiConfig);
95
101
  // reset wagmi connector state if the provider handles disconnection because of the accountsChanged event
96
102
  // from the connected provider
@@ -99,19 +105,41 @@ const Web3AuthWagmiProvider = defineComponent({
99
105
  }
100
106
  }
101
107
  });
102
- watch([isConnected, connection], async () => {
103
- var _connection$value;
108
+ watch([isConnected, connection, chainNamespace], async () => {
109
+ var _newConnection$ethere;
104
110
  const newIsConnected = isConnected.value;
105
- if (newIsConnected && (_connection$value = connection.value) !== null && _connection$value !== void 0 && _connection$value.ethereumProvider) {
106
- const connector = await setupConnector(connection.value.ethereumProvider, wagmiConfig);
111
+ const newConnection = connection.value;
112
+ const newEth = (_newConnection$ethere = newConnection === null || newConnection === void 0 ? void 0 : newConnection.ethereumProvider) !== null && _newConnection$ethere !== void 0 ? _newConnection$ethere : null;
113
+ const shouldBindToWagmi = newIsConnected && chainNamespace.value === CHAIN_NAMESPACES.EIP155 && Boolean(newConnection && newEth);
114
+ if (shouldBindToWagmi && newConnection && newEth) {
115
+ const hasSameBinding = lastSyncedProvider.value === newEth && lastSyncedConnectorName.value === newConnection.connectorName;
116
+ if (hasSameBinding && wagmiConfig.state.status === "connected") {
117
+ return;
118
+ }
119
+ if (!hasSameBinding && getWeb3authConnector(wagmiConfig)) {
120
+ if (wagmiConfig.state.status === "connected") {
121
+ suppressWagmiDisconnect.value = true;
122
+ await disconnectWeb3AuthFromWagmi(wagmiConfig);
123
+ } else {
124
+ resetConnectorState(wagmiConfig);
125
+ }
126
+ }
127
+ const connector = await setupConnector(newEth, wagmiConfig);
107
128
  if (!connector) {
108
129
  throw new Error("Failed to setup connector");
109
130
  }
110
131
  await connectWeb3AuthWithWagmi(connector, wagmiConfig);
132
+ lastSyncedProvider.value = newEth;
133
+ lastSyncedConnectorName.value = newConnection.connectorName;
111
134
  reconnect();
112
- } else if (!newIsConnected) {
135
+ } else {
136
+ lastSyncedProvider.value = null;
137
+ lastSyncedConnectorName.value = null;
113
138
  if (wagmiConfig.state.status === "connected") {
139
+ suppressWagmiDisconnect.value = true;
114
140
  await disconnectWeb3AuthFromWagmi(wagmiConfig);
141
+ } else if (getWeb3authConnector(wagmiConfig)) {
142
+ resetConnectorState(wagmiConfig);
115
143
  }
116
144
  }
117
145
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web3auth/no-modal",
3
- "version": "11.0.0-beta.0",
3
+ "version": "11.0.0-beta.2",
4
4
  "description": "Multi chain wallet aggregator for web3Auth",
5
5
  "keywords": [
6
6
  "web3Auth/no-modal",
@@ -65,12 +65,12 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@metamask/connect-evm": "^1.0.0",
69
- "@metamask/connect-multichain": "^0.12.1",
70
- "@metamask/connect-solana": "^1.0.0",
71
- "@segment/analytics-next": "^1.82.0",
68
+ "@metamask/connect-evm": "^1.3.0",
69
+ "@metamask/connect-multichain": "^0.14.0",
70
+ "@metamask/connect-solana": "^1.1.0",
71
+ "@segment/analytics-next": "^1.83.0",
72
72
  "@solana/client": "^1.7.0",
73
- "@solana/kit": "^6.5.0",
73
+ "@solana/kit": "^6.8.0",
74
74
  "@solana/wallet-standard-features": "^1.3.0",
75
75
  "@toruslabs/base-controllers": "^9.5.0",
76
76
  "@toruslabs/constants": "^16.1.1",
@@ -84,11 +84,11 @@
84
84
  "@wallet-standard/app": "^1.1.0",
85
85
  "@wallet-standard/base": "^1.1.0",
86
86
  "@wallet-standard/features": "^1.1.0",
87
- "@walletconnect/sign-client": "^2.23.8",
88
- "@walletconnect/types": "^2.23.8",
89
- "@walletconnect/utils": "^2.23.8",
90
- "@web3auth/auth": "^11.6.0",
91
- "@web3auth/ws-embed": "^6.0.0",
87
+ "@walletconnect/sign-client": "^2.23.9",
88
+ "@walletconnect/types": "^2.23.9",
89
+ "@walletconnect/utils": "^2.23.9",
90
+ "@web3auth/auth": "^11.8.0",
91
+ "@web3auth/ws-embed": "^6.0.4",
92
92
  "bignumber.js": "~9.3.1",
93
93
  "deepmerge": "^4.3.1",
94
94
  "ethers": "^6.16.0",
@@ -102,15 +102,15 @@
102
102
  "@coinbase/wallet-sdk": "^4.3.7",
103
103
  "@solana/react-hooks": "^1.4.1",
104
104
  "@types/react": "^19.2.14",
105
- "@wagmi/core": "^3.4.1",
106
- "@wagmi/vue": "^0.5.1",
107
- "@x402/evm": "^2.7.0",
108
- "@x402/fetch": "^2.7.0",
109
- "@x402/svm": "^2.7.0",
110
- "react": "^19.2.4",
111
- "viem": "^2.47.6",
105
+ "@wagmi/core": "^3.4.7",
106
+ "@wagmi/vue": "^0.5.9",
107
+ "@x402/evm": "^2.11.0",
108
+ "@x402/fetch": "^2.11.0",
109
+ "@x402/svm": "^2.11.0",
110
+ "react": "^19.2.5",
111
+ "viem": "^2.48.4",
112
112
  "vue": "^3.x",
113
- "wagmi": "^3.6.0"
113
+ "wagmi": "^3.6.8"
114
114
  },
115
115
  "exports": {
116
116
  ".": {
@@ -118,6 +118,21 @@
118
118
  "require": "./dist/lib.cjs/index.js",
119
119
  "types": "./dist/lib.cjs/types/index.d.ts"
120
120
  },
121
+ "./account-linking": {
122
+ "import": "./dist/lib.esm/account-linking/index.js",
123
+ "require": "./dist/lib.cjs/account-linking/index.js",
124
+ "types": "./dist/lib.cjs/types/account-linking/index.d.ts"
125
+ },
126
+ "./account-linking/react": {
127
+ "import": "./dist/lib.esm/account-linking/react.js",
128
+ "require": "./dist/lib.cjs/account-linking/react.js",
129
+ "types": "./dist/lib.cjs/types/account-linking/react.d.ts"
130
+ },
131
+ "./account-linking/vue": {
132
+ "import": "./dist/lib.esm/account-linking/vue.js",
133
+ "require": "./dist/lib.cjs/account-linking/vue.js",
134
+ "types": "./dist/lib.cjs/types/account-linking/vue.d.ts"
135
+ },
121
136
  "./x402": {
122
137
  "import": "./dist/lib.esm/x402/index.js",
123
138
  "require": "./dist/lib.cjs/x402/index.js",
@@ -176,6 +191,15 @@
176
191
  },
177
192
  "typesVersions": {
178
193
  "*": {
194
+ "account-linking": [
195
+ "./dist/lib.cjs/types/account-linking/index.d.ts"
196
+ ],
197
+ "account-linking/react": [
198
+ "./dist/lib.cjs/types/account-linking/react.d.ts"
199
+ ],
200
+ "account-linking/vue": [
201
+ "./dist/lib.cjs/types/account-linking/vue.d.ts"
202
+ ],
179
203
  "x402": [
180
204
  "./dist/lib.cjs/types/x402/index.d.ts"
181
205
  ],
@@ -228,5 +252,5 @@
228
252
  "node": ">=22.x",
229
253
  "npm": ">=10.x"
230
254
  },
231
- "gitHead": "992aabbd96cd8f19e6cdab1bebf498bb15157024"
255
+ "gitHead": "05577130ae9ced90ed412c1597681672074d8d2a"
232
256
  }