mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-25 13:09:32 +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>
69 lines
1.8 KiB
Dart
69 lines
1.8 KiB
Dart
import 'package:cw_core/crypto_currency.dart';
|
|
import 'package:cw_core/hive_type_ids.dart';
|
|
import 'package:hive/hive.dart';
|
|
|
|
part 'erc20_token.g.dart';
|
|
|
|
@HiveType(typeId: Erc20Token.typeId)
|
|
class Erc20Token extends CryptoCurrency with HiveObjectMixin {
|
|
@HiveField(0)
|
|
final String name;
|
|
@HiveField(1)
|
|
final String symbol;
|
|
@HiveField(2)
|
|
final String contractAddress;
|
|
@HiveField(3)
|
|
final int decimal;
|
|
@HiveField(4, defaultValue: true)
|
|
bool _enabled;
|
|
@HiveField(5)
|
|
final String? iconPath;
|
|
|
|
bool get enabled => _enabled;
|
|
|
|
set enabled(bool value) => _enabled = value;
|
|
|
|
Erc20Token({
|
|
required this.name,
|
|
required this.symbol,
|
|
required this.contractAddress,
|
|
required this.decimal,
|
|
bool enabled = true,
|
|
this.iconPath,
|
|
}) : _enabled = enabled,
|
|
super(
|
|
name: symbol.toLowerCase(),
|
|
title: symbol.toUpperCase(),
|
|
fullName: name,
|
|
tag: "ETH",
|
|
iconPath: iconPath,
|
|
decimals: decimal
|
|
);
|
|
|
|
Erc20Token.copyWith(Erc20Token other, String? icon)
|
|
: this.name = other.name,
|
|
this.symbol = other.symbol,
|
|
this.contractAddress = other.contractAddress,
|
|
this.decimal = other.decimal,
|
|
this._enabled = other.enabled,
|
|
this.iconPath = icon,
|
|
super(
|
|
name: other.name,
|
|
title: other.symbol.toUpperCase(),
|
|
fullName: other.name,
|
|
tag: "ETH",
|
|
iconPath: icon,
|
|
decimals: other.decimal
|
|
);
|
|
|
|
static const typeId = ERC20_TOKEN_TYPE_ID;
|
|
static const boxName = 'Erc20Tokens';
|
|
static const polygonBoxName = ' PolygonErc20Tokens';
|
|
|
|
@override
|
|
bool operator ==(other) => (other is Erc20Token && other.contractAddress == contractAddress) ||
|
|
(other is CryptoCurrency && other.title == title);
|
|
|
|
@override
|
|
int get hashCode => contractAddress.hashCode;
|
|
}
|