enforce default node addition per crypto currency

This commit is contained in:
julian 2023-11-16 19:44:17 -06:00
parent 994922c146
commit f3612ab79b
11 changed files with 375 additions and 83 deletions

View file

@ -13,9 +13,10 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
abstract class DefaultNodes { abstract class DefaultNodes {
static const String defaultNodeIdPrefix = "default_"; static const String defaultNodeIdPrefix = "default_";
static String _nodeId(Coin coin) => "$defaultNodeIdPrefix${coin.name}"; static String buildId(Coin coin) => "$defaultNodeIdPrefix${coin.name}";
static const String defaultName = "Stack Default"; static const String defaultName = "Stack Default";
@Deprecated("old and decrepit")
static List<NodeModel> get all => [ static List<NodeModel> get all => [
bitcoin, bitcoin,
litecoin, litecoin,
@ -44,8 +45,8 @@ abstract class DefaultNodes {
static NodeModel get bitcoin => NodeModel( static NodeModel get bitcoin => NodeModel(
host: "bitcoin.stackwallet.com", host: "bitcoin.stackwallet.com",
port: 50002, port: 50002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.bitcoin), id: DefaultNodes.buildId(Coin.bitcoin),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.bitcoin.name, coinName: Coin.bitcoin.name,
@ -56,8 +57,8 @@ abstract class DefaultNodes {
static NodeModel get litecoin => NodeModel( static NodeModel get litecoin => NodeModel(
host: "litecoin.stackwallet.com", host: "litecoin.stackwallet.com",
port: 20063, port: 20063,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.litecoin), id: DefaultNodes.buildId(Coin.litecoin),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.litecoin.name, coinName: Coin.litecoin.name,
@ -68,8 +69,8 @@ abstract class DefaultNodes {
static NodeModel get litecoinTestNet => NodeModel( static NodeModel get litecoinTestNet => NodeModel(
host: "litecoin.stackwallet.com", host: "litecoin.stackwallet.com",
port: 51002, port: 51002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.litecoinTestNet), id: DefaultNodes.buildId(Coin.litecoinTestNet),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.litecoinTestNet.name, coinName: Coin.litecoinTestNet.name,
@ -80,8 +81,8 @@ abstract class DefaultNodes {
static NodeModel get bitcoincash => NodeModel( static NodeModel get bitcoincash => NodeModel(
host: "bitcoincash.stackwallet.com", host: "bitcoincash.stackwallet.com",
port: 50002, port: 50002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.bitcoincash), id: DefaultNodes.buildId(Coin.bitcoincash),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.bitcoincash.name, coinName: Coin.bitcoincash.name,
@ -92,8 +93,8 @@ abstract class DefaultNodes {
static NodeModel get dogecoin => NodeModel( static NodeModel get dogecoin => NodeModel(
host: "dogecoin.stackwallet.com", host: "dogecoin.stackwallet.com",
port: 50022, port: 50022,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.dogecoin), id: DefaultNodes.buildId(Coin.dogecoin),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.dogecoin.name, coinName: Coin.dogecoin.name,
@ -104,8 +105,8 @@ abstract class DefaultNodes {
static NodeModel get firo => NodeModel( static NodeModel get firo => NodeModel(
host: "firo.stackwallet.com", host: "firo.stackwallet.com",
port: 50002, port: 50002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.firo), id: DefaultNodes.buildId(Coin.firo),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.firo.name, coinName: Coin.firo.name,
@ -116,8 +117,8 @@ abstract class DefaultNodes {
static NodeModel get monero => NodeModel( static NodeModel get monero => NodeModel(
host: "https://monero.stackwallet.com", host: "https://monero.stackwallet.com",
port: 18081, port: 18081,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.monero), id: DefaultNodes.buildId(Coin.monero),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.monero.name, coinName: Coin.monero.name,
@ -129,8 +130,8 @@ abstract class DefaultNodes {
static NodeModel get wownero => NodeModel( static NodeModel get wownero => NodeModel(
host: "https://wownero.stackwallet.com", host: "https://wownero.stackwallet.com",
port: 34568, port: 34568,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.wownero), id: DefaultNodes.buildId(Coin.wownero),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.wownero.name, coinName: Coin.wownero.name,
@ -142,8 +143,8 @@ abstract class DefaultNodes {
static NodeModel get epicCash => NodeModel( static NodeModel get epicCash => NodeModel(
host: "http://epiccash.stackwallet.com", host: "http://epiccash.stackwallet.com",
port: 3413, port: 3413,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.epicCash), id: DefaultNodes.buildId(Coin.epicCash),
useSSL: false, useSSL: false,
enabled: true, enabled: true,
coinName: Coin.epicCash.name, coinName: Coin.epicCash.name,
@ -154,8 +155,8 @@ abstract class DefaultNodes {
static NodeModel get ethereum => NodeModel( static NodeModel get ethereum => NodeModel(
host: "https://eth.stackwallet.com", host: "https://eth.stackwallet.com",
port: 443, port: 443,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.ethereum), id: DefaultNodes.buildId(Coin.ethereum),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.ethereum.name, coinName: Coin.ethereum.name,
@ -166,8 +167,8 @@ abstract class DefaultNodes {
static NodeModel get namecoin => NodeModel( static NodeModel get namecoin => NodeModel(
host: "namecoin.stackwallet.com", host: "namecoin.stackwallet.com",
port: 57002, port: 57002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.namecoin), id: DefaultNodes.buildId(Coin.namecoin),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.namecoin.name, coinName: Coin.namecoin.name,
@ -176,66 +177,71 @@ abstract class DefaultNodes {
); );
static NodeModel get particl => NodeModel( static NodeModel get particl => NodeModel(
host: "particl.stackwallet.com", host: "particl.stackwallet.com",
port: 58002, port: 58002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.particl), id: DefaultNodes.buildId(Coin.particl),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.particl.name, coinName: Coin.particl.name,
isFailover: true, isFailover: true,
isDown: false); isDown: false,
);
static NodeModel get stellar => NodeModel( static NodeModel get stellar => NodeModel(
host: "https://horizon.stellar.org", host: "https://horizon.stellar.org",
port: 443, port: 443,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.stellar), id: DefaultNodes.buildId(Coin.stellar),
useSSL: false, useSSL: false,
enabled: true, enabled: true,
coinName: Coin.stellar.name, coinName: Coin.stellar.name,
isFailover: true, isFailover: true,
isDown: false); isDown: false,
);
static NodeModel get tezos => NodeModel( static NodeModel get tezos => NodeModel(
// TODO: Change this to stack wallet one // TODO: Change this to stack wallet one
host: "https://mainnet.api.tez.ie", host: "https://mainnet.api.tez.ie",
port: 443, port: 443,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.tezos), id: DefaultNodes.buildId(Coin.tezos),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.tezos.name, coinName: Coin.tezos.name,
isFailover: true, isFailover: true,
isDown: false); isDown: false,
);
static NodeModel get nano => NodeModel( static NodeModel get nano => NodeModel(
host: "https://rainstorm.city/api", host: "https://rainstorm.city/api",
port: 443, port: 443,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.nano), id: DefaultNodes.buildId(Coin.nano),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.nano.name, coinName: Coin.nano.name,
isFailover: true, isFailover: true,
isDown: false); isDown: false,
);
static NodeModel get banano => NodeModel( static NodeModel get banano => NodeModel(
host: "https://kaliumapi.appditto.com/api", host: "https://kaliumapi.appditto.com/api",
port: 443, port: 443,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.banano), id: DefaultNodes.buildId(Coin.banano),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.banano.name, coinName: Coin.banano.name,
isFailover: true, isFailover: true,
isDown: false); isDown: false,
);
static NodeModel get bitcoinTestnet => NodeModel( static NodeModel get bitcoinTestnet => NodeModel(
host: "bitcoin-testnet.stackwallet.com", host: "bitcoin-testnet.stackwallet.com",
port: 51002, port: 51002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.bitcoinTestNet), id: DefaultNodes.buildId(Coin.bitcoinTestNet),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.bitcoinTestNet.name, coinName: Coin.bitcoinTestNet.name,
@ -246,7 +252,7 @@ abstract class DefaultNodes {
// static NodeModel get firoTestnet => NodeModel( // static NodeModel get firoTestnet => NodeModel(
// host: "firo-testnet.stackwallet.com", // host: "firo-testnet.stackwallet.com",
// port: 50002, // port: 50002,
// name: defaultName, // name: DefaultNodes.defaultName,
// id: _nodeId(Coin.firoTestNet), // id: _nodeId(Coin.firoTestNet),
// useSSL: true, // useSSL: true,
// enabled: true, // enabled: true,
@ -259,8 +265,8 @@ abstract class DefaultNodes {
static NodeModel get firoTestnet => NodeModel( static NodeModel get firoTestnet => NodeModel(
host: "95.179.164.13", host: "95.179.164.13",
port: 51002, port: 51002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.firoTestNet), id: DefaultNodes.buildId(Coin.firoTestNet),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.firoTestNet.name, coinName: Coin.firoTestNet.name,
@ -271,8 +277,8 @@ abstract class DefaultNodes {
static NodeModel get dogecoinTestnet => NodeModel( static NodeModel get dogecoinTestnet => NodeModel(
host: "dogecoin-testnet.stackwallet.com", host: "dogecoin-testnet.stackwallet.com",
port: 50022, port: 50022,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.dogecoinTestNet), id: DefaultNodes.buildId(Coin.dogecoinTestNet),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.dogecoinTestNet.name, coinName: Coin.dogecoinTestNet.name,
@ -283,8 +289,8 @@ abstract class DefaultNodes {
static NodeModel get bitcoincashTestnet => NodeModel( static NodeModel get bitcoincashTestnet => NodeModel(
host: "bitcoincash-testnet.stackwallet.com", host: "bitcoincash-testnet.stackwallet.com",
port: 60002, port: 60002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.bitcoincashTestnet), id: DefaultNodes.buildId(Coin.bitcoincashTestnet),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.bitcoincashTestnet.name, coinName: Coin.bitcoincashTestnet.name,
@ -295,8 +301,8 @@ abstract class DefaultNodes {
static NodeModel get eCash => NodeModel( static NodeModel get eCash => NodeModel(
host: "electrum.bitcoinabc.org", host: "electrum.bitcoinabc.org",
port: 50002, port: 50002,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.eCash), id: DefaultNodes.buildId(Coin.eCash),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.eCash.name, coinName: Coin.eCash.name,
@ -307,8 +313,8 @@ abstract class DefaultNodes {
static NodeModel get stellarTestnet => NodeModel( static NodeModel get stellarTestnet => NodeModel(
host: "https://horizon-testnet.stellar.org/", host: "https://horizon-testnet.stellar.org/",
port: 50022, port: 50022,
name: defaultName, name: DefaultNodes.defaultName,
id: _nodeId(Coin.stellarTestnet), id: DefaultNodes.buildId(Coin.stellarTestnet),
useSSL: true, useSSL: true,
enabled: true, enabled: true,
coinName: Coin.stellarTestnet.name, coinName: Coin.stellarTestnet.name,

View file

@ -1,4 +1,6 @@
import 'package:nanodart/nanodart.dart'; import 'package:nanodart/nanodart.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/nano_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/intermediate/nano_currency.dart';
@ -22,4 +24,25 @@ class Banano extends NanoCurrency {
@override @override
int get nanoAccountType => NanoAccountType.BANANO; int get nanoAccountType => NanoAccountType.BANANO;
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "https://kaliumapi.appditto.com/api",
port: 443,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.banano),
useSSL: true,
enabled: true,
coinName: Coin.banano.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,6 +1,8 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
@ -175,4 +177,38 @@ class Bitcoin extends Bip39HDCurrency {
return false; return false;
} }
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "bitcoin.stackwallet.com",
port: 50002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.bitcoin),
useSSL: true,
enabled: true,
coinName: Coin.bitcoin.name,
isFailover: true,
isDown: false,
);
case CryptoCurrencyNetwork.test:
return NodeModel(
host: "bitcoin-testnet.stackwallet.com",
port: 51002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.bitcoinTestNet),
useSSL: true,
enabled: true,
coinName: Coin.bitcoinTestNet.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -5,7 +5,9 @@ import 'package:bitbox/bitbox.dart' as bitbox;
import 'package:bs58check/bs58check.dart' as bs58check; import 'package:bs58check/bs58check.dart' as bs58check;
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
@ -245,4 +247,38 @@ class Bitcoincash extends Bip39HDCurrency {
} }
throw ArgumentError('$address has no matching Script'); throw ArgumentError('$address has no matching Script');
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "bitcoincash.stackwallet.com",
port: 50002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.bitcoincash),
useSSL: true,
enabled: true,
coinName: Coin.bitcoincash.name,
isFailover: true,
isDown: false,
);
case CryptoCurrencyNetwork.test:
return NodeModel(
host: "bitcoincash-testnet.stackwallet.com",
port: 60002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.bitcoincashTestnet),
useSSL: true,
enabled: true,
coinName: Coin.bitcoincashTestnet.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,6 +1,8 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
@ -136,4 +138,38 @@ class Dogecoin extends Bip39HDCurrency {
return false; return false;
} }
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "dogecoin.stackwallet.com",
port: 50022,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.dogecoin),
useSSL: true,
enabled: true,
coinName: Coin.dogecoin.name,
isFailover: true,
isDown: false,
);
case CryptoCurrencyNetwork.test:
return NodeModel(
host: "dogecoin-testnet.stackwallet.com",
port: 50022,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.dogecoinTestNet),
useSSL: true,
enabled: true,
coinName: Coin.dogecoinTestNet.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -5,7 +5,9 @@ import 'package:bitbox/bitbox.dart' as bitbox;
import 'package:bs58check/bs58check.dart' as bs58check; import 'package:bs58check/bs58check.dart' as bs58check;
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
@ -238,4 +240,25 @@ class Ecash extends Bip39HDCurrency {
} }
throw ArgumentError('$address has no matching Script'); throw ArgumentError('$address has no matching Script');
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "electrum.bitcoinabc.org",
port: 50002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.eCash),
useSSL: true,
enabled: true,
coinName: Coin.eCash.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,4 +1,6 @@
import 'package:flutter_libepiccash/lib.dart' as epic; import 'package:flutter_libepiccash/lib.dart' as epic;
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_currency.dart';
@ -37,4 +39,26 @@ class Epiccash extends Bip39Currency {
return epic.LibEpiccash.validateSendAddress(address: address); return epic.LibEpiccash.validateSendAddress(address: address);
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "https://wownero.stackwallet.com",
port: 34568,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.wownero),
useSSL: true,
enabled: true,
coinName: Coin.wownero.name,
isFailover: true,
isDown: false,
trusted: true,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,6 +1,8 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart'; import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
@ -134,4 +136,51 @@ class Firo extends Bip39HDCurrency {
} }
// TODO: implement validateAddress for spark addresses? // TODO: implement validateAddress for spark addresses?
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "firo.stackwallet.com",
port: 50002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.firo),
useSSL: true,
enabled: true,
coinName: Coin.firo.name,
isFailover: true,
isDown: false,
);
case CryptoCurrencyNetwork.test:
// NodeModel(
// host: "firo-testnet.stackwallet.com",
// port: 50002,
// name: DefaultNodes.defaultName,
// id: _nodeId(Coin.firoTestNet),
// useSSL: true,
// enabled: true,
// coinName: Coin.firoTestNet.name,
// isFailover: true,
// isDown: false,
// );
// TODO revert to above eventually
return NodeModel(
host: "95.179.164.13",
port: 51002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.firoTestNet),
useSSL: true,
enabled: true,
coinName: Coin.firoTestNet.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,4 +1,6 @@
import 'package:nanodart/nanodart.dart'; import 'package:nanodart/nanodart.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/nano_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/intermediate/nano_currency.dart';
@ -22,4 +24,25 @@ class Nano extends NanoCurrency {
@override @override
int get nanoAccountType => NanoAccountType.NANO; int get nanoAccountType => NanoAccountType.NANO;
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "https://rainstorm.city/api",
port: 443,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.nano),
useSSL: true,
enabled: true,
coinName: Coin.nano.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,8 +1,19 @@
import 'package:cw_wownero/api/wallet.dart' as wownero_wallet; import 'package:cw_wownero/api/wallet.dart' as wownero_wallet;
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/cryptonote_currency.dart'; import 'package:stackwallet/wallets/crypto_currency/intermediate/cryptonote_currency.dart';
class Wownero extends CryptonoteCurrency { class Wownero extends CryptonoteCurrency {
Wownero(super.network); Wownero(super.network) {
switch (network) {
case CryptoCurrencyNetwork.main:
coin = Coin.wownero;
default:
throw Exception("Unsupported network: $network");
}
}
@override @override
int get minConfirms => 15; int get minConfirms => 15;
@ -11,4 +22,26 @@ class Wownero extends CryptonoteCurrency {
bool validateAddress(String address) { bool validateAddress(String address) {
return wownero_wallet.validateAddress(address); return wownero_wallet.validateAddress(address);
} }
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "https://wownero.stackwallet.com",
port: 34568,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.wownero),
useSSL: true,
enabled: true,
coinName: Coin.wownero.name,
isFailover: true,
isDown: false,
trusted: true,
);
default:
throw UnimplementedError();
}
}
} }

View file

@ -1,3 +1,4 @@
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -29,4 +30,6 @@ abstract class CryptoCurrency {
String get genesisHash; String get genesisHash;
bool validateAddress(String address); bool validateAddress(String address);
NodeModel get defaultNode;
} }