stack_wallet/lib/wallets/crypto_currency/crypto_currency.dart

70 lines
1.9 KiB
Dart
Raw Normal View History

2024-05-15 21:20:45 +00:00
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
2024-05-15 21:20:45 +00:00
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
2023-09-18 21:28:31 +00:00
enum CryptoCurrencyNetwork {
main,
test,
stage;
}
abstract class CryptoCurrency {
2024-05-15 21:20:45 +00:00
// @Deprecated("[prio=low] Should eventually move away from Coin enum")
// late final CryptoCurrency coin;
2023-09-18 21:28:31 +00:00
final CryptoCurrencyNetwork network;
CryptoCurrency(this.network);
2024-05-15 21:20:45 +00:00
// Identifier should be unique.
/// This [identifier] should also match the old `Coin` enum name for each
/// respective coin as it is used to differentiate between coins in persistent
/// storage.
String get identifier;
/// Should be the [identifier] of the main net version of the currency
String get mainNetId;
String get ticker;
String get prettyName;
String get uriScheme;
// override in subclass if the currency has tokens on it's network
// (used for eth currently)
bool get hasTokenSupport => false;
// Override in subclass if the currency has Tor support:
bool get torSupport => false;
2023-09-18 21:28:31 +00:00
int get minConfirms;
2023-10-30 17:41:52 +00:00
// TODO: [prio=low] could be handled differently as (at least) epiccash does not use this
String get genesisHash;
2023-09-18 21:28:31 +00:00
bool validateAddress(String address);
NodeModel get defaultNode;
2024-05-15 21:20:45 +00:00
int get defaultSeedPhraseLength;
int get fractionDigits;
bool get hasBuySupport;
bool get hasMnemonicPassphraseSupport;
List<int> get possibleMnemonicLengths;
AddressType get primaryAddressType;
BigInt get satsPerCoin;
int get targetBlockTimeSeconds;
DerivePathType get primaryDerivePathType;
Uri defaultBlockExplorer(String txid);
@override
bool operator ==(Object other) {
return other is CryptoCurrency &&
other.runtimeType == runtimeType &&
other.network == network;
}
@override
int get hashCode => Object.hash(runtimeType, network);
2023-09-18 21:28:31 +00:00
}