2023-11-15 21:59:01 +00:00
|
|
|
import 'package:nanodart/nanodart.dart';
|
2024-06-13 01:02:14 +00:00
|
|
|
|
2024-05-23 00:37:06 +00:00
|
|
|
import '../../../models/isar/models/isar_models.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/nano_currency.dart';
|
2023-11-15 21:59:01 +00:00
|
|
|
|
|
|
|
class Nano extends NanoCurrency {
|
|
|
|
Nano(super.network) {
|
|
|
|
switch (network) {
|
|
|
|
case CryptoCurrencyNetwork.main:
|
2024-05-15 21:20:45 +00:00
|
|
|
_id = "nano";
|
|
|
|
_idMain = "nano";
|
|
|
|
_name = "Nano";
|
|
|
|
_uriScheme = "nano";
|
|
|
|
_ticker = "XNO";
|
2023-11-15 21:59:01 +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;
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get fractionDigits => 30;
|
|
|
|
|
|
|
|
@override
|
|
|
|
BigInt get satsPerCoin => BigInt.parse(
|
|
|
|
"1000000000000000000000000000000",
|
|
|
|
); // 1*10^30
|
|
|
|
|
2023-11-15 21:59:01 +00:00
|
|
|
@override
|
|
|
|
int get minConfirms => 1;
|
|
|
|
|
2024-05-15 21:20:45 +00:00
|
|
|
@override
|
2024-06-20 16:16:12 +00:00
|
|
|
AddressType get defaultAddressType => AddressType.nano;
|
2024-05-15 21:20:45 +00:00
|
|
|
|
2023-11-15 21:59:01 +00:00
|
|
|
@override
|
|
|
|
String get defaultRepresentative =>
|
|
|
|
"nano_38713x95zyjsqzx6nm1dsom1jmm668owkeb9913ax6nfgj15az3nu8xkx579";
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get nanoAccountType => NanoAccountType.NANO;
|
2023-11-17 01:44:17 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
NodeModel get defaultNode {
|
|
|
|
switch (network) {
|
|
|
|
case CryptoCurrencyNetwork.main:
|
|
|
|
return NodeModel(
|
2024-06-13 01:02:14 +00:00
|
|
|
// host: "https://rainstorm.city/api",
|
|
|
|
host: "https://nodes.nanswap.com/XNO",
|
2023-11-17 01:44:17 +00:00
|
|
|
port: 443,
|
|
|
|
name: DefaultNodes.defaultName,
|
2024-05-15 21:20:45 +00:00
|
|
|
id: DefaultNodes.buildId(this),
|
2023-11-17 01:44:17 +00:00
|
|
|
useSSL: true,
|
|
|
|
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-06-20 16:16:12 +00:00
|
|
|
DerivePathType get defaultDerivePathType => throw UnsupportedError(
|
2024-05-15 21:20:45 +00:00
|
|
|
"$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) {
|
|
|
|
case CryptoCurrencyNetwork.main:
|
|
|
|
return Uri.parse("https://www.nanolooker.com/block/$txid");
|
|
|
|
default:
|
|
|
|
throw Exception(
|
|
|
|
"Unsupported network for defaultBlockExplorer(): $network",
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-11-15 21:59:01 +00:00
|
|
|
}
|