mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-20 06:08:34 +02:00
Cw 602 nano bad rep (#1356)
* add support for paths in node settings * update translations and fixes * fix node path * add rep warning flag * update translations * code cleanup [skip ci] * add additional node options * add migration * update transaction history rpc to be under the limit * review fixes [skip ci] * [skip ci] updates * move n2_node.dart * minor code improvements * more minor code cleanup
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
class N2Node {
|
||||
N2Node({
|
||||
this.weight,
|
||||
this.uptime,
|
||||
this.score,
|
||||
this.account,
|
||||
this.alias,
|
||||
});
|
||||
|
||||
String? uptime;
|
||||
double? weight;
|
||||
int? score;
|
||||
String? account;
|
||||
String? alias;
|
||||
|
||||
factory N2Node.fromJson(Map<String, dynamic> json) => N2Node(
|
||||
weight: double.tryParse((json['weight'] as num).toString()),
|
||||
uptime: json['uptime'] as String?,
|
||||
score: json['score'] as int?,
|
||||
account: json['rep_address'] as String?,
|
||||
alias: json['alias'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'uptime': uptime,
|
||||
'weight': weight,
|
||||
'score': score,
|
||||
'rep_address': account,
|
||||
'alias': alias,
|
||||
};
|
||||
}
|
||||
+14
-4
@@ -21,6 +21,7 @@ class Node extends HiveObject with Keyable {
|
||||
this.trusted = false,
|
||||
this.socksProxyAddress,
|
||||
String? uri,
|
||||
String? path,
|
||||
WalletType? type,
|
||||
}) {
|
||||
if (uri != null) {
|
||||
@@ -29,10 +30,14 @@ class Node extends HiveObject with Keyable {
|
||||
if (type != null) {
|
||||
this.type = type;
|
||||
}
|
||||
if (path != null) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
Node.fromMap(Map<String, Object?> map)
|
||||
: uriRaw = map['uri'] as String? ?? '',
|
||||
path = map['path'] as String? ?? '',
|
||||
login = map['login'] as String?,
|
||||
password = map['password'] as String?,
|
||||
useSSL = map['useSSL'] as bool?,
|
||||
@@ -63,6 +68,9 @@ class Node extends HiveObject with Keyable {
|
||||
@HiveField(6)
|
||||
String? socksProxyAddress;
|
||||
|
||||
@HiveField(7, defaultValue: '')
|
||||
String? path;
|
||||
|
||||
bool get isSSL => useSSL ?? false;
|
||||
|
||||
bool get useSocksProxy => socksProxyAddress == null ? false : socksProxyAddress!.isNotEmpty;
|
||||
@@ -79,9 +87,9 @@ class Node extends HiveObject with Keyable {
|
||||
case WalletType.nano:
|
||||
case WalletType.banano:
|
||||
if (isSSL) {
|
||||
return Uri.https(uriRaw, '');
|
||||
return Uri.https(uriRaw, path ?? '');
|
||||
} else {
|
||||
return Uri.http(uriRaw, '');
|
||||
return Uri.http(uriRaw, path ?? '');
|
||||
}
|
||||
case WalletType.ethereum:
|
||||
case WalletType.polygon:
|
||||
@@ -103,7 +111,8 @@ class Node extends HiveObject with Keyable {
|
||||
other.typeRaw == typeRaw &&
|
||||
other.useSSL == useSSL &&
|
||||
other.trusted == trusted &&
|
||||
other.socksProxyAddress == socksProxyAddress);
|
||||
other.socksProxyAddress == socksProxyAddress &&
|
||||
other.path == path);
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
@@ -113,7 +122,8 @@ class Node extends HiveObject with Keyable {
|
||||
typeRaw.hashCode ^
|
||||
useSSL.hashCode ^
|
||||
trusted.hashCode ^
|
||||
socksProxyAddress.hashCode;
|
||||
socksProxyAddress.hashCode ^
|
||||
path.hashCode;
|
||||
|
||||
@override
|
||||
dynamic get keyIndex {
|
||||
|
||||
Reference in New Issue
Block a user