| 1 | import 'package:cw_core/erc20_token.dart'; |
| 2 | import 'package:cw_evm/tokens/arbitrum_tokens.dart'; |
| 3 | import 'package:cw_evm/tokens/base_tokens.dart'; |
| 4 | import 'package:cw_evm/tokens/bsc_tokens.dart'; |
| 5 | import 'package:cw_evm/tokens/ethereum_tokens.dart'; |
| 6 | import 'package:cw_evm/tokens/polygon_tokens.dart'; |
| 7 | |
| 8 | /// Default ERC20 tokens for each EVM chain and utility methods for interacting with them |
| 9 | class EVMChainDefaultTokens { |
| 10 | static List<Erc20Token> getDefaultTokensByChainId(int chainId) { |
| 11 | return switch (chainId) { |
| 12 | 1 => EthereumTokens.tokens, |
| 13 | 137 => PolygonTokens.tokens, |
| 14 | 8453 => BaseTokens.tokens, |
| 15 | 42161 => ArbitrumTokens.tokens, |
| 16 | 56 => BSCTokens.tokens, |
| 17 | _ => [], |
| 18 | }; |
| 19 | } |
| 20 | |
| 21 | static List<String> getDefaultTokenAddresses(int chainId) { |
| 22 | return getDefaultTokensByChainId(chainId).map((token) => token.contractAddress).toList(); |
| 23 | } |
| 24 | |
| 25 | static List<String> getDefaultTokenSymbols(int chainId) { |
| 26 | return getDefaultTokensByChainId(chainId).map((token) => token.symbol.toUpperCase()).toList(); |
| 27 | } |
| 28 | } |