mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-03 09:19:22 +00:00
rename to shorter name
This commit is contained in:
parent
7550b334ec
commit
c9d4e57d65
43 changed files with 84 additions and 91 deletions
|
@ -560,7 +560,7 @@ class DbVersionMigrator with WalletDB {
|
||||||
|
|
||||||
final count = await MainDB.instance.getTransactions(walletId).count();
|
final count = await MainDB.instance.getTransactions(walletId).count();
|
||||||
|
|
||||||
final crypto = SupportedCoins.getCryptoCurrencyFor(info.coinIdentifier);
|
final crypto = Coins.getCryptoCurrencyFor(info.coinIdentifier);
|
||||||
|
|
||||||
for (var i = 0; i < count; i += 50) {
|
for (var i = 0; i < count; i += 50) {
|
||||||
final txns = await MainDB.instance
|
final txns = await MainDB.instance
|
||||||
|
|
|
@ -164,7 +164,7 @@ class DB {
|
||||||
names.removeWhere((name, dyn) {
|
names.removeWhere((name, dyn) {
|
||||||
final jsonObject = Map<String, dynamic>.from(dyn as Map);
|
final jsonObject = Map<String, dynamic>.from(dyn as Map);
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyFor(jsonObject["coin"] as String);
|
Coins.getCryptoCurrencyFor(jsonObject["coin"] as String);
|
||||||
return false;
|
return false;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
|
|
|
@ -171,7 +171,7 @@ Future<void> migrateWalletsToIsar({
|
||||||
coinName: old.coinIdentifier,
|
coinName: old.coinIdentifier,
|
||||||
walletId: old.walletId,
|
walletId: old.walletId,
|
||||||
name: old.name,
|
name: old.name,
|
||||||
mainAddressType: SupportedCoins.getCryptoCurrencyFor(old.coinIdentifier)
|
mainAddressType: Coins.getCryptoCurrencyFor(old.coinIdentifier)
|
||||||
.primaryAddressType,
|
.primaryAddressType,
|
||||||
favouriteOrderIndex: favourites.indexOf(old.walletId),
|
favouriteOrderIndex: favourites.indexOf(old.walletId),
|
||||||
cachedChainHeight: walletBox.get(
|
cachedChainHeight: walletBox.get(
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ContactAddressEntry {
|
||||||
|
|
||||||
factory ContactAddressEntry.fromJson(Map<String, dynamic> jsonObject) {
|
factory ContactAddressEntry.fromJson(Map<String, dynamic> jsonObject) {
|
||||||
return ContactAddressEntry(
|
return ContactAddressEntry(
|
||||||
coin: SupportedCoins.getCryptoCurrencyFor(jsonObject["coin"] as String),
|
coin: Coins.getCryptoCurrencyFor(jsonObject["coin"] as String),
|
||||||
address: jsonObject["address"] as String,
|
address: jsonObject["address"] as String,
|
||||||
label: jsonObject["label"] as String,
|
label: jsonObject["label"] as String,
|
||||||
other: jsonObject["other"] as String?,
|
other: jsonObject["other"] as String?,
|
||||||
|
|
|
@ -161,7 +161,7 @@ class Currency {
|
||||||
|
|
||||||
static bool checkIsStackCoin(String ticker) {
|
static bool checkIsStackCoin(String ticker) {
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return true;
|
return true;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TransactionBlockExplorer {
|
||||||
@ignore
|
@ignore
|
||||||
CryptoCurrency? get coin {
|
CryptoCurrency? get coin {
|
||||||
try {
|
try {
|
||||||
return SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
return Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ContactEntry {
|
||||||
@ignore
|
@ignore
|
||||||
List<ContactAddressEntry> get addressesSorted {
|
List<ContactAddressEntry> get addressesSorted {
|
||||||
final List<ContactAddressEntry> sorted = [];
|
final List<ContactAddressEntry> sorted = [];
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
final slice = addresses.where((e) => e.coin == coin).toList();
|
final slice = addresses.where((e) => e.coin == coin).toList();
|
||||||
if (slice.isNotEmpty) {
|
if (slice.isNotEmpty) {
|
||||||
slice.sort(
|
slice.sort(
|
||||||
|
@ -102,7 +102,7 @@ class ContactAddressEntry {
|
||||||
late final String? other;
|
late final String? other;
|
||||||
|
|
||||||
@ignore
|
@ignore
|
||||||
CryptoCurrency get coin => SupportedCoins.getCryptoCurrencyFor(coinName);
|
CryptoCurrency get coin => Coins.getCryptoCurrencyFor(coinName);
|
||||||
|
|
||||||
ContactAddressEntry();
|
ContactAddressEntry();
|
||||||
|
|
||||||
|
|
|
@ -1858,7 +1858,7 @@ class StackTheme {
|
||||||
final Map<String, Color> result = {};
|
final Map<String, Color> result = {};
|
||||||
|
|
||||||
for (final mainNetId
|
for (final mainNetId
|
||||||
in SupportedCoins.cryptocurrencies.map((e) => e.mainNetId)) {
|
in Coins.cryptocurrencies.map((e) => e.mainNetId)) {
|
||||||
if (map[mainNetId] is String) {
|
if (map[mainNetId] is String) {
|
||||||
result[mainNetId] = Color(
|
result[mainNetId] = Color(
|
||||||
(map[mainNetId] as String).toBigIntFromHex.toInt(),
|
(map[mainNetId] as String).toBigIntFromHex.toInt(),
|
||||||
|
@ -2176,7 +2176,7 @@ class ThemeAssetsV2 implements IThemeAssets {
|
||||||
|
|
||||||
final Map<String, String> result = {};
|
final Map<String, String> result = {};
|
||||||
|
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
result[coin.mainNetId] = map[coin.mainNetId] as String? ?? placeHolder;
|
result[coin.mainNetId] = map[coin.mainNetId] as String? ?? placeHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2511,7 +2511,7 @@ class ThemeAssetsV3 implements IThemeAssets {
|
||||||
|
|
||||||
final Map<String, String> result = {};
|
final Map<String, String> result = {};
|
||||||
|
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
result[coin.mainNetId] = map[coin.mainNetId] as String? ?? placeHolder;
|
result[coin.mainNetId] = map[coin.mainNetId] as String? ?? placeHolder;
|
||||||
result[coin.mainNetId] = prependIfNeeded(result[coin.mainNetId]!);
|
result[coin.mainNetId] = prependIfNeeded(result[coin.mainNetId]!);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,7 @@ class NotificationCard extends ConsumerWidget {
|
||||||
|
|
||||||
String coinIconPath(IThemeAssets assets, WidgetRef ref) {
|
String coinIconPath(IThemeAssets assets, WidgetRef ref) {
|
||||||
try {
|
try {
|
||||||
final coin =
|
final coin = Coins.getCryptoCurrencyByPrettyName(notification.coinName);
|
||||||
SupportedCoins.getCryptoCurrencyByPrettyName(notification.coinName);
|
|
||||||
return ref.read(coinIconProvider(coin));
|
return ref.read(coinIconProvider(coin));
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return notification.iconAssetName;
|
return notification.iconAssetName;
|
||||||
|
|
|
@ -66,11 +66,11 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
||||||
String _searchTerm = "";
|
String _searchTerm = "";
|
||||||
|
|
||||||
final _coinsTestnet = [
|
final _coinsTestnet = [
|
||||||
...SupportedCoins.cryptocurrencies
|
...Coins.cryptocurrencies
|
||||||
.where((e) => e.network == CryptoCurrencyNetwork.test),
|
.where((e) => e.network == CryptoCurrencyNetwork.test),
|
||||||
];
|
];
|
||||||
final _coins = [
|
final _coins = [
|
||||||
...SupportedCoins.cryptocurrencies
|
...Coins.cryptocurrencies
|
||||||
.where((e) => e.network == CryptoCurrencyNetwork.main),
|
.where((e) => e.network == CryptoCurrencyNetwork.main),
|
||||||
];
|
];
|
||||||
final List<AddWalletListEntity> coinEntities = [];
|
final List<AddWalletListEntity> coinEntities = [];
|
||||||
|
|
|
@ -67,7 +67,7 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
|
||||||
ref.refresh(addressBookFilterProvider);
|
ref.refresh(addressBookFilterProvider);
|
||||||
|
|
||||||
if (widget.coin == null) {
|
if (widget.coin == null) {
|
||||||
final coins = [...SupportedCoins.cryptocurrencies];
|
final coins = [...Coins.cryptocurrencies];
|
||||||
coins.removeWhere(
|
coins.removeWhere(
|
||||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||||
);
|
);
|
||||||
|
|
|
@ -41,7 +41,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
final coins = [...SupportedCoins.cryptocurrencies];
|
final coins = [...Coins.cryptocurrencies];
|
||||||
coins.removeWhere(
|
coins.removeWhere(
|
||||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CoinSelectSheet extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final maxHeight = MediaQuery.of(context).size.height * 0.60;
|
final maxHeight = MediaQuery.of(context).size.height * 0.60;
|
||||||
final coins_ = [...SupportedCoins.cryptocurrencies];
|
final coins_ = [...Coins.cryptocurrencies];
|
||||||
coins_.removeWhere(
|
coins_.removeWhere(
|
||||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||||
);
|
);
|
||||||
|
|
|
@ -74,7 +74,7 @@ class _NewContactAddressEntryFormState
|
||||||
..text = ref.read(addressEntryDataProvider(widget.id)).address ?? "";
|
..text = ref.read(addressEntryDataProvider(widget.id)).address ?? "";
|
||||||
addressLabelFocusNode = FocusNode();
|
addressLabelFocusNode = FocusNode();
|
||||||
addressFocusNode = FocusNode();
|
addressFocusNode = FocusNode();
|
||||||
coins = [...SupportedCoins.cryptocurrencies];
|
coins = [...Coins.cryptocurrencies];
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class _NewContactAddressEntryFormState
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isDesktop = Util.isDesktop;
|
final isDesktop = Util.isDesktop;
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
coins = [...SupportedCoins.cryptocurrencies];
|
coins = [...Coins.cryptocurrencies];
|
||||||
coins.removeWhere(
|
coins.removeWhere(
|
||||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||||
);
|
);
|
||||||
|
|
|
@ -413,7 +413,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
if (ticker == null) return false;
|
if (ticker == null) return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1168,7 +1168,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
text: "Choose from Stack",
|
text: "Choose from Stack",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(
|
final coin = Coins.getCryptoCurrencyForTicker(
|
||||||
selectedCrypto!.ticker,
|
selectedCrypto!.ticker,
|
||||||
);
|
);
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
|
@ -1331,7 +1331,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: AddressBookAddressChooser(
|
child: AddressBookAddressChooser(
|
||||||
coin: SupportedCoins
|
coin: Coins
|
||||||
.cryptocurrencies
|
.cryptocurrencies
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(e) =>
|
(e) =>
|
||||||
|
|
|
@ -70,7 +70,7 @@ class _CryptoSelectionViewState extends ConsumerState<CryptoSelectionView> {
|
||||||
coins.sort(
|
coins.sort(
|
||||||
(a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()),
|
(a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()),
|
||||||
);
|
);
|
||||||
for (final coin in SupportedCoins.cryptocurrencies.reversed) {
|
for (final coin in Coins.cryptocurrencies.reversed) {
|
||||||
final index = coins.indexWhere(
|
final index = coins.indexWhere(
|
||||||
(element) => element.ticker.toLowerCase() == coin.ticker.toLowerCase(),
|
(element) => element.ticker.toLowerCase() == coin.ticker.toLowerCase(),
|
||||||
);
|
);
|
||||||
|
@ -270,7 +270,7 @@ bool isStackCoin(String? ticker) {
|
||||||
if (ticker == null) return false;
|
if (ticker == null) return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -305,7 +305,7 @@ class CoinIconForTicker extends ConsumerWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
final coin = Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return SvgPicture.file(
|
return SvgPicture.file(
|
||||||
File(
|
File(
|
||||||
ref.watch(coinIconProvider(coin)),
|
ref.watch(coinIconProvider(coin)),
|
||||||
|
|
|
@ -365,7 +365,7 @@ class _ExchangeCurrencySelectionViewState
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final coins = SupportedCoins.cryptocurrencies.where(
|
final coins = Coins.cryptocurrencies.where(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.ticker.toLowerCase() !=
|
e.ticker.toLowerCase() !=
|
||||||
widget.pairedTicker?.toLowerCase(),
|
widget.pairedTicker?.toLowerCase(),
|
||||||
|
|
|
@ -72,7 +72,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
|
|
||||||
bool isStackCoin(String ticker) {
|
bool isStackCoin(String ticker) {
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -207,8 +207,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
text: "Choose from Stack",
|
text: "Choose from Stack",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins
|
final coin = Coins.cryptocurrencies
|
||||||
.cryptocurrencies
|
|
||||||
.firstWhere((e) =>
|
.firstWhere((e) =>
|
||||||
e.ticker.toLowerCase() ==
|
e.ticker.toLowerCase() ==
|
||||||
model.receiveTicker
|
model.receiveTicker
|
||||||
|
@ -483,8 +482,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
text: "Choose from Stack",
|
text: "Choose from Stack",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins
|
final coin = Coins.cryptocurrencies
|
||||||
.cryptocurrencies
|
|
||||||
.firstWhere((e) =>
|
.firstWhere((e) =>
|
||||||
e.ticker.toLowerCase() ==
|
e.ticker.toLowerCase() ==
|
||||||
model.sendTicker.toLowerCase());
|
model.sendTicker.toLowerCase());
|
||||||
|
|
|
@ -75,7 +75,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
|
||||||
|
|
||||||
bool _isWalletCoinAndHasWallet(String ticker, WidgetRef ref) {
|
bool _isWalletCoinAndHasWallet(String ticker, WidgetRef ref) {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
final coin = Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return ref
|
return ref
|
||||||
.read(pWallets)
|
.read(pWallets)
|
||||||
.wallets
|
.wallets
|
||||||
|
@ -853,7 +853,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
|
||||||
.useMaterialPageRoute,
|
.useMaterialPageRoute,
|
||||||
builder:
|
builder:
|
||||||
(BuildContext context) {
|
(BuildContext context) {
|
||||||
final coin = SupportedCoins
|
final coin = Coins
|
||||||
.cryptocurrencies
|
.cryptocurrencies
|
||||||
.firstWhere(
|
.firstWhere(
|
||||||
(e) =>
|
(e) =>
|
||||||
|
|
|
@ -94,7 +94,7 @@ class _ExchangeOptionState extends ConsumerState<ExchangeOption> {
|
||||||
|
|
||||||
int decimals;
|
int decimals;
|
||||||
try {
|
try {
|
||||||
decimals = SupportedCoins.getCryptoCurrencyForTicker(
|
decimals = Coins.getCryptoCurrencyForTicker(
|
||||||
receivingCurrency.ticker,
|
receivingCurrency.ticker,
|
||||||
).fractionDigits;
|
).fractionDigits;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
@ -113,7 +113,7 @@ class _ExchangeOptionState extends ConsumerState<ExchangeOption> {
|
||||||
|
|
||||||
CryptoCurrency? coin;
|
CryptoCurrency? coin;
|
||||||
try {
|
try {
|
||||||
coin = SupportedCoins.getCryptoCurrencyForTicker(
|
coin = Coins.getCryptoCurrencyForTicker(
|
||||||
receivingCurrency.ticker,
|
receivingCurrency.ticker,
|
||||||
);
|
);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|
|
@ -88,9 +88,9 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
bool isStackCoin(String ticker) {
|
bool isStackCoin(String ticker) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
SupportedCoins.getCryptoCurrencyByPrettyName(ticker);
|
Coins.getCryptoCurrencyByPrettyName(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -279,11 +279,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
CryptoCurrency coin;
|
CryptoCurrency coin;
|
||||||
try {
|
try {
|
||||||
coin = SupportedCoins.getCryptoCurrencyForTicker(
|
coin = Coins.getCryptoCurrencyForTicker(
|
||||||
trade.payInCurrency,
|
trade.payInCurrency,
|
||||||
);
|
);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
coin = SupportedCoins.getCryptoCurrencyByPrettyName(
|
coin = Coins.getCryptoCurrencyByPrettyName(
|
||||||
trade.payInCurrency,
|
trade.payInCurrency,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -379,8 +379,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
String text;
|
String text;
|
||||||
try {
|
try {
|
||||||
final coin =
|
final coin = Coins.getCryptoCurrencyForTicker(
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(
|
|
||||||
trade.payInCurrency,
|
trade.payInCurrency,
|
||||||
);
|
);
|
||||||
final amount = sendAmount.toAmount(
|
final amount = sendAmount.toAmount(
|
||||||
|
@ -629,7 +628,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
text: "View transaction",
|
text: "View transaction",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final CryptoCurrency coin =
|
final CryptoCurrency coin =
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(
|
Coins.getCryptoCurrencyForTicker(
|
||||||
trade.payInCurrency,
|
trade.payInCurrency,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1382,11 +1381,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
CryptoCurrency coin;
|
CryptoCurrency coin;
|
||||||
try {
|
try {
|
||||||
coin = SupportedCoins.getCryptoCurrencyForTicker(
|
coin = Coins.getCryptoCurrencyForTicker(
|
||||||
trade.payInCurrency,
|
trade.payInCurrency,
|
||||||
);
|
);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
coin = SupportedCoins.getCryptoCurrencyByPrettyName(
|
coin = Coins.getCryptoCurrencyByPrettyName(
|
||||||
trade.payInCurrency,
|
trade.payInCurrency,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ManageCoinUnitsView extends ConsumerWidget {
|
||||||
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
||||||
);
|
);
|
||||||
|
|
||||||
final _coins = SupportedCoins.cryptocurrencies
|
final _coins = Coins.cryptocurrencies
|
||||||
.where((e) => e is! Firo && e.network != CryptoCurrencyNetwork.test)
|
.where((e) => e is! Firo && e.network != CryptoCurrencyNetwork.test)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class ManageNodesView extends ConsumerStatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ManageNodesViewState extends ConsumerState<ManageNodesView> {
|
class _ManageNodesViewState extends ConsumerState<ManageNodesView> {
|
||||||
List<CryptoCurrency> _coins = [...SupportedCoins.cryptocurrencies];
|
List<CryptoCurrency> _coins = [...Coins.cryptocurrencies];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
|
@ -774,7 +774,7 @@ abstract class SWB {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final coin = SupportedCoins.getCryptoCurrencyFor(
|
final coin = Coins.getCryptoCurrencyFor(
|
||||||
walletbackup['coinName'] as String,
|
walletbackup['coinName'] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1036,7 +1036,7 @@ abstract class SWB {
|
||||||
for (final node in primaryNodes) {
|
for (final node in primaryNodes) {
|
||||||
try {
|
try {
|
||||||
await nodeService.setPrimaryNodeFor(
|
await nodeService.setPrimaryNodeFor(
|
||||||
coin: SupportedCoins.getCryptoCurrencyByPrettyName(
|
coin: Coins.getCryptoCurrencyByPrettyName(
|
||||||
node['coinName'] as String,
|
node['coinName'] as String,
|
||||||
),
|
),
|
||||||
node: nodeService.getNodeById(id: node['id'] as String)!,
|
node: nodeService.getNodeById(id: node['id'] as String)!,
|
||||||
|
@ -1226,7 +1226,7 @@ abstract class SWB {
|
||||||
for (final node in primaryNodes) {
|
for (final node in primaryNodes) {
|
||||||
try {
|
try {
|
||||||
await nodeService.setPrimaryNodeFor(
|
await nodeService.setPrimaryNodeFor(
|
||||||
coin: SupportedCoins.getCryptoCurrencyByPrettyName(
|
coin: Coins.getCryptoCurrencyByPrettyName(
|
||||||
node['coinName'] as String,
|
node['coinName'] as String,
|
||||||
),
|
),
|
||||||
node: nodeService.getNodeById(id: node['id'] as String)!,
|
node: nodeService.getNodeById(id: node['id'] as String)!,
|
||||||
|
|
|
@ -99,7 +99,7 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
|
||||||
ref.refresh(addressBookFilterProvider);
|
ref.refresh(addressBookFilterProvider);
|
||||||
|
|
||||||
// if (widget.coin == null) {
|
// if (widget.coin == null) {
|
||||||
final coins = SupportedCoins.cryptocurrencies.toList();
|
final coins = Coins.cryptocurrencies.toList();
|
||||||
coins.removeWhere(
|
coins.removeWhere(
|
||||||
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
(e) => e is Firo && e.network == CryptoCurrencyNetwork.test,
|
||||||
);
|
);
|
||||||
|
|
|
@ -194,7 +194,7 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
|
||||||
void sendFromStack() {
|
void sendFromStack() {
|
||||||
final trade = ref.read(desktopExchangeModelProvider)!.trade!;
|
final trade = ref.read(desktopExchangeModelProvider)!.trade!;
|
||||||
final address = trade.payInAddress;
|
final address = trade.payInAddress;
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(trade.payInCurrency);
|
final coin = Coins.getCryptoCurrencyForTicker(trade.payInCurrency);
|
||||||
final amount = Decimal.parse(trade.payInAmount).toAmount(
|
final amount = Decimal.parse(trade.payInAmount).toAmount(
|
||||||
fractionDigits: coin.fractionDigits,
|
fractionDigits: coin.fractionDigits,
|
||||||
);
|
);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
|
||||||
|
|
||||||
bool isStackCoin(String ticker) {
|
bool isStackCoin(String ticker) {
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -68,7 +68,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
|
||||||
|
|
||||||
void selectRecipientAddressFromStack() async {
|
void selectRecipientAddressFromStack() async {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(
|
final coin = Coins.getCryptoCurrencyForTicker(
|
||||||
ref.read(desktopExchangeModelProvider)!.receiveTicker,
|
ref.read(desktopExchangeModelProvider)!.receiveTicker,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
|
||||||
|
|
||||||
void selectRefundAddressFromStack() async {
|
void selectRefundAddressFromStack() async {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(
|
final coin = Coins.getCryptoCurrencyForTicker(
|
||||||
ref.read(desktopExchangeModelProvider)!.sendTicker,
|
ref.read(desktopExchangeModelProvider)!.sendTicker,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectRecipientFromAddressBook() async {
|
void selectRecipientFromAddressBook() async {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(
|
final coin = Coins.getCryptoCurrencyForTicker(
|
||||||
ref.read(desktopExchangeModelProvider)!.receiveTicker,
|
ref.read(desktopExchangeModelProvider)!.receiveTicker,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class _DesktopStep2State extends ConsumerState<DesktopStep2> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectRefundFromAddressBook() async {
|
void selectRefundFromAddressBook() async {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(
|
final coin = Coins.getCryptoCurrencyForTicker(
|
||||||
ref.read(desktopExchangeModelProvider)!.sendTicker,
|
ref.read(desktopExchangeModelProvider)!.sendTicker,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class _DesktopStep4State extends ConsumerState<DesktopStep4> {
|
||||||
|
|
||||||
bool _isWalletCoinAndHasWallet(String ticker) {
|
bool _isWalletCoinAndHasWallet(String ticker) {
|
||||||
try {
|
try {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
final coin = Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return ref
|
return ref
|
||||||
.read(pWallets)
|
.read(pWallets)
|
||||||
.wallets
|
.wallets
|
||||||
|
|
|
@ -40,8 +40,8 @@ class DesktopManageBlockExplorersDialog extends ConsumerWidget {
|
||||||
);
|
);
|
||||||
|
|
||||||
final coins = showTestNet
|
final coins = showTestNet
|
||||||
? SupportedCoins.cryptocurrencies
|
? Coins.cryptocurrencies
|
||||||
: SupportedCoins.cryptocurrencies
|
: Coins.cryptocurrencies
|
||||||
.where(
|
.where(
|
||||||
(e) => e.network == CryptoCurrencyNetwork.main,
|
(e) => e.network == CryptoCurrencyNetwork.main,
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,7 +42,7 @@ class NodesSettings extends ConsumerStatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NodesSettings extends ConsumerState<NodesSettings> {
|
class _NodesSettings extends ConsumerState<NodesSettings> {
|
||||||
List<CryptoCurrency> _coins = [...SupportedCoins.cryptocurrencies];
|
List<CryptoCurrency> _coins = [...Coins.cryptocurrencies];
|
||||||
|
|
||||||
late final TextEditingController searchNodeController;
|
late final TextEditingController searchNodeController;
|
||||||
late final FocusNode searchNodeFocusNode;
|
late final FocusNode searchNodeFocusNode;
|
||||||
|
|
|
@ -405,7 +405,7 @@ bool isStackCoin(String? ticker) {
|
||||||
if (ticker == null) return false;
|
if (ticker == null) return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyForTicker(ticker);
|
Coins.getCryptoCurrencyForTicker(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class NodeService extends ChangeNotifier {
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> updateDefaults() async {
|
Future<void> updateDefaults() async {
|
||||||
for (final defaultNode in SupportedCoins.cryptocurrencies.map(
|
for (final defaultNode in Coins.cryptocurrencies.map(
|
||||||
(e) => e.defaultNode,
|
(e) => e.defaultNode,
|
||||||
)) {
|
)) {
|
||||||
final savedNode = DB.instance
|
final savedNode = DB.instance
|
||||||
|
@ -39,7 +39,7 @@ class NodeService extends ChangeNotifier {
|
||||||
if (savedNode == null) {
|
if (savedNode == null) {
|
||||||
// save the default node to hive only if no other nodes for the specific coin exist
|
// save the default node to hive only if no other nodes for the specific coin exist
|
||||||
if (getNodesFor(
|
if (getNodesFor(
|
||||||
SupportedCoins.getCryptoCurrencyByPrettyName(
|
Coins.getCryptoCurrencyByPrettyName(
|
||||||
defaultNode.coinName,
|
defaultNode.coinName,
|
||||||
),
|
),
|
||||||
).isEmpty) {
|
).isEmpty) {
|
||||||
|
@ -64,8 +64,7 @@ class NodeService extends ChangeNotifier {
|
||||||
|
|
||||||
// check if a default node is the primary node for the crypto currency
|
// check if a default node is the primary node for the crypto currency
|
||||||
// and update it if needed
|
// and update it if needed
|
||||||
final coin =
|
final coin = Coins.getCryptoCurrencyByPrettyName(defaultNode.coinName);
|
||||||
SupportedCoins.getCryptoCurrencyByPrettyName(defaultNode.coinName);
|
|
||||||
final primaryNode = getPrimaryNodeFor(currency: coin);
|
final primaryNode = getPrimaryNodeFor(currency: coin);
|
||||||
if (primaryNode != null && primaryNode.id == defaultNode.id) {
|
if (primaryNode != null && primaryNode.id == defaultNode.id) {
|
||||||
await setPrimaryNodeFor(
|
await setPrimaryNodeFor(
|
||||||
|
@ -206,8 +205,7 @@ class NodeService extends ChangeNotifier {
|
||||||
bool shouldNotifyListeners,
|
bool shouldNotifyListeners,
|
||||||
) async {
|
) async {
|
||||||
// check if the node being edited is the primary one; if it is, setPrimaryNodeFor coin
|
// check if the node being edited is the primary one; if it is, setPrimaryNodeFor coin
|
||||||
final coin =
|
final coin = Coins.getCryptoCurrencyByPrettyName(editedNode.coinName);
|
||||||
SupportedCoins.getCryptoCurrencyByPrettyName(editedNode.coinName);
|
|
||||||
final primaryNode = getPrimaryNodeFor(currency: coin);
|
final primaryNode = getPrimaryNodeFor(currency: coin);
|
||||||
if (primaryNode?.id == editedNode.id) {
|
if (primaryNode?.id == editedNode.id) {
|
||||||
await setPrimaryNodeFor(
|
await setPrimaryNodeFor(
|
||||||
|
@ -240,7 +238,7 @@ class NodeService extends ChangeNotifier {
|
||||||
final map = jsonDecode(result as String);
|
final map = jsonDecode(result as String);
|
||||||
Logging.instance.log(map, level: LogLevel.Info);
|
Logging.instance.log(map, level: LogLevel.Info);
|
||||||
|
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
final nodeList = List<Map<String, dynamic>>.from(
|
final nodeList = List<Map<String, dynamic>>.from(
|
||||||
map["nodes"][coin.identifier] as List? ?? [],
|
map["nodes"][coin.identifier] as List? ?? [],
|
||||||
);
|
);
|
||||||
|
|
|
@ -129,7 +129,7 @@ class NotificationsService extends ChangeNotifier {
|
||||||
for (final notification in _watchedTransactionNotifications) {
|
for (final notification in _watchedTransactionNotifications) {
|
||||||
try {
|
try {
|
||||||
final CryptoCurrency coin =
|
final CryptoCurrency coin =
|
||||||
SupportedCoins.getCryptoCurrencyByPrettyName(notification.coinName);
|
Coins.getCryptoCurrencyByPrettyName(notification.coinName);
|
||||||
final txid = notification.txid!;
|
final txid = notification.txid!;
|
||||||
final wallet = Wallets.sharedInstance.getWallet(notification.walletId);
|
final wallet = Wallets.sharedInstance.getWallet(notification.walletId);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class PriceAPI {
|
||||||
) async {
|
) async {
|
||||||
final Map<String, dynamic> map = {};
|
final Map<String, dynamic> map = {};
|
||||||
|
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
final entry = data[coin];
|
final entry = data[coin];
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
map[coin.prettyName] = ["0", 0.0];
|
map[coin.prettyName] = ["0", 0.0];
|
||||||
|
@ -68,12 +68,12 @@ class PriceAPI {
|
||||||
{};
|
{};
|
||||||
// init with 0
|
// init with 0
|
||||||
final result = {
|
final result = {
|
||||||
for (final coin in SupportedCoins.cryptocurrencies)
|
for (final coin in Coins.cryptocurrencies)
|
||||||
coin: Tuple2(Decimal.zero, 0.0),
|
coin: Tuple2(Decimal.zero, 0.0),
|
||||||
};
|
};
|
||||||
|
|
||||||
for (final entry in map.entries) {
|
for (final entry in map.entries) {
|
||||||
result[SupportedCoins.getCryptoCurrencyByPrettyName(
|
result[Coins.getCryptoCurrencyByPrettyName(
|
||||||
entry.key as String,
|
entry.key as String,
|
||||||
)] = Tuple2(
|
)] = Tuple2(
|
||||||
Decimal.parse(entry.value[0] as String),
|
Decimal.parse(entry.value[0] as String),
|
||||||
|
@ -126,7 +126,7 @@ class PriceAPI {
|
||||||
|
|
||||||
for (final map in coinGeckoData) {
|
for (final map in coinGeckoData) {
|
||||||
final String coinName = map["name"] as String;
|
final String coinName = map["name"] as String;
|
||||||
final coin = SupportedCoins.getCryptoCurrencyByPrettyName(coinName);
|
final coin = Coins.getCryptoCurrencyByPrettyName(coinName);
|
||||||
|
|
||||||
final price = Decimal.parse(map["current_price"].toString());
|
final price = Decimal.parse(map["current_price"].toString());
|
||||||
final change24h = map["price_change_percentage_24h"] != null
|
final change24h = map["price_change_percentage_24h"] != null
|
||||||
|
|
|
@ -30,8 +30,7 @@ class PriceService extends ChangeNotifier {
|
||||||
|
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
final Map<CryptoCurrency, Tuple2<Decimal, double>> _cachedPrices = {
|
final Map<CryptoCurrency, Tuple2<Decimal, double>> _cachedPrices = {
|
||||||
for (final coin in SupportedCoins.cryptocurrencies)
|
for (final coin in Coins.cryptocurrencies) coin: Tuple2(Decimal.zero, 0.0)
|
||||||
coin: Tuple2(Decimal.zero, 0.0)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final Map<String, Tuple2<Decimal, double>> _cachedTokenPrices = {};
|
final Map<String, Tuple2<Decimal, double>> _cachedTokenPrices = {};
|
||||||
|
|
|
@ -90,7 +90,7 @@ class WalletsService extends ChangeNotifier {
|
||||||
mapped.removeWhere((name, dyn) {
|
mapped.removeWhere((name, dyn) {
|
||||||
final jsonObject = Map<String, dynamic>.from(dyn as Map);
|
final jsonObject = Map<String, dynamic>.from(dyn as Map);
|
||||||
try {
|
try {
|
||||||
SupportedCoins.getCryptoCurrencyFor(jsonObject["coin"] as String);
|
Coins.getCryptoCurrencyFor(jsonObject["coin"] as String);
|
||||||
return false;
|
return false;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
|
|
|
@ -21,7 +21,7 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||||
import 'package:stackwallet/wallets/crypto_currency/intermediate/frost_currency.dart';
|
import 'package:stackwallet/wallets/crypto_currency/intermediate/frost_currency.dart';
|
||||||
|
|
||||||
/// The supported coins. Eventually move away from the Coin enum
|
/// The supported coins. Eventually move away from the Coin enum
|
||||||
class SupportedCoins {
|
class Coins {
|
||||||
/// A List of our supported coins.
|
/// A List of our supported coins.
|
||||||
static final List<CryptoCurrency> cryptocurrencies = [
|
static final List<CryptoCurrency> cryptocurrencies = [
|
||||||
Bitcoin(CryptoCurrencyNetwork.main),
|
Bitcoin(CryptoCurrencyNetwork.main),
|
||||||
|
|
|
@ -867,7 +867,7 @@ class Prefs extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _setAmountUnits() async {
|
Future<void> _setAmountUnits() async {
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
final unitIndex = await DB.instance.get<dynamic>(
|
final unitIndex = await DB.instance.get<dynamic>(
|
||||||
boxName: DB.boxNamePrefs,
|
boxName: DB.boxNamePrefs,
|
||||||
key: "amountUnitFor${coin.identifier}",
|
key: "amountUnitFor${coin.identifier}",
|
||||||
|
@ -900,7 +900,7 @@ class Prefs extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _setMaxDecimals() async {
|
Future<void> _setMaxDecimals() async {
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
final decimals = await DB.instance.get<dynamic>(
|
final decimals = await DB.instance.get<dynamic>(
|
||||||
boxName: DB.boxNamePrefs,
|
boxName: DB.boxNamePrefs,
|
||||||
key: "maxDecimalsFor${coin.identifier}",
|
key: "maxDecimalsFor${coin.identifier}",
|
||||||
|
|
|
@ -96,7 +96,7 @@ class WalletInfo implements IsarId {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ignore
|
@ignore
|
||||||
CryptoCurrency get coin => SupportedCoins.getCryptoCurrencyFor(coinName);
|
CryptoCurrency get coin => Coins.getCryptoCurrencyFor(coinName);
|
||||||
|
|
||||||
@ignore
|
@ignore
|
||||||
Balance get cachedBalance {
|
Balance get cachedBalance {
|
||||||
|
@ -407,7 +407,7 @@ class WalletInfo implements IsarId {
|
||||||
this.cachedBalanceTertiaryString,
|
this.cachedBalanceTertiaryString,
|
||||||
this.otherDataJsonString,
|
this.otherDataJsonString,
|
||||||
}) : assert(
|
}) : assert(
|
||||||
SupportedCoins.cryptocurrencies
|
Coins.cryptocurrencies
|
||||||
.map((e) => e.identifier)
|
.map((e) => e.identifier)
|
||||||
.contains(coinName),
|
.contains(coinName),
|
||||||
);
|
);
|
||||||
|
@ -466,7 +466,7 @@ class WalletInfo implements IsarId {
|
||||||
Map<String, dynamic> jsonObject,
|
Map<String, dynamic> jsonObject,
|
||||||
AddressType mainAddressType,
|
AddressType mainAddressType,
|
||||||
) {
|
) {
|
||||||
final coin = SupportedCoins.getCryptoCurrencyFor(
|
final coin = Coins.getCryptoCurrencyFor(
|
||||||
jsonObject["coin"] as String,
|
jsonObject["coin"] as String,
|
||||||
);
|
);
|
||||||
return WalletInfo(
|
return WalletInfo(
|
||||||
|
|
|
@ -27,7 +27,7 @@ final pAllWalletsInfoByCoin = Provider((ref) {
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<({CryptoCurrency coin, List<WalletInfo> wallets})> results = [];
|
final List<({CryptoCurrency coin, List<WalletInfo> wallets})> results = [];
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
if (map[coin] != null) {
|
if (map[coin] != null) {
|
||||||
results.add(map[coin]!);
|
results.add(map[coin]!);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class _AddressBookCardState extends ConsumerState<AddressBookCard> {
|
||||||
|
|
||||||
final List<CryptoCurrency> coins = [];
|
final List<CryptoCurrency> coins = [];
|
||||||
|
|
||||||
for (final coin in SupportedCoins.cryptocurrencies) {
|
for (final coin in Coins.cryptocurrencies) {
|
||||||
if (contact.addresses.where((e) => e.coin == coin).isNotEmpty) {
|
if (contact.addresses.where((e) => e.coin == coin).isNotEmpty) {
|
||||||
coins.add(coin);
|
coins.add(coin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ChooseCoinView extends ConsumerStatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChooseCoinViewState extends ConsumerState<ChooseCoinView> {
|
class _ChooseCoinViewState extends ConsumerState<ChooseCoinView> {
|
||||||
List<CryptoCurrency> _coins = [...SupportedCoins.cryptocurrencies];
|
List<CryptoCurrency> _coins = [...Coins.cryptocurrencies];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
|
@ -114,7 +114,7 @@ void main() {
|
||||||
await service.updateDefaults();
|
await service.updateDefaults();
|
||||||
expect(
|
expect(
|
||||||
service.nodes.length,
|
service.nodes.length,
|
||||||
SupportedCoins.cryptocurrencies.map((e) => e.defaultNode).length,
|
Coins.cryptocurrencies.map((e) => e.defaultNode).length,
|
||||||
);
|
);
|
||||||
expect(fakeStore.interactions, 0);
|
expect(fakeStore.interactions, 0);
|
||||||
});
|
});
|
||||||
|
@ -208,7 +208,7 @@ void main() {
|
||||||
final service = NodeService(secureStorageInterface: fakeStore);
|
final service = NodeService(secureStorageInterface: fakeStore);
|
||||||
final nodes = service.nodes;
|
final nodes = service.nodes;
|
||||||
final defaults =
|
final defaults =
|
||||||
SupportedCoins.cryptocurrencies.map((e) => e.defaultNode).toList();
|
Coins.cryptocurrencies.map((e) => e.defaultNode).toList();
|
||||||
|
|
||||||
nodes.sort((a, b) => a.host.compareTo(b.host));
|
nodes.sort((a, b) => a.host.compareTo(b.host));
|
||||||
defaults.sort((a, b) => a.host.compareTo(b.host));
|
defaults.sort((a, b) => a.host.compareTo(b.host));
|
||||||
|
@ -224,7 +224,7 @@ void main() {
|
||||||
await service.add(nodeA, null, true);
|
await service.add(nodeA, null, true);
|
||||||
expect(
|
expect(
|
||||||
service.nodes.length,
|
service.nodes.length,
|
||||||
SupportedCoins.cryptocurrencies.map((e) => e.defaultNode).length + 1,
|
Coins.cryptocurrencies.map((e) => e.defaultNode).length + 1,
|
||||||
);
|
);
|
||||||
expect(fakeStore.interactions, 0);
|
expect(fakeStore.interactions, 0);
|
||||||
});
|
});
|
||||||
|
@ -235,7 +235,7 @@ void main() {
|
||||||
await service.add(nodeA, "some password", true);
|
await service.add(nodeA, "some password", true);
|
||||||
expect(
|
expect(
|
||||||
service.nodes.length,
|
service.nodes.length,
|
||||||
SupportedCoins.cryptocurrencies.map((e) => e.defaultNode).length + 1,
|
Coins.cryptocurrencies.map((e) => e.defaultNode).length + 1,
|
||||||
);
|
);
|
||||||
expect(fakeStore.interactions, 1);
|
expect(fakeStore.interactions, 1);
|
||||||
expect(fakeStore.writes, 1);
|
expect(fakeStore.writes, 1);
|
||||||
|
@ -293,7 +293,7 @@ void main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
service.nodes.length,
|
service.nodes.length,
|
||||||
SupportedCoins.cryptocurrencies.map((e) => e.defaultNode).length + 2,
|
Coins.cryptocurrencies.map((e) => e.defaultNode).length + 2,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
service.nodes.where((element) => element.id == nodeB.id).length,
|
service.nodes.where((element) => element.id == nodeB.id).length,
|
||||||
|
|
Loading…
Reference in a new issue