Merge pull request #349 from cypherstack/paynyms

Paynyms
This commit is contained in:
Diego Salazar 2023-02-13 18:37:54 -07:00 committed by GitHub
commit ffe2935a4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 749 additions and 670 deletions

17
assets/svg/faceid.svg Normal file
View file

@ -0,0 +1,17 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1023_80475)">
<path d="M9 2H6.9C5.60044 2 4.35411 2.48881 3.43518 3.3589C2.51625 4.22899 2 5.40909 2 6.63958V9" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M2 15V16.8086C2 18.1854 2.51625 19.5059 3.43518 20.4795C4.35411 21.4531 5.60044 22 6.9 22H9" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M15 16C14.6414 16.3118 14.1854 16.5637 13.6659 16.7369C13.1464 16.9101 12.5769 17 12 17C11.4231 17 10.8536 16.9101 10.3341 16.7369C9.81462 16.5637 9.35856 16.3118 9 16" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M7 8V9" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M15 2H17.1C18.3996 2 19.6459 2.48881 20.5648 3.3589C21.4838 4.22899 22 5.40909 22 6.63958V9" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M22 15V16.8086C22 18.1854 21.4838 19.5059 20.5648 20.4795C19.6459 21.4531 18.3996 22 17.1 22H15" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M17 8V9" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M12 12V9" stroke="#232323" stroke-width="2.5" stroke-linecap="round"/>
</g>
<defs>
<clipPath id="clip0_1023_80475">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7 3C7 3 11.2308 0.750557 17 2.99876" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M5 8C5 8 10.9231 3.50111 19 7.99752" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
<path d="M14.8112 22C14.8112 22 13.1852 21.8081 11.3534 20.1185C10.4045 19.2225 9.80215 18.0577 9.64132 16.8076C9.57137 16.3404 9.61834 15.8644 9.77855 15.4169C10.5987 13.2245 13.3568 13.3774 14.0613 15.2399C14.0992 15.3403 14.1239 15.4447 14.1347 15.5508C14.1793 15.936 14.2648 16.3161 14.39 16.6856C14.39 16.6856 14.9915 18.173 16.6989 18.118C16.6989 18.118 17.8158 18.0867 18.3535 17.4516C20.1582 15.3485 17.6116 12.5433 17.6116 12.5433C14.4825 8.89181 9.91098 10.2453 9.91098 10.2453C9.91098 10.2453 6.85373 10.9355 5.54211 13.5547C4.23049 16.174 5.71124 19.586 5.71124 19.586" stroke="#232323" stroke-width="2.5" stroke-miterlimit="10" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -112,7 +112,7 @@ void main() async {
await DebugService.instance.init(isar);
// clear out all info logs on startup. No need to await and block
unawaited(DebugService.instance.purgeInfoLogs());
unawaited(DebugService.instance.deleteLogsOlderThan());
}
// Registering Transaction Model Adapters

View file

