2023-10-30 15:48:05 +00:00
|
|
|
import 'package:flutter_libepiccash/lib.dart' as epic;
|
2024-05-23 00:37:06 +00:00
|
|
|
import '../../../models/isar/models/blockchain_data/address.dart';
|
|
|
|
import '../../../models/node_model.dart';
|
|
|
|
import '../../../utilities/default_nodes.dart';
|
|
|
|
import '../../../utilities/enums/derive_path_type_enum.dart';
|
|
|
|
import '../crypto_currency.dart';
|
|
|
|
import '../intermediate/bip39_currency.dart';
|
2023-09-18 21:28:31 +00:00
|
|
|
|
|
|
|
class Epiccash extends Bip39Currency {
|
|
|
|
Epiccash(super.network) {
|
2024-05-15 21:20:45 +00:00
|
|
|
_idMain = "epicCash";
|
|
|
|
_uriScheme = "epic"; // ?
|
2023-09-18 21:28:31 +00:00
|
|
|
switch (network) {
|
|
|
|
case CryptoCurrencyNetwork.main:
|
2024-05-15 21:20:45 +00:00
|
|
|
_id = _idMain;
|
|
|
|
_name = "Epic Cash";
|
|
|
|
_ticker = "EPIC";
|
2023-09-18 21:28:31 +00:00
|
|
|
default:
|
|
|
|
throw Exception("Unsupported network: $network");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-15 21:20:45 +00:00
|
|
|
late final String _id;
|
|
|
|
@override
|
|
|
|
String get identifier => _id;
|
|
|
|
|
|
|
|
late final String _idMain;
|
|
|
|
@override
|
|
|
|
String get mainNetId => _idMain;
|
|
|
|
|
|
|
|
late final String _name;
|
|
|
|
@override
|
|
|
|
String get prettyName => _name;
|
|
|
|
|
|
|
|
late final String _uriScheme;
|
|
|
|
@override
|
|
|
|
String get uriScheme => _uriScheme;
|
|
|
|
|
|
|
|
late final String _ticker;
|
|
|
|
@override
|
|
|
|
String get ticker => _ticker;
|
|
|
|
|
2023-10-30 17:41:52 +00:00
|
|
|
@override
|
|
|
|
String get genesisHash {
|
|
|
|
return "not used in epiccash";
|
|
|
|
}
|
|
|
|
|
2023-09-18 21:28:31 +00:00
|
|
|
@override
|
|
|
|
// change this to change the number of confirms a tx needs in order to show as confirmed
|
|
|
|
int get minConfirms => 3;
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool validateAddress(String address) {
|
|
|
|
// Invalid address that contains HTTP and epicbox domain
|
|
|
|
if ((address.startsWith("http://") || address.startsWith("https://")) &&
|
|
|
|
address.contains("@")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (address.startsWith("http://") || address.startsWith("https://")) {
|
|
|
|
if (Uri.tryParse(address) != null) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-30 15:48:05 +00:00
|
|
|
return epic.LibEpiccash.validateSendAddress(address: address);
|
2023-09-18 21:28:31 +00:00
|
|
|
}
|
2023-11-17 01:44:17 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
NodeModel get defaultNode {
|
|
|
|
switch (network) {
|
|
|
|
case CryptoCurrencyNetwork.main:
|
|
|
|
return NodeModel(
|
2024-05-15 21:20:45 +00:00
|
|
|
host: "http://epiccash.stackwallet.com",
|
|
|
|
port: 3413,
|
2023-11-17 01:44:17 +00:00
|
|
|
name: DefaultNodes.defaultName,
|
2024-05-15 21:20:45 +00:00
|
|
|
id: DefaultNodes.buildId(this),
|
|
|
|
useSSL: false,
|
2023-11-17 01:44:17 +00:00
|
|
|
enabled: true,
|
2024-05-15 21:20:45 +00:00
|
|
|
coinName: identifier,
|
2023-11-17 01:44:17 +00:00
|
|
|
isFailover: true,
|
|
|
|
isDown: false,
|
|
|
|
);
|
|
|
|
|
|
|
|
default:
|
|
|
|
throw UnimplementedError();
|
|
|
|
}
|
|
|
|
}
|
2024-04-17 18:04:10 +00:00
|
|
|
|
|
|
|
@override
|
2024-05-15 21:20:45 +00:00
|
|
|
int get defaultSeedPhraseLength => 24;
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get fractionDigits => 8;
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get hasBuySupport => false;
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get hasMnemonicPassphraseSupport => false;
|
|
|
|
|
|
|
|
@override
|
|
|
|
List<int> get possibleMnemonicLengths => [defaultSeedPhraseLength, 12];
|
|
|
|
|
|
|
|
@override
|
|
|
|
AddressType get primaryAddressType => AddressType.mimbleWimble;
|
|
|
|
|
|
|
|
@override
|
|
|
|
BigInt get satsPerCoin => BigInt.from(100000000);
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get targetBlockTimeSeconds => 60;
|
|
|
|
|
|
|
|
@override
|
|
|
|
DerivePathType get primaryDerivePathType => throw UnsupportedError(
|
|
|
|
"$runtimeType does not use bitcoin style derivation paths",
|
|
|
|
);
|
2024-04-17 18:04:10 +00:00
|
|
|
|
|
|
|
@override
|
2024-05-15 21:20:45 +00:00
|
|
|
Uri defaultBlockExplorer(String txid) {
|
|
|
|
switch (network) {
|
|
|
|
default:
|
|
|
|
throw Exception(
|
|
|
|
"Unsupported network for defaultBlockExplorer(): $network",
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-09-18 21:28:31 +00:00
|
|
|
}
|