stack_wallet/lib/wallets/crypto_currency/coins/epiccash.dart

128 lines
3.1 KiB
Dart

import 'package:flutter_libepiccash/lib.dart' as epic;
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';
class Epiccash extends Bip39Currency {
Epiccash(super.network) {
_idMain = "epicCash";
_uriScheme = "epic"; // ?
switch (network) {
case CryptoCurrencyNetwork.main:
_id = _idMain;
_name = "Epic Cash";
_ticker = "EPIC";
default:
throw Exception("Unsupported network: $network");
}
}
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;
@override
String get genesisHash {
return "not used in epiccash";
}
@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;
}
}
return epic.LibEpiccash.validateSendAddress(address: address);
}
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "http://epiccash.stackwallet.com",
port: 3413,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(this),
useSSL: false,
enabled: true,
coinName: identifier,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
@override
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 defaultAddressType => AddressType.mimbleWimble;
@override
BigInt get satsPerCoin => BigInt.from(100000000);
@override
int get targetBlockTimeSeconds => 60;
@override
DerivePathType get defaultDerivePathType => throw UnsupportedError(
"$runtimeType does not use bitcoin style derivation paths",
);
@override
Uri defaultBlockExplorer(String txid) {
switch (network) {
default:
throw Exception(
"Unsupported network for defaultBlockExplorer(): $network",
);
}
}
}