@ -6,7 +6,9 @@ import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/exchange_cache/currency.dart';
import 'package:stackwallet/models/isar/exchange_cache/pair.dart';
import 'package:stackwallet/pages/buy_view/sub_widgets/crypto_selection_view.dart';
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
import 'package:stackwallet/services/exchange/majestic_bank/majestic_bank_exchange.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -17,9 +19,12 @@ import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart';
@ -49,7 +54,6 @@ class _ExchangeCurrencySelectionViewState
final isDesktop = Util.isDesktop;
List<Currency> _currencies = [];
List<Pair> pairs = [];
bool _loaded = false;
String _searchString = "";
@ -90,64 +94,45 @@ class _ExchangeCurrencySelectionViewState
if (widget.pairedTicker == null) {
return await _getCurrencies();
}
List<Currency> currencies = await ExchangeDataLoadingService
.instance.isar.currencies
.where()
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
.findAll();
final pairs = await _loadAvailablePairs();
List<Currency> currencies = [];
for (final pair in pairs) {
final currency =
await _getCurrency(widget.willChangeIsSend ? pair.from : pair.to);
if (currency != null) {
currencies.add(currency);
}
final cn = await ChangeNowExchange.instance.getPairedCurrencies(
widget.pairedTicker!,
widget.isFixedRate,
);
if (cn.value == null) {
await showDialog<void>(
context: context,
builder: (context) => StackDialog(
title: "ChangeNOW Error",
message: "Failed to load currency data: ${cn.exception}",
leftButton: SecondaryButton(
label: "Ok",
onPressed: Navigator.of(context, rootNavigator: isDesktop).pop,
),
rightButton: PrimaryButton(
label: "Retry",
onPressed: () async {
Navigator.of(context, rootNavigator: isDesktop).pop();
_currencies =
await _showUpdatingCurrencies(whileFuture: _loadCurrencies());
setState(() {});
},
),
),
);
} else {
currencies.addAll(cn.value!);
}
return currencies;
}
Future<Currency?> _getCurrency(String ticker) {
return ExchangeDataLoadingService.instance.isar.currencies
.where()
.filter()
.isFiatEqualTo(false)
.and()
.tickerEqualTo(ticker, caseSensitive: false)
.group((q) => widget.isFixedRate
? q
.rateTypeEqualTo(SupportedRateType.both)
.or()
.rateTypeEqualTo(SupportedRateType.fixed)
: q
.rateTypeEqualTo(SupportedRateType.both)
.or()
.rateTypeEqualTo(SupportedRateType.estimated))
.findFirst();
}
Future<List<Pair>> _loadAvailablePairs() {
final query = ExchangeDataLoadingService.instance.isar.pairs
.where()
.filter()
.group((q) => widget.isFixedRate
? q
.rateTypeEqualTo(SupportedRateType.both)
.or()
.rateTypeEqualTo(SupportedRateType.fixed)
: q
.rateTypeEqualTo(SupportedRateType.both)
.or()
.rateTypeEqualTo(SupportedRateType.estimated))
.and()
.group((q) => widget.willChangeIsSend
? q.toEqualTo(widget.pairedTicker!, caseSensitive: false)
: q.fromEqualTo(widget.pairedTicker!, caseSensitive: false));
if (widget.willChangeIsSend) {
return query.sortByFrom().findAll();
} else {
return query.sortByTo().findAll();
}
}
Future<List<Currency>> _getCurrencies() async {
return ExchangeDataLoadingService.instance.isar.currencies
.where()

View file

@ -32,7 +32,6 @@ import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/desktop/simple_desktop_dialog.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@ -386,50 +385,10 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
final sendAmount = ref.read(exchangeFormStateProvider).sendAmount!;
final estimate = ref.read(exchangeFormStateProvider).estimate!;
final exchangeName = ref.read(exchangeFormStateProvider).exchange.name;
String rate;
switch (rateType) {
case ExchangeRateType.estimated:
final pair = await ExchangeDataLoadingService.instance.isar.pairs
.where()
.exchangeNameEqualTo(exchangeName)
.filter()
.group((q) => q
.rateTypeEqualTo(SupportedRateType.estimated)
.or()
.rateTypeEqualTo(SupportedRateType.both))
.and()
.fromEqualTo(fromTicker, caseSensitive: false)
.and()
.toEqualTo(toTicker, caseSensitive: false)
.findFirst();
if (pair == null) {
unawaited(
showDialog<dynamic>(
context: context,
barrierDismissible: true,
builder: (_) {
if (isDesktop) {
return SimpleDesktopDialog(
title: "Selected trade pair unavailable",
message:
"The $fromTicker - $toTicker market is currently disabled for estimated/floating rate trades",
);
} else {
return StackDialog(
title: "Selected trade pair unavailable",
message:
"The $fromTicker - $toTicker market is currently disabled for estimated/floating rate trades",
);
}
},
),
);
return;
}
rate =
"1 ${fromTicker.toUpperCase()} ~${(estimate.estimatedAmount / sendAmount).toDecimal(scaleOnInfinitePrecision: 8).toStringAsFixed(8)} ${toTicker.toUpperCase()}";
break;

View file

@ -263,7 +263,12 @@ class _Step2ViewState extends ConsumerState<Step2View> {
focusNode: _toFocusNode,
style: STextStyles.field(context),
onChanged: (value) {
setState(() {});
model.recipientAddress = _toController.text;
setState(() {
enableNext = _toController.text.isNotEmpty &&
(_refundController.text.isNotEmpty ||
!supportsRefund);
});
},
decoration: standardInputDecoration(
"Enter the ${model.receiveTicker.toUpperCase()} payout address",
@ -529,7 +534,12 @@ class _Step2ViewState extends ConsumerState<Step2View> {
focusNode: _refundFocusNode,
style: STextStyles.field(context),
onChanged: (value) {
setState(() {});
model.refundAddress = _refundController.text;
setState(() {
enableNext =
_toController.text.isNotEmpty &&
_refundController.text.isNotEmpty;
});
},
decoration: standardInputDecoration(
"Enter ${model.sendTicker.toUpperCase()} refund address",
@ -714,6 +724,9 @@ class _Step2ViewState extends ConsumerState<Step2View> {
style: STextStyles.label(context),
),
),
const SizedBox(
height: 16,
),
const Spacer(),
Row(
children: [

View file

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@ -20,6 +21,7 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_pin_put/custom_pin_put.dart';
import 'package:stackwallet/widgets/custom_pin_put/pin_keyboard.dart';
import 'package:stackwallet/widgets/shake/shake.dart';
import 'package:tuple/tuple.dart';
@ -205,6 +207,12 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
height: 52,
),
CustomPinPut(
customKey: CustomKey(
onPressed: _checkUseBiometrics,
iconAssetName: Platform.isIOS
? Assets.svg.faceId
: Assets.svg.fingerprint,
),
fieldsCount: Constants.pinLength,
eachFieldHeight: 12,
eachFieldWidth: 12,

View file

@ -40,15 +40,17 @@ Future<bool> doesCommitExist(
);
final response = jsonDecode(commitQuery.body.toString());
Logging.instance.log("doesCommitExist $project $commit $response",
Logging.instance.log("doesCommitExist $project $commit", // $response",
level: LogLevel.Info);
bool isThereCommit;
try {
isThereCommit = response['sha'] == commit;
Logging.instance
.log("isThereCommit $isThereCommit", level: LogLevel.Info);
Logging.instance.log(
"$commit isThereCommit=$isThereCommit",
level: LogLevel.Info,
);
return isThereCommit;
} catch (e, s) {
} catch (_) {
return false;
}
} catch (e, s) {
@ -75,14 +77,19 @@ Future<bool> isHeadCommit(
);
final response = jsonDecode(commitQuery.body.toString());
Logging.instance.log("isHeadCommit $project $commit $branch $response",
level: LogLevel.Info);
Logging.instance.log(
"isHeadCommit $project $commit $branch", //$response",
level: LogLevel.Info,
);
bool isHead;
try {
isHead = response['sha'] == commit;
Logging.instance.log("isHead $isHead", level: LogLevel.Info);
Logging.instance.log(
"$commit isHead=$isHead",
level: LogLevel.Info,
);
return isHead;
} catch (e, s) {
} catch (_) {
return false;
}
} catch (e, s) {

View file

@ -85,7 +85,6 @@ class _DebugViewState extends ConsumerState<DebugView> {
@override
void initState() {
ref.read(debugServiceProvider).updateRecentLogs();
super.initState();
}
@ -181,10 +180,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
await ref
.read(debugServiceProvider)
.deleteAllMessages();
await ref
.read(debugServiceProvider)
.updateRecentLogs();
.deleteAllLogs();
shouldPop = true;
@ -194,6 +190,8 @@ class _DebugViewState extends ConsumerState<DebugView> {
type: FlushBarType.info,
context: context,
message: 'Logs cleared!'));
setState(() {});
}
},
),
@ -313,7 +311,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
_searchTerm)
.reversed
.toList(growable: false);
List errorLogs = [];
List<String> errorLogs = [];
for (var log in logs) {
if (log.logLevel == LogLevel.Error ||
log.logLevel == LogLevel.Fatal) {
@ -406,14 +404,14 @@ class _DebugViewState extends ConsumerState<DebugView> {
),
));
bool logssaved = true;
var filename;
bool logsSaved = true;
String? filename;
try {
filename = await ref
.read(debugServiceProvider)
.exportToFile(path, eventBus);
} catch (e, s) {
logssaved = false;
logsSaved = false;
Logging.instance
.log("$e $s", level: LogLevel.Error);
}
@ -428,7 +426,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
showDialog(
context: context,
builder: (context) => StackOkDialog(
title: logssaved
title: logsSaved
? "Logs saved to"
: "Error Saving Logs",
message: "${path!}/$filename",
@ -440,7 +438,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
showFloatingFlushBar(
type: FlushBarType.info,
context: context,
message: logssaved
message: logsSaved
? 'Logs file saved'
: "Error Saving Logs",
),

View file

@ -110,7 +110,7 @@ class HiddenSettings extends StatelessWidget {
onTap: () async {
await ref
.read(debugServiceProvider)
.deleteAllMessages();
.deleteAllLogs();
unawaited(showFloatingFlushBar(
type: FlushBarType.success,

View file

@ -17,8 +17,13 @@ class WalletsSheet extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final providers = ref.watch(walletsChangeNotifierProvider
.select((value) => value.getManagerProvidersByCoin()))[coin];
final providers = ref
.watch(walletsChangeNotifierProvider
.select((value) => value.getManagerProvidersByCoin()))
.where((e) => e.item1 == coin)
.map((e) => e.item2)
.expand((e) => e)
.toList();
final maxHeight = MediaQuery.of(context).size.height * 0.60;
@ -70,7 +75,7 @@ class WalletsSheet extends ConsumerWidget {
Flexible(
child: ListView.builder(
shrinkWrap: true,
itemCount: providers!.length,
itemCount: providers.length,
itemBuilder: (builderContext, index) {
final walletId = ref.watch(
providers[index].select((value) => value.walletId));

View file

@ -44,9 +44,8 @@ class AllWallets extends StatelessWidget {
return ListView.builder(
itemCount: providersByCoin.length,
itemBuilder: (builderContext, index) {
final coin =
providersByCoin.keys.toList(growable: false)[index];
final int walletCount = providersByCoin[coin]!.length;
final coin = providersByCoin[index].item1;
final int walletCount = providersByCoin[index].item2.length;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: WalletListItem(

View file

@ -105,20 +105,25 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
),
),
child: GestureDetector(
onTap: () {
if (Util.isDesktop) {
Navigator.of(context).pushNamed(
DesktopWalletView.routeName,
arguments: walletId,
);
} else {
Navigator.of(context).pushNamed(
WalletView.routeName,
arguments: Tuple2(
walletId,
managerProvider,
),
);
onTap: () async {
if (coin == Coin.monero || coin == Coin.wownero) {
await ref.read(managerProvider).initializeExisting();
}
if (mounted) {
if (Util.isDesktop) {
await Navigator.of(context).pushNamed(
DesktopWalletView.routeName,
arguments: walletId,
);
} else {
await Navigator.of(context).pushNamed(
WalletView.routeName,
arguments: Tuple2(
walletId,
managerProvider,
),
);
}
}
},
child: SizedBox(

View file

@ -46,9 +46,14 @@ class WalletListItem extends ConsumerWidget {
),
onPressed: () async {
if (walletCount == 1) {
final providersByCoin = ref.watch(walletsChangeNotifierProvider
.select((value) => value.getManagerProvidersByCoin()));
final manager = ref.read(providersByCoin[coin]!.first);
final providersByCoin = ref
.watch(walletsChangeNotifierProvider
.select((value) => value.getManagerProvidersByCoin()))
.where((e) => e.item1 == coin)
.map((e) => e.item2)
.expand((e) => e)
.toList();
final manager = ref.read(providersByCoin.first);
if (coin == Coin.monero || coin == Coin.wownero) {
await manager.initializeExisting();
}
@ -57,7 +62,7 @@ class WalletListItem extends ConsumerWidget {
WalletView.routeName,
arguments: Tuple2(
manager.walletId,
providersByCoin[coin]!.first,
providersByCoin.first,
),
),
);

View file

@ -25,24 +25,19 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
final providersByCoin = ref
.watch(
walletsChangeNotifierProvider.select(
(value) => value.getManagerProvidersByCoin(),
),
)
.entries
.toList(growable: false);
final providersByCoin = ref.watch(
walletsChangeNotifierProvider.select(
(value) => value.getManagerProvidersByCoin(),
),
);
return TableView(
rows: [
for (int i = 0; i < providersByCoin.length; i++)
Builder(
key: Key("${providersByCoin[i].key.name}_${runtimeType}_key"),
key: Key("${providersByCoin[i].item1.name}_${runtimeType}_key"),
builder: (context) {
final providers = ref.watch(walletsChangeNotifierProvider.select(
(value) => value
.getManagerProvidersForCoin(providersByCoin[i].key)));
final providers = providersByCoin[i].item2;
VoidCallback? expandOverride;
if (providers.length == 1) {
@ -77,7 +72,7 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
child: Row(
children: [
SvgPicture.asset(
Assets.svg.iconFor(coin: providersByCoin[i].key),
Assets.svg.iconFor(coin: providersByCoin[i].item1),
width: 28,
height: 28,
),
@ -85,7 +80,7 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
width: 10,
),
Text(
providersByCoin[i].key.prettyName,
providersByCoin[i].item1.prettyName,
style: STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
@ -113,12 +108,12 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
TableViewCell(
flex: 6,
child: TablePriceInfo(
coin: providersByCoin[i].key,
coin: providersByCoin[i].item1,
),
),
],
expandingChild: CoinWalletsTable(
coin: providersByCoin[i].key,
coin: providersByCoin[i].item1,
),
);
},

View file

@ -8,7 +8,6 @@ import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/enums/log_level_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -73,7 +72,6 @@ class _DebugInfoDialog extends ConsumerState<DebugInfoDialog> {
searchDebugController = TextEditingController();
searchDebugFocusNode = FocusNode();
ref.read(debugServiceProvider).updateRecentLogs();
super.initState();
}
@ -109,7 +107,7 @@ class _DebugInfoDialog extends ConsumerState<DebugInfoDialog> {
],
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 32),
padding: const EdgeInsets.symmetric(horizontal: 32),
child: ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
@ -319,8 +317,8 @@ class _DebugInfoDialog extends ConsumerState<DebugInfoDialog> {
child: SecondaryButton(
label: "Clear logs",
onPressed: () async {
await ref.read(debugServiceProvider).deleteAllMessages();
await ref.read(debugServiceProvider).updateRecentLogs();
await ref.read(debugServiceProvider).deleteAllLogs();
setState(() {});
if (mounted) {
Navigator.pop(context);
@ -338,7 +336,9 @@ class _DebugInfoDialog extends ConsumerState<DebugInfoDialog> {
Expanded(
child: PrimaryButton(
label: "Save logs to file",
onPressed: () {},
onPressed: () {
// TODO: save file dialog
},
),
)
],

View file

@ -742,23 +742,32 @@ class BitcoinWallet extends CoinServiceAPI
// refresh transactions to pick up any received notification transactions
await _refreshTransactions();
final Set<String> codesToCheck = {};
final nym = await PaynymIsApi().nym(myCode.toString());
if (nym.value != null) {
for (final follower in nym.value!.followers) {
codesToCheck.add(follower.code);
try {
final Set<String> codesToCheck = {};
final nym = await PaynymIsApi().nym(myCode.toString());
if (nym.value != null) {
for (final follower in nym.value!.followers) {
codesToCheck.add(follower.code);
}
for (final following in nym.value!.following) {
codesToCheck.add(following.code);
}
}
for (final following in nym.value!.following) {
codesToCheck.add(following.code);
}
}
// restore paynym transactions
await restoreAllHistory(
maxUnusedAddressGap: maxUnusedAddressGap,
maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
paymentCodeStrings: codesToCheck,
);
// restore paynym transactions
await restoreAllHistory(
maxUnusedAddressGap: maxUnusedAddressGap,
maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
paymentCodeStrings: codesToCheck,
);
} catch (e, s) {
Logging.instance.log(
"Failed to check paynym.is followers/following for history during "
"bitcoin wallet ($walletId $walletName) "
"_recoverWalletFromBIP32SeedPhrase: $e/n$s",
level: LogLevel.Error,
);
}
await _updateUTXOs();
@ -1267,7 +1276,7 @@ class BitcoinWallet extends CoinServiceAPI
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet.",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1276,8 +1285,8 @@ class BitcoinWallet extends CoinServiceAPI
}
await _prefs.init();
await _checkCurrentChangeAddressesForTransactions();
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
// hack to add tx to txData before refresh completes
@ -1502,6 +1511,11 @@ class BitcoinWallet extends CoinServiceAPI
) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
derivePathType: derivePathType,
@ -2907,6 +2921,11 @@ class BitcoinWallet extends CoinServiceAPI
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
mnemonic: _mnemonic!,

View file

@ -1195,7 +1195,7 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet.",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1204,8 +1204,8 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
}
await _prefs.init();
await _checkCurrentChangeAddressesForTransactions();
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
// hack to add tx to txData before refresh completes
@ -1466,6 +1466,11 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
derivePathType: derivePathType,
@ -2976,6 +2981,11 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
mnemonic: _mnemonic!,

View file

@ -1062,7 +1062,7 @@ class DogecoinWallet extends CoinServiceAPI
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet.",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1071,8 +1071,8 @@ class DogecoinWallet extends CoinServiceAPI
}
await _prefs.init();
await _checkCurrentChangeAddressesForTransactions();
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
// hack to add tx to txData before refresh completes
@ -1294,6 +1294,11 @@ class DogecoinWallet extends CoinServiceAPI
) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
derivePathType: derivePathType,
@ -2551,6 +2556,11 @@ class DogecoinWallet extends CoinServiceAPI
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
mnemonic: _mnemonic!,

View file

@ -981,7 +981,7 @@ class EpicCashWallet extends CoinServiceAPI
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet",
level: LogLevel.Info);
final config = await getRealConfig();

View file

@ -1856,7 +1856,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
@override
Future<void> initializeExisting() async {
Logging.instance.log(
"Opening existing $_walletId ${coin.prettyName} wallet.",
"initializeExisting() $_walletId ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1864,8 +1864,8 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
"Attempted to initialize an existing wallet using an unknown wallet ID!");
}
await _prefs.init();
await checkChangeAddressForTransactions();
await checkReceivingAddressForTransactions();
// await checkChangeAddressForTransactions();
// await checkReceivingAddressForTransactions();
}
Future<bool> refreshIfThereIsNewData() async {
@ -2185,6 +2185,12 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
final mnemonic = await mnemonicString;
final mnemonicPassphrase =
await _secureStore.read(key: '${_walletId}_mnemonicPassphrase');
if (mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await fillAddresses(
mnemonic!,
mnemonicPassphrase!,
@ -2281,6 +2287,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
Future<List<DartLelantusEntry>> _getLelantusEntry() async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _getLelantusEntry: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final List<LelantusCoin> lelantusCoins = await _getUnspentCoins();
@ -2915,10 +2926,16 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
// this should normally never be null anyways but old (dbVersion up to 4)
// migrated transactions may not have had an address (full rescan should
// fix this)
final transactionAddress =
value.item2.subType == isar_models.TransactionSubType.mint
? value.item1
: value.item1!;
isar_models.Address? transactionAddress;
try {
transactionAddress =
value.item2.subType == isar_models.TransactionSubType.mint
? value.item1
: value.item1!;
} catch (_) {
Logging.instance
.log("_refreshLelantusData value: $value", level: LogLevel.Fatal);
}
final outs =
value.item2.outputs.where((_) => true).toList(growable: false);
final ins = value.item2.inputs.where((_) => true).toList(growable: false);
@ -2943,6 +2960,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
Future<String> _getMintHex(int amount, int index) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _getMintHex: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
networkWIF: _network.wif,
@ -3825,6 +3847,12 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
int chain, int index) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
Map<String, dynamic>? derivations;
if (chain == 0) {
final receiveDerivationsString =
@ -3964,6 +3992,12 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
_mnemonic!,
_mnemonicPassphrase!,
@ -4376,7 +4410,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
changeAddressArray.add(changeAddress);
}
await db.putAddresses([
await db.updateOrPutAddresses([
...receivingAddressArray,
...changeAddressArray,
]);

View file

@ -1191,7 +1191,7 @@ class LitecoinWallet extends CoinServiceAPI
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet.",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1199,8 +1199,8 @@ class LitecoinWallet extends CoinServiceAPI
"Attempted to initialize an existing wallet using an unknown wallet ID!");
}
await _prefs.init();
await _checkCurrentChangeAddressesForTransactions();
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
// hack to add tx to txData before refresh completes
@ -1477,6 +1477,11 @@ class LitecoinWallet extends CoinServiceAPI
) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
derivePathType: derivePathType,
@ -2872,6 +2877,11 @@ class LitecoinWallet extends CoinServiceAPI
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
mnemonic: _mnemonic!,

View file

@ -258,7 +258,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override
Future<void> initializeExisting() async {
Logging.instance.log(
"Opening existing ${coin.prettyName} wallet $walletName...",
"initializeExisting() ${coin.prettyName} wallet $walletName...",
level: LogLevel.Info,
);
@ -289,24 +289,12 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
walletBase = (await walletService!.openWallet(_walletId, password))
as MoneroWalletBase;
await _checkCurrentReceivingAddressesForTransactions();
// walletBase!.onNewBlock = onNewBlock;
// walletBase!.onNewTransaction = onNewTransaction;
// walletBase!.syncStatusChanged = syncStatusChanged;
// await _checkCurrentReceivingAddressesForTransactions();
Logging.instance.log(
"Opened existing ${coin.prettyName} wallet $walletName",
level: LogLevel.Info,
);
// Wallet already exists, triggers for a returning user
// String indexKey = "receivingIndex";
// final curIndex =
// await DB.instance.get<dynamic>(boxName: walletId, key: indexKey) as int;
// // Use new index to derive a new receiving address
// final newReceivingAddress = await _generateAddressForChain(0, curIndex);
// Logging.instance.log("xmr address in init existing: $newReceivingAddress",
// level: LogLevel.Info);
// _currentReceivingAddress = Future(() => newReceivingAddress);
}
@override

View file

@ -1181,7 +1181,7 @@ class NamecoinWallet extends CoinServiceAPI
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet.",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1189,8 +1189,8 @@ class NamecoinWallet extends CoinServiceAPI
"Attempted to initialize an existing wallet using an unknown wallet ID!");
}
await _prefs.init();
await _checkCurrentChangeAddressesForTransactions();
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
// hack to add tx to txData before refresh completes
@ -1459,6 +1459,11 @@ class NamecoinWallet extends CoinServiceAPI
) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
derivePathType: derivePathType,
@ -2868,6 +2873,12 @@ class NamecoinWallet extends CoinServiceAPI
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
mnemonic: _mnemonic!,
mnemonicPassphrase: _mnemonicPassphrase!,

View file

@ -1107,7 +1107,7 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override
Future<void> initializeExisting() async {
Logging.instance.log("Opening existing ${coin.prettyName} wallet.",
Logging.instance.log("initializeExisting() ${coin.prettyName} wallet.",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -1115,8 +1115,8 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
"Attempted to initialize an existing wallet using an unknown wallet ID!");
}
await _prefs.init();
await _checkCurrentChangeAddressesForTransactions();
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
// TODO make sure this copied implementation from bitcoin_wallet.dart applies for particl just as well--or import it
@ -1369,6 +1369,11 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
) async {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in _generateAddressForChain: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
final derivePath = constructDerivePath(
derivePathType: derivePathType,
@ -2961,6 +2966,11 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
try {
final _mnemonic = await mnemonicString;
final _mnemonicPassphrase = await mnemonicPassphrase;
if (_mnemonicPassphrase == null) {
Logging.instance.log(
"Exception in fullRescan: mnemonic passphrase null, possible migration issue; if using internal builds, delete wallet and restore from seed, if using a release build, please file bug report",
level: LogLevel.Error);
}
await _recoverWalletFromBIP32SeedPhrase(
mnemonic: _mnemonic!,

View file

@ -281,7 +281,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override
Future<void> initializeExisting() async {
Logging.instance.log(
"Opening existing ${coin.prettyName} wallet $walletName...",
"initializeExisting() ${coin.prettyName} wallet $walletName...",
level: LogLevel.Info);
if (getCachedId() == null) {
@ -306,7 +306,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
walletBase = (await walletService?.openWallet(_walletId, password!))
as WowneroWalletBase;
await _checkCurrentReceivingAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
Logging.instance.log(
"Opened existing ${coin.prettyName} wallet $walletName",

View file

@ -15,8 +15,6 @@ class DebugService extends ChangeNotifier {
late final Isar isar;
// late final Stream<void> logsChanged;
final int numberOfRecentLogsToLoad = 500;
// bool _shouldPause = false;
//
// void togglePauseUiUpdates() {
@ -36,44 +34,49 @@ class DebugService extends ChangeNotifier {
// });
}
List<Log> _recentLogs = [];
List<Log> get recentLogs => _recentLogs;
List<Log> get recentLogs => isar.logs.where().limit(200).findAllSync();
Future<void> updateRecentLogs() async {
int totalCount = await isar.logs.count();
int offset = totalCount - numberOfRecentLogsToLoad;
if (offset < 0) {
offset = 0;
}
// Future<void> updateRecentLogs() async {
// int totalCount = await isar.logs.count();
// int offset = totalCount - numberOfRecentLogsToLoad;
// if (offset < 0) {
// offset = 0;
// }
//
// _recentLogs = (await isar.logs
// .where()
// .anyTimestampInMillisUTC()
// .offset(offset)
// .limit(numberOfRecentLogsToLoad)
// .findAll());
// notifyListeners();
// }
_recentLogs = (await isar.logs
.where()
.anyTimestampInMillisUTC()
.offset(offset)
.limit(numberOfRecentLogsToLoad)
.findAll());
notifyListeners();
}
Future<void> deleteAllMessages() async {
Future<bool> deleteAllLogs() async {
try {
await isar.writeTxn(() async => await isar.logs.clear());
notifyListeners();
} catch (e, s) {
//todo: come back to this
debugPrint("$e, $s");
return true;
} catch (_) {
return false;
}
}
Future<void> purgeInfoLogs() async {
final now = DateTime.now();
Future<void> deleteLogsOlderThan({
Duration timeframe = const Duration(days: 30),
}) async {
final cutoffDate = DateTime.now().subtract(timeframe).toUtc();
await isar.writeTxn(() async {
await isar.logs.filter().logLevelEqualTo(LogLevel.Info).deleteAll();
await isar.logs
.where()
.timestampInMillisUTCLessThan(cutoffDate.millisecondsSinceEpoch)
.deleteAll();
});
Logging.instance.log(
"Info logs purged in ${DateTime.now().difference(now).inMilliseconds} milliseconds",
level: LogLevel.Info);
"Logs older than $cutoffDate cleared!",
level: LogLevel.Info,
);
}
/// returns the filename of the saved logs file

View file

@ -88,6 +88,17 @@ class ChangeNowExchange extends Exchange {
);
}
@override
Future<ExchangeResponse<List<Currency>>> getPairedCurrencies(
String forCurrency,
bool fixedRate,
) async {
return await ChangeNowAPI.instance.getPairedCurrencies(
ticker: forCurrency,
fixedRate: fixedRate,
);
}
@override
Future<ExchangeResponse<List<Pair>>> getAllPairs(bool fixedRate) async {
if (fixedRate) {

View file

@ -29,6 +29,11 @@ abstract class Exchange {
Future<ExchangeResponse<List<Currency>>> getAllCurrencies(bool fixedRate);
Future<ExchangeResponse<List<Currency>>> getPairedCurrencies(
String forCurrency,
bool fixedRate,
);
Future<ExchangeResponse<List<Pair>>> getPairsFor(
String currency,
bool fixedRate,

View file

@ -45,13 +45,13 @@ class ExchangeDataLoadingService {
_isar = await Isar.open(
[
CurrencySchema,
PairSchema,
// PairSchema,
],
directory: (await StackFileSystem.applicationIsarDirectory()).path,
// inspector: kDebugMode,
inspector: false,
name: "exchange_cache",
maxSizeMiB: 256,
maxSizeMiB: 64,
);
}
@ -122,8 +122,9 @@ class ExchangeDataLoadingService {
loadMajesticBankCurrencies(),
]);
await _loadChangeNowFixedRatePairs();
await _loadChangeNowEstimatedRatePairs();
// quicker to load available currencies on the fly for a specific base currency
// await _loadChangeNowFixedRatePairs();
// await _loadChangeNowEstimatedRatePairs();
Logging.instance.log(
"ExchangeDataLoadingService.loadAll finished in ${DateTime.now().difference(start).inSeconds} seconds",
@ -163,55 +164,55 @@ class ExchangeDataLoadingService {
}
}
Future<void> _loadChangeNowFixedRatePairs() async {
final exchange = ChangeNowExchange.instance;
// Future<void> _loadChangeNowFixedRatePairs() async {
// final exchange = ChangeNowExchange.instance;
//
// final responsePairs = await compute(exchange.getAllPairs, true);
//
// if (responsePairs.value != null) {
// await isar.writeTxn(() async {
// final idsToDelete2 = await isar.pairs
// .where()
// .exchangeNameEqualTo(ChangeNowExchange.exchangeName)
// .filter()
// .rateTypeEqualTo(SupportedRateType.fixed)
// .idProperty()
// .findAll();
// await isar.pairs.deleteAll(idsToDelete2);
// await isar.pairs.putAll(responsePairs.value!);
// });
// } else {
// Logging.instance.log(
// "Failed to load changeNOW available fixed rate pairs: ${responsePairs.exception?.message}",
// level: LogLevel.Error);
// return;
// }
// }
final responsePairs = await compute(exchange.getAllPairs, true);
if (responsePairs.value != null) {
await isar.writeTxn(() async {
final idsToDelete2 = await isar.pairs
.where()
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
.filter()
.rateTypeEqualTo(SupportedRateType.fixed)
.idProperty()
.findAll();
await isar.pairs.deleteAll(idsToDelete2);
await isar.pairs.putAll(responsePairs.value!);
});
} else {
Logging.instance.log(
"Failed to load changeNOW available fixed rate pairs: ${responsePairs.exception?.message}",
level: LogLevel.Error);
return;
}
}
Future<void> _loadChangeNowEstimatedRatePairs() async {
final exchange = ChangeNowExchange.instance;
final responsePairs = await compute(exchange.getAllPairs, false);
if (responsePairs.value != null) {
await isar.writeTxn(() async {
final idsToDelete = await isar.pairs
.where()
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
.filter()
.rateTypeEqualTo(SupportedRateType.estimated)
.idProperty()
.findAll();
await isar.pairs.deleteAll(idsToDelete);
await isar.pairs.putAll(responsePairs.value!);
});
} else {
Logging.instance.log(
"Failed to load changeNOW available floating rate pairs: ${responsePairs.exception?.message}",
level: LogLevel.Error);
return;
}
}
// Future<void> _loadChangeNowEstimatedRatePairs() async {
// final exchange = ChangeNowExchange.instance;
//
// final responsePairs = await compute(exchange.getAllPairs, false);
//
// if (responsePairs.value != null) {
// await isar.writeTxn(() async {
// final idsToDelete = await isar.pairs
// .where()
// .exchangeNameEqualTo(ChangeNowExchange.exchangeName)
// .filter()
// .rateTypeEqualTo(SupportedRateType.estimated)
// .idProperty()
// .findAll();
// await isar.pairs.deleteAll(idsToDelete);
// await isar.pairs.putAll(responsePairs.value!);
// });
// } else {
// Logging.instance.log(
// "Failed to load changeNOW available floating rate pairs: ${responsePairs.exception?.message}",
// level: LogLevel.Error);
// return;
// }
// }
//
// Future<void> loadSimpleswapFloatingRateCurrencies(WidgetRef ref) async {
// final exchange = SimpleSwapExchange();
@ -276,31 +277,15 @@ class ExchangeDataLoadingService {
final responseCurrencies = await exchange.getAllCurrencies(false);
if (responseCurrencies.value != null) {
final responsePairs = await exchange.getAllPairs(false);
if (responsePairs.value != null) {
await isar.writeTxn(() async {
final idsToDelete = await isar.currencies
.where()
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
.idProperty()
.findAll();
await isar.currencies.deleteAll(idsToDelete);
await isar.currencies.putAll(responseCurrencies.value!);
final idsToDelete2 = await isar.pairs
.where()
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
.idProperty()
.findAll();
await isar.pairs.deleteAll(idsToDelete2);
await isar.pairs.putAll(responsePairs.value!);
});
} else {
Logging.instance.log(
"loadMajesticBankCurrencies: $responsePairs",
level: LogLevel.Warning,
);
}
await isar.writeTxn(() async {
final idsToDelete = await isar.currencies
.where()
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
.idProperty()
.findAll();
await isar.currencies.deleteAll(idsToDelete);
await isar.currencies.putAll(responseCurrencies.value!);
});
} else {
Logging.instance.log(
"loadMajesticBankCurrencies: $responseCurrencies",
@ -308,4 +293,26 @@ class ExchangeDataLoadingService {
);
}
}
// Future<void> loadMajesticBankPairs() async {
// final exchange = MajesticBankExchange.instance;
//
// final responsePairs = await exchange.getAllPairs(false);
// if (responsePairs.value != null) {
// await isar.writeTxn(() async {
// final idsToDelete2 = await isar.pairs
// .where()
// .exchangeNameEqualTo(MajesticBankExchange.exchangeName)
// .idProperty()
// .findAll();
// await isar.pairs.deleteAll(idsToDelete2);
// await isar.pairs.putAll(responsePairs.value!);
// });
// } else {
// Logging.instance.log(
// "loadMajesticBankCurrencies: $responsePairs",
// level: LogLevel.Warning,
// );
// }
// }
}

View file

@ -124,6 +124,13 @@ class MajesticBankExchange extends Exchange {
return ExchangeResponse(value: currencies);
}
@override
Future<ExchangeResponse<List<Currency>>> getPairedCurrencies(
String forCurrency, bool fixedRate) {
// TODO: change this if the api changes to allow getting by paired currency
return getAllCurrencies(fixedRate);
}
@override
Future<ExchangeResponse<List<Pair>>> getAllPairs(bool fixedRate) async {
final response = await MajesticBankAPI.instance.getRates();

View file

@ -156,4 +156,11 @@ class SimpleSwapExchange extends Exchange {
// TODO: implement getTrades
throw UnimplementedError();
}
@override
Future<ExchangeResponse<List<Currency>>> getPairedCurrencies(
String forCurrency, bool fixedRate) {
// TODO: implement getPairedCurrencies
throw UnimplementedError();
}
}

View file

@ -62,15 +62,24 @@ class Wallets extends ChangeNotifier {
return result;
}
Map<Coin, List<ChangeNotifierProvider<Manager>>> getManagerProvidersByCoin() {
Map<Coin, List<ChangeNotifierProvider<Manager>>> result = {};
List<Tuple2<Coin, List<ChangeNotifierProvider<Manager>>>>
getManagerProvidersByCoin() {
Map<Coin, List<ChangeNotifierProvider<Manager>>> map = {};
for (final manager in _managerMap.values) {
if (result[manager.coin] == null) {
result[manager.coin] = [];
if (map[manager.coin] == null) {
map[manager.coin] = [];
}
result[manager.coin]!.add(_managerProviderMap[manager.walletId]
map[manager.coin]!.add(_managerProviderMap[manager.walletId]
as ChangeNotifierProvider<Manager>);
}
final List<Tuple2<Coin, List<ChangeNotifierProvider<Manager>>>> result = [];
for (final coin in map.keys) {
result.add(Tuple2(coin, map[coin]!));
}
result.sort((a, b) => a.item1.prettyName.compareTo(b.item1.prettyName));
return result;
}

View file

@ -203,6 +203,8 @@ class _SVG {
String get arrowDown => "assets/svg/arrow-down.svg";
String get robotHead => "assets/svg/robot-head.svg";
String get whirlPool => "assets/svg/whirlpool.svg";
String get fingerprint => "assets/svg/fingerprint.svg";
String get faceId => "assets/svg/faceid.svg";
String get ellipse1 => "assets/svg/Ellipse-43.svg";
String get ellipse2 => "assets/svg/Ellipse-42.svg";

View file

@ -1,61 +1,65 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:stackwallet/widgets/custom_pin_put/custom_pin_put_state.dart';
import 'package:stackwallet/widgets/custom_pin_put/pin_keyboard.dart';
class CustomPinPut extends StatefulWidget {
const CustomPinPut(
{Key? key,
required this.fieldsCount,
this.height,
this.width,
this.onSubmit,
this.onSaved,
this.onChanged,
this.controller,
this.focusNode,
this.separator = const SizedBox(width: 15.0),
this.textStyle,
this.submittedFieldDecoration,
this.selectedFieldDecoration,
this.followingFieldDecoration,
this.disabledDecoration,
this.eachFieldWidth,
this.eachFieldHeight,
this.fieldsAlignment = MainAxisAlignment.spaceBetween,
this.eachFieldAlignment = Alignment.center,
this.eachFieldMargin,
this.eachFieldPadding,
this.eachFieldConstraints =
const BoxConstraints(minHeight: 10.0, minWidth: 10.0),
this.inputDecoration = const InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
counterText: '',
),
this.animationCurve = Curves.linear,
this.animationDuration = const Duration(milliseconds: 160),
this.pinAnimationType = PinAnimationType.slide,
this.slideTransitionBeginOffset,
this.enabled = true,
this.useNativeKeyboard = true,
this.autofocus = false,
this.autovalidateMode = AutovalidateMode.disabled,
this.keyboardAppearance,
this.inputFormatters,
this.validator,
this.keyboardType = TextInputType.number,
this.obscureText,
this.textCapitalization = TextCapitalization.none,
this.textInputAction,
this.toolbarOptions,
this.mainAxisSize = MainAxisSize.max,
this.autofillHints})
: assert(fieldsCount > 0),
const CustomPinPut({
Key? key,
required this.fieldsCount,
this.height,
this.width,
this.onSubmit,
this.onSaved,
this.onChanged,
this.controller,
this.focusNode,
this.separator = const SizedBox(width: 15.0),
this.textStyle,
this.submittedFieldDecoration,
this.selectedFieldDecoration,
this.followingFieldDecoration,
this.disabledDecoration,
this.eachFieldWidth,
this.eachFieldHeight,
this.fieldsAlignment = MainAxisAlignment.spaceBetween,
this.eachFieldAlignment = Alignment.center,
this.eachFieldMargin,
this.eachFieldPadding,
this.eachFieldConstraints =
const BoxConstraints(minHeight: 10.0, minWidth: 10.0),
this.inputDecoration = const InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
counterText: '',
),
this.animationCurve = Curves.linear,
this.animationDuration = const Duration(milliseconds: 160),
this.pinAnimationType = PinAnimationType.slide,
this.slideTransitionBeginOffset,
this.enabled = true,
this.useNativeKeyboard = true,
this.autofocus = false,
this.autovalidateMode = AutovalidateMode.disabled,
this.keyboardAppearance,
this.inputFormatters,
this.validator,
this.keyboardType = TextInputType.number,
this.obscureText,
this.textCapitalization = TextCapitalization.none,
this.textInputAction,
this.toolbarOptions,
this.mainAxisSize = MainAxisSize.max,
this.autofillHints,
this.customKey,
}) : assert(fieldsCount > 0),
super(key: key);
final double? width;
final double? height;
final CustomKey? customKey;
/// Displayed fields count. PIN code length.
final int fieldsCount;

View file

@ -69,6 +69,7 @@ class CustomPinPutState extends State<CustomPinPut>
),
Center(
child: PinKeyboard(
customKey: widget.customKey,
onNumberKeyPressed: (number) {
if (_controller.text.length < widget.fieldsCount) {
_controller.text += number;

View file

@ -192,6 +192,50 @@ class SubmitKey extends StatelessWidget {
}
}
class CustomKey extends StatelessWidget {
const CustomKey({
Key? key,
required this.onPressed,
this.iconAssetName,
}) : super(key: key);
final VoidCallback onPressed;
final String? iconAssetName;
@override
Widget build(BuildContext context) {
return Container(
height: 72,
width: 72,
decoration: ShapeDecoration(
shape: const StadiumBorder(),
color: Theme.of(context).extension<StackColors>()!.numpadBackDefault,
shadows: const [],
),
child: MaterialButton(
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: const StadiumBorder(),
onPressed: () {
onPressed.call();
},
child: Center(
child: iconAssetName == null
? null
: SvgPicture.asset(
iconAssetName!,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.numpadTextDefault,
),
),
),
);
}
}
class PinKeyboard extends StatelessWidget {
const PinKeyboard({
Key? key,
@ -201,6 +245,7 @@ class PinKeyboard extends StatelessWidget {
this.backgroundColor,
this.width = 264,
this.height = 360,
this.customKey,
}) : super(key: key);
final ValueSetter<String> onNumberKeyPressed;
@ -209,6 +254,7 @@ class PinKeyboard extends StatelessWidget {
final Color? backgroundColor;
final double? width;
final double? height;
final CustomKey? customKey;
void _backHandler() {
onBackPressed.call();
@ -307,10 +353,12 @@ class PinKeyboard extends StatelessWidget {
),
Row(
children: [
const SizedBox(
height: 72,
width: 72,
),
customKey == null
? const SizedBox(
height: 72,
width: 72,
)
: customKey!,
const SizedBox(
width: 24,
),

View file

@ -300,82 +300,26 @@ flutter:
- assets/svg/configuration.svg
- assets/svg/robot-head.svg
- assets/svg/whirlpool.svg
- assets/svg/fingerprint.svg
- assets/svg/faceid.svg
# light theme coin
- assets/images/light/stack.png
- assets/images/light/monero.png
- assets/images/light/wownero.png
- assets/images/light/firo.png
- assets/images/light/litecoin.png
- assets/images/light/doge.png
- assets/images/light/bitcoin.png
- assets/images/light/epic-cash.png
- assets/images/light/bitcoincash.png
- assets/images/light/namecoin.png
- assets/images/light/particl.png
- assets/images/light/
# dark theme coin
- assets/images/dark/stack.png
- assets/images/dark/monero.png
- assets/images/dark/wownero.png
- assets/images/dark/firo.png
- assets/images/dark/litecoin.png
- assets/images/dark/doge.png
- assets/images/dark/bitcoin.png
- assets/images/dark/epic-cash.png
- assets/images/dark/bitcoincash.png
- assets/images/dark/namecoin.png
- assets/images/dark/particl.png
- assets/images/dark/
# oled black theme coin
- assets/images/oledBlack/stack.png
- assets/images/oledBlack/monero.png
- assets/images/oledBlack/wownero.png
- assets/images/oledBlack/firo.png
- assets/images/oledBlack/litecoin.png
- assets/images/oledBlack/doge.png
- assets/images/oledBlack/bitcoin.png
- assets/images/oledBlack/epic-cash.png
- assets/images/oledBlack/bitcoincash.png
- assets/images/oledBlack/namecoin.png
- assets/images/oledBlack/particl.png
- assets/images/oledBlack/
# fruit sorbet theme coin
- assets/images/fruitSorbet/stack.png
- assets/images/fruitSorbet/monero.png
- assets/images/fruitSorbet/wownero.png
- assets/images/fruitSorbet/firo.png
- assets/images/fruitSorbet/litecoin.png
- assets/images/fruitSorbet/doge.png
- assets/images/fruitSorbet/bitcoin.png
- assets/images/fruitSorbet/epic-cash.png
- assets/images/fruitSorbet/bitcoincash.png
- assets/images/fruitSorbet/namecoin.png
- assets/images/fruitSorbet/particl.png
- assets/images/fruitSorbet/
# forest theme coin
- assets/images/forest/stack.png
- assets/images/forest/monero.png
- assets/images/forest/wownero.png
- assets/images/forest/firo.png
- assets/images/forest/litecoin.png
- assets/images/forest/doge.png
- assets/images/forest/bitcoin.png
- assets/images/forest/epic-cash.png
- assets/images/forest/bitcoincash.png
- assets/images/forest/namecoin.png
- assets/images/forest/particl.png
- assets/images/forest/
# coin icons
- assets/svg/coin_icons/Bitcoin.svg
- assets/svg/coin_icons/Litecoin.svg
- assets/svg/coin_icons/Bitcoincash.svg
- assets/svg/coin_icons/Dogecoin.svg
- assets/svg/coin_icons/EpicCash.svg
- assets/svg/coin_icons/Firo.svg
- assets/svg/coin_icons/Monero.svg
- assets/svg/coin_icons/Wownero.svg
- assets/svg/coin_icons/Namecoin.svg
- assets/svg/coin_icons/Particl.svg
- assets/svg/coin_icons/
# lottie animations
- assets/lottie/test.json
- assets/lottie/test2.json
@ -408,109 +352,22 @@ flutter:
- assets/svg/forest-theme.svg
# light theme specific
- assets/svg/light/tx-exchange-icon.svg
- assets/svg/light/tx-exchange-icon-pending.svg
- assets/svg/light/tx-exchange-icon-failed.svg
- assets/svg/light/tx-icon-send.svg
- assets/svg/light/tx-icon-send-pending.svg
- assets/svg/light/tx-icon-send-failed.svg
- assets/svg/light/tx-icon-receive.svg
- assets/svg/light/tx-icon-receive-pending.svg
- assets/svg/light/tx-icon-receive-failed.svg
- assets/svg/light/exchange-2.svg
- assets/svg/light/bell-new.svg
- assets/svg/light/stack-icon1.svg
- assets/svg/light/buy-coins-icon.svg
- assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg
- assets/svg/light/
# dark theme specific
- assets/svg/dark/tx-exchange-icon.svg
- assets/svg/dark/tx-exchange-icon-pending.svg
- assets/svg/dark/tx-exchange-icon-failed.svg
- assets/svg/dark/tx-icon-send.svg
- assets/svg/dark/tx-icon-send-pending.svg
- assets/svg/dark/tx-icon-send-failed.svg
- assets/svg/dark/tx-icon-receive.svg
- assets/svg/dark/tx-icon-receive-pending.svg
- assets/svg/dark/tx-icon-receive-failed.svg
- assets/svg/dark/exchange-2.svg
- assets/svg/dark/bell-new.svg
- assets/svg/dark/stack-icon1.svg
- assets/svg/dark/buy-coins-icon.svg
- assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg
- assets/svg/dark/
# ocean theme specific
- assets/svg/oceanBreeze/tx-exchange-icon.svg
- assets/svg/oceanBreeze/tx-exchange-icon-pending.svg
- assets/svg/oceanBreeze/tx-exchange-icon-failed.svg
- assets/svg/oceanBreeze/tx-icon-send.svg
- assets/svg/oceanBreeze/tx-icon-send-pending.svg
- assets/svg/oceanBreeze/tx-icon-send-failed.svg
- assets/svg/oceanBreeze/tx-icon-receive.svg
- assets/svg/oceanBreeze/tx-icon-receive-pending.svg
- assets/svg/oceanBreeze/tx-icon-receive-failed.svg
- assets/svg/oceanBreeze/exchange-2.svg
- assets/svg/oceanBreeze/bell-new.svg
- assets/svg/oceanBreeze/stack-icon1.svg
- assets/svg/oceanBreeze/buy-coins-icon.svg
- assets/svg/oceanBreeze/bg.svg
- assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg
- assets/svg/oceanBreeze/
# OLED black theme specific
- assets/svg/oledBlack/tx-exchange-icon.svg
- assets/svg/oledBlack/tx-exchange-icon-pending.svg
- assets/svg/oledBlack/tx-exchange-icon-failed.svg
- assets/svg/oledBlack/tx-icon-send.svg
- assets/svg/oledBlack/tx-icon-send-pending.svg
- assets/svg/oledBlack/tx-icon-send-failed.svg
- assets/svg/oledBlack/tx-icon-receive.svg
- assets/svg/oledBlack/tx-icon-receive-pending.svg
- assets/svg/oledBlack/tx-icon-receive-failed.svg
- assets/svg/oledBlack/exchange-2.svg
- assets/svg/oledBlack/bell-new.svg
- assets/svg/oledBlack/stack-icon1.svg
- assets/svg/oledBlack/buy-coins-icon.svg
- assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg
- assets/svg/oledBlack/
# fruit sorbet theme specific
- assets/svg/fruitSorbet/tx-exchange-icon.svg
- assets/svg/fruitSorbet/tx-exchange-icon-pending.svg
- assets/svg/fruitSorbet/tx-exchange-icon-failed.svg
- assets/svg/fruitSorbet/tx-icon-send.svg
- assets/svg/fruitSorbet/tx-icon-send-pending.svg
- assets/svg/fruitSorbet/tx-icon-send-failed.svg
- assets/svg/fruitSorbet/tx-icon-receive.svg
- assets/svg/fruitSorbet/tx-icon-receive-pending.svg
- assets/svg/fruitSorbet/tx-icon-receive-failed.svg
- assets/svg/fruitSorbet/exchange-2.svg
- assets/svg/fruitSorbet/bell-new.svg
- assets/svg/fruitSorbet/stack-icon1.svg
- assets/svg/fruitSorbet/buy-coins-icon.svg
- assets/svg/fruitSorbet/bg.svg
- assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg
- assets/svg/fruitSorbet/
# forest theme specific
- assets/svg/forest/tx-exchange-icon.svg
- assets/svg/forest/tx-exchange-icon-pending.svg
- assets/svg/forest/tx-exchange-icon-failed.svg
- assets/svg/forest/tx-icon-send.svg
- assets/svg/forest/tx-icon-send-pending.svg
- assets/svg/forest/tx-icon-send-failed.svg
- assets/svg/forest/tx-icon-receive.svg
- assets/svg/forest/tx-icon-receive-pending.svg
- assets/svg/forest/tx-icon-receive-failed.svg
- assets/svg/forest/exchange-2.svg
- assets/svg/forest/bell-new.svg
- assets/svg/forest/stack-icon1.svg
- assets/svg/forest/buy-coins-icon.svg
- assets/svg/forest/bg.svg
- assets/svg/persona-easy-1.svg
- assets/svg/persona-incognito-1.svg
- assets/svg/forest/
# buy
- assets/svg/buy/Simplex-Nuvei-Logo.svg

View file

@ -306,15 +306,18 @@ class MockWallets extends _i1.Mock implements _i19.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i15.Tuple2<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i15.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i15.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i20.Coin? coin) =>

View file

@ -303,15 +303,18 @@ class MockWallets extends _i1.Mock implements _i19.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i14.Tuple2<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i14.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i14.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i20.Coin? coin) =>

View file

@ -3,23 +3,24 @@
// Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i10;
import 'dart:ui' as _i12;
import 'dart:async' as _i11;
import 'dart:ui' as _i13;
import 'package:flutter/foundation.dart' as _i4;
import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/models/node_model.dart' as _i15;
import 'package:stackwallet/models/node_model.dart' as _i16;
import 'package:stackwallet/services/coins/manager.dart' as _i6;
import 'package:stackwallet/services/node_service.dart' as _i3;
import 'package:stackwallet/services/wallets.dart' as _i8;
import 'package:stackwallet/services/wallets_service.dart' as _i2;
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i14;
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i15;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9;
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i13;
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i14;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i7;
import 'package:stackwallet/utilities/prefs.dart' as _i11;
import 'package:stackwallet/utilities/prefs.dart' as _i12;
import 'package:tuple/tuple.dart' as _i10;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
@ -165,15 +166,18 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i9.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i10.Tuple2<_i9.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i9.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i9.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i10.Tuple2<_i9.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i10.Tuple2<_i9.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i9.Coin? coin) =>
@ -240,17 +244,17 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
returnValueForMissingStub: null,
);
@override
_i10.Future<void> load(_i11.Prefs? prefs) => (super.noSuchMethod(
_i11.Future<void> load(_i12.Prefs? prefs) => (super.noSuchMethod(
Invocation.method(
#load,
[prefs],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> loadAfterStackRestore(
_i11.Prefs? prefs,
_i11.Future<void> loadAfterStackRestore(
_i12.Prefs? prefs,
List<_i6.Manager>? managers,
) =>
(super.noSuchMethod(
@ -261,11 +265,11 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
managers,
],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
void addListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
@ -273,7 +277,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
returnValueForMissingStub: null,
);
@override
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
@ -293,7 +297,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
/// A class which mocks [Prefs].
///
/// See the documentation for Mockito's code generation for more information.
class MockPrefs extends _i1.Mock implements _i11.Prefs {
class MockPrefs extends _i1.Mock implements _i12.Prefs {
MockPrefs() {
_i1.throwOnMissingStub(this);
}
@ -349,12 +353,12 @@ class MockPrefs extends _i1.Mock implements _i11.Prefs {
returnValueForMissingStub: null,
);
@override
_i13.SyncingType get syncType => (super.noSuchMethod(
_i14.SyncingType get syncType => (super.noSuchMethod(
Invocation.getter(#syncType),
returnValue: _i13.SyncingType.currentWalletOnly,
) as _i13.SyncingType);
returnValue: _i14.SyncingType.currentWalletOnly,
) as _i14.SyncingType);
@override
set syncType(_i13.SyncingType? syncType) => super.noSuchMethod(
set syncType(_i14.SyncingType? syncType) => super.noSuchMethod(
Invocation.setter(
#syncType,
syncType,
@ -487,12 +491,12 @@ class MockPrefs extends _i1.Mock implements _i11.Prefs {
returnValueForMissingStub: null,
);
@override
_i14.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod(
_i15.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod(
Invocation.getter(#backupFrequencyType),
returnValue: _i14.BackupFrequencyType.everyTenMinutes,
) as _i14.BackupFrequencyType);
returnValue: _i15.BackupFrequencyType.everyTenMinutes,
) as _i15.BackupFrequencyType);
@override
set backupFrequencyType(_i14.BackupFrequencyType? backupFrequencyType) =>
set backupFrequencyType(_i15.BackupFrequencyType? backupFrequencyType) =>
super.noSuchMethod(
Invocation.setter(
#backupFrequencyType,
@ -562,51 +566,51 @@ class MockPrefs extends _i1.Mock implements _i11.Prefs {
returnValue: false,
) as bool);
@override
_i10.Future<void> init() => (super.noSuchMethod(
_i11.Future<void> init() => (super.noSuchMethod(
Invocation.method(
#init,
[],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> incrementCurrentNotificationIndex() => (super.noSuchMethod(
_i11.Future<void> incrementCurrentNotificationIndex() => (super.noSuchMethod(
Invocation.method(
#incrementCurrentNotificationIndex,
[],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<bool> isExternalCallsSet() => (super.noSuchMethod(
_i11.Future<bool> isExternalCallsSet() => (super.noSuchMethod(
Invocation.method(
#isExternalCallsSet,
[],
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
returnValue: _i11.Future<bool>.value(false),
) as _i11.Future<bool>);
@override
_i10.Future<void> saveUserID(String? userId) => (super.noSuchMethod(
_i11.Future<void> saveUserID(String? userId) => (super.noSuchMethod(
Invocation.method(
#saveUserID,
[userId],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod(
_i11.Future<void> saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod(
Invocation.method(
#saveSignupEpoch,
[signupEpoch],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
void addListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
@ -614,7 +618,7 @@ class MockPrefs extends _i1.Mock implements _i11.Prefs {
returnValueForMissingStub: null,
);
@override
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
@ -656,33 +660,33 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
),
) as _i7.SecureStorageInterface);
@override
List<_i15.NodeModel> get primaryNodes => (super.noSuchMethod(
List<_i16.NodeModel> get primaryNodes => (super.noSuchMethod(
Invocation.getter(#primaryNodes),
returnValue: <_i15.NodeModel>[],
) as List<_i15.NodeModel>);
returnValue: <_i16.NodeModel>[],
) as List<_i16.NodeModel>);
@override
List<_i15.NodeModel> get nodes => (super.noSuchMethod(
List<_i16.NodeModel> get nodes => (super.noSuchMethod(
Invocation.getter(#nodes),
returnValue: <_i15.NodeModel>[],
) as List<_i15.NodeModel>);
returnValue: <_i16.NodeModel>[],
) as List<_i16.NodeModel>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i10.Future<void> updateDefaults() => (super.noSuchMethod(
_i11.Future<void> updateDefaults() => (super.noSuchMethod(
Invocation.method(
#updateDefaults,
[],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> setPrimaryNodeFor({
_i11.Future<void> setPrimaryNodeFor({
required _i9.Coin? coin,
required _i15.NodeModel? node,
required _i16.NodeModel? node,
bool? shouldNotifyListeners = false,
}) =>
(super.noSuchMethod(
@ -695,44 +699,44 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i15.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) =>
_i16.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) =>
(super.noSuchMethod(Invocation.method(
#getPrimaryNodeFor,
[],
{#coin: coin},
)) as _i15.NodeModel?);
)) as _i16.NodeModel?);
@override
List<_i15.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod(
List<_i16.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod(
Invocation.method(
#getNodesFor,
[coin],
),
returnValue: <_i15.NodeModel>[],
) as List<_i15.NodeModel>);
returnValue: <_i16.NodeModel>[],
) as List<_i16.NodeModel>);
@override
_i15.NodeModel? getNodeById({required String? id}) =>
_i16.NodeModel? getNodeById({required String? id}) =>
(super.noSuchMethod(Invocation.method(
#getNodeById,
[],
{#id: id},
)) as _i15.NodeModel?);
)) as _i16.NodeModel?);
@override
List<_i15.NodeModel> failoverNodesFor({required _i9.Coin? coin}) =>
List<_i16.NodeModel> failoverNodesFor({required _i9.Coin? coin}) =>
(super.noSuchMethod(
Invocation.method(
#failoverNodesFor,
[],
{#coin: coin},
),
returnValue: <_i15.NodeModel>[],
) as List<_i15.NodeModel>);
returnValue: <_i16.NodeModel>[],
) as List<_i16.NodeModel>);
@override
_i10.Future<void> add(
_i15.NodeModel? node,
_i11.Future<void> add(
_i16.NodeModel? node,
String? password,
bool? shouldNotifyListeners,
) =>
@ -745,11 +749,11 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
shouldNotifyListeners,
],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> delete(
_i11.Future<void> delete(
String? id,
bool? shouldNotifyListeners,
) =>
@ -761,11 +765,11 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
shouldNotifyListeners,
],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> setEnabledState(
_i11.Future<void> setEnabledState(
String? id,
bool? enabled,
bool? shouldNotifyListeners,
@ -779,12 +783,12 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
shouldNotifyListeners,
],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> edit(
_i15.NodeModel? editedNode,
_i11.Future<void> edit(
_i16.NodeModel? editedNode,
String? password,
bool? shouldNotifyListeners,
) =>
@ -797,20 +801,20 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
shouldNotifyListeners,
],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
_i10.Future<void> updateCommunityNodes() => (super.noSuchMethod(
_i11.Future<void> updateCommunityNodes() => (super.noSuchMethod(
Invocation.method(
#updateCommunityNodes,
[],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
returnValue: _i11.Future<void>.value(),
returnValueForMissingStub: _i11.Future<void>.value(),
) as _i11.Future<void>);
@override
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
void addListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
@ -818,7 +822,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
returnValueForMissingStub: null,
);
@override
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],

View file

@ -290,15 +290,18 @@ class MockWallets extends _i1.Mock implements _i18.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i19.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i14.Tuple2<_i19.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i19.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i19.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i14.Tuple2<_i19.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i14.Tuple2<_i19.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i19.Coin? coin) =>

View file

@ -270,15 +270,18 @@ class MockWallets extends _i1.Mock implements _i16.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i17.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i15.Tuple2<_i17.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i17.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i17.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i15.Tuple2<_i17.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i15.Tuple2<_i17.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i17.Coin? coin) =>

View file

@ -279,15 +279,18 @@ class MockWallets extends _i1.Mock implements _i17.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i18.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i14.Tuple2<_i18.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i18.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i18.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i14.Tuple2<_i18.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i14.Tuple2<_i18.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i18.Coin? coin) =>

View file

@ -302,15 +302,18 @@ class MockWallets extends _i1.Mock implements _i19.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i14.Tuple2<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i14.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i14.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i20.Coin? coin) =>

View file

@ -302,15 +302,18 @@ class MockWallets extends _i1.Mock implements _i19.Wallets {
returnValue: <String>[],
) as List<String>);
@override
Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
List<_i14.Tuple2<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>>
getManagerProvidersByCoin() => (super.noSuchMethod(
Invocation.method(
#getManagerProvidersByCoin,
[],
),
returnValue: <_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
) as Map<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
returnValue: <
_i14.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[],
) as List<
_i14.Tuple2<_i20.Coin,
List<_i5.ChangeNotifierProvider<_i6.Manager>>>>);
@override
List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin(
_i20.Coin? coin) =>