stack_wallet/lib/wallets/crypto_currency/crypto_currency.dart

94 lines
2.5 KiB
Dart
Raw Normal View History

import '../../models/isar/models/blockchain_data/address.dart';
import '../../models/node_model.dart';
import '../../utilities/enums/derive_path_type_enum.dart';
2023-09-18 21:28:31 +00:00
2024-05-23 14:55:14 +00:00
export 'coins/banano.dart';
export 'coins/bitcoin.dart';
export 'coins/bitcoin_frost.dart';
export 'coins/bitcoincash.dart';
2024-08-26 17:38:58 +00:00
export 'coins/cardano.dart';
2024-06-20 20:40:52 +00:00
export 'coins/dash.dart';
2024-05-23 14:55:14 +00:00
export 'coins/dogecoin.dart';
export 'coins/ecash.dart';
export 'coins/epiccash.dart';
export 'coins/ethereum.dart';
export 'coins/firo.dart';
export 'coins/litecoin.dart';
export 'coins/monero.dart';
export 'coins/namecoin.dart';
export 'coins/nano.dart';
export 'coins/particl.dart';
export 'coins/peercoin.dart';
export 'coins/solana.dart';
export 'coins/stellar.dart';
export 'coins/tezos.dart';
export 'coins/wownero.dart';
2023-09-18 21:28:31 +00:00
enum CryptoCurrencyNetwork {
main,
test,
2024-06-19 15:15:49 +00:00
stage,
test4;
bool get isTestNet =>
this == CryptoCurrencyNetwork.test || this == CryptoCurrencyNetwork.test4;
2023-09-18 21:28:31 +00:00
}
abstract class CryptoCurrency {
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;
int get minCoinbaseConfirms => minConfirms;
2023-09-18 21:28:31 +00:00
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 defaultAddressType;
2024-05-15 21:20:45 +00:00
BigInt get satsPerCoin;
int get targetBlockTimeSeconds;
DerivePathType get defaultDerivePathType;
2024-05-15 21:20:45 +00:00
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
}