@hashgraph/hedera-wallet-connect 2.1.2-canary.4ead3b9.0 → 2.1.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.
@@ -2,7 +2,7 @@ import { BrowserProvider, Contract, JsonRpcSigner, hexlify, isHexString, toQuant
2
2
  import UniversalProvider from '@walletconnect/universal-provider';
3
3
  import { Transaction } from '@hiero-ledger/sdk';
4
4
  import { HederaJsonRpcMethod, } from '../..';
5
- import { getChainsFromApprovedSession, mergeRequiredOptionalNamespaces, } from '../utils';
5
+ import { getChainsFromApprovedSession, getChainId, mergeRequiredOptionalNamespaces, SUPPORTED_EIP155_CHAIN_IDS, } from '../utils';
6
6
  import HIP820Provider from './HIP820Provider';
7
7
  import EIP155Provider from './EIP155Provider';
8
8
  import { createLogger } from '../../lib/shared/logger';
@@ -461,8 +461,19 @@ export class HederaProvider extends UniversalProvider {
461
461
  var _a, _b, _c, _d;
462
462
  const accounts = ((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.namespaces[namespace]) === null || _b === void 0 ? void 0 : _b.accounts) || [];
463
463
  const approvedChains = getChainsFromApprovedSession(accounts);
464
+ // Filter out non-Hedera EIP155 chains that wallets like MetaMask v11+ include in the session
465
+ const filteredChains = namespace === 'eip155'
466
+ ? approvedChains.filter((chain) => {
467
+ const chainId = parseInt(getChainId(chain));
468
+ const supported = SUPPORTED_EIP155_CHAIN_IDS.has(chainId);
469
+ if (!supported) {
470
+ this.hederaLogger.warn(`Skipping unsupported EIP155 chain: ${chain}`);
471
+ }
472
+ return supported;
473
+ })
474
+ : approvedChains;
464
475
  const mergedNamespaces = mergeRequiredOptionalNamespaces(this.namespaces, this.optionalNamespaces);
465
- const combinedNamespace = Object.assign(Object.assign(Object.assign({}, mergedNamespaces[namespace]), { accounts, chains: approvedChains }), (((_d = (_c = this.optionalNamespaces) === null || _c === void 0 ? void 0 : _c[namespace]) === null || _d === void 0 ? void 0 : _d.rpcMap) && {
476
+ const combinedNamespace = Object.assign(Object.assign(Object.assign({}, mergedNamespaces[namespace]), { accounts, chains: filteredChains }), (((_d = (_c = this.optionalNamespaces) === null || _c === void 0 ? void 0 : _c[namespace]) === null || _d === void 0 ? void 0 : _d.rpcMap) && {
466
477
  rpcMap: this.optionalNamespaces[namespace].rpcMap,
467
478
  }));
468
479
  switch (namespace) {
@@ -13,6 +13,7 @@ export declare const HederaChainDefinition: {
13
13
  };
14
14
  };
15
15
  export declare function createNamespaces(caipNetworks: CaipNetwork[]): NamespaceConfig;
16
+ export declare const SUPPORTED_EIP155_CHAIN_IDS: Set<string | number>;
16
17
  export declare function getChainsFromApprovedSession(accounts: string[]): string[];
17
18
  export declare function getChainId(chain: string): string;
18
19
  export declare function mergeRequiredOptionalNamespaces(required?: ProposalTypes.RequiredNamespaces, optional?: ProposalTypes.RequiredNamespaces): ProposalTypes.RequiredNamespaces;
@@ -126,6 +126,10 @@ export function createNamespaces(caipNetworks) {
126
126
  return acc;
127
127
  }, {});
128
128
  }
129
+ export const SUPPORTED_EIP155_CHAIN_IDS = new Set([
130
+ HederaChainDefinition.EVM.Mainnet.id, // 295
131
+ HederaChainDefinition.EVM.Testnet.id, // 296
132
+ ]);
129
133
  export function getChainsFromApprovedSession(accounts) {
130
134
  return accounts.map((address) => `${address.split(':')[0]}:${address.split(':')[1]}`);
131
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraph/hedera-wallet-connect",
3
- "version": "2.1.2-canary.4ead3b9.0",
3
+ "version": "2.1.2",
4
4
  "description": "A library to facilitate integrating Hedera with WalletConnect",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  "@types/jest": "^30.0.0",
42
42
  "jest": "^30.0.3",
43
43
  "nodemon": "^3.1.10",
44
- "prettier": "^3.5.3",
44
+ "prettier": "^3.8.1",
45
45
  "ts-node": "^10.9.2",
46
46
  "typescript": "^5.8.2"
47
47
  }