import 'package:hash_wallet/src/screens/wallet_connect/services/chain_service/eth/evm_chain_id.dart'; import 'package:hash_wallet/src/screens/wallet_connect/services/chain_service/eth/evm_supported_methods.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:hash_wallet/evm/evm.dart'; bool isEVMCompatibleChain(WalletType walletType) { switch (walletType) { case WalletType.polygon: case WalletType.ethereum: case WalletType.base: case WalletType.arbitrum: case WalletType.bsc: return true; default: return false; } } // Blink Protection is supported on Ethereum and Base chains bool canSupportBlinkProtection(int? chainId) { if (chainId == null) return false; return chainId == 1 || chainId == 8453; } bool isNFTACtivatedChain(WalletType walletType, {int? chainId}) { if (chainId != null) { switch (chainId) { case 1: case 8453: case 137: case 42161: case 56: return true; default: return false; } } switch (walletType) { default: return false; } } bool isWalletConnectCompatibleChain(WalletType walletType) { switch (walletType) { case WalletType.polygon: case WalletType.ethereum: case WalletType.base: case WalletType.arbitrum: case WalletType.bsc: return true; default: return false; } } String getChainNameSpaceAndIdBasedOnWalletType(WalletType walletType, {int? chainId}) { if (chainId != null) { return evm!.getCaip2ByChainId(chainId); } switch (walletType) { case WalletType.ethereum: return EVMChainId.ethereum.chain(); case WalletType.polygon: return EVMChainId.polygon.chain(); case WalletType.base: return EVMChainId.base.chain(); case WalletType.arbitrum: return EVMChainId.arbitrum.chain(); case WalletType.bsc: return EVMChainId.bsc.chain(); default: return ''; } } List getChainSupportedMethodsOnWalletType(WalletType walletType) { switch (walletType) { case WalletType.ethereum: case WalletType.polygon: case WalletType.base: case WalletType.arbitrum: case WalletType.bsc: return EVMSupportedMethods.values.map((e) => e.name).toList(); default: return []; } } String getChainNameBasedOnWalletType(WalletType walletType, {int? chainId}) { if (chainId != null) { return evm!.getChainNameByChainId(chainId); } return evm!.getChainNameByWalletType(walletType); } String getTokenNameBasedOnWalletType(WalletType walletType, {int? chainId}) { if (chainId != null) { return evm!.getTokenNameByChainId(chainId); } return evm!.getTokenNameByWalletType(walletType); }