mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-24 16:18:51 +00:00
Add testnet to coin list
This commit is contained in:
parent
58364a6c88
commit
7061c3c40b
17 changed files with 78 additions and 3 deletions
Binary file not shown.
Binary file not shown.
|
@ -197,6 +197,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
//TODO: check network/node
|
//TODO: check network/node
|
||||||
}
|
}
|
||||||
|
@ -739,6 +740,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.eCash:
|
case Coin.eCash:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case Coin.ethereum:
|
case Coin.ethereum:
|
||||||
|
|
|
@ -173,6 +173,7 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
//TODO: check network/node
|
//TODO: check network/node
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,6 +285,15 @@ abstract class CoinServiceAPI {
|
||||||
cachedClient: cachedClient,
|
cachedClient: cachedClient,
|
||||||
tracker: tracker,
|
tracker: tracker,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return StellarWallet(
|
||||||
|
walletId: walletId,
|
||||||
|
walletName: walletName,
|
||||||
|
coin: coin,
|
||||||
|
secureStore: secureStorageInterface,
|
||||||
|
tracker: tracker,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,9 @@ const int MINIMUM_CONFIRMATIONS = 1;
|
||||||
class StellarWallet extends CoinServiceAPI
|
class StellarWallet extends CoinServiceAPI
|
||||||
with WalletCache, WalletDB, CoinControlInterface {
|
with WalletCache, WalletDB, CoinControlInterface {
|
||||||
|
|
||||||
|
late StellarSDK stellarSdk;
|
||||||
|
late Network stellarNetwork;
|
||||||
|
|
||||||
StellarWallet({
|
StellarWallet({
|
||||||
required String walletId,
|
required String walletId,
|
||||||
required String walletName,
|
required String walletName,
|
||||||
|
@ -56,12 +59,20 @@ class StellarWallet extends CoinServiceAPI
|
||||||
_secureStore = secureStore;
|
_secureStore = secureStore;
|
||||||
initCache(walletId, coin);
|
initCache(walletId, coin);
|
||||||
initWalletDB(mockableOverride: mockableOverride);
|
initWalletDB(mockableOverride: mockableOverride);
|
||||||
|
|
||||||
|
if (coin.name == "stellarTestnet") {
|
||||||
|
stellarSdk = StellarSDK.TESTNET;
|
||||||
|
stellarNetwork = Network.TESTNET;
|
||||||
|
} else {
|
||||||
|
stellarSdk = StellarSDK.PUBLIC;
|
||||||
|
stellarNetwork = Network.PUBLIC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
late final TransactionNotificationTracker txTracker;
|
late final TransactionNotificationTracker txTracker;
|
||||||
late SecureStorageInterface _secureStore;
|
late SecureStorageInterface _secureStore;
|
||||||
|
|
||||||
final StellarSDK stellarSdk = StellarSDK.PUBLIC;
|
// final StellarSDK stellarSdk = StellarSDK.PUBLIC;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isFavorite => _isFavorite ??= getCachedIsFavorite();
|
bool get isFavorite => _isFavorite ??= getCachedIsFavorite();
|
||||||
|
@ -199,7 +210,7 @@ class StellarWallet extends CoinServiceAPI
|
||||||
.build()
|
.build()
|
||||||
).build();
|
).build();
|
||||||
}
|
}
|
||||||
transaction.sign(senderKeyPair, Network.PUBLIC);
|
transaction.sign(senderKeyPair, stellarNetwork);
|
||||||
try {
|
try {
|
||||||
SubmitTransactionResponse response = await stellarSdk.submitTransaction(transaction);
|
SubmitTransactionResponse response = await stellarSdk.submitTransaction(transaction);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CoinThemeColorDefault {
|
||||||
Color get namecoin => const Color(0xFF91B1E1);
|
Color get namecoin => const Color(0xFF91B1E1);
|
||||||
Color get wownero => const Color(0xFFED80C1);
|
Color get wownero => const Color(0xFFED80C1);
|
||||||
Color get particl => const Color(0xFF8175BD);
|
Color get particl => const Color(0xFF8175BD);
|
||||||
Color get stellar => const Color(0xFFE8E8E8); // TODO: find color
|
Color get stellar => const Color(0xFF6600FF);
|
||||||
Color get nano => const Color(0xFF209CE9);
|
Color get nano => const Color(0xFF209CE9);
|
||||||
Color get banano => const Color(0xFFFBDD11);
|
Color get banano => const Color(0xFFFBDD11);
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ class CoinThemeColorDefault {
|
||||||
case Coin.particl:
|
case Coin.particl:
|
||||||
return particl;
|
return particl;
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return stellar;
|
return stellar;
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
return nano;
|
return nano;
|
||||||
|
|
|
@ -1708,6 +1708,7 @@ class StackColors extends ThemeExtension<StackColors> {
|
||||||
case Coin.particl:
|
case Coin.particl:
|
||||||
return _coin.particl;
|
return _coin.particl;
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return _coin.stellar;
|
return _coin.stellar;
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
return _coin.nano;
|
return _coin.nano;
|
||||||
|
|
|
@ -141,6 +141,8 @@ class AddressUtils {
|
||||||
return Address.validateAddress(address, firoTestNetwork);
|
return Address.validateAddress(address, firoTestNetwork);
|
||||||
case Coin.dogecoinTestNet:
|
case Coin.dogecoinTestNet:
|
||||||
return Address.validateAddress(address, dogecointestnet);
|
return Address.validateAddress(address, dogecointestnet);
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return RegExp(r"^[G][A-Z0-9]{55}$").hasMatch(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ enum AmountUnit {
|
||||||
case Coin.eCash:
|
case Coin.eCash:
|
||||||
case Coin.epicCash:
|
case Coin.epicCash:
|
||||||
case Coin.stellar: // TODO: check if this is correct
|
case Coin.stellar: // TODO: check if this is correct
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return AmountUnit.values.sublist(0, 4);
|
return AmountUnit.values.sublist(0, 4);
|
||||||
|
|
||||||
case Coin.monero:
|
case Coin.monero:
|
||||||
|
|
|
@ -60,6 +60,8 @@ Uri getDefaultBlockExplorerUrlFor({
|
||||||
return Uri.parse("https://www.nanolooker.com/block/$txid");
|
return Uri.parse("https://www.nanolooker.com/block/$txid");
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
return Uri.parse("https://www.bananolooker.com/block/$txid");
|
return Uri.parse("https://www.bananolooker.com/block/$txid");
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return Uri.parse("https://horizon-testnet.stellar.org/transactions/$txid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ abstract class Constants {
|
||||||
return _satsPerCoinECash;
|
return _satsPerCoinECash;
|
||||||
|
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return _satsPerCoinStellar;
|
return _satsPerCoinStellar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,6 +141,7 @@ abstract class Constants {
|
||||||
return _decimalPlacesECash;
|
return _decimalPlacesECash;
|
||||||
|
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return _decimalPlacesStellar;
|
return _decimalPlacesStellar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,6 +166,7 @@ abstract class Constants {
|
||||||
case Coin.particl:
|
case Coin.particl:
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
values.addAll([24, 12]);
|
values.addAll([24, 12]);
|
||||||
break;
|
break;
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
|
@ -225,6 +228,7 @@ abstract class Constants {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,6 +258,7 @@ abstract class Constants {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return 24;
|
return 24;
|
||||||
|
|
||||||
case Coin.monero:
|
case Coin.monero:
|
||||||
|
|
|
@ -34,6 +34,7 @@ abstract class DefaultNodes {
|
||||||
bitcoincashTestnet,
|
bitcoincashTestnet,
|
||||||
dogecoinTestnet,
|
dogecoinTestnet,
|
||||||
firoTestnet,
|
firoTestnet,
|
||||||
|
stellarTestnet,
|
||||||
];
|
];
|
||||||
|
|
||||||
static NodeModel get bitcoin => NodeModel(
|
static NodeModel get bitcoin => NodeModel(
|
||||||
|
@ -275,6 +276,18 @@ abstract class DefaultNodes {
|
||||||
isDown: false,
|
isDown: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static NodeModel get stellarTestnet => NodeModel(
|
||||||
|
host: "https://horizon-testnet.stellar.org/",
|
||||||
|
port: 50022,
|
||||||
|
name: defaultName,
|
||||||
|
id: _nodeId(Coin.stellarTestnet),
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: Coin.stellarTestnet.name,
|
||||||
|
isFailover: true,
|
||||||
|
isDown: false,
|
||||||
|
);
|
||||||
|
|
||||||
static NodeModel getNodeFor(Coin coin) {
|
static NodeModel getNodeFor(Coin coin) {
|
||||||
switch (coin) {
|
switch (coin) {
|
||||||
case Coin.bitcoin:
|
case Coin.bitcoin:
|
||||||
|
@ -336,6 +349,9 @@ abstract class DefaultNodes {
|
||||||
|
|
||||||
case Coin.dogecoinTestNet:
|
case Coin.dogecoinTestNet:
|
||||||
return dogecoinTestnet;
|
return dogecoinTestnet;
|
||||||
|
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return stellarTestnet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ enum Coin {
|
||||||
dogecoinTestNet,
|
dogecoinTestNet,
|
||||||
firoTestNet,
|
firoTestNet,
|
||||||
litecoinTestNet,
|
litecoinTestNet,
|
||||||
|
stellarTestnet,
|
||||||
}
|
}
|
||||||
|
|
||||||
final int kTestNetCoinCount = 4; // Util.isDesktop ? 5 : 4;
|
final int kTestNetCoinCount = 4; // Util.isDesktop ? 5 : 4;
|
||||||
|
@ -106,6 +107,8 @@ extension CoinExt on Coin {
|
||||||
return "tFiro";
|
return "tFiro";
|
||||||
case Coin.dogecoinTestNet:
|
case Coin.dogecoinTestNet:
|
||||||
return "tDogecoin";
|
return "tDogecoin";
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return "tStellar";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +154,8 @@ extension CoinExt on Coin {
|
||||||
return "tFIRO";
|
return "tFIRO";
|
||||||
case Coin.dogecoinTestNet:
|
case Coin.dogecoinTestNet:
|
||||||
return "tDOGE";
|
return "tDOGE";
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return "tXLM";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +202,8 @@ extension CoinExt on Coin {
|
||||||
return "firo";
|
return "firo";
|
||||||
case Coin.dogecoinTestNet:
|
case Coin.dogecoinTestNet:
|
||||||
return "dogecoin";
|
return "dogecoin";
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return "stellar";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +231,7 @@ extension CoinExt on Coin {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,6 +260,7 @@ extension CoinExt on Coin {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,6 +289,7 @@ extension CoinExt on Coin {
|
||||||
case Coin.litecoinTestNet:
|
case Coin.litecoinTestNet:
|
||||||
case Coin.bitcoincashTestnet:
|
case Coin.bitcoincashTestnet:
|
||||||
case Coin.firoTestNet:
|
case Coin.firoTestNet:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,6 +327,9 @@ extension CoinExt on Coin {
|
||||||
|
|
||||||
case Coin.firoTestNet:
|
case Coin.firoTestNet:
|
||||||
return Coin.firo;
|
return Coin.firo;
|
||||||
|
|
||||||
|
case Coin.stellarTestnet:
|
||||||
|
return Coin.stellar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +371,7 @@ extension CoinExt on Coin {
|
||||||
return particl.MINIMUM_CONFIRMATIONS;
|
return particl.MINIMUM_CONFIRMATIONS;
|
||||||
|
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
return xlm.MINIMUM_CONFIRMATIONS;
|
return xlm.MINIMUM_CONFIRMATIONS;
|
||||||
|
|
||||||
case Coin.wownero:
|
case Coin.wownero:
|
||||||
|
@ -467,6 +481,11 @@ Coin coinFromPrettyName(String name) {
|
||||||
case "banano":
|
case "banano":
|
||||||
return Coin.banano;
|
return Coin.banano;
|
||||||
|
|
||||||
|
case "Stellar Testnet":
|
||||||
|
case "stellarTestnet":
|
||||||
|
case "tStellar":
|
||||||
|
return Coin.stellarTestnet;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ArgumentError.value(
|
throw ArgumentError.value(
|
||||||
name,
|
name,
|
||||||
|
@ -518,6 +537,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
|
||||||
return Coin.nano;
|
return Coin.nano;
|
||||||
case "ban":
|
case "ban":
|
||||||
return Coin.banano;
|
return Coin.banano;
|
||||||
|
case "txlm":
|
||||||
|
return Coin.stellarTestnet;
|
||||||
default:
|
default:
|
||||||
throw ArgumentError.value(
|
throw ArgumentError.value(
|
||||||
ticker, "name", "No Coin enum value with that ticker");
|
ticker, "name", "No Coin enum value with that ticker");
|
||||||
|
|
|
@ -50,6 +50,7 @@ extension DerivePathTypeExt on DerivePathType {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
throw UnsupportedError(
|
throw UnsupportedError(
|
||||||
"$coin does not use bitcoin style derivation paths");
|
"$coin does not use bitcoin style derivation paths");
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,6 +195,7 @@ class _NodeCardState extends ConsumerState<NodeCard> {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
//TODO: check network/node
|
//TODO: check network/node
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,7 @@ class NodeOptionsSheet extends ConsumerWidget {
|
||||||
case Coin.nano:
|
case Coin.nano:
|
||||||
case Coin.banano:
|
case Coin.banano:
|
||||||
case Coin.stellar:
|
case Coin.stellar:
|
||||||
|
case Coin.stellarTestnet:
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
//TODO: check network/node
|
//TODO: check network/node
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue