WIP: Add particle

This commit is contained in:
Likho 2022-10-25 17:06:37 +02:00
parent 9f94789229
commit 7e92be4b67
12 changed files with 3932 additions and 0 deletions

View file

@ -56,10 +56,12 @@ class _SendFromViewState extends ConsumerState<SendFromView> {
case Coin.epicCash:
case Coin.firo:
case Coin.namecoin:
case Coin.particl:
case Coin.bitcoinTestNet:
case Coin.bitcoincashTestnet:
case Coin.dogecoinTestNet:
case Coin.firoTestNet:
case Coin.particlTestNet:
return amount.toStringAsFixed(Constants.decimalPlaces);
case Coin.monero:
return amount.toStringAsFixed(Constants.decimalPlacesMonero);

View file

@ -118,10 +118,12 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
case Coin.dogecoin:
case Coin.firo:
case Coin.namecoin:
case Coin.particl:
case Coin.bitcoinTestNet:
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
case Coin.particlTestNet:
final client = ElectrumX(
host: formData.host!,
port: formData.port!,
@ -533,10 +535,12 @@ class _NodeFormState extends ConsumerState<NodeForm> {
case Coin.firo:
case Coin.namecoin:
case Coin.bitcoincash:
case Coin.particl:
case Coin.bitcoinTestNet:
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
case Coin.particlTestNet:
return false;
case Coin.epicCash:

View file

@ -9,6 +9,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/particl/particl_wallet.dart';
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
@ -146,6 +147,24 @@ abstract class CoinServiceAPI {
// tracker: tracker,
);
case Coin.particl:
return ParticlWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
client: client,
cachedClient: cachedClient,
tracker: tracker);
case Coin.particlTestNet:
return ParticlWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
client: client,
cachedClient: cachedClient,
tracker: tracker);
case Coin.wownero:
return WowneroWallet(
walletId: walletId,

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@ 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';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
@ -58,6 +59,8 @@ class AddressUtils {
RegExp("[a-zA-Z0-9]{106}").hasMatch(address);
case Coin.namecoin:
return Address.validateAddress(address, namecoin, namecoin.bech32!);
case Coin.particl:
return Address.validateAddress(address, particl);
case Coin.bitcoinTestNet:
return Address.validateAddress(address, testnet);
case Coin.bitcoincashTestnet:
@ -66,6 +69,8 @@ class AddressUtils {
return Address.validateAddress(address, firoTestNetwork);
case Coin.dogecoinTestNet:
return Address.validateAddress(address, dogecointestnet);
case Coin.particlTestNet:
return Address.validateAddress(address, particltestnet);
}
}

View file

@ -142,6 +142,8 @@ class _SVG {
String get monero => "assets/svg/coin_icons/Monero.svg";
String get wownero => "assets/svg/coin_icons/Wownero.svg";
String get namecoin => "assets/svg/coin_icons/Namecoin.svg";
String get particl =>
"assets/svg/coin_icons/Namecoin.svg"; //TODO - Update icon to particl
String get chevronRight => "assets/svg/chevron-right.svg";
String get minimize => "assets/svg/minimize.svg";
@ -154,6 +156,8 @@ class _SVG {
String get bitcoincashTestnet => "assets/svg/coin_icons/Bitcoincash.svg";
String get firoTestnet => "assets/svg/coin_icons/Firo.svg";
String get dogecoinTestnet => "assets/svg/coin_icons/Dogecoin.svg";
String get particlTestnet =>
"assets/svg/coin_icons/Dogecoin.svg"; //TODO - Update icon to particl
String iconFor({required Coin coin}) {
switch (coin) {
@ -173,6 +177,8 @@ class _SVG {
return wownero;
case Coin.namecoin:
return namecoin;
case Coin.particl:
return particl;
case Coin.bitcoinTestNet:
return bitcoinTestnet;
case Coin.bitcoincashTestnet:
@ -181,6 +187,8 @@ class _SVG {
return firoTestnet;
case Coin.dogecoinTestNet:
return dogecoinTestnet;
case Coin.particlTestNet:
return particlTestnet;
}
}
}
@ -199,6 +207,7 @@ class _PNG {
String get epicCash => "assets/images/epic-cash.png";
String get bitcoincash => "assets/images/bitcoincash.png";
String get namecoin => "assets/images/namecoin.png";
String get particl => "assets/images/namecoin.png"; //TODO - use particl png
String imageFor({required Coin coin}) {
switch (coin) {
@ -223,6 +232,9 @@ class _PNG {
return wownero;
case Coin.namecoin:
return namecoin;
case Coin.particl:
case Coin.particlTestNet:
return particl;
}
}
}

View file

@ -31,5 +31,9 @@ Uri getBlockExplorerTransactionUrlFor({
"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.particl:
return Uri.parse("https://chainz.cryptoid.info/part/tx.dws?$txid.htm");
case Coin.particlTestNet:
return Uri.parse("");
}
}

View file

@ -51,6 +51,8 @@ abstract class Constants {
case Coin.firoTestNet:
case Coin.epicCash:
case Coin.namecoin:
case Coin.particl:
case Coin.particlTestNet:
values.addAll([24, 21, 18, 15, 12]);
break;
@ -94,6 +96,10 @@ abstract class Constants {
case Coin.namecoin:
return 600;
case Coin.particl:
case Coin.particlTestNet:
return 600;
}
}

View file

@ -118,6 +118,17 @@ abstract class DefaultNodes {
isDown: false,
);
static NodeModel get particl => NodeModel(
host: "host",
port: 123,
name: defaultName,
id: _nodeId(Coin.particl),
useSSL: true,
enabled: true,
coinName: Coin.particl.name,
isFailover: true,
isDown: false); //TODO - UPDATE WITH CORRECT DETAILS
static NodeModel get bitcoinTestnet => NodeModel(
host: "electrumx-testnet.cypherstack.com",
port: 51002,
@ -166,6 +177,18 @@ abstract class DefaultNodes {
isDown: false,
);
static NodeModel get particlTestnet => NodeModel(
host: "host",
port: 60002,
name: defaultName,
id: _nodeId(Coin.particlTestNet),
useSSL: true,
enabled: true,
coinName: Coin.particlTestNet.name,
isFailover: true,
isDown: false,
);
static NodeModel getNodeFor(Coin coin) {
switch (coin) {
case Coin.bitcoin:
@ -192,6 +215,9 @@ abstract class DefaultNodes {
case Coin.namecoin:
return namecoin;
case Coin.particl:
return namecoin;
case Coin.bitcoinTestNet:
return bitcoinTestnet;
@ -203,6 +229,9 @@ abstract class DefaultNodes {
case Coin.dogecoinTestNet:
return dogecoinTestnet;
case Coin.particlTestNet:
return particlTestnet;
}
}

View file

@ -10,6 +10,8 @@ import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr;
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
as nmc;
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart' as wow;
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'
as particl;
enum Coin {
bitcoin,
@ -18,6 +20,7 @@ enum Coin {
epicCash,
firo,
monero,
particl,
wownero,
namecoin,
@ -29,6 +32,7 @@ enum Coin {
bitcoincashTestnet,
dogecoinTestNet,
firoTestNet,
particlTestNet
}
// remove firotestnet for now
@ -49,6 +53,8 @@ extension CoinExt on Coin {
return "Firo";
case Coin.monero:
return "Monero";
case Coin.particl:
return "Particl";
case Coin.wownero:
return "Wownero";
case Coin.namecoin:
@ -61,6 +67,8 @@ extension CoinExt on Coin {
return "tFiro";
case Coin.dogecoinTestNet:
return "tDogecoin";
case Coin.particlTestNet:
return "tParticl";
}
}
@ -78,6 +86,8 @@ extension CoinExt on Coin {
return "FIRO";
case Coin.monero:
return "XMR";
case Coin.particl:
return "PART";
case Coin.wownero:
return "WOW";
case Coin.namecoin:
@ -90,6 +100,8 @@ extension CoinExt on Coin {
return "tFIRO";
case Coin.dogecoinTestNet:
return "tDOGE";
case Coin.particlTestNet:
return "tPART";
}
}
@ -108,6 +120,8 @@ extension CoinExt on Coin {
return "firo";
case Coin.monero:
return "monero";
case Coin.particl:
return "particl";
case Coin.wownero:
return "wownero";
case Coin.namecoin:
@ -120,6 +134,8 @@ extension CoinExt on Coin {
return "firo";
case Coin.dogecoinTestNet:
return "dogecoin";
case Coin.particlTestNet:
return "particl";
}
}
@ -130,10 +146,12 @@ extension CoinExt on Coin {
case Coin.dogecoin:
case Coin.firo:
case Coin.namecoin:
case Coin.particl:
case Coin.bitcoinTestNet:
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
case Coin.particlTestNet:
return true;
case Coin.epicCash:
@ -167,6 +185,10 @@ extension CoinExt on Coin {
case Coin.monero:
return xmr.MINIMUM_CONFIRMATIONS;
case Coin.particl:
case Coin.particlTestNet:
return particl.MINIMUM_CONFIRMATIONS;
case Coin.wownero:
return wow.MINIMUM_CONFIRMATIONS;
@ -203,6 +225,11 @@ Coin coinFromPrettyName(String name) {
case "monero":
return Coin.monero;
case "Particl":
case "particl":
case "particlTestNet":
return Coin.particl;
case "Namecoin":
case "namecoin":
return Coin.namecoin;
@ -255,6 +282,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
return Coin.monero;
case "nmc":
return Coin.namecoin;
case "part":
return Coin.particl;
case "tbtc":
return Coin.bitcoinTestNet;
case "tbch":
@ -263,6 +292,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
return Coin.firoTestNet;
case "tdoge":
return Coin.dogecoinTestNet;
case "tparticl":
return Coin.particlTestNet;
case "wow":
return Coin.wownero;
default:

View file

@ -188,6 +188,7 @@ class CoinThemeColor {
Color get monero => const Color(0xFFFF9E6B);
Color get namecoin => const Color(0xFF91B1E1);
Color get wownero => const Color(0xFFED80C1);
Color get particl => const Color(0xFFED80C1); //TODO - Use part colors
Color forCoin(Coin coin) {
switch (coin) {
@ -211,6 +212,9 @@ class CoinThemeColor {
return namecoin;
case Coin.wownero:
return wownero;
case Coin.particl:
case Coin.particlTestNet:
return particl;
}
}
}

View file

@ -1423,6 +1423,9 @@ class StackColors extends ThemeExtension<StackColors> {
return _coin.namecoin;
case Coin.wownero:
return _coin.wownero;
case Coin.particl:
case Coin.particlTestNet:
return _coin.particl;
}
}