Merge pull request #78 from cypherstack/testing

namecoin
This commit is contained in:
Rylee Davis 2022-09-23 15:57:37 -06:00 committed by GitHub
commit d237ed4e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 3887 additions and 3886 deletions

View file

@ -116,7 +116,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
// case Coin.bitcoincash:
case Coin.dogecoin:
case Coin.firo:
// case Coin.namecoin:
case Coin.namecoin:
case Coin.bitcoinTestNet:
// case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
@ -529,7 +529,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
case Coin.bitcoin:
case Coin.dogecoin:
case Coin.firo:
// case Coin.namecoin:
case Coin.namecoin:
// case Coin.bitcoincash:
case Coin.bitcoinTestNet:
// case Coin.bitcoincashTestnet:

View file

@ -102,8 +102,8 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
case Coin.bitcoinTestNet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
// case Coin.bitcoincash:
// case Coin.namecoin:
// case Coin.bitcoincash:
case Coin.namecoin:
// case Coin.bitcoincashTestnet:
final client = ElectrumX(
host: node!.host,

View file

@ -8,6 +8,7 @@ import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/coins/monero/monero_wallet.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/prefs.dart';
@ -143,15 +144,15 @@ abstract class CoinServiceAPI {
// tracker: tracker,
);
// case Coin.namecoin:
// return NamecoinWallet(
// walletId: walletId,
// walletName: walletName,
// coin: coin,
// tracker: tracker,
// cachedClient: cachedClient,
// client: client,
// );
case Coin.namecoin:
return NamecoinWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
tracker: tracker,
cachedClient: cachedClient,
client: client,
);
case Coin.dogecoinTestNet:
return DogecoinWallet(

File diff suppressed because it is too large Load diff

View file

@ -79,7 +79,7 @@ class PriceAPI {
Map<Coin, Tuple2<Decimal, double>> result = {};
try {
final uri = Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=${baseCurrency.toLowerCase()}&ids=monero,bitcoin,epic-cash,zcoin,dogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false");
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=${baseCurrency.toLowerCase()}&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false");
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=${baseCurrency.toLowerCase()}&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,bitcoin-cash,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false");
// final uri = Uri.parse(
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=${baseCurrency.toLowerCase()}&ids=monero%2Cbitcoin%2Cepic-cash%2Czcoin%2Cdogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false");

View file

@ -5,6 +5,7 @@ import 'package:crypto/crypto.dart';
import 'package:flutter_libepiccash/epic_cash.dart';
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
@ -51,8 +52,8 @@ class AddressUtils {
case Coin.monero:
return RegExp("[a-zA-Z0-9]{95}").hasMatch(address) ||
RegExp("[a-zA-Z0-9]{106}").hasMatch(address);
// case Coin.namecoin:
// return Address.validateAddress(address, namecoin);
case Coin.namecoin:
return Address.validateAddress(address, namecoin, namecoin.bech32!);
case Coin.bitcoinTestNet:
return Address.validateAddress(address, testnet);
// case Coin.bitcoincashTestnet:

View file

@ -155,8 +155,8 @@ class _SVG {
return firo;
case Coin.monero:
return monero;
// case Coin.namecoin:
// return namecoin;
case Coin.namecoin:
return namecoin;
case Coin.bitcoinTestNet:
return bitcoinTestnet;
// case Coin.bitcoincashTestnet:
@ -202,8 +202,8 @@ class _PNG {
return firo;
case Coin.monero:
return monero;
// case Coin.namecoin:
// return namecoin;
case Coin.namecoin:
return namecoin;
}
}
}

View file

@ -27,7 +27,7 @@ Uri getBlockExplorerTransactionUrlFor({
// case Coin.bitcoincashTestnet:
// return Uri.parse(
// "https://blockexplorer.one/bitcoin-cash/testnet/tx/$txid");
// case Coin.namecoin:
// return Uri.parse("https://chainz.cryptoid.info/nmc/tx.dws?$txid.htm");
case Coin.namecoin:
return Uri.parse("https://chainz.cryptoid.info/nmc/tx.dws?$txid.htm");
}
}

View file

@ -47,7 +47,7 @@ abstract class Constants {
case Coin.dogecoinTestNet:
case Coin.firoTestNet:
case Coin.epicCash:
// case Coin.namecoin:
case Coin.namecoin:
values.addAll([24, 21, 18, 15, 12]);
break;
@ -83,8 +83,8 @@ abstract class Constants {
case Coin.monero:
return 120;
// case Coin.namecoin:
// return 600;
case Coin.namecoin:
return 600;
}
}

View file

@ -14,7 +14,7 @@ abstract class DefaultNodes {
monero,
epicCash,
// bitcoincash,
// namecoin,
namecoin,
bitcoinTestnet,
// bitcoincashTestnet,
dogecoinTestnet,
@ -95,17 +95,17 @@ abstract class DefaultNodes {
isDown: false,
);
// static NodeModel get namecoin => NodeModel(
// host: "namecoin.stackwallet.com",
// port: 57002,
// name: defaultName,
// id: _nodeId(Coin.namecoin),
// useSSL: true,
// enabled: true,
// coinName: Coin.namecoin.name,
// isFailover: true,
// isDown: false,
// );
static NodeModel get namecoin => NodeModel(
host: "namecoin.stackwallet.com",
port: 57002,
name: defaultName,
id: _nodeId(Coin.namecoin),
useSSL: true,
enabled: true,
coinName: Coin.namecoin.name,
isFailover: true,
isDown: false,
);
static NodeModel get bitcoinTestnet => NodeModel(
host: "electrumx-testnet.cypherstack.com",
@ -175,8 +175,8 @@ abstract class DefaultNodes {
case Coin.monero:
return monero;
// case Coin.namecoin:
// return namecoin;
case Coin.namecoin:
return namecoin;
case Coin.bitcoinTestNet:
return bitcoinTestnet;

View file

@ -5,6 +5,8 @@ import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart'
as epic;
import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as firo;
import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr;
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
as nmc;
enum Coin {
bitcoin,
@ -13,7 +15,7 @@ enum Coin {
epicCash,
firo,
monero,
// namecoin,
namecoin,
///
///
@ -43,8 +45,8 @@ extension CoinExt on Coin {
return "Firo";
case Coin.monero:
return "Monero";
// case Coin.namecoin:
// return "Namecoin";
case Coin.namecoin:
return "Namecoin";
case Coin.bitcoinTestNet:
return "tBitcoin";
// case Coin.bitcoincashTestnet:
@ -70,8 +72,8 @@ extension CoinExt on Coin {
return "FIRO";
case Coin.monero:
return "XMR";
// case Coin.namecoin:
// return "NMC";
case Coin.namecoin:
return "NMC";
case Coin.bitcoinTestNet:
return "tBTC";
// case Coin.bitcoincashTestnet:
@ -98,8 +100,8 @@ extension CoinExt on Coin {
return "firo";
case Coin.monero:
return "monero";
// case Coin.namecoin:
// return "namecoin";
case Coin.namecoin:
return "namecoin";
case Coin.bitcoinTestNet:
return "bitcoin";
// case Coin.bitcoincashTestnet:
@ -117,7 +119,7 @@ extension CoinExt on Coin {
// case Coin.bitcoincash:
case Coin.dogecoin:
case Coin.firo:
// case Coin.namecoin:
case Coin.namecoin:
case Coin.bitcoinTestNet:
// case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
@ -153,8 +155,8 @@ extension CoinExt on Coin {
case Coin.monero:
return xmr.MINIMUM_CONFIRMATIONS;
// case Coin.namecoin:
// return nmc.MINIMUM_CONFIRMATIONS;
case Coin.namecoin:
return nmc.MINIMUM_CONFIRMATIONS;
}
}
}
@ -180,9 +182,9 @@ Coin coinFromPrettyName(String name) {
case "Monero":
case "monero":
return Coin.monero;
// case "Namecoin":
// case "namecoin":
// return Coin.namecoin;
case "Namecoin":
case "namecoin":
return Coin.namecoin;
case "Bitcoin Testnet":
case "tBitcoin":
case "bitcoinTestNet":
@ -220,8 +222,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
return Coin.firo;
case "xmr":
return Coin.monero;
// case "nmc":
// return Coin.namecoin;
case "nmc":
return Coin.namecoin;
case "tbtc":
return Coin.bitcoinTestNet;
// case "tbch":

View file

@ -205,8 +205,8 @@ class CoinThemeColor {
return firo;
case Coin.monero:
return monero;
// case Coin.namecoin:
// return namecoin;
case Coin.namecoin:
return namecoin;
// case Coin.wownero:
// return wownero;
}

View file

@ -1398,8 +1398,8 @@ class StackColors extends ThemeExtension<StackColors> {
return _coin.firo;
case Coin.monero:
return _coin.monero;
// case Coin.namecoin:
// return _coin.namecoin;
case Coin.namecoin:
return _coin.namecoin;
// case Coin.wownero:
// return wownero;
}

View file

@ -106,8 +106,8 @@ class NodeOptionsSheet extends ConsumerWidget {
case Coin.bitcoinTestNet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
// case Coin.bitcoincash:
// case Coin.namecoin:
// case Coin.bitcoincash:
case Coin.namecoin:
// case Coin.bitcoincashTestnet:
final client = ElectrumX(
host: node.host,

View file

@ -23,7 +23,7 @@ void main() {
when(client.get(
Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,bitcoin-cash,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
headers: {
'Content-Type': 'application/json'
@ -37,11 +37,11 @@ void main() {
final price = await priceAPI.getPricesAnd24hChange(baseCurrency: "btc");
expect(price.toString(),
'{Coin.bitcoin: [1, 0.0], Coin.dogecoin: [0.00000315, -2.68533], Coin.epicCash: [0.00002803, 7.27524], Coin.firo: [0.0001096, -0.89304], Coin.monero: [0.00717236, -0.77656], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
'{Coin.bitcoin: [1, 0.0], Coin.dogecoin: [0.00000315, -2.68533], Coin.epicCash: [0.00002803, 7.27524], Coin.firo: [0.0001096, -0.89304], Coin.monero: [0.00717236, -0.77656], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
// '{Coin.bitcoin: [1, 0.0], Coin.bitcoincash: [0, 0.0], Coin.dogecoin: [0.00000315, -2.68533], Coin.epicCash: [0.00002803, 7.27524], Coin.firo: [0.0001096, -0.89304], Coin.monero: [0.00717236, -0.77656], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.bitcoincashTestnet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
verify(client.get(
Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,bitcoin-cash,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
headers: {'Content-Type': 'application/json'})).called(1);
@ -53,7 +53,7 @@ void main() {
when(client.get(
Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,bitcoin-cash,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
headers: {
'Content-Type': 'application/json'
@ -72,13 +72,13 @@ void main() {
await priceAPI.getPricesAnd24hChange(baseCurrency: "btc");
expect(cachedPrice.toString(),
'{Coin.bitcoin: [1, 0.0], Coin.dogecoin: [0.00000315, -2.68533], Coin.epicCash: [0.00002803, 7.27524], Coin.firo: [0.0001096, -0.89304], Coin.monero: [0.00717236, -0.77656], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
'{Coin.bitcoin: [1, 0.0], Coin.dogecoin: [0.00000315, -2.68533], Coin.epicCash: [0.00002803, 7.27524], Coin.firo: [0.0001096, -0.89304], Coin.monero: [0.00717236, -0.77656], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
// '{Coin.bitcoin: [1, 0.0], Coin.bitcoincash: [0, 0.0], Coin.dogecoin: [0.00000315, -2.68533], Coin.epicCash: [0.00002803, 7.27524], Coin.firo: [0.0001096, -0.89304], Coin.monero: [0.00717236, -0.77656], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.bitcoincashTestnet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
// verify only called once during filling of cache
verify(client.get(
Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,bitcoin-cash,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
headers: {'Content-Type': 'application/json'})).called(1);
@ -103,7 +103,7 @@ void main() {
final price = await priceAPI.getPricesAnd24hChange(baseCurrency: "btc");
expect(price.toString(),
'{Coin.bitcoin: [0, 0.0], Coin.dogecoin: [0, 0.0], Coin.epicCash: [0, 0.0], Coin.firo: [0, 0.0], Coin.monero: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
'{Coin.bitcoin: [0, 0.0], Coin.dogecoin: [0, 0.0], Coin.epicCash: [0, 0.0], Coin.firo: [0, 0.0], Coin.monero: [0, 0.0], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
// '{Coin.bitcoin: [0, 0.0], Coin.bitcoincash: [0, 0.0], Coin.dogecoin: [0, 0.0], Coin.epicCash: [0, 0.0], Coin.firo: [0, 0.0], Coin.monero: [0, 0.0], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.bitcoincashTestnet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
});
@ -112,7 +112,7 @@ void main() {
when(client.get(
Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
// "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids=monero,bitcoin,epic-cash,zcoin,dogecoin,bitcoin-cash,namecoin&order=market_cap_desc&per_page=10&page=1&sparkline=false"),
headers: {
'Content-Type': 'application/json'
@ -127,7 +127,7 @@ void main() {
expect(
price.toString(),
// '{Coin.bitcoin: [0, 0.0], Coin.bitcoincash: [0, 0.0], Coin.dogecoin: [0, 0.0], Coin.epicCash: [0, 0.0], Coin.firo: [0, 0.0], Coin.monero: [0, 0.0], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.bitcoincashTestnet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
'{Coin.bitcoin: [0, 0.0], Coin.dogecoin: [0, 0.0], Coin.epicCash: [0, 0.0], Coin.firo: [0, 0.0], Coin.monero: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
'{Coin.bitcoin: [0, 0.0], Coin.dogecoin: [0, 0.0], Coin.epicCash: [0, 0.0], Coin.firo: [0, 0.0], Coin.monero: [0, 0.0], Coin.namecoin: [0, 0.0], Coin.bitcoinTestNet: [0, 0.0], Coin.dogecoinTestNet: [0, 0.0], Coin.firoTestNet: [0, 0.0]}');
});
tearDown(() async {

View file

@ -1,6 +1,3 @@
// import 'dart:convert';
//
// import 'package:bitcoindart/bitcoindart.dart';
// import 'package:decimal/decimal.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:hive/hive.dart';