cake_wallet/lib/reactions/wallet_connect.dart
Adegoke David ef7762eaca
Polygon-Wallet-fixes (#1222)
* fix: Fix issues surrounding polygon release

* Add polygon generation command to pubspec script

* Remove unnecesary cast

* fix: Remove unneeded code

* fix: Adjust workflow file to pick polygonScan apikey

* fix: Issues noticed while testing

* fix: Issues noticed while testing

* fix: Transaction should reflect the token name

* fix: Remove unused import

* feat: Add alchemy node to default migration settings

* Fix sending Polygon delay
Remove alchemy node
Minor Enhancements

* Remove scrolling from multiple choices settings row and make them fill the whole space [skip ci]

* Add USDT poly
Add icon for USDC.e

* Fix ERC20 tokens overriding old wallets
Add USDC.e to exchange

* - Remove unnecessary code
- Minor Enhancements

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2023-12-13 16:03:07 +02:00

57 lines
1.3 KiB
Dart

import 'package:cake_wallet/core/wallet_connect/evm_chain_id.dart';
import 'package:cw_core/wallet_type.dart';
bool isEVMCompatibleChain(WalletType walletType) {
switch (walletType) {
case WalletType.polygon:
case WalletType.ethereum:
return true;
default:
return false;
}
}
String getChainNameSpaceAndIdBasedOnWalletType(WalletType walletType) {
switch (walletType) {
case WalletType.ethereum:
return EVMChainId.ethereum.chain();
case WalletType.polygon:
return EVMChainId.polygon.chain();
default:
return '';
}
}
int getChainIdBasedOnWalletType(WalletType walletType) {
switch (walletType) {
case WalletType.polygon:
return 137;
// For now, we return eth chain Id as the default, we'll modify as we add more wallets
case WalletType.ethereum:
default:
return 1;
}
}
String getChainNameBasedOnWalletType(WalletType walletType) {
switch (walletType) {
case WalletType.ethereum:
return 'eth';
case WalletType.polygon:
return 'polygon';
default:
return '';
}
}
String getTokenNameBasedOnWalletType(WalletType walletType) {
switch (walletType) {
case WalletType.ethereum:
return 'ETH';
case WalletType.polygon:
return 'MATIC';
default:
return '';
}
}