@wagmi/connectors 5.0.25 → 5.0.26

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.
@@ -1,2 +1,2 @@
1
- export const version = '5.0.25';
1
+ export const version = '5.0.26';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metaMask.d.ts","sourceRoot":"","sources":["../../src/metaMask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,WAAW,EACZ,MAAM,eAAe,CAAA;AAMtB,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EAEb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAGL,KAAK,mBAAmB,EAUzB,MAAM,MAAM,CAAA;AAEb,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAC,CACrE,CAAA;AAGD,wBAAgB,QAAQ,CAAC,UAAU,GAAE,kBAAuB;2BAGjC,mBAAmB,GAAG,IAAI;sBAC/B,MAAM,GAAG,IAAI;4BA+UlC;yBAnVe,QAAQ"}
1
+ {"version":3,"file":"metaMask.d.ts","sourceRoot":"","sources":["../../src/metaMask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,WAAW,EACZ,MAAM,eAAe,CAAA;AAMtB,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EAEb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAGL,KAAK,mBAAmB,EAUzB,MAAM,MAAM,CAAA;AAEb,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAC,CACrE,CAAA;AAGD,wBAAgB,QAAQ,CAAC,UAAU,GAAE,kBAAuB;2BAGjC,mBAAmB,GAAG,IAAI;sBAC/B,MAAM,GAAG,IAAI;4BA0VlC;yBA9Ve,QAAQ"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.0.25";
1
+ export declare const version = "5.0.26";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wagmi/connectors",
3
3
  "description": "Collection of connectors for Wagmi",
4
- "version": "5.0.25",
4
+ "version": "5.0.26",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "peerDependencies": {
31
31
  "typescript": ">=5.0.4",
32
32
  "viem": "2.x",
33
- "@wagmi/core": "2.12.1"
33
+ "@wagmi/core": "2.12.2"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "typescript": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@coinbase/wallet-sdk": "4.0.4",
42
- "@metamask/sdk": "0.26.4",
42
+ "@metamask/sdk": "0.26.5",
43
43
  "@safe-global/safe-apps-provider": "0.18.3",
44
44
  "@safe-global/safe-apps-sdk": "9.1.0",
45
45
  "@walletconnect/ethereum-provider": "2.13.0",
package/src/metaMask.ts CHANGED
@@ -218,10 +218,21 @@ export function metaMask(parameters: MetaMaskParameters = {}) {
218
218
 
219
219
  try {
220
220
  await Promise.all([
221
- provider.request({
222
- method: 'wallet_switchEthereumChain',
223
- params: [{ chainId: numberToHex(chainId) }],
224
- }),
221
+ provider
222
+ .request({
223
+ method: 'wallet_switchEthereumChain',
224
+ params: [{ chainId: numberToHex(chainId) }],
225
+ })
226
+ // During `'wallet_switchEthereumChain'`, MetaMask makes a `'net_version'` RPC call to the target chain.
227
+ // If this request fails, MetaMask does not emit the `'chainChanged'` event, but will still switch the chain.
228
+ // To counter this behavior, we request and emit the current chain ID to confirm the chain switch either via
229
+ // this callback or an externally emitted `'chainChanged'` event.
230
+ // https://github.com/MetaMask/metamask-extension/issues/24247
231
+ .then(async () => {
232
+ const currentChainId = await this.getChainId()
233
+ if (currentChainId === chainId)
234
+ config.emitter.emit('change', { chainId })
235
+ }),
225
236
  new Promise<void>((resolve) =>
226
237
  config.emitter.once('change', ({ chainId: currentChainId }) => {
227
238
  if (currentChainId === chainId) resolve()
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.0.25'
1
+ export const version = '5.0.26'