Files
hash-wallet/cw_evm/lib/evm_chain_client_factory.dart
T
046e57c598 Add Robinhood Chain (#3398)
* fix android CI

* feat: Add Robinhood Chain, all major flows done. minor issue now is our providers don't support it yet as its still pretty early, two weeks from launch

* feat: Add Robinhood Chain, all major flows done. minor issue now is our providers don't support it yet as its still pretty early, two weeks from launch

* Cleanup

* auto-reformat

* fix ui issue and contact listing for tokens

* fix: missing icons and crash for fee priority in settings

* chore: cleanup

* fixes from feedbacks

* fix: review issues and sync to latest dev
feat: switch history api to etherscan, add history toggle to privacy settings, exclude robETH from exchange pickers, skip tokens discovery for chains that moralis hasn't indexed, add tests

* fix: address Robinhood review comments

* fix: show Solana token icons in history

* fix: address review comments and default Robinhood to PublicNode

* fix:  revert filter and refuse unmapped networks in provider

---------

Co-authored-by: Robert Malikowski <malikowskirobert@gmail.com>
2026-10-04 13:22:05 +02:00

43 lines
1.3 KiB
Dart

import 'package:cw_evm/clients/arbitrum_client.dart';
import 'package:cw_evm/clients/base_client.dart';
import 'package:cw_evm/clients/bsc_client.dart';
import "package:cw_evm/clients/robinhood_client.dart";
import 'package:cw_evm/clients/ethereum_client.dart';
import 'package:cw_evm/clients/polygon_client.dart';
import 'package:cw_evm/clients/evm_chain_client.dart';
import 'package:cw_evm/evm_chain_registry.dart';
/// Factory to create appropriate EVMChainClient based on chainId
class EVMChainClientFactory {
static final EvmChainRegistry _registry = EvmChainRegistry();
/// Create an EVMChainClient for the given chainId
///
/// Throws an exception if chainId is not registered
static EVMChainClient createClient(int chainId) {
final config = _registry.getChainConfig(chainId);
if (config == null) {
throw Exception('Chain config not found for chainId: $chainId');
}
// Check if chain needs custom client
switch (chainId) {
case 1:
return EthereumClient();
case 137:
return PolygonClient();
case 8453:
return BaseClient();
case 42161:
return ArbitrumClient();
case 56:
return BSCClient();
case 4663:
return RobinhoodClient();
default:
return EVMChainClient(chainId: chainId);
}
}
}