@wagmi/connectors 2.6.4 → 2.6.5

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.
@@ -8,6 +8,7 @@ import {
8
8
  } from "./chunk-QYMCVNHT.js";
9
9
 
10
10
  // src/walletConnect.ts
11
+ import { normalizeNamespaces } from "@walletconnect/utils";
11
12
  import {
12
13
  SwitchChainError,
13
14
  UserRejectedRequestError,
@@ -88,7 +89,7 @@ var WalletConnectConnector = class extends Connector {
88
89
  await provider.connect({
89
90
  pairingTopic,
90
91
  chains: [targetChainId],
91
- optionalChains
92
+ optionalChains: optionalChains.length ? optionalChains : void 0
92
93
  });
93
94
  __privateMethod(this, _setRequestedChainsIds, setRequestedChainsIds_fn).call(this, this.chains.map(({ id: id2 }) => id2));
94
95
  }
@@ -239,7 +240,7 @@ initProvider_fn = async function() {
239
240
  optionalMethods: OPTIONAL_METHODS,
240
241
  optionalEvents: OPTIONAL_EVENTS,
241
242
  chains: [defaultChain],
242
- optionalChains: optionalChains.length > 0 ? optionalChains : void 0,
243
+ optionalChains: optionalChains.length ? optionalChains : void 0,
243
244
  rpcMap: Object.fromEntries(
244
245
  this.chains.map((chain) => [
245
246
  chain.id,
@@ -300,7 +301,11 @@ _getNamespaceChainsIds = new WeakSet();
300
301
  getNamespaceChainsIds_fn = function() {
301
302
  if (!__privateGet(this, _provider))
302
303
  return [];
303
- const chainIds = __privateGet(this, _provider).session?.namespaces[NAMESPACE]?.chains?.map(
304
+ const namespaces = __privateGet(this, _provider).session?.namespaces;
305
+ if (!namespaces)
306
+ return [];
307
+ const normalizedNamespaces = normalizeNamespaces(namespaces);
308
+ const chainIds = normalizedNamespaces[NAMESPACE]?.chains?.map(
304
309
  (chain) => parseInt(chain.split(":")[1] || "")
305
310
  );
306
311
  return chainIds ?? [];
@@ -309,7 +314,11 @@ _getNamespaceMethods = new WeakSet();
309
314
  getNamespaceMethods_fn = function() {
310
315
  if (!__privateGet(this, _provider))
311
316
  return [];
312
- const methods = __privateGet(this, _provider).session?.namespaces[NAMESPACE]?.methods;
317
+ const namespaces = __privateGet(this, _provider).session?.namespaces;
318
+ if (!namespaces)
319
+ return [];
320
+ const normalizedNamespaces = normalizeNamespaces(namespaces);
321
+ const methods = normalizedNamespaces[NAMESPACE]?.methods;
313
322
  return methods ?? [];
314
323
  };
315
324
  export {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/connectors",
3
3
  "description": "A collection of connectors for wagmi",
4
4
  "license": "MIT",
5
- "version": "2.6.4",
5
+ "version": "2.6.5",
6
6
  "peerDependencies": {
7
7
  "@wagmi/chains": ">=1.3.0",
8
8
  "typescript": ">=5.0.4",
@@ -22,6 +22,7 @@
22
22
  "@safe-global/safe-apps-provider": "^0.17.1",
23
23
  "@safe-global/safe-apps-sdk": "^8.0.0",
24
24
  "@walletconnect/ethereum-provider": "2.8.6",
25
+ "@walletconnect/utils": "2.8.6",
25
26
  "@walletconnect/legacy-provider": "^2.0.0",
26
27
  "@walletconnect/modal": "2.5.9",
27
28
  "abitype": "0.8.7",