enable bch

This commit is contained in:
julian 2022-09-26 14:32:53 -06:00
parent 1c889fd054
commit 84db4ac17f
13 changed files with 3227 additions and 3224 deletions

View file

@ -113,12 +113,12 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
break;
case Coin.bitcoin:
// case Coin.bitcoincash:
case Coin.bitcoincash:
case Coin.dogecoin:
case Coin.firo:
case Coin.namecoin:
case Coin.bitcoinTestNet:
// case Coin.bitcoincashTestnet:
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
final client = ElectrumX(
@ -530,9 +530,9 @@ class _NodeFormState extends ConsumerState<NodeForm> {
case Coin.dogecoin:
case Coin.firo:
case Coin.namecoin:
// case Coin.bitcoincash:
case Coin.bitcoincash:
case Coin.bitcoinTestNet:
// case Coin.bitcoincashTestnet:
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
return false;

View file

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

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/models/models.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
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';
@ -98,25 +99,25 @@ abstract class CoinServiceAPI {
tracker: tracker,
);
// case Coin.bitcoincash:
// return BitcoinCashWallet(
// walletId: walletId,
// walletName: walletName,
// coin: coin,
// client: client,
// cachedClient: cachedClient,
// tracker: tracker,
// );
//
// case Coin.bitcoincashTestnet:
// return BitcoinCashWallet(
// walletId: walletId,
// walletName: walletName,
// coin: coin,
// client: client,
// cachedClient: cachedClient,
// tracker: tracker,
// );
case Coin.bitcoincash:
return BitcoinCashWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
client: client,
cachedClient: cachedClient,
tracker: tracker,
);
case Coin.bitcoincashTestnet:
return BitcoinCashWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
client: client,
cachedClient: cachedClient,
tracker: tracker,
);
case Coin.dogecoin:
return DogecoinWallet(

View file

@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:bitcoindart/bitcoindart.dart';
import 'package:crypto/crypto.dart';
import 'package:flutter_libepiccash/epic_cash.dart';
// import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.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';
@ -42,8 +42,8 @@ class AddressUtils {
switch (coin) {
case Coin.bitcoin:
return Address.validateAddress(address, bitcoin);
// case Coin.bitcoincash:
// return Address.validateAddress(address, bitcoincash);
case Coin.bitcoincash:
return Address.validateAddress(address, bitcoincash);
case Coin.dogecoin:
return Address.validateAddress(address, dogecoin);
case Coin.epicCash:
@ -57,8 +57,8 @@ class AddressUtils {
return Address.validateAddress(address, namecoin, namecoin.bech32!);
case Coin.bitcoinTestNet:
return Address.validateAddress(address, testnet);
// case Coin.bitcoincashTestnet:
// return Address.validateAddress(address, bitcoincashtestnet);
case Coin.bitcoincashTestnet:
return Address.validateAddress(address, bitcoincashtestnet);
case Coin.firoTestNet:
return Address.validateAddress(address, firoTestNetwork);
case Coin.dogecoinTestNet:

View file

@ -145,8 +145,8 @@ class _SVG {
switch (coin) {
case Coin.bitcoin:
return bitcoin;
// case Coin.bitcoincash:
// return bitcoincash;
case Coin.bitcoincash:
return bitcoincash;
case Coin.dogecoin:
return dogecoin;
case Coin.epicCash:
@ -159,8 +159,8 @@ class _SVG {
return namecoin;
case Coin.bitcoinTestNet:
return bitcoinTestnet;
// case Coin.bitcoincashTestnet:
// return bitcoincashTestnet;
case Coin.bitcoincashTestnet:
return bitcoincashTestnet;
case Coin.firoTestNet:
return firoTestnet;
case Coin.dogecoinTestNet:
@ -188,9 +188,9 @@ class _PNG {
case Coin.bitcoin:
case Coin.bitcoinTestNet:
return bitcoin;
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
// return bitcoincash;
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
return bitcoincash;
case Coin.dogecoin:
case Coin.dogecoinTestNet:
return dogecoin;

View file

@ -22,11 +22,11 @@ Uri getBlockExplorerTransactionUrlFor({
return Uri.parse("https://explorer.firo.org/tx/$txid");
case Coin.firoTestNet:
return Uri.parse("https://testexplorer.firo.org/tx/$txid");
// case Coin.bitcoincash:
// return Uri.parse("https://blockchair.com/bitcoin-cash/transaction/$txid");
// case Coin.bitcoincashTestnet:
// return Uri.parse(
// "https://blockexplorer.one/bitcoin-cash/testnet/tx/$txid");
case Coin.bitcoincash:
return Uri.parse("https://blockchair.com/bitcoin-cash/transaction/$txid");
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");
}

View file

@ -39,8 +39,8 @@ abstract class Constants {
final List<int> values = [];
switch (coin) {
case Coin.bitcoin:
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
case Coin.dogecoin:
case Coin.firo:
case Coin.bitcoinTestNet:
@ -65,9 +65,9 @@ abstract class Constants {
case Coin.bitcoinTestNet:
return 600;
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
// return 600;
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
return 600;
case Coin.dogecoin:
case Coin.dogecoinTestNet:

View file

@ -33,17 +33,17 @@ abstract class DefaultNodes {
isDown: false,
);
// static NodeModel get bitcoincash => NodeModel(
// host: "bitcoincash.stackwallet.com",
// port: 50002,
// name: defaultName,
// id: _nodeId(Coin.bitcoincash),
// useSSL: true,
// enabled: true,
// coinName: Coin.bitcoincash.name,
// isFailover: true,
// isDown: false,
// );
static NodeModel get bitcoincash => NodeModel(
host: "bitcoincash.stackwallet.com",
port: 50002,
name: defaultName,
id: _nodeId(Coin.bitcoincash),
useSSL: true,
enabled: true,
coinName: Coin.bitcoincash.name,
isFailover: true,
isDown: false,
);
static NodeModel get dogecoin => NodeModel(
host: "dogecoin.stackwallet.com",
@ -143,25 +143,25 @@ abstract class DefaultNodes {
isDown: false,
);
// static NodeModel get bitcoincashTestnet => NodeModel(
// host: "testnet.hsmiths.com",
// port: 53012,
// name: defaultName,
// id: _nodeId(Coin.bitcoincash),
// useSSL: true,
// enabled: true,
// coinName: Coin.bitcoincash.name,
// isFailover: true,
// isDown: false,
// );
static NodeModel get bitcoincashTestnet => NodeModel(
host: "testnet.hsmiths.com",
port: 53012,
name: defaultName,
id: _nodeId(Coin.bitcoincash),
useSSL: true,
enabled: true,
coinName: Coin.bitcoincash.name,
isFailover: true,
isDown: false,
);
static NodeModel getNodeFor(Coin coin) {
switch (coin) {
case Coin.bitcoin:
return bitcoin;
//
// case Coin.bitcoincash:
// return bitcoincash;
case Coin.bitcoincash:
return bitcoincash;
case Coin.dogecoin:
return dogecoin;
@ -181,8 +181,8 @@ abstract class DefaultNodes {
case Coin.bitcoinTestNet:
return bitcoinTestnet;
// case Coin.bitcoincashTestnet:
// return bitcoincashTestnet;
case Coin.bitcoincashTestnet:
return bitcoincashTestnet;
case Coin.firoTestNet:
return firoTestnet;

View file

@ -1,4 +1,6 @@
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as btc;
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart'
as bch;
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart'
as doge;
import 'package:stackwallet/services/coins/epiccash/epiccash_wallet.dart'
@ -10,7 +12,7 @@ import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
enum Coin {
bitcoin,
// bitcoincash,
bitcoincash,
dogecoin,
epicCash,
firo,
@ -22,7 +24,7 @@ enum Coin {
///
bitcoinTestNet,
// bitcoincashTestnet,
bitcoincashTestnet,
dogecoinTestNet,
firoTestNet,
}
@ -35,8 +37,8 @@ extension CoinExt on Coin {
switch (this) {
case Coin.bitcoin:
return "Bitcoin";
// case Coin.bitcoincash:
// return "Bitcoin Cash";
case Coin.bitcoincash:
return "Bitcoin Cash";
case Coin.dogecoin:
return "Dogecoin";
case Coin.epicCash:
@ -49,8 +51,8 @@ extension CoinExt on Coin {
return "Namecoin";
case Coin.bitcoinTestNet:
return "tBitcoin";
// case Coin.bitcoincashTestnet:
// return "tBitcoin Cash";
case Coin.bitcoincashTestnet:
return "tBitcoin Cash";
case Coin.firoTestNet:
return "tFiro";
case Coin.dogecoinTestNet:
@ -62,8 +64,8 @@ extension CoinExt on Coin {
switch (this) {
case Coin.bitcoin:
return "BTC";
// case Coin.bitcoincash:
// return "BCH";
case Coin.bitcoincash:
return "BCH";
case Coin.dogecoin:
return "DOGE";
case Coin.epicCash:
@ -76,8 +78,8 @@ extension CoinExt on Coin {
return "NMC";
case Coin.bitcoinTestNet:
return "tBTC";
// case Coin.bitcoincashTestnet:
// return "tBCH";
case Coin.bitcoincashTestnet:
return "tBCH";
case Coin.firoTestNet:
return "tFIRO";
case Coin.dogecoinTestNet:
@ -89,8 +91,8 @@ extension CoinExt on Coin {
switch (this) {
case Coin.bitcoin:
return "bitcoin";
// case Coin.bitcoincash:
// return "bitcoincash";
case Coin.bitcoincash:
return "bitcoincash";
case Coin.dogecoin:
return "dogecoin";
case Coin.epicCash:
@ -104,8 +106,8 @@ extension CoinExt on Coin {
return "namecoin";
case Coin.bitcoinTestNet:
return "bitcoin";
// case Coin.bitcoincashTestnet:
// return "bitcoincash";
case Coin.bitcoincashTestnet:
return "bitcoincash";
case Coin.firoTestNet:
return "firo";
case Coin.dogecoinTestNet:
@ -116,12 +118,12 @@ extension CoinExt on Coin {
bool get isElectrumXCoin {
switch (this) {
case Coin.bitcoin:
// case Coin.bitcoincash:
case Coin.bitcoincash:
case Coin.dogecoin:
case Coin.firo:
case Coin.namecoin:
case Coin.bitcoinTestNet:
// case Coin.bitcoincashTestnet:
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
return true;
@ -138,9 +140,9 @@ extension CoinExt on Coin {
case Coin.bitcoinTestNet:
return btc.MINIMUM_CONFIRMATIONS;
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
// return bch.MINIMUM_CONFIRMATIONS;
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
return bch.MINIMUM_CONFIRMATIONS;
case Coin.firo:
case Coin.firoTestNet:
@ -166,10 +168,10 @@ Coin coinFromPrettyName(String name) {
case "Bitcoin":
case "bitcoin":
return Coin.bitcoin;
// case "Bitcoincash":
// case "bitcoincash":
// case "Bitcoin Cash":
// return Coin.bitcoincash;
case "Bitcoincash":
case "bitcoincash":
case "Bitcoin Cash":
return Coin.bitcoincash;
case "Dogecoin":
case "dogecoin":
return Coin.dogecoin;
@ -190,10 +192,10 @@ Coin coinFromPrettyName(String name) {
case "bitcoinTestNet":
return Coin.bitcoinTestNet;
// case "Bitcoincash Testnet":
// case "tBitcoin Cash":
// case "Bitcoin Cash Testnet":
// return Coin.bitcoincashTestnet;
case "Bitcoincash Testnet":
case "tBitcoin Cash":
case "Bitcoin Cash Testnet":
return Coin.bitcoincashTestnet;
case "Firo Testnet":
case "tFiro":
case "firoTestNet":
@ -212,8 +214,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
switch (ticker.toLowerCase()) {
case "btc":
return Coin.bitcoin;
// case "bch":
// return Coin.bitcoincash;
case "bch":
return Coin.bitcoincash;
case "doge":
return Coin.dogecoin;
case "epic":
@ -226,8 +228,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
return Coin.namecoin;
case "tbtc":
return Coin.bitcoinTestNet;
// case "tbch":
// return Coin.bitcoincashTestnet;
case "tbch":
return Coin.bitcoincashTestnet;
case "tfiro":
return Coin.firoTestNet;
case "tdoge":

View file

@ -194,9 +194,9 @@ class CoinThemeColor {
case Coin.bitcoin:
case Coin.bitcoinTestNet:
return bitcoin;
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
// return bitcoincash;
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
return bitcoincash;
case Coin.dogecoin:
case Coin.dogecoinTestNet:
return dogecoin;

View file

@ -1407,9 +1407,9 @@ class StackColors extends ThemeExtension<StackColors> {
case Coin.bitcoin:
case Coin.bitcoinTestNet:
return _coin.bitcoin;
// case Coin.bitcoincash:
// case Coin.bitcoincashTestnet:
// return _coin.bitcoincash;
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
return _coin.bitcoincash;
case Coin.dogecoin:
case Coin.dogecoinTestNet:
return _coin.dogecoin;

View file

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