Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/default_themes/dark.zip
Binary file not shown.
Binary file modified assets/default_themes/light.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
case Coin.firo:
case Coin.namecoin:
case Coin.particl:
case Coin.peercoin:
case Coin.peercoinTestNet:
case Coin.bitcoinFrost:
case Coin.bitcoinFrostTestNet:
case Coin.bitcoinTestNet:
Expand Down Expand Up @@ -221,7 +223,8 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
case Coin.solana:
try {
RpcClient rpcClient;
if (formData.host!.startsWith("http") || formData.host!.startsWith("https")) {
if (formData.host!.startsWith("http") ||
formData.host!.startsWith("https")) {
rpcClient = RpcClient("${formData.host}:${formData.port}");
} else {
rpcClient = RpcClient("http://${formData.host}:${formData.port}");
Expand Down Expand Up @@ -761,6 +764,8 @@ class _NodeFormState extends ConsumerState<NodeForm> {
case Coin.namecoin:
case Coin.bitcoincash:
case Coin.particl:
case Coin.peercoin:
case Coin.peercoinTestNet:
case Coin.tezos:
case Coin.bitcoinTestNet:
case Coin.litecoinTestNet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
case Coin.dogecoin:
case Coin.firo:
case Coin.particl:
case Coin.peercoin:
case Coin.peercoinTestNet:
case Coin.bitcoinTestNet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
Expand Down
5 changes: 5 additions & 0 deletions lib/supported_coins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:stackwallet/wallets/crypto_currency/coins/monero.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/namecoin.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/nano.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/particl.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/peercoin.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/solana.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/stellar.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/tezos.dart';
Expand Down Expand Up @@ -52,6 +53,8 @@ class SupportedCoins {
return Monero(CryptoCurrencyNetwork.main);
case Coin.particl:
return Particl(CryptoCurrencyNetwork.main);
case Coin.peercoin:
return Peercoin(CryptoCurrencyNetwork.main);
case Coin.solana:
return Solana(CryptoCurrencyNetwork.main);
case Coin.stellar:
Expand Down Expand Up @@ -80,6 +83,8 @@ class SupportedCoins {
return Dogecoin(CryptoCurrencyNetwork.test);
case Coin.stellarTestnet:
return Stellar(CryptoCurrencyNetwork.test);
case Coin.peercoinTestNet:
return Peercoin(CryptoCurrencyNetwork.test);
}
}
}
5 changes: 5 additions & 0 deletions lib/themes/color_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CoinThemeColorDefault {
Color get namecoin => const Color(0xFF91B1E1);
Color get wownero => const Color(0xFFED80C1);
Color get particl => const Color(0xFF8175BD);
Color get peercoin => const Color(0xFF3CB054);
Color get solana => const Color(0xFFC696FF);
Color get stellar => const Color(0xFF6600FF);
Color get nano => const Color(0xFF209CE9);
Expand Down Expand Up @@ -67,6 +68,10 @@ class CoinThemeColorDefault {
return wownero;
case Coin.particl:
return particl;
case Coin.peercoin:
return peercoin;
case Coin.peercoinTestNet:
return peercoin;
case Coin.solana:
return solana;
case Coin.stellar:
Expand Down
3 changes: 3 additions & 0 deletions lib/themes/stack_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,9 @@ class StackColors extends ThemeExtension<StackColors> {
return _coin.wownero;
case Coin.particl:
return _coin.particl;
case Coin.peercoin:
case Coin.peercoinTestNet:
return _coin.peercoin;
case Coin.solana:
return _coin.solana;
case Coin.stellar:
Expand Down
2 changes: 1 addition & 1 deletion lib/themes/theme_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final pThemeService = Provider<ThemeService>((ref) {
});

class ThemeService {
static const _currentDefaultThemeVersion = 8;
static const _currentDefaultThemeVersion = 9;
ThemeService._();
static ThemeService? _instance;
static ThemeService get instance => _instance ??= ThemeService._();
Expand Down
6 changes: 6 additions & 0 deletions lib/utilities/address_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import 'package:stackwallet/wallets/crypto_currency/coins/tezos.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';

import '../wallets/crypto_currency/coins/peercoin.dart';

class AddressUtils {
static String condenseAddress(String address) {
return '${address.substring(0, 5)}...${address.substring(address.length - 5)}';
Expand Down Expand Up @@ -68,6 +70,8 @@ class AddressUtils {
return Namecoin(CryptoCurrencyNetwork.main).validateAddress(address);
case Coin.particl:
return Particl(CryptoCurrencyNetwork.main).validateAddress(address);
case Coin.peercoin:
return Peercoin(CryptoCurrencyNetwork.main).validateAddress(address);
case Coin.solana:
return Solana(CryptoCurrencyNetwork.main).validateAddress(address);
case Coin.stellar:
Expand All @@ -91,6 +95,8 @@ class AddressUtils {
return Firo(CryptoCurrencyNetwork.test).validateAddress(address);
case Coin.dogecoinTestNet:
return Dogecoin(CryptoCurrencyNetwork.test).validateAddress(address);
case Coin.peercoinTestNet:
return Peercoin(CryptoCurrencyNetwork.test).validateAddress(address);
case Coin.stellarTestnet:
return Stellar(CryptoCurrencyNetwork.test).validateAddress(address);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/utilities/amount/amount_unit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum AmountUnit {
case Coin.firo:
case Coin.litecoin:
case Coin.particl:
case Coin.peercoin:
case Coin.namecoin:
case Coin.bitcoinFrost:
case Coin.bitcoinFrostTestNet:
Expand All @@ -47,6 +48,7 @@ enum AmountUnit {
case Coin.bitcoincashTestnet:
case Coin.dogecoinTestNet:
case Coin.firoTestNet:
case Coin.peercoinTestNet:
case Coin.bitcoin:
case Coin.bitcoincash:
case Coin.dogecoin:
Expand Down
5 changes: 5 additions & 0 deletions lib/utilities/block_explorers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ Uri getDefaultBlockExplorerUrlFor({
return Uri.parse("https://tzstats.com/$txid");
case Coin.solana:
return Uri.parse("https://explorer.solana.com/tx/$txid");
case Coin.peercoin:
return Uri.parse("https://chainz.cryptoid.info/ppc/tx.dws?$txid.htm");
case Coin.peercoinTestNet:
return Uri.parse(
"https://chainz.cryptoid.info/ppc-test/search.dws?q=$txid.htm");
}
}

Expand Down
20 changes: 20 additions & 0 deletions lib/utilities/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ abstract class Constants {
static final BigInt _satsPerCoin = BigInt.from(100000000);
static final BigInt _satsPerCoinTezos = BigInt.from(1000000);
static final BigInt _satsPerCoinSolana = BigInt.from(1000000000);
static final BigInt _satsPerCoinPeercoin = BigInt.from(1000000); // 1*10^6.
static const int _decimalPlaces = 8;
static const int _decimalPlacesNano = 30;
static const int _decimalPlacesBanano = 29;
Expand All @@ -57,6 +58,7 @@ abstract class Constants {
static const int _decimalPlacesStellar = 7;
static const int _decimalPlacesTezos = 6;
static const int _decimalPlacesSolana = 9;
static const int _decimalPlacesPeercoin = 6;

static const int notificationsMax = 0xFFFFFFFF;
static const Duration networkAliveTimerDuration = Duration(seconds: 10);
Expand Down Expand Up @@ -114,6 +116,10 @@ abstract class Constants {

case Coin.solana:
return _satsPerCoinSolana;

case Coin.peercoin:
case Coin.peercoinTestNet:
return _satsPerCoinPeercoin;
}
}

Expand Down Expand Up @@ -163,6 +169,10 @@ abstract class Constants {

case Coin.solana:
return _decimalPlacesSolana;

case Coin.peercoin:
case Coin.peercoinTestNet:
return _decimalPlacesPeercoin;
}
}

Expand All @@ -184,6 +194,8 @@ abstract class Constants {
case Coin.ethereum:
case Coin.namecoin:
case Coin.particl:
values.addAll([12, 24]);
break;
case Coin.solana:
case Coin.nano:
case Coin.stellar:
Expand All @@ -206,6 +218,10 @@ abstract class Constants {
case Coin.bitcoinFrost:
case Coin.bitcoinFrostTestNet:
throw ArgumentError("Frost mnemonic lengths unsupported");
case Coin.peercoin:
case Coin.peercoinTestNet:
values.addAll([12, /*15, 18, 21,*/ 24]); // TODO [prio=low]: Test rest.
break;
}
return values;
}
Expand All @@ -220,6 +236,8 @@ abstract class Constants {
case Coin.bitcoincash:
case Coin.bitcoincashTestnet:
case Coin.eCash:
case Coin.peercoin:
case Coin.peercoinTestNet:
return 600;

case Coin.dogecoin:
Expand Down Expand Up @@ -291,6 +309,8 @@ abstract class Constants {
case Coin.nano:
case Coin.banano:
case Coin.epicCash:
case Coin.peercoin: // TODO [prio=low]: Verify default seed length.
case Coin.peercoinTestNet:
case Coin.stellar:
case Coin.stellarTestnet:
case Coin.tezos:
Expand Down
60 changes: 35 additions & 25 deletions lib/utilities/default_nodes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,9 @@ abstract class DefaultNodes {
static const String defaultName = "Stack Default";

@Deprecated("old and decrepit")
static List<NodeModel> get all => [
bitcoin,
litecoin,
dogecoin,
firo,
monero,
eCash,
epicCash,
ethereum,
bitcoincash,
namecoin,
wownero,
particl,
stellar,
nano,
banano,
tezos,
bitcoinTestnet,
litecoinTestNet,
bitcoincashTestnet,
dogecoinTestnet,
firoTestnet,
stellarTestnet,
];
static List<NodeModel> get all => Coin.values
.map((e) => DefaultNodes.getNodeFor(e))
.toList(growable: false);

static NodeModel get bitcoin => NodeModel(
host: "bitcoin.stackwallet.com",
Expand Down Expand Up @@ -188,8 +167,21 @@ abstract class DefaultNodes {
isDown: false,
);

static NodeModel get peercoin => NodeModel(
host: "electrum.peercoinexplorer.net",
port: 50002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.peercoin),
useSSL: true,
enabled: true,
coinName: Coin.peercoin.name,
isFailover: true,
isDown: false,
);

static NodeModel get solana => NodeModel(
host: "https://api.mainnet-beta.solana.com", // TODO: Change this to stack wallet one
host:
"https://api.mainnet-beta.solana.com", // TODO: Change this to stack wallet one
port: 443,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.solana),
Expand Down Expand Up @@ -309,6 +301,18 @@ abstract class DefaultNodes {
isDown: false,
);

static NodeModel get peercoinTestNet => NodeModel(
host: "testnet-electrum.peercoinexplorer.net",
port: 50002,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.peercoinTestNet),
useSSL: true,
enabled: true,
coinName: Coin.peercoinTestNet.name,
isFailover: true,
isDown: false,
);

static NodeModel get stellarTestnet => NodeModel(
host: "https://horizon-testnet.stellar.org/",
port: 50022,
Expand Down Expand Up @@ -360,6 +364,12 @@ abstract class DefaultNodes {
case Coin.particl:
return particl;

case Coin.peercoin:
return peercoin;

case Coin.peercoinTestNet:
return peercoinTestNet;

case Coin.solana:
return solana;

Expand Down
Loading