mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 11:04:33 +00:00
WIP: Add particle
This commit is contained in:
parent
df45922149
commit
c7abf3a7e8
11 changed files with 3930 additions and 0 deletions
|
@ -142,11 +142,13 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
|
|||
case Coin.dogecoin:
|
||||
case Coin.firo:
|
||||
case Coin.namecoin:
|
||||
case Coin.particl:
|
||||
case Coin.bitcoinTestNet:
|
||||
case Coin.litecoinTestNet:
|
||||
case Coin.bitcoincashTestnet:
|
||||
case Coin.firoTestNet:
|
||||
case Coin.dogecoinTestNet:
|
||||
case Coin.particlTestNet:
|
||||
final client = ElectrumX(
|
||||
host: formData.host!,
|
||||
port: formData.port!,
|
||||
|
@ -687,11 +689,13 @@ class _NodeFormState extends ConsumerState<NodeForm> {
|
|||
case Coin.firo:
|
||||
case Coin.namecoin:
|
||||
case Coin.bitcoincash:
|
||||
case Coin.particl:
|
||||
case Coin.bitcoinTestNet:
|
||||
case Coin.litecoinTestNet:
|
||||
case Coin.bitcoincashTestnet:
|
||||
case Coin.firoTestNet:
|
||||
case Coin.dogecoinTestNet:
|
||||
case Coin.particlTestNet:
|
||||
return false;
|
||||
|
||||
case Coin.epicCash:
|
||||
|
|
|
@ -10,6 +10,7 @@ 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/coins/particl/particl_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart';
|
||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
@ -181,6 +182,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,
|
||||
|
|
3813
lib/services/coins/particl/particl_wallet.dart
Normal file
3813
lib/services/coins/particl/particl_wallet.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -8,6 +8,7 @@ import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
|
|||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/litecoin/litecoin_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';
|
||||
|
||||
|
@ -61,6 +62,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.litecoinTestNet:
|
||||
|
@ -71,6 +74,8 @@ class AddressUtils {
|
|||
return Address.validateAddress(address, firoTestNetwork);
|
||||
case Coin.dogecoinTestNet:
|
||||
return Address.validateAddress(address, dogecointestnet);
|
||||
case Coin.particlTestNet:
|
||||
return Address.validateAddress(address, particltestnet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,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";
|
||||
|
@ -192,6 +194,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) {
|
||||
|
@ -214,6 +218,8 @@ class _SVG {
|
|||
return wownero;
|
||||
case Coin.namecoin:
|
||||
return namecoin;
|
||||
case Coin.particl:
|
||||
return particl;
|
||||
case Coin.bitcoinTestNet:
|
||||
return bitcoinTestnet;
|
||||
case Coin.bitcoincashTestnet:
|
||||
|
@ -222,6 +228,8 @@ class _SVG {
|
|||
return firoTestnet;
|
||||
case Coin.dogecoinTestNet:
|
||||
return dogecoinTestnet;
|
||||
case Coin.particlTestNet:
|
||||
return particlTestnet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,6 +249,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 get glasses => "assets/images/glasses.png";
|
||||
String get glassesHidden => "assets/images/glasses-hidden.png";
|
||||
|
@ -271,6 +280,9 @@ class _PNG {
|
|||
return wownero;
|
||||
case Coin.namecoin:
|
||||
return namecoin;
|
||||
case Coin.particl:
|
||||
case Coin.particlTestNet:
|
||||
return particl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,5 +35,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("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,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;
|
||||
|
||||
|
@ -150,6 +152,10 @@ abstract class Constants {
|
|||
|
||||
case Coin.namecoin:
|
||||
return 600;
|
||||
|
||||
case Coin.particl:
|
||||
case Coin.particlTestNet:
|
||||
return 600;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,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,
|
||||
|
@ -193,6 +204,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:
|
||||
|
@ -222,6 +245,9 @@ abstract class DefaultNodes {
|
|||
case Coin.namecoin:
|
||||
return namecoin;
|
||||
|
||||
case Coin.particl:
|
||||
return namecoin;
|
||||
|
||||
case Coin.bitcoinTestNet:
|
||||
return bitcoinTestnet;
|
||||
|
||||
|
@ -236,6 +262,9 @@ abstract class DefaultNodes {
|
|||
|
||||
case Coin.dogecoinTestNet:
|
||||
return dogecoinTestnet;
|
||||
|
||||
case Coin.particlTestNet:
|
||||
return particlTestnet;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ 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/utilities/util.dart';
|
||||
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'
|
||||
as particl;
|
||||
|
||||
enum Coin {
|
||||
bitcoin,
|
||||
|
@ -23,6 +25,7 @@ enum Coin {
|
|||
litecoin,
|
||||
monero,
|
||||
namecoin,
|
||||
particl,
|
||||
wownero,
|
||||
|
||||
///
|
||||
|
@ -35,6 +38,7 @@ enum Coin {
|
|||
bitcoincashTestnet,
|
||||
dogecoinTestNet,
|
||||
firoTestNet,
|
||||
particlTestNet
|
||||
}
|
||||
|
||||
final int kTestNetCoinCount = Util.isDesktop ? 5 : 4;
|
||||
|
@ -56,6 +60,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:
|
||||
|
@ -70,6 +76,8 @@ extension CoinExt on Coin {
|
|||
return "tFiro";
|
||||
case Coin.dogecoinTestNet:
|
||||
return "tDogecoin";
|
||||
case Coin.particlTestNet:
|
||||
return "tParticl";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +97,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:
|
||||
|
@ -103,6 +113,8 @@ extension CoinExt on Coin {
|
|||
return "tFIRO";
|
||||
case Coin.dogecoinTestNet:
|
||||
return "tDOGE";
|
||||
case Coin.particlTestNet:
|
||||
return "tPART";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,6 +135,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:
|
||||
|
@ -137,6 +151,8 @@ extension CoinExt on Coin {
|
|||
return "firo";
|
||||
case Coin.dogecoinTestNet:
|
||||
return "dogecoin";
|
||||
case Coin.particlTestNet:
|
||||
return "particl";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,11 +164,13 @@ extension CoinExt on Coin {
|
|||
case Coin.dogecoin:
|
||||
case Coin.firo:
|
||||
case Coin.namecoin:
|
||||
case Coin.particl:
|
||||
case Coin.bitcoinTestNet:
|
||||
case Coin.litecoinTestNet:
|
||||
case Coin.bitcoincashTestnet:
|
||||
case Coin.firoTestNet:
|
||||
case Coin.dogecoinTestNet:
|
||||
case Coin.particlTestNet:
|
||||
return true;
|
||||
|
||||
case Coin.epicCash:
|
||||
|
@ -190,6 +208,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;
|
||||
|
||||
|
@ -230,6 +252,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;
|
||||
|
@ -295,6 +322,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
|
|||
return Coin.namecoin;
|
||||
case "tltc":
|
||||
return Coin.litecoinTestNet;
|
||||
case "part":
|
||||
return Coin.particl;
|
||||
case "tbtc":
|
||||
return Coin.bitcoinTestNet;
|
||||
case "tbch":
|
||||
|
@ -303,6 +332,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
|
|||
return Coin.firoTestNet;
|
||||
case "tdoge":
|
||||
return Coin.dogecoinTestNet;
|
||||
case "tparticl":
|
||||
return Coin.particlTestNet;
|
||||
case "wow":
|
||||
return Coin.wownero;
|
||||
default:
|
||||
|
|
|
@ -193,6 +193,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) {
|
||||
|
@ -219,6 +220,9 @@ class CoinThemeColor {
|
|||
return namecoin;
|
||||
case Coin.wownero:
|
||||
return wownero;
|
||||
case Coin.particl:
|
||||
case Coin.particlTestNet:
|
||||
return particl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1443,6 +1443,9 @@ class StackColors extends ThemeExtension<StackColors> {
|
|||
return _coin.namecoin;
|
||||
case Coin.wownero:
|
||||
return _coin.wownero;
|
||||
case Coin.particl:
|
||||
case Coin.particlTestNet:
|
||||
return _coin.particl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue