mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 11:29:23 +00:00
make it easy to comment out certain coins in app config to disable them
This commit is contained in:
parent
c9d4e57d65
commit
e0abd97041
33 changed files with 417 additions and 317 deletions
|
@ -1,3 +1,5 @@
|
|||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
abstract class AppConfig {
|
||||
static const appName = prefix + _separator + suffix;
|
||||
|
||||
|
@ -6,4 +8,27 @@ abstract class AppConfig {
|
|||
static const _separator = " ";
|
||||
|
||||
static const suffix = "Wallet";
|
||||
|
||||
// comment out coins to disable them
|
||||
static const supportedCoins = [
|
||||
Bitcoin,
|
||||
BitcoinFrost,
|
||||
Litecoin,
|
||||
Bitcoincash,
|
||||
Dogecoin,
|
||||
Epiccash,
|
||||
Ecash,
|
||||
Ethereum,
|
||||
Firo,
|
||||
Monero,
|
||||
Particl,
|
||||
Peercoin,
|
||||
Solana,
|
||||
Stellar,
|
||||
Tezos,
|
||||
Wownero,
|
||||
Namecoin,
|
||||
Nano,
|
||||
Banano,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class ContactEntry {
|
|||
@ignore
|
||||
List<ContactAddressEntry> get addressesSorted {
|
||||
final List<ContactAddressEntry> sorted = [];
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
final slice = addresses.where((e) => e.coin == coin).toList();
|
||||
if (slice.isNotEmpty) {
|
||||
slice.sort(
|
||||
|
|
|
@ -1548,7 +1548,8 @@ class StackTheme {
|
|||
json["colors"]["box_shadows"]["home_view_button_bar"] == null
|
||||
? null
|
||||
: jsonEncode(
|
||||
json["colors"]["box_shadows"]["home_view_button_bar"] as Map)
|
||||
json["colors"]["box_shadows"]["home_view_button_bar"] as Map,
|
||||
)
|
||||
..coinColorsJsonString = jsonEncode(json["colors"]['coin'] as Map)
|
||||
..overlayInt = parseColor(json["colors"]["overlay"] as String)
|
||||
..accentColorBlueInt =
|
||||
|
@ -1587,7 +1588,8 @@ class StackTheme {
|
|||
..buttonBackBorderSecondaryInt =
|
||||
parseColor(json["colors"]["button_back_border_secondary"] as String)
|
||||
..buttonBackBorderSecondaryDisabledInt = parseColor(
|
||||
json["colors"]["button_back_border_secondary_disabled"] as String)
|
||||
json["colors"]["button_back_border_secondary_disabled"] as String,
|
||||
)
|
||||
..numberBackDefaultInt =
|
||||
parseColor(json["colors"]["number_back_default"] as String)
|
||||
..numpadBackDefaultInt =
|
||||
|
@ -1621,7 +1623,8 @@ class StackTheme {
|
|||
..buttonTextBorderlessInt =
|
||||
parseColor(json["colors"]["button_text_borderless"] as String)
|
||||
..buttonTextBorderlessDisabledInt = parseColor(
|
||||
json["colors"]["button_text_borderless_disabled"] as String)
|
||||
json["colors"]["button_text_borderless_disabled"] as String,
|
||||
)
|
||||
..numberTextDefaultInt =
|
||||
parseColor(json["colors"]["number_text_default"] as String)
|
||||
..numpadTextDefaultInt =
|
||||
|
@ -1629,9 +1632,11 @@ class StackTheme {
|
|||
..bottomNavTextInt =
|
||||
parseColor(json["colors"]["bottom_nav_text"] as String)
|
||||
..customTextButtonEnabledTextInt = parseColor(
|
||||
json["colors"]["custom_text_button_enabled_text"] as String)
|
||||
json["colors"]["custom_text_button_enabled_text"] as String,
|
||||
)
|
||||
..customTextButtonDisabledTextInt = parseColor(
|
||||
json["colors"]["custom_text_button_disabled_text"] as String)
|
||||
json["colors"]["custom_text_button_disabled_text"] as String,
|
||||
)
|
||||
..switchBGOnInt = parseColor(json["colors"]["switch_bg_on"] as String)
|
||||
..switchBGOffInt = parseColor(json["colors"]["switch_bg_off"] as String)
|
||||
..switchBGDisabledInt =
|
||||
|
@ -1651,7 +1656,8 @@ class StackTheme {
|
|||
..stepIndicatorBGLinesInt =
|
||||
parseColor(json["colors"]["step_indicator_bg_lines"] as String)
|
||||
..stepIndicatorBGLinesInactiveInt = parseColor(
|
||||
json["colors"]["step_indicator_bg_lines_inactive"] as String)
|
||||
json["colors"]["step_indicator_bg_lines_inactive"] as String,
|
||||
)
|
||||
..stepIndicatorIconTextInt =
|
||||
parseColor(json["colors"]["step_indicator_icon_text"] as String)
|
||||
..stepIndicatorIconNumberInt =
|
||||
|
@ -1687,7 +1693,8 @@ class StackTheme {
|
|||
..bottomNavIconIconInt =
|
||||
parseColor(json["colors"]["bottom_nav_icon_icon"] as String)
|
||||
..bottomNavIconIconHighlightedInt = parseColor(
|
||||
json["colors"]["bottom_nav_icon_icon_highlighted"] as String)
|
||||
json["colors"]["bottom_nav_icon_icon_highlighted"] as String,
|
||||
)
|
||||
..topNavIconPrimaryInt =
|
||||
parseColor(json["colors"]["top_nav_icon_primary"] as String)
|
||||
..topNavIconGreenInt =
|
||||
|
@ -1717,13 +1724,17 @@ class StackTheme {
|
|||
..textFieldSuccessBorderInt =
|
||||
parseColor(json["colors"]["text_field_success_border"] as String)
|
||||
..textFieldActiveSearchIconLeftInt = parseColor(
|
||||
json["colors"]["text_field_active_search_icon_left"] as String)
|
||||
json["colors"]["text_field_active_search_icon_left"] as String,
|
||||
)
|
||||
..textFieldDefaultSearchIconLeftInt = parseColor(
|
||||
json["colors"]["text_field_default_search_icon_left"] as String)
|
||||
json["colors"]["text_field_default_search_icon_left"] as String,
|
||||
)
|
||||
..textFieldErrorSearchIconLeftInt = parseColor(
|
||||
json["colors"]["text_field_error_search_icon_left"] as String)
|
||||
json["colors"]["text_field_error_search_icon_left"] as String,
|
||||
)
|
||||
..textFieldSuccessSearchIconLeftInt = parseColor(
|
||||
json["colors"]["text_field_success_search_icon_left"] as String)
|
||||
json["colors"]["text_field_success_search_icon_left"] as String,
|
||||
)
|
||||
..textFieldActiveTextInt =
|
||||
parseColor(json["colors"]["text_field_active_text"] as String)
|
||||
..textFieldDefaultTextInt =
|
||||
|
@ -1739,23 +1750,31 @@ class StackTheme {
|
|||
..textFieldSuccessLabelInt =
|
||||
parseColor(json["colors"]["text_field_success_label"] as String)
|
||||
..textFieldActiveSearchIconRightInt = parseColor(
|
||||
json["colors"]["text_field_active_search_icon_right"] as String)
|
||||
json["colors"]["text_field_active_search_icon_right"] as String,
|
||||
)
|
||||
..textFieldDefaultSearchIconRightInt = parseColor(
|
||||
json["colors"]["text_field_default_search_icon_right"] as String)
|
||||
json["colors"]["text_field_default_search_icon_right"] as String,
|
||||
)
|
||||
..textFieldErrorSearchIconRightInt = parseColor(
|
||||
json["colors"]["text_field_error_search_icon_right"] as String)
|
||||
json["colors"]["text_field_error_search_icon_right"] as String,
|
||||
)
|
||||
..textFieldSuccessSearchIconRightInt = parseColor(
|
||||
json["colors"]["text_field_success_search_icon_right"] as String)
|
||||
json["colors"]["text_field_success_search_icon_right"] as String,
|
||||
)
|
||||
..settingsItem2ActiveBGInt = parseColor(
|
||||
json["colors"]["settings_item_level_two_active_bg"] as String)
|
||||
json["colors"]["settings_item_level_two_active_bg"] as String,
|
||||
)
|
||||
..settingsItem2ActiveTextInt = parseColor(
|
||||
json["colors"]["settings_item_level_two_active_text"] as String)
|
||||
json["colors"]["settings_item_level_two_active_text"] as String,
|
||||
)
|
||||
..settingsItem2ActiveSubInt = parseColor(
|
||||
json["colors"]["settings_item_level_two_active_sub"] as String)
|
||||
json["colors"]["settings_item_level_two_active_sub"] as String,
|
||||
)
|
||||
..radioButtonIconBorderInt =
|
||||
parseColor(json["colors"]["radio_button_icon_border"] as String)
|
||||
..radioButtonIconBorderDisabledInt = parseColor(
|
||||
json["colors"]["radio_button_icon_border_disabled"] as String)
|
||||
json["colors"]["radio_button_icon_border_disabled"] as String,
|
||||
)
|
||||
..radioButtonBorderEnabledInt =
|
||||
parseColor(json["colors"]["radio_button_border_enabled"] as String)
|
||||
..radioButtonBorderDisabledInt =
|
||||
|
@ -1809,9 +1828,11 @@ class StackTheme {
|
|||
..rateTypeToggleColorOffInt =
|
||||
parseColor(json["colors"]["rate_type_toggle_color_off"] as String)
|
||||
..rateTypeToggleDesktopColorOnInt = parseColor(
|
||||
json["colors"]["rate_type_toggle_desktop_color_on"] as String)
|
||||
json["colors"]["rate_type_toggle_desktop_color_on"] as String,
|
||||
)
|
||||
..rateTypeToggleDesktopColorOffInt = parseColor(
|
||||
json["colors"]["rate_type_toggle_desktop_color_off"] as String)
|
||||
json["colors"]["rate_type_toggle_desktop_color_off"] as String,
|
||||
)
|
||||
..ethTagTextInt = parseColor(json["colors"]["eth_tag_text"] as String)
|
||||
..ethTagBGInt = parseColor(json["colors"]["eth_tag_bg"] as String)
|
||||
..ethWalletTagTextInt =
|
||||
|
@ -1857,8 +1878,7 @@ class StackTheme {
|
|||
|
||||
final Map<String, Color> result = {};
|
||||
|
||||
for (final mainNetId
|
||||
in Coins.cryptocurrencies.map((e) => e.mainNetId)) {
|
||||
for (final mainNetId in Coins.enabled.map((e) => e.mainNetId)) {
|
||||
if (map[mainNetId] is String) {
|
||||
result[mainNetId] = Color(
|
||||
(map[mainNetId] as String).toBigIntFromHex.toInt(),
|
||||
|
@ -2176,7 +2196,7 @@ class ThemeAssetsV2 implements IThemeAssets {
|
|||
|
||||
final Map<String, String> result = {};
|
||||
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
result[coin.mainNetId] = map[coin.mainNetId] as String? ?? placeHolder;
|
||||
}
|
||||
|
||||
|
@ -2511,7 +2531,7 @@ class ThemeAssetsV3 implements IThemeAssets {
|
|||
|
||||
final Map<String, String> result = {};
|
||||
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
result[coin.mainNetId] = map[coin.mainNetId] as String? ?? placeHolder;
|
||||
result[coin.mainNetId] = prependIfNeeded(result[coin.mainNetId]!);
|
||||
}
|
||||
|
|
|
@ -35,9 +35,6 @@ import 'package:stackwallet/utilities/constants.dart';
|
|||
import 'package:stackwallet/utilities/default_eth_tokens.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin_frost.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/monero.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -66,12 +63,10 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
|||
String _searchTerm = "";
|
||||
|
||||
final _coinsTestnet = [
|
||||
...Coins.cryptocurrencies
|
||||
.where((e) => e.network == CryptoCurrencyNetwork.test),
|
||||
...Coins.enabled.where((e) => e.network == CryptoCurrencyNetwork.test),
|
||||
];
|
||||
final _coins = [
|
||||
...Coins.cryptocurrencies
|
||||
.where((e) => e.network == CryptoCurrencyNetwork.main),
|
||||
...Coins.enabled.where((e) => e.network == CryptoCurrencyNetwork.main),
|
||||
];
|
||||
final List<AddWalletListEntity> coinEntities = [];
|
||||
final List<EthTokenEntity> tokenEntities = [];
|
||||
|
@ -152,17 +147,19 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
|||
coinEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e)));
|
||||
}
|
||||
|
||||
final contracts =
|
||||
MainDB.instance.getEthContracts().sortByName().findAllSync();
|
||||
if (Coins.enabled.whereType<Ethereum>().isNotEmpty) {
|
||||
final contracts =
|
||||
MainDB.instance.getEthContracts().sortByName().findAllSync();
|
||||
|
||||
if (contracts.isEmpty) {
|
||||
contracts.addAll(DefaultTokens.list);
|
||||
MainDB.instance.putEthContracts(contracts).then(
|
||||
(value) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice());
|
||||
if (contracts.isEmpty) {
|
||||
contracts.addAll(DefaultTokens.list);
|
||||
MainDB.instance.putEthContracts(contracts).then((value) =>
|
||||
ref.read(priceAnd24hChangeNotifierProvider).updatePrice());
|
||||
}
|
||||
|
||||
tokenEntities.addAll(contracts.map((e) => EthTokenEntity(e)));
|
||||
}
|
||||
|
||||
tokenEntities.addAll(contracts.map((e) => EthTokenEntity(e)));
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ref.refresh(addWalletSelectedEntityStateProvider);
|
||||
});
|
||||
|
@ -292,15 +289,16 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
|||
initialState: ExpandableState.expanded,
|
||||
animationDurationMultiplier: 0.5,
|
||||
),
|
||||
ExpandingSubListItem(
|
||||
title: "Tokens",
|
||||
entities: filter(_searchTerm, tokenEntities),
|
||||
initialState: ExpandableState.expanded,
|
||||
animationDurationMultiplier: 0.5,
|
||||
trailing: AddCustomTokenSelector(
|
||||
addFunction: _addToken,
|
||||
if (tokenEntities.isNotEmpty)
|
||||
ExpandingSubListItem(
|
||||
title: "Tokens",
|
||||
entities: filter(_searchTerm, tokenEntities),
|
||||
initialState: ExpandableState.expanded,
|
||||
animationDurationMultiplier: 0.5,
|
||||
trailing: AddCustomTokenSelector(
|
||||
addFunction: _addToken,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
||||
class AddWalletText extends StatelessWidget {
|
||||
const AddWalletText({Key? key, required this.isDesktop}) : super(key: key);
|
||||
const AddWalletText({super.key, required this.isDesktop});
|
||||
|
||||
final bool isDesktop;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
|
||||
import 'package:stackwallet/widgets/address_book_card.dart';
|
||||
|
@ -67,7 +66,7 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
|
|||
ref.refresh(addressBookFilterProvider);
|
||||
|
||||
if (widget.coin == null) {
|
||||
final coins = [...Coins.cryptocurrencies];
|
||||
final coins = [...Coins.enabled];
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
|
|
|
@ -16,7 +16,6 @@ import 'package:stackwallet/supported_coins.dart';
|
|||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
|
@ -41,7 +40,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
final coins = [...Coins.cryptocurrencies];
|
||||
final coins = [...Coins.enabled];
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
|
|
|
@ -19,7 +19,6 @@ import 'package:stackwallet/themes/coin_image_provider.dart';
|
|||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
class CoinSelectSheet extends StatelessWidget {
|
||||
|
@ -28,7 +27,7 @@ class CoinSelectSheet extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final maxHeight = MediaQuery.of(context).size.height * 0.60;
|
||||
final coins_ = [...Coins.cryptocurrencies];
|
||||
final coins_ = [...Coins.enabled];
|
||||
coins_.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
|
|
|
@ -30,7 +30,6 @@ import 'package:stackwallet/utilities/constants.dart';
|
|||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
|
||||
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
||||
|
@ -40,11 +39,11 @@ import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
|||
|
||||
class NewContactAddressEntryForm extends ConsumerStatefulWidget {
|
||||
const NewContactAddressEntryForm({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.id,
|
||||
required this.barcodeScanner,
|
||||
required this.clipboard,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final int id;
|
||||
|
||||
|
@ -74,7 +73,7 @@ class _NewContactAddressEntryFormState
|
|||
..text = ref.read(addressEntryDataProvider(widget.id)).address ?? "";
|
||||
addressLabelFocusNode = FocusNode();
|
||||
addressFocusNode = FocusNode();
|
||||
coins = [...Coins.cryptocurrencies];
|
||||
coins = [...Coins.enabled];
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -91,7 +90,7 @@ class _NewContactAddressEntryFormState
|
|||
Widget build(BuildContext context) {
|
||||
final isDesktop = Util.isDesktop;
|
||||
if (isDesktop) {
|
||||
coins = [...Coins.cryptocurrencies];
|
||||
coins = [...Coins.enabled];
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
|
|
|
@ -1331,9 +1331,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
|||
),
|
||||
Expanded(
|
||||
child: AddressBookAddressChooser(
|
||||
coin: Coins
|
||||
.cryptocurrencies
|
||||
.firstWhere(
|
||||
coin: Coins.enabled.firstWhere(
|
||||
(e) =>
|
||||
e.ticker.toLowerCase() ==
|
||||
selectedCrypto!.ticker
|
||||
|
|
|
@ -32,9 +32,9 @@ import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
|||
|
||||
class CryptoSelectionView extends ConsumerStatefulWidget {
|
||||
const CryptoSelectionView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.coins,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<Crypto> coins;
|
||||
|
||||
|
@ -70,7 +70,7 @@ class _CryptoSelectionViewState extends ConsumerState<CryptoSelectionView> {
|
|||
coins.sort(
|
||||
(a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()),
|
||||
);
|
||||
for (final coin in Coins.cryptocurrencies.reversed) {
|
||||
for (final coin in Coins.enabled.reversed) {
|
||||
final index = coins.indexWhere(
|
||||
(element) => element.ticker.toLowerCase() == coin.ticker.toLowerCase(),
|
||||
);
|
||||
|
|
|
@ -44,12 +44,12 @@ import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
|||
|
||||
class ExchangeCurrencySelectionView extends StatefulWidget {
|
||||
const ExchangeCurrencySelectionView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.willChangeTicker,
|
||||
required this.pairedTicker,
|
||||
required this.isFixedRate,
|
||||
required this.willChangeIsSend,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String? willChangeTicker;
|
||||
final String? pairedTicker;
|
||||
|
@ -365,7 +365,7 @@ class _ExchangeCurrencySelectionViewState
|
|||
Flexible(
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final coins = Coins.cryptocurrencies.where(
|
||||
final coins = Coins.enabled.where(
|
||||
(e) =>
|
||||
e.ticker.toLowerCase() !=
|
||||
widget.pairedTicker?.toLowerCase(),
|
||||
|
|
|
@ -207,11 +207,11 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
text: "Choose from Stack",
|
||||
onTap: () {
|
||||
try {
|
||||
final coin = Coins.cryptocurrencies
|
||||
.firstWhere((e) =>
|
||||
e.ticker.toLowerCase() ==
|
||||
model.receiveTicker
|
||||
.toLowerCase());
|
||||
final coin = Coins.enabled.firstWhere(
|
||||
(e) =>
|
||||
e.ticker.toLowerCase() ==
|
||||
model.receiveTicker.toLowerCase(),
|
||||
);
|
||||
|
||||
Navigator.of(context)
|
||||
.pushNamed(
|
||||
|
@ -258,7 +258,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
child: TextField(
|
||||
onTap: () {},
|
||||
key: const Key(
|
||||
"recipientExchangeStep2ViewAddressFieldKey"),
|
||||
"recipientExchangeStep2ViewAddressFieldKey",
|
||||
),
|
||||
controller: _toController,
|
||||
readOnly: false,
|
||||
autocorrect: false,
|
||||
|
@ -305,7 +306,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
_toController.text.isNotEmpty
|
||||
? TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewClearAddressFieldButtonKey"),
|
||||
"sendViewClearAddressFieldButtonKey",
|
||||
),
|
||||
onTap: () {
|
||||
_toController.text = "";
|
||||
model.recipientAddress =
|
||||
|
@ -323,11 +325,13 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
)
|
||||
: TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewPasteAddressFieldButtonKey"),
|
||||
"sendViewPasteAddressFieldButtonKey",
|
||||
),
|
||||
onTap: () async {
|
||||
final ClipboardData? data =
|
||||
await clipboard.getData(
|
||||
Clipboard.kTextPlain);
|
||||
Clipboard.kTextPlain,
|
||||
);
|
||||
if (data?.text != null &&
|
||||
data!.text!.isNotEmpty) {
|
||||
final content =
|
||||
|
@ -357,12 +361,14 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
if (_toController.text.isEmpty)
|
||||
TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewAddressBookButtonKey"),
|
||||
"sendViewAddressBookButtonKey",
|
||||
),
|
||||
onTap: () {
|
||||
ref
|
||||
.read(
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state)
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = true;
|
||||
Navigator.of(context)
|
||||
.pushNamed(
|
||||
|
@ -371,14 +377,16 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
.then((_) {
|
||||
ref
|
||||
.read(
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state)
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = false;
|
||||
|
||||
final address = ref
|
||||
.read(
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state)
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state,
|
||||
)
|
||||
.state;
|
||||
if (address.isNotEmpty) {
|
||||
_toController.text = address;
|
||||
|
@ -386,8 +394,9 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
_toController.text;
|
||||
ref
|
||||
.read(
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state)
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = "";
|
||||
}
|
||||
setState(() {
|
||||
|
@ -404,7 +413,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
if (_toController.text.isEmpty)
|
||||
TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewScanQrButtonKey"),
|
||||
"sendViewScanQrButtonKey",
|
||||
),
|
||||
onTap: () async {
|
||||
try {
|
||||
final qrResult =
|
||||
|
@ -412,7 +422,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
|
||||
final results =
|
||||
AddressUtils.parseUri(
|
||||
qrResult.rawContent);
|
||||
qrResult.rawContent,
|
||||
);
|
||||
if (results.isNotEmpty) {
|
||||
// auto fill address
|
||||
_toController.text =
|
||||
|
@ -482,10 +493,11 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
text: "Choose from Stack",
|
||||
onTap: () {
|
||||
try {
|
||||
final coin = Coins.cryptocurrencies
|
||||
.firstWhere((e) =>
|
||||
e.ticker.toLowerCase() ==
|
||||
model.sendTicker.toLowerCase());
|
||||
final coin = Coins.enabled.firstWhere(
|
||||
(e) =>
|
||||
e.ticker.toLowerCase() ==
|
||||
model.sendTicker.toLowerCase(),
|
||||
);
|
||||
|
||||
Navigator.of(context)
|
||||
.pushNamed(
|
||||
|
@ -512,8 +524,10 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
});
|
||||
});
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("$e\n$s",
|
||||
level: LogLevel.Info);
|
||||
Logging.instance.log(
|
||||
"$e\n$s",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
@ -530,7 +544,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
),
|
||||
child: TextField(
|
||||
key: const Key(
|
||||
"refundExchangeStep2ViewAddressFieldKey"),
|
||||
"refundExchangeStep2ViewAddressFieldKey",
|
||||
),
|
||||
controller: _refundController,
|
||||
readOnly: false,
|
||||
autocorrect: false,
|
||||
|
@ -577,7 +592,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
_refundController.text.isNotEmpty
|
||||
? TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewClearAddressFieldButtonKey"),
|
||||
"sendViewClearAddressFieldButtonKey",
|
||||
),
|
||||
onTap: () {
|
||||
_refundController.text = "";
|
||||
model.refundAddress =
|
||||
|
@ -595,12 +611,13 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
)
|
||||
: TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewPasteAddressFieldButtonKey"),
|
||||
"sendViewPasteAddressFieldButtonKey",
|
||||
),
|
||||
onTap: () async {
|
||||
final ClipboardData? data =
|
||||
await clipboard.getData(
|
||||
Clipboard
|
||||
.kTextPlain);
|
||||
Clipboard.kTextPlain,
|
||||
);
|
||||
if (data?.text != null &&
|
||||
data!
|
||||
.text!.isNotEmpty) {
|
||||
|
@ -631,12 +648,14 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
if (_refundController.text.isEmpty)
|
||||
TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewAddressBookButtonKey"),
|
||||
"sendViewAddressBookButtonKey",
|
||||
),
|
||||
onTap: () {
|
||||
ref
|
||||
.read(
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state)
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = true;
|
||||
Navigator.of(context)
|
||||
.pushNamed(
|
||||
|
@ -645,13 +664,15 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
.then((_) {
|
||||
ref
|
||||
.read(
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state)
|
||||
exchangeFlowIsActiveStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = false;
|
||||
final address = ref
|
||||
.read(
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state)
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state,
|
||||
)
|
||||
.state;
|
||||
if (address.isNotEmpty) {
|
||||
_refundController.text =
|
||||
|
@ -672,7 +693,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
if (_refundController.text.isEmpty)
|
||||
TextFieldIconButton(
|
||||
key: const Key(
|
||||
"sendViewScanQrButtonKey"),
|
||||
"sendViewScanQrButtonKey",
|
||||
),
|
||||
onTap: () async {
|
||||
try {
|
||||
final qrResult =
|
||||
|
@ -680,7 +702,8 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
|||
|
||||
final results =
|
||||
AddressUtils.parseUri(
|
||||
qrResult.rawContent);
|
||||
qrResult.rawContent,
|
||||
);
|
||||
if (results.isNotEmpty) {
|
||||
// auto fill address
|
||||
_refundController.text =
|
||||
|
|
|
@ -35,8 +35,6 @@ import 'package:stackwallet/utilities/clipboard_interface.dart';
|
|||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/stellar.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
import 'package:stackwallet/wallets/models/tx_data.dart';
|
||||
|
@ -853,9 +851,8 @@ class _Step4ViewState extends ConsumerState<Step4View> {
|
|||
.useMaterialPageRoute,
|
||||
builder:
|
||||
(BuildContext context) {
|
||||
final coin = Coins
|
||||
.cryptocurrencies
|
||||
.firstWhere(
|
||||
final coin =
|
||||
Coins.enabled.firstWhere(
|
||||
(e) =>
|
||||
e.ticker
|
||||
.toLowerCase() ==
|
||||
|
|
|
@ -11,7 +11,6 @@ import 'package:stackwallet/themes/stack_colors.dart';
|
|||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
|
@ -45,7 +44,7 @@ class ManageCoinUnitsView extends ConsumerWidget {
|
|||
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
||||
);
|
||||
|
||||
final _coins = Coins.cryptocurrencies
|
||||
final _coins = Coins.enabled
|
||||
.where((e) => e is! Firo && e.network != CryptoCurrencyNetwork.test)
|
||||
.toList();
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import 'package:stackwallet/themes/coin_icon_provider.dart';
|
|||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -38,7 +37,7 @@ class ManageNodesView extends ConsumerStatefulWidget {
|
|||
}
|
||||
|
||||
class _ManageNodesViewState extends ConsumerState<ManageNodesView> {
|
||||
List<CryptoCurrency> _coins = [...Coins.cryptocurrencies];
|
||||
List<CryptoCurrency> _coins = [...Coins.enabled];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
|
@ -28,7 +28,6 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
|
||||
import 'package:stackwallet/widgets/address_book_card.dart';
|
||||
|
@ -99,7 +98,7 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
|
|||
ref.refresh(addressBookFilterProvider);
|
||||
|
||||
// if (widget.coin == null) {
|
||||
final coins = Coins.cryptocurrencies.toList();
|
||||
final coins = Coins.enabled.toList();
|
||||
coins.removeWhere(
|
||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
|
|
|
@ -39,13 +39,11 @@ class DesktopManageBlockExplorersDialog extends ConsumerWidget {
|
|||
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
||||
);
|
||||
|
||||
final coins = showTestNet
|
||||
? Coins.cryptocurrencies
|
||||
: Coins.cryptocurrencies
|
||||
.where(
|
||||
(e) => e.network == CryptoCurrencyNetwork.main,
|
||||
)
|
||||
.toList();
|
||||
final coins = Coins.enabled
|
||||
.where(
|
||||
(e) => showTestNet || e.network == CryptoCurrencyNetwork.main,
|
||||
)
|
||||
.toList();
|
||||
|
||||
return DesktopDialog(
|
||||
maxHeight: 850,
|
||||
|
|
|
@ -23,9 +23,6 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/monero.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
@ -33,7 +30,7 @@ import 'package:stackwallet/widgets/stack_text_field.dart';
|
|||
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||
|
||||
class NodesSettings extends ConsumerStatefulWidget {
|
||||
const NodesSettings({Key? key}) : super(key: key);
|
||||
const NodesSettings({super.key});
|
||||
|
||||
static const String routeName = "/settingsMenuNodes";
|
||||
|
||||
|
@ -42,7 +39,7 @@ class NodesSettings extends ConsumerStatefulWidget {
|
|||
}
|
||||
|
||||
class _NodesSettings extends ConsumerState<NodesSettings> {
|
||||
List<CryptoCurrency> _coins = [...Coins.cryptocurrencies];
|
||||
List<CryptoCurrency> _coins = [...Coins.enabled];
|
||||
|
||||
late final TextEditingController searchNodeController;
|
||||
late final FocusNode searchNodeFocusNode;
|
||||
|
@ -56,10 +53,12 @@ class _NodesSettings extends ConsumerState<NodesSettings> {
|
|||
return coins;
|
||||
}
|
||||
return coins
|
||||
.where((coin) =>
|
||||
coin.prettyName.contains(filter) ||
|
||||
coin.identifier.contains(filter) ||
|
||||
coin.ticker.toLowerCase().contains(filter.toLowerCase()))
|
||||
.where(
|
||||
(coin) =>
|
||||
coin.prettyName.contains(filter) ||
|
||||
coin.identifier.contains(filter) ||
|
||||
coin.ticker.toLowerCase().contains(filter.toLowerCase()),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
@ -227,8 +226,10 @@ class _NodesSettings extends ConsumerState<NodesSettings> {
|
|||
itemBuilder: (context, index) {
|
||||
final coin = coins[index];
|
||||
final count = ref
|
||||
.watch(nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getNodesFor(coin)))
|
||||
.watch(
|
||||
nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getNodesFor(coin)),
|
||||
)
|
||||
.length;
|
||||
|
||||
return Padding(
|
||||
|
@ -290,7 +291,8 @@ class _NodesSettings extends ConsumerState<NodesSettings> {
|
|||
Text(
|
||||
"${coin.prettyName} nodes",
|
||||
style: STextStyles.titleBold12(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
count > 1
|
||||
|
|
|
@ -31,7 +31,7 @@ class NodeService extends ChangeNotifier {
|
|||
});
|
||||
|
||||
Future<void> updateDefaults() async {
|
||||
for (final defaultNode in Coins.cryptocurrencies.map(
|
||||
for (final defaultNode in Coins.enabled.map(
|
||||
(e) => e.defaultNode,
|
||||
)) {
|
||||
final savedNode = DB.instance
|
||||
|
@ -238,7 +238,7 @@ class NodeService extends ChangeNotifier {
|
|||
final map = jsonDecode(result as String);
|
||||
Logging.instance.log(map, level: LogLevel.Info);
|
||||
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
final nodeList = List<Map<String, dynamic>>.from(
|
||||
map["nodes"][coin.identifier] as List? ?? [],
|
||||
);
|
||||
|
|
|
@ -48,7 +48,7 @@ class PriceAPI {
|
|||
) async {
|
||||
final Map<String, dynamic> map = {};
|
||||
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
final entry = data[coin];
|
||||
if (entry == null) {
|
||||
map[coin.prettyName] = ["0", 0.0];
|
||||
|
@ -68,8 +68,7 @@ class PriceAPI {
|
|||
{};
|
||||
// init with 0
|
||||
final result = {
|
||||
for (final coin in Coins.cryptocurrencies)
|
||||
coin: Tuple2(Decimal.zero, 0.0),
|
||||
for (final coin in Coins.enabled) coin: Tuple2(Decimal.zero, 0.0),
|
||||
};
|
||||
|
||||
for (final entry in map.entries) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class PriceService extends ChangeNotifier {
|
|||
|
||||
Timer? _timer;
|
||||
final Map<CryptoCurrency, Tuple2<Decimal, double>> _cachedPrices = {
|
||||
for (final coin in Coins.cryptocurrencies) coin: Tuple2(Decimal.zero, 0.0)
|
||||
for (final coin in Coins.enabled) coin: Tuple2(Decimal.zero, 0.0),
|
||||
};
|
||||
|
||||
final Map<String, Tuple2<Decimal, double>> _cachedTokenPrices = {};
|
||||
|
|
|
@ -10,19 +10,20 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_libmonero/monero/monero.dart';
|
||||
import 'package:flutter_libmonero/wownero/wownero.dart';
|
||||
import 'package:flutter_libmonero/monero/monero.dart' as monero;
|
||||
import 'package:flutter_libmonero/wownero/wownero.dart' as wownero;
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/db/hive/db.dart';
|
||||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
import 'package:stackwallet/services/node_service.dart';
|
||||
import 'package:stackwallet/services/notifications_service.dart';
|
||||
import 'package:stackwallet/services/trade_sent_from_stack_service.dart';
|
||||
import 'package:stackwallet/supported_coins.dart';
|
||||
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/prefs.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/epiccash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/wallet_info.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet.dart';
|
||||
|
@ -76,27 +77,31 @@ class Wallets {
|
|||
|
||||
await secureStorage.delete(key: Wallet.mnemonicKey(walletId: walletId));
|
||||
await secureStorage.delete(
|
||||
key: Wallet.mnemonicPassphraseKey(walletId: walletId));
|
||||
key: Wallet.mnemonicPassphraseKey(walletId: walletId),
|
||||
);
|
||||
await secureStorage.delete(key: Wallet.privateKeyKey(walletId: walletId));
|
||||
|
||||
if (info.coin is Wownero) {
|
||||
final wowService =
|
||||
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
final wowService = wownero.wownero
|
||||
.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
await wowService.remove(walletId);
|
||||
Logging.instance
|
||||
.log("monero wallet: $walletId deleted", level: LogLevel.Info);
|
||||
} else if (info.coin is Monero) {
|
||||
final xmrService =
|
||||
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
final xmrService = monero.monero
|
||||
.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
await xmrService.remove(walletId);
|
||||
Logging.instance
|
||||
.log("monero wallet: $walletId deleted", level: LogLevel.Info);
|
||||
} else if (info.coin is Epiccash) {
|
||||
final deleteResult = await deleteEpicWallet(
|
||||
walletId: walletId, secureStore: secureStorage);
|
||||
walletId: walletId,
|
||||
secureStore: secureStorage,
|
||||
);
|
||||
Logging.instance.log(
|
||||
"epic wallet: $walletId deleted with result: $deleteResult",
|
||||
level: LogLevel.Info);
|
||||
"epic wallet: $walletId deleted with result: $deleteResult",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
}
|
||||
|
||||
// delete wallet data in main db
|
||||
|
@ -108,7 +113,9 @@ class Wallets {
|
|||
// when delete was requested so instead of deleting now we mark the wallet
|
||||
// as needs delete by adding it's id to a list which gets checked on app start
|
||||
await DB.instance.add<String>(
|
||||
boxName: DB.boxNameWalletsToDeleteOnStart, value: walletId);
|
||||
boxName: DB.boxNameWalletsToDeleteOnStart,
|
||||
value: walletId,
|
||||
);
|
||||
|
||||
final lookupService = TradeSentFromStackService();
|
||||
for (final lookup in lookupService.all) {
|
||||
|
@ -149,10 +156,12 @@ class Wallets {
|
|||
// clear out any wallet hive boxes where the wallet was deleted in previous app run
|
||||
for (final walletId in DB.instance
|
||||
.values<String>(boxName: DB.boxNameWalletsToDeleteOnStart)) {
|
||||
await mainDB.isar.writeTxn(() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll());
|
||||
await mainDB.isar.writeTxn(
|
||||
() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll(),
|
||||
);
|
||||
}
|
||||
// clear list
|
||||
await DB.instance
|
||||
|
@ -210,11 +219,13 @@ class Wallets {
|
|||
if (wallet is CwBasedInterface) {
|
||||
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||
} else {
|
||||
walletInitFutures.add(wallet.init().then((_) {
|
||||
if (shouldSetAutoSync) {
|
||||
wallet.shouldAutoSync = true;
|
||||
}
|
||||
}));
|
||||
walletInitFutures.add(
|
||||
wallet.init().then((_) {
|
||||
if (shouldSetAutoSync) {
|
||||
wallet.shouldAutoSync = true;
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
_wallets[wallet.walletId] = wallet;
|
||||
|
@ -251,10 +262,12 @@ class Wallets {
|
|||
// clear out any wallet hive boxes where the wallet was deleted in previous app run
|
||||
for (final walletId in DB.instance
|
||||
.values<String>(boxName: DB.boxNameWalletsToDeleteOnStart)) {
|
||||
await mainDB.isar.writeTxn(() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll());
|
||||
await mainDB.isar.writeTxn(
|
||||
() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll(),
|
||||
);
|
||||
}
|
||||
// clear list
|
||||
await DB.instance
|
||||
|
@ -346,10 +359,12 @@ class Wallets {
|
|||
.toList();
|
||||
|
||||
if (walletInitFutures.isNotEmpty && walletsToInitLinearly.isNotEmpty) {
|
||||
unawaited(Future.wait([
|
||||
_initLinearly(walletsToInitLinearly),
|
||||
...walletInitFutures,
|
||||
]));
|
||||
unawaited(
|
||||
Future.wait([
|
||||
_initLinearly(walletsToInitLinearly),
|
||||
...walletInitFutures,
|
||||
]),
|
||||
);
|
||||
} else if (walletInitFutures.isNotEmpty) {
|
||||
unawaited(Future.wait(walletInitFutures));
|
||||
} else if (walletsToInitLinearly.isNotEmpty) {
|
||||
|
@ -370,16 +385,25 @@ class Wallets {
|
|||
// clear out any wallet hive boxes where the wallet was deleted in previous app run
|
||||
for (final walletId in DB.instance
|
||||
.values<String>(boxName: DB.boxNameWalletsToDeleteOnStart)) {
|
||||
await mainDB.isar.writeTxn(() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll());
|
||||
await mainDB.isar.writeTxn(
|
||||
() async => await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.deleteAll(),
|
||||
);
|
||||
}
|
||||
// clear list
|
||||
await DB.instance
|
||||
.deleteAll<String>(boxName: DB.boxNameWalletsToDeleteOnStart);
|
||||
|
||||
final walletInfoList = await mainDB.isar.walletInfo.where().findAll();
|
||||
final walletInfoList = await mainDB.isar.walletInfo
|
||||
.where()
|
||||
.filter()
|
||||
.anyOf<String, CryptoCurrency>(
|
||||
Coins.enabled.map((e) => e.identifier),
|
||||
(q, element) => q.coinNameMatches(element),
|
||||
)
|
||||
.findAll();
|
||||
if (walletInfoList.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
@ -552,11 +576,13 @@ class Wallets {
|
|||
if (wallet is CwBasedInterface) {
|
||||
// walletsToInitLinearly.add(Tuple2(manager, shouldSetAutoSync));
|
||||
} else {
|
||||
walletInitFutures.add(wallet.init().then((_) {
|
||||
// if (shouldSetAutoSync) {
|
||||
// wallet.shouldAutoSync = true;
|
||||
// }
|
||||
}));
|
||||
walletInitFutures.add(
|
||||
wallet.init().then((_) {
|
||||
// if (shouldSetAutoSync) {
|
||||
// wallet.shouldAutoSync = true;
|
||||
// }
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,6 +622,7 @@ class Wallets {
|
|||
Future<void> _deleteWallet(String walletId) async {
|
||||
// TODO proper clean up of other wallet data in addition to the following
|
||||
await mainDB.isar.writeTxn(
|
||||
() async => await mainDB.isar.walletInfo.deleteByWalletId(walletId));
|
||||
() async => await mainDB.isar.walletInfo.deleteByWalletId(walletId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
import 'package:stackwallet/wallets/crypto_currency/coins/banano.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin_frost.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/dogecoin.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/epiccash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/ethereum.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/litecoin.dart';
|
||||
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';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart';
|
||||
import 'package:stackwallet/app_config.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/intermediate/frost_currency.dart';
|
||||
|
||||
/// The supported coins. Eventually move away from the Coin enum
|
||||
class Coins {
|
||||
/// A List of our supported coins.
|
||||
static final List<CryptoCurrency> cryptocurrencies = [
|
||||
/// A List of enabled coins.
|
||||
static List<CryptoCurrency> get enabled => all
|
||||
.where(
|
||||
(element) => AppConfig.supportedCoins.contains(element.runtimeType))
|
||||
.toList();
|
||||
|
||||
/// A List of all implemented coins.
|
||||
static final List<CryptoCurrency> all = [
|
||||
Bitcoin(CryptoCurrencyNetwork.main),
|
||||
BitcoinFrost(CryptoCurrencyNetwork.main),
|
||||
Litecoin(CryptoCurrencyNetwork.main),
|
||||
|
@ -54,7 +42,7 @@ class Coins {
|
|||
];
|
||||
|
||||
static CryptoCurrency getCryptoCurrencyFor(String coinIdentifier) =>
|
||||
cryptocurrencies.firstWhere(
|
||||
all.firstWhere(
|
||||
(e) => e.identifier == coinIdentifier,
|
||||
);
|
||||
|
||||
|
@ -63,7 +51,7 @@ class Coins {
|
|||
bool caseInsensitive = true,
|
||||
}) {
|
||||
final _ticker = caseInsensitive ? ticker.toLowerCase() : ticker;
|
||||
return cryptocurrencies.firstWhere(
|
||||
return all.firstWhere(
|
||||
caseInsensitive
|
||||
? (e) => e.ticker.toLowerCase() == _ticker && e is! FrostCurrency
|
||||
: (e) => e.ticker == _ticker && e is! FrostCurrency,
|
||||
|
@ -75,7 +63,7 @@ class Coins {
|
|||
static CryptoCurrency getCryptoCurrencyByPrettyName(final String prettyName) {
|
||||
final name = prettyName.replaceAll(" ", "").toLowerCase();
|
||||
try {
|
||||
return cryptocurrencies.firstWhere(
|
||||
return all.firstWhere(
|
||||
(e) => e.identifier.toLowerCase() == name || e.prettyName == prettyName,
|
||||
);
|
||||
} catch (_) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "lastUnlockedTimeout",
|
||||
value: lastUnlockedTimeout);
|
||||
value: lastUnlockedTimeout,);
|
||||
_lastUnlockedTimeout = lastUnlockedTimeout;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<int> _getLastUnlockedTimeout() async {
|
||||
return (DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "lastUnlockedTimeout")) as int? ??
|
||||
boxName: DB.boxNamePrefs, key: "lastUnlockedTimeout",)) as int? ??
|
||||
60;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class Prefs extends ChangeNotifier {
|
|||
set lastUnlocked(int lastUnlocked) {
|
||||
if (_lastUnlocked != lastUnlocked) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "lastUnlocked", value: lastUnlocked);
|
||||
boxName: DB.boxNamePrefs, key: "lastUnlocked", value: lastUnlocked,);
|
||||
_lastUnlocked = lastUnlocked;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<int> _getLastUnlocked() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "lastUnlocked") as int? ??
|
||||
boxName: DB.boxNamePrefs, key: "lastUnlocked",) as int? ??
|
||||
0;
|
||||
}
|
||||
|
||||
|
@ -133,13 +133,13 @@ class Prefs extends ChangeNotifier {
|
|||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "currentNotificationId",
|
||||
value: _currentNotificationId);
|
||||
value: _currentNotificationId,);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<int> _getCurrentNotificationIndex() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "currentNotificationId") as int? ??
|
||||
boxName: DB.boxNamePrefs, key: "currentNotificationId",) as int? ??
|
||||
0;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "walletIdsSyncOnStartup",
|
||||
value: walletIdsSyncOnStartup);
|
||||
value: walletIdsSyncOnStartup,);
|
||||
_walletIdsSyncOnStartup = walletIdsSyncOnStartup;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<List<String>> _getWalletIdsSyncOnStartup() async {
|
||||
final list = await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "walletIdsSyncOnStartup") as List? ??
|
||||
boxName: DB.boxNamePrefs, key: "walletIdsSyncOnStartup",) as List? ??
|
||||
[];
|
||||
return List<String>.from(list);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "syncTypeIndex",
|
||||
value: syncType.index);
|
||||
value: syncType.index,);
|
||||
_syncType = syncType;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<SyncingType> _getSyncType() async {
|
||||
final int index = await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "syncTypeIndex") as int? ??
|
||||
boxName: DB.boxNamePrefs, key: "syncTypeIndex",) as int? ??
|
||||
SyncingType.allWalletsOnStartup.index;
|
||||
return SyncingType.values[index];
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ class Prefs extends ChangeNotifier {
|
|||
set wifiOnly(bool wifiOnly) {
|
||||
if (_wifiOnly != wifiOnly) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "wifiOnly", value: wifiOnly);
|
||||
boxName: DB.boxNamePrefs, key: "wifiOnly", value: wifiOnly,);
|
||||
_wifiOnly = wifiOnly;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "showFavoriteWallets",
|
||||
value: showFavoriteWallets);
|
||||
value: showFavoriteWallets,);
|
||||
_showFavoriteWallets = showFavoriteWallets;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getShowFavoriteWallets() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "showFavoriteWallets") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "showFavoriteWallets",) as bool? ??
|
||||
true;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ class Prefs extends ChangeNotifier {
|
|||
set language(String newLanguage) {
|
||||
if (_language != newLanguage) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "language", value: newLanguage);
|
||||
boxName: DB.boxNamePrefs, key: "language", value: newLanguage,);
|
||||
_language = newLanguage;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<String> _getPreferredLanguage() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "language") as String? ??
|
||||
boxName: DB.boxNamePrefs, key: "language",) as String? ??
|
||||
Language.englishUS.description;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ class Prefs extends ChangeNotifier {
|
|||
set currency(String newCurrency) {
|
||||
if (currency != newCurrency) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "currency", value: newCurrency);
|
||||
boxName: DB.boxNamePrefs, key: "currency", value: newCurrency,);
|
||||
_currency = newCurrency;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<String> _getPreferredCurrency() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "currency") as String? ??
|
||||
boxName: DB.boxNamePrefs, key: "currency",) as String? ??
|
||||
"USD";
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ class Prefs extends ChangeNotifier {
|
|||
set randomizePIN(bool randomizePIN) {
|
||||
if (_randomizePIN != randomizePIN) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "randomizePIN", value: randomizePIN);
|
||||
boxName: DB.boxNamePrefs, key: "randomizePIN", value: randomizePIN,);
|
||||
_randomizePIN = randomizePIN;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getRandomizePIN() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "randomizePIN") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "randomizePIN",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ class Prefs extends ChangeNotifier {
|
|||
set useBiometrics(bool useBiometrics) {
|
||||
if (_useBiometrics != useBiometrics) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "useBiometrics", value: useBiometrics);
|
||||
boxName: DB.boxNamePrefs, key: "useBiometrics", value: useBiometrics,);
|
||||
_useBiometrics = useBiometrics;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getUseBiometrics() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "useBiometrics") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "useBiometrics",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ class Prefs extends ChangeNotifier {
|
|||
set familiarity(int familiarity) {
|
||||
if (_familiarity != familiarity) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "familiarity", value: familiarity);
|
||||
boxName: DB.boxNamePrefs, key: "familiarity", value: familiarity,);
|
||||
_familiarity = familiarity;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<int> _getHasFamiliarity() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "familiarity") as int? ??
|
||||
boxName: DB.boxNamePrefs, key: "familiarity",) as int? ??
|
||||
0;
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "showTestNetCoins",
|
||||
value: showTestNetCoins);
|
||||
value: showTestNetCoins,);
|
||||
_showTestNetCoins = showTestNetCoins;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getShowTestNetCoins() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "showTestNetCoins") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "showTestNetCoins",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ class Prefs extends ChangeNotifier {
|
|||
.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "isAutoBackupEnabled",
|
||||
value: isAutoBackupEnabled)
|
||||
value: isAutoBackupEnabled,)
|
||||
.then((_) {
|
||||
_isAutoBackupEnabled = isAutoBackupEnabled;
|
||||
notifyListeners();
|
||||
|
@ -473,7 +473,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getIsAutoBackupEnabled() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "isAutoBackupEnabled") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "isAutoBackupEnabled",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "autoBackupLocation",
|
||||
value: autoBackupLocation);
|
||||
value: autoBackupLocation,);
|
||||
_autoBackupLocation = autoBackupLocation;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<String?> _getAutoBackupLocation() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "autoBackupLocation") as String?;
|
||||
boxName: DB.boxNamePrefs, key: "autoBackupLocation",) as String?;
|
||||
}
|
||||
|
||||
// auto backup frequency type
|
||||
|
@ -513,19 +513,19 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "backupFrequencyType",
|
||||
value: "10Min");
|
||||
value: "10Min",);
|
||||
break;
|
||||
case BackupFrequencyType.everyAppStart:
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "backupFrequencyType",
|
||||
value: "onStart");
|
||||
value: "onStart",);
|
||||
break;
|
||||
case BackupFrequencyType.afterClosingAWallet:
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "backupFrequencyType",
|
||||
value: "onWalletClose");
|
||||
value: "onWalletClose",);
|
||||
break;
|
||||
}
|
||||
_backupFrequencyType = backupFrequencyType;
|
||||
|
@ -535,7 +535,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<BackupFrequencyType> _getBackupFrequencyType() async {
|
||||
String? rate = await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "backupFrequencyType") as String?;
|
||||
boxName: DB.boxNamePrefs, key: "backupFrequencyType",) as String?;
|
||||
rate ??= "10Min";
|
||||
switch (rate) {
|
||||
case "10Min":
|
||||
|
@ -560,7 +560,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "lastAutoBackup",
|
||||
value: lastAutoBackup);
|
||||
value: lastAutoBackup,);
|
||||
_lastAutoBackup = lastAutoBackup;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<DateTime?> _getLastAutoBackup() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "autoBackupFileUri") as DateTime?;
|
||||
boxName: DB.boxNamePrefs, key: "autoBackupFileUri",) as DateTime?;
|
||||
}
|
||||
|
||||
// auto backup
|
||||
|
@ -583,7 +583,7 @@ class Prefs extends ChangeNotifier {
|
|||
.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "hideBlockExplorerWarning",
|
||||
value: hideBlockExplorerWarning)
|
||||
value: hideBlockExplorerWarning,)
|
||||
.then((_) {
|
||||
_hideBlockExplorerWarning = hideBlockExplorerWarning;
|
||||
notifyListeners();
|
||||
|
@ -594,7 +594,7 @@ class Prefs extends ChangeNotifier {
|
|||
Future<bool> _getHideBlockExplorerWarning() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "hideBlockExplorerWarning") as bool? ??
|
||||
key: "hideBlockExplorerWarning",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ class Prefs extends ChangeNotifier {
|
|||
.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "gotoWalletOnStartup",
|
||||
value: gotoWalletOnStartup)
|
||||
value: gotoWalletOnStartup,)
|
||||
.then((_) {
|
||||
_gotoWalletOnStartup = gotoWalletOnStartup;
|
||||
notifyListeners();
|
||||
|
@ -620,7 +620,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getGotoWalletOnStartup() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "gotoWalletOnStartup") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "gotoWalletOnStartup",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -635,7 +635,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "startupWalletId",
|
||||
value: startupWalletId);
|
||||
value: startupWalletId,);
|
||||
_startupWalletId = startupWalletId;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<String?> _getStartupWalletId() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "startupWalletId") as String?;
|
||||
boxName: DB.boxNamePrefs, key: "startupWalletId",) as String?;
|
||||
}
|
||||
|
||||
// incognito mode off by default
|
||||
|
@ -658,7 +658,7 @@ class Prefs extends ChangeNotifier {
|
|||
.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: externalCalls)
|
||||
value: externalCalls,)
|
||||
.then((_) {
|
||||
_externalCalls = externalCalls;
|
||||
notifyListeners();
|
||||
|
@ -668,7 +668,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getHasExternalCalls() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "externalCalls") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "externalCalls",) as bool? ??
|
||||
true;
|
||||
}
|
||||
|
||||
|
@ -718,7 +718,7 @@ class Prefs extends ChangeNotifier {
|
|||
Future<void> saveSignupEpoch(int signupEpoch) async {
|
||||
_signupEpoch = signupEpoch;
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "signupEpoch", value: _signupEpoch);
|
||||
boxName: DB.boxNamePrefs, key: "signupEpoch", value: _signupEpoch,);
|
||||
// notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -733,7 +733,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "enableCoinControl",
|
||||
value: enableCoinControl);
|
||||
value: enableCoinControl,);
|
||||
_enableCoinControl = enableCoinControl;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getEnableCoinControl() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "enableCoinControl") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "enableCoinControl",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ class Prefs extends ChangeNotifier {
|
|||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "enableSystemBrightness",
|
||||
value: enableSystemBrightness);
|
||||
value: enableSystemBrightness,);
|
||||
_enableSystemBrightness = enableSystemBrightness;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ class Prefs extends ChangeNotifier {
|
|||
|
||||
Future<bool> _getEnableSystemBrightness() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "enableSystemBrightness") as bool? ??
|
||||
boxName: DB.boxNamePrefs, key: "enableSystemBrightness",) as bool? ??
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -854,7 +854,7 @@ class Prefs extends ChangeNotifier {
|
|||
_amountUnits[coin] ?? AmountUnit.normal;
|
||||
|
||||
void updateAmountUnit(
|
||||
{required CryptoCurrency coin, required AmountUnit amountUnit}) {
|
||||
{required CryptoCurrency coin, required AmountUnit amountUnit,}) {
|
||||
if (this.amountUnit(coin) != amountUnit) {
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
|
@ -867,7 +867,7 @@ class Prefs extends ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<void> _setAmountUnits() async {
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
final unitIndex = await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "amountUnitFor${coin.identifier}",
|
||||
|
@ -900,7 +900,7 @@ class Prefs extends ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<void> _setMaxDecimals() async {
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
final decimals = await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "maxDecimalsFor${coin.identifier}",
|
||||
|
|
|
@ -2,6 +2,27 @@ import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
|||
import 'package:stackwallet/models/node_model.dart';
|
||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/banano.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/bitcoin_frost.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/dogecoin.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/epiccash.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/ethereum.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/litecoin.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/monero.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/namecoin.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/nano.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/particl.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/peercoin.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/solana.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/stellar.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/tezos.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/coins/wownero.dart';
|
||||
export 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
enum CryptoCurrencyNetwork {
|
||||
main,
|
||||
test,
|
||||
|
|
|
@ -407,9 +407,7 @@ class WalletInfo implements IsarId {
|
|||
this.cachedBalanceTertiaryString,
|
||||
this.otherDataJsonString,
|
||||
}) : assert(
|
||||
Coins.cryptocurrencies
|
||||
.map((e) => e.identifier)
|
||||
.contains(coinName),
|
||||
Coins.enabled.map((e) => e.identifier).contains(coinName),
|
||||
);
|
||||
|
||||
WalletInfo copyWith({
|
||||
|
|
|
@ -27,7 +27,7 @@ final pAllWalletsInfoByCoin = Provider((ref) {
|
|||
}
|
||||
|
||||
final List<({CryptoCurrency coin, List<WalletInfo> wallets})> results = [];
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
if (map[coin] != null) {
|
||||
results.add(map[coin]!);
|
||||
}
|
||||
|
@ -42,7 +42,14 @@ final _pAllWalletsInfo = ChangeNotifierProvider((ref) {
|
|||
if (_globalInstance == null) {
|
||||
final isar = ref.watch(mainDBProvider).isar;
|
||||
_globalInstance = _WalletInfoWatcher(
|
||||
isar.walletInfo.where().findAllSync(),
|
||||
isar.walletInfo
|
||||
.where()
|
||||
.filter()
|
||||
.anyOf<String, CryptoCurrency>(
|
||||
Coins.enabled.map((e) => e.identifier),
|
||||
(q, element) => q.coinNameMatches(element),
|
||||
)
|
||||
.findAllSync(),
|
||||
isar,
|
||||
);
|
||||
}
|
||||
|
@ -60,7 +67,15 @@ class _WalletInfoWatcher extends ChangeNotifier {
|
|||
_WalletInfoWatcher(this._value, Isar isar) {
|
||||
_streamSubscription =
|
||||
isar.walletInfo.watchLazy(fireImmediately: true).listen((event) {
|
||||
isar.walletInfo.where().findAll().then((value) {
|
||||
isar.walletInfo
|
||||
.where()
|
||||
.filter()
|
||||
.anyOf<String, CryptoCurrency>(
|
||||
Coins.enabled.map((e) => e.identifier),
|
||||
(q, element) => q.coinNameMatches(element),
|
||||
)
|
||||
.findAll()
|
||||
.then((value) {
|
||||
_value = value;
|
||||
notifyListeners();
|
||||
});
|
||||
|
|
|
@ -4,6 +4,8 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/providers/db/main_db_provider.dart';
|
||||
import 'package:stackwallet/supported_coins.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/wallet_info.dart';
|
||||
|
||||
class _Watcher extends ChangeNotifier {
|
||||
|
@ -17,6 +19,10 @@ class _Watcher extends ChangeNotifier {
|
|||
_Watcher(this._value, this.isFavourite, Isar isar) {
|
||||
_streamSubscription = isar.walletInfo
|
||||
.filter()
|
||||
.anyOf<String, CryptoCurrency>(
|
||||
Coins.enabled.map((e) => e.identifier),
|
||||
(q, element) => q.coinNameMatches(element),
|
||||
)
|
||||
.isFavouriteEqualTo(isFavourite)
|
||||
.sortByFavouriteOrderIndex()
|
||||
.watch(fireImmediately: true)
|
||||
|
@ -40,6 +46,10 @@ final _wiProvider = ChangeNotifierProvider.family<_Watcher, bool>(
|
|||
final watcher = _Watcher(
|
||||
isar.walletInfo
|
||||
.filter()
|
||||
.anyOf<String, CryptoCurrency>(
|
||||
Coins.enabled.map((e) => e.identifier),
|
||||
(q, element) => q.coinNameMatches(element),
|
||||
)
|
||||
.isFavouriteEqualTo(isFavourite)
|
||||
.sortByFavouriteOrderIndex()
|
||||
.findAllSync(),
|
||||
|
|
|
@ -72,7 +72,7 @@ class _AddressBookCardState extends ConsumerState<AddressBookCard> {
|
|||
|
||||
final List<CryptoCurrency> coins = [];
|
||||
|
||||
for (final coin in Coins.cryptocurrencies) {
|
||||
for (final coin in Coins.enabled) {
|
||||
if (contact.addresses.where((e) => e.coin == coin).isNotEmpty) {
|
||||
coins.add(coin);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import 'package:stackwallet/themes/coin_icon_provider.dart';
|
|||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -52,7 +51,7 @@ class ChooseCoinView extends ConsumerStatefulWidget {
|
|||
}
|
||||
|
||||
class _ChooseCoinViewState extends ConsumerState<ChooseCoinView> {
|
||||
List<CryptoCurrency> _coins = [...Coins.cryptocurrencies];
|
||||
List<CryptoCurrency> _coins = [...Coins.enabled];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_libmonero/wownero/wownero.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:solana/solana.dart';
|
||||
|
@ -33,35 +32,17 @@ import 'package:stackwallet/utilities/test_epic_box_connection.dart';
|
|||
import 'package:stackwallet/utilities/test_eth_node_connection.dart';
|
||||
import 'package:stackwallet/utilities/test_monero_node_connection.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/banano.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin_frost.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/dogecoin.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/epiccash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/ethereum.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/firo.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/litecoin.dart';
|
||||
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';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class NodeOptionsSheet extends ConsumerWidget {
|
||||
const NodeOptionsSheet({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.nodeId,
|
||||
required this.coin,
|
||||
required this.popBackToRoute,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String nodeId;
|
||||
final CryptoCurrency coin;
|
||||
|
@ -101,7 +82,10 @@ class NodeOptionsSheet extends ConsumerWidget {
|
|||
}
|
||||
|
||||
Future<bool> _testConnection(
|
||||
NodeModel node, BuildContext context, WidgetRef ref) async {
|
||||
NodeModel node,
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
) async {
|
||||
bool testPassed = false;
|
||||
|
||||
switch (coin.runtimeType) {
|
||||
|
@ -183,7 +167,7 @@ class NodeOptionsSheet extends ConsumerWidget {
|
|||
|
||||
break;
|
||||
|
||||
case (Ethereum):
|
||||
case const (Ethereum):
|
||||
try {
|
||||
testPassed = await testEthNodeConnection(node.host);
|
||||
} catch (_) {
|
||||
|
@ -220,12 +204,14 @@ class NodeOptionsSheet extends ConsumerWidget {
|
|||
// context: context,
|
||||
// );
|
||||
} else {
|
||||
unawaited(showFloatingFlushBar(
|
||||
type: FlushBarType.warning,
|
||||
iconAsset: Assets.svg.circleAlert,
|
||||
message: "Could not connect to node",
|
||||
context: context,
|
||||
));
|
||||
unawaited(
|
||||
showFloatingFlushBar(
|
||||
type: FlushBarType.warning,
|
||||
iconAsset: Assets.svg.circleAlert,
|
||||
message: "Could not connect to node",
|
||||
context: context,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return testPassed;
|
||||
|
@ -234,12 +220,16 @@ class NodeOptionsSheet extends ConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final maxHeight = MediaQuery.of(context).size.height * 0.60;
|
||||
final node = ref.watch(nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getNodeById(id: nodeId)))!;
|
||||
final node = ref.watch(
|
||||
nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getNodeById(id: nodeId)),
|
||||
)!;
|
||||
|
||||
final status = ref
|
||||
.watch(nodeServiceChangeNotifierProvider
|
||||
.select((value) => value.getPrimaryNodeFor(currency: coin)))
|
||||
.watch(
|
||||
nodeServiceChangeNotifierProvider.select(
|
||||
(value) => value.getPrimaryNodeFor(currency: coin)),
|
||||
)
|
||||
?.id !=
|
||||
nodeId
|
||||
? "Disconnected"
|
||||
|
@ -313,7 +303,8 @@ class NodeOptionsSheet extends ConsumerWidget {
|
|||
height: 15,
|
||||
width: 19,
|
||||
color: node.id.startsWith(
|
||||
DefaultNodes.defaultNodeIdPrefix)
|
||||
DefaultNodes.defaultNodeIdPrefix,
|
||||
)
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark
|
||||
|
@ -379,9 +370,10 @@ class NodeOptionsSheet extends ConsumerWidget {
|
|||
child: Text(
|
||||
"Details",
|
||||
style: STextStyles.button(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -6,8 +6,6 @@ import 'package:stackwallet/models/node_model.dart';
|
|||
import 'package:stackwallet/services/node_service.dart';
|
||||
import 'package:stackwallet/supported_coins.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/coins/monero.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -114,7 +112,7 @@ void main() {
|
|||
await service.updateDefaults();
|
||||
expect(
|
||||
service.nodes.length,
|
||||
Coins.cryptocurrencies.map((e) => e.defaultNode).length,
|
||||
Coins.enabled.map((e) => e.defaultNode).length,
|
||||
);
|
||||
expect(fakeStore.interactions, 0);
|
||||
});
|
||||
|
@ -207,11 +205,10 @@ void main() {
|
|||
final fakeStore = FakeSecureStorage();
|
||||
final service = NodeService(secureStorageInterface: fakeStore);
|
||||
final nodes = service.nodes;
|
||||
final defaults =
|
||||
Coins.cryptocurrencies.map((e) => e.defaultNode).toList();
|
||||
final defaults = Coins.enabled.map((e) => e.defaultNode).toList();
|
||||
|
||||
nodes.sort((a, b) => a.host.compareTo(b.host));
|
||||
defaults.sort((a, b) => a.host.compareTo(b.host));
|
||||
nodes.sort((a, b) => a.id.compareTo(b.id));
|
||||
defaults.sort((a, b) => a.id.compareTo(b.id));
|
||||
|
||||
expect(nodes.length, defaults.length);
|
||||
expect(nodes.toString(), defaults.toString());
|
||||
|
@ -224,7 +221,7 @@ void main() {
|
|||
await service.add(nodeA, null, true);
|
||||
expect(
|
||||
service.nodes.length,
|
||||
Coins.cryptocurrencies.map((e) => e.defaultNode).length + 1,
|
||||
Coins.enabled.map((e) => e.defaultNode).length + 1,
|
||||
);
|
||||
expect(fakeStore.interactions, 0);
|
||||
});
|
||||
|
@ -235,7 +232,7 @@ void main() {
|
|||
await service.add(nodeA, "some password", true);
|
||||
expect(
|
||||
service.nodes.length,
|
||||
Coins.cryptocurrencies.map((e) => e.defaultNode).length + 1,
|
||||
Coins.enabled.map((e) => e.defaultNode).length + 1,
|
||||
);
|
||||
expect(fakeStore.interactions, 1);
|
||||
expect(fakeStore.writes, 1);
|
||||
|
@ -293,7 +290,7 @@ void main() {
|
|||
|
||||
expect(
|
||||
service.nodes.length,
|
||||
Coins.cryptocurrencies.map((e) => e.defaultNode).length + 2,
|
||||
Coins.enabled.map((e) => e.defaultNode).length + 2,
|
||||
);
|
||||
expect(
|
||||
service.nodes.where((element) => element.id == nodeB.id).length,
|
||||
|
|
Loading…
Reference in a new issue