mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
add plain/tor network flags to node data
This commit is contained in:
parent
f38efd35e9
commit
6cfe9e9c0f
25 changed files with 90 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
import '../utilities/default_nodes.dart';
|
import '../utilities/default_nodes.dart';
|
||||||
import '../utilities/flutter_secure_storage_interface.dart';
|
import '../utilities/flutter_secure_storage_interface.dart';
|
||||||
|
|
||||||
|
@ -38,6 +39,10 @@ class NodeModel {
|
||||||
final bool isDown;
|
final bool isDown;
|
||||||
// @HiveField(10)
|
// @HiveField(10)
|
||||||
final bool? trusted;
|
final bool? trusted;
|
||||||
|
// @HiveField(11)
|
||||||
|
final bool torEnabled;
|
||||||
|
// @HiveField(12)
|
||||||
|
final bool plainEnabled;
|
||||||
|
|
||||||
NodeModel({
|
NodeModel({
|
||||||
required this.host,
|
required this.host,
|
||||||
|
@ -49,6 +54,8 @@ class NodeModel {
|
||||||
required this.coinName,
|
required this.coinName,
|
||||||
required this.isFailover,
|
required this.isFailover,
|
||||||
required this.isDown,
|
required this.isDown,
|
||||||
|
required this.torEnabled,
|
||||||
|
required this.plainEnabled,
|
||||||
this.loginName,
|
this.loginName,
|
||||||
this.trusted,
|
this.trusted,
|
||||||
});
|
});
|
||||||
|
@ -64,6 +71,8 @@ class NodeModel {
|
||||||
bool? isFailover,
|
bool? isFailover,
|
||||||
bool? isDown,
|
bool? isDown,
|
||||||
bool? trusted,
|
bool? trusted,
|
||||||
|
bool? torEnabled,
|
||||||
|
bool? plainEnabled,
|
||||||
}) {
|
}) {
|
||||||
return NodeModel(
|
return NodeModel(
|
||||||
host: host ?? this.host,
|
host: host ?? this.host,
|
||||||
|
@ -77,6 +86,8 @@ class NodeModel {
|
||||||
isFailover: isFailover ?? this.isFailover,
|
isFailover: isFailover ?? this.isFailover,
|
||||||
isDown: isDown ?? this.isDown,
|
isDown: isDown ?? this.isDown,
|
||||||
trusted: trusted ?? this.trusted,
|
trusted: trusted ?? this.trusted,
|
||||||
|
torEnabled: torEnabled ?? this.torEnabled,
|
||||||
|
plainEnabled: plainEnabled ?? this.plainEnabled,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +109,8 @@ class NodeModel {
|
||||||
map['isFailover'] = isFailover;
|
map['isFailover'] = isFailover;
|
||||||
map['isDown'] = isDown;
|
map['isDown'] = isDown;
|
||||||
map['trusted'] = trusted;
|
map['trusted'] = trusted;
|
||||||
|
map['torEnabled'] = torEnabled;
|
||||||
|
map['plainEnabled'] = plainEnabled;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,15 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
|
||||||
isFailover: fields[8] as bool,
|
isFailover: fields[8] as bool,
|
||||||
isDown: fields[9] as bool,
|
isDown: fields[9] as bool,
|
||||||
trusted: fields[10] as bool?,
|
trusted: fields[10] as bool?,
|
||||||
|
torEnabled: fields[11] as bool? ?? true,
|
||||||
|
plainEnabled: fields[12] as bool? ?? true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, NodeModel obj) {
|
void write(BinaryWriter writer, NodeModel obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(11)
|
..writeByte(13)
|
||||||
..writeByte(0)
|
..writeByte(0)
|
||||||
..write(obj.id)
|
..write(obj.id)
|
||||||
..writeByte(1)
|
..writeByte(1)
|
||||||
|
@ -56,7 +58,11 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
|
||||||
..writeByte(9)
|
..writeByte(9)
|
||||||
..write(obj.isDown)
|
..write(obj.isDown)
|
||||||
..writeByte(10)
|
..writeByte(10)
|
||||||
..write(obj.trusted);
|
..write(obj.trusted)
|
||||||
|
..writeByte(11)
|
||||||
|
..write(obj.torEnabled)
|
||||||
|
..writeByte(12)
|
||||||
|
..write(obj.plainEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -1272,6 +1272,8 @@ abstract class SWB {
|
||||||
loginName: node['loginName'] as String?,
|
loginName: node['loginName'] as String?,
|
||||||
isFailover: node['isFailover'] as bool,
|
isFailover: node['isFailover'] as bool,
|
||||||
isDown: node['isDown'] as bool,
|
isDown: node['isDown'] as bool,
|
||||||
|
torEnabled: node['torEnabled'] as bool? ?? true,
|
||||||
|
plainEnabled: node['plainEnabled'] as bool? ?? true,
|
||||||
),
|
),
|
||||||
node["password"] as String?,
|
node["password"] as String?,
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
|
|
||||||
import '../app_config.dart';
|
import '../app_config.dart';
|
||||||
import '../db/hive/db.dart';
|
import '../db/hive/db.dart';
|
||||||
import '../models/node_model.dart';
|
import '../models/node_model.dart';
|
||||||
|
@ -253,7 +254,9 @@ class NodeService extends ChangeNotifier {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
coinName: coin.identifier,
|
coinName: coin.identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
|
torEnabled: nodeMap["torEnabled"] == "true",
|
||||||
isDown: nodeMap["isDown"] == "true",
|
isDown: nodeMap["isDown"] == "true",
|
||||||
|
plainEnabled: nodeMap["plainEnabled"] == "true",
|
||||||
);
|
);
|
||||||
final currentNode = getNodeById(id: nodeMap["id"] as String);
|
final currentNode = getNodeById(id: nodeMap["id"] as String);
|
||||||
if (currentNode != null) {
|
if (currentNode != null) {
|
||||||
|
|
|
@ -77,6 +77,8 @@ class Banano extends NanoCurrency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -239,6 +239,8 @@ class Bitcoin extends Bip39HDCurrency
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -252,6 +254,8 @@ class Bitcoin extends Bip39HDCurrency
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test4:
|
case CryptoCurrencyNetwork.test4:
|
||||||
|
@ -265,6 +269,8 @@ class Bitcoin extends Bip39HDCurrency
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -73,6 +73,8 @@ class BitcoinFrost extends FrostCurrency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -86,6 +88,8 @@ class BitcoinFrost extends FrostCurrency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test4:
|
case CryptoCurrencyNetwork.test4:
|
||||||
|
@ -99,6 +103,8 @@ class BitcoinFrost extends FrostCurrency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -298,6 +298,8 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -311,6 +313,8 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -77,6 +77,8 @@ class Cardano extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -91,7 +93,8 @@ class Cardano extends Bip39Currency {
|
||||||
int get fractionDigits => 6;
|
int get fractionDigits => 6;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get genesisHash => "f0f7892b5c333cffc4b3c4344de48af4cc63f55e44936196f365a9ef2244134f";
|
String get genesisHash =>
|
||||||
|
"f0f7892b5c333cffc4b3c4344de48af4cc63f55e44936196f365a9ef2244134f";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get hasBuySupport => false;
|
bool get hasBuySupport => false;
|
||||||
|
|
|
@ -189,6 +189,8 @@ class Dash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -189,6 +189,8 @@ class Dogecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -202,6 +204,8 @@ class Dogecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -289,6 +289,8 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -80,6 +80,8 @@ class Epiccash extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -57,6 +57,8 @@ class Ethereum extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -231,6 +231,8 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -257,6 +259,8 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -220,6 +220,8 @@ class Litecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -233,6 +235,8 @@ class Litecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -72,6 +72,8 @@ class Monero extends CryptonoteCurrency {
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
trusted: true,
|
trusted: true,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -102,6 +102,8 @@ class Namecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
// case CryptoCurrencyNetwork.test:
|
// case CryptoCurrencyNetwork.test:
|
||||||
// TODO: [prio=low] Add testnet support.
|
// TODO: [prio=low] Add testnet support.
|
||||||
|
|
|
@ -77,6 +77,8 @@ class Nano extends NanoCurrency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -97,6 +97,8 @@ class Particl extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
// case CryptoCurrencyNetwork.test:
|
// case CryptoCurrencyNetwork.test:
|
||||||
// TODO: [prio=low] Add testnet.
|
// TODO: [prio=low] Add testnet.
|
||||||
|
|
|
@ -103,6 +103,8 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -116,6 +118,8 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -55,6 +55,8 @@ class Solana extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
throw Exception("Unsupported network: $network");
|
throw Exception("Unsupported network: $network");
|
||||||
|
|
|
@ -68,6 +68,8 @@ class Stellar extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
case CryptoCurrencyNetwork.test:
|
case CryptoCurrencyNetwork.test:
|
||||||
|
@ -81,6 +83,8 @@ class Stellar extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -118,6 +118,8 @@ class Tezos extends Bip39Currency {
|
||||||
coinName: identifier,
|
coinName: identifier,
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -72,6 +72,8 @@ class Wownero extends CryptonoteCurrency {
|
||||||
isFailover: true,
|
isFailover: true,
|
||||||
isDown: false,
|
isDown: false,
|
||||||
trusted: true,
|
trusted: true,
|
||||||
|
torEnabled: true,
|
||||||
|
plainEnabled: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue