mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 01:47:41 +00:00
b3d579c24a
* chore: Initial setup for polygon package * feat: Add polygon node urls * feat: Add Polygon(MATIC) wallet WIP * feat: Add Polygon(MATIC) wallet WIP * feat: Add Polygon MATIC wallet [skip ci] * fix: Issue with create/restore wallet for polygon * feat: Add erc20 tokens for polygon * feat: Adding Polygon MATIC Wallet * fix: Add build command for polygon to workflow file to fix failing action * fix: Switch evm to not display additional balance * chore: Sync with remote * fix: Revert change to inject app script * feat: Add polygon erc20 tokens * feat: Increase migration version * fix: Restore from QR address validator fix * fix: Adjust wallet connect connection flow to adapt to wallet type * fix: Make wallet fetch nfts based on the current wallet type * fix: Make wallet fetch nfts based on the current wallet type * fix: Try fetching transactions with moralis * fix: Requested review changes * fix: Error creating new wallet * fix: Revert script * fix: Exclude spam NFTs from nft listing API response * Update default_erc20_tokens.dart * replace matic with matic poly * Add polygon wallet scheme to app links * style: reformat default_settings_migration.dart * minor enhancement * fix using different wallet function for setting the transaction priorities * fix: Add chain to calls * Add USDC.e to initial coins * Add other default polygon node * Use Polygon scan some UI fixes * Add polygon scan api key to secrets generation code --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
46 lines
1.1 KiB
Dart
46 lines
1.1 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 '';
|
|
}
|
|
}
|