mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-31 19:39:06 +00:00
Merge pull request #719 from cypherstack/wallets_refactor
Wallets refactor
This commit is contained in:
commit
3d9485dd40
33 changed files with 458 additions and 3280 deletions
lib
db
pages
add_wallet_views/restore_wallet_view
settings_views/global_settings_view/stack_backup_views
pages_desktop_specific/password
services
wallets/wallet
test
screen_tests
lockscreen_view_screen_test.mocks.dart
main_view_tests
main_view_screen_testA_test.mocks.dartmain_view_screen_testB_test.mocks.dartmain_view_screen_testC_test.mocks.dart
onboarding
backup_key_warning_view_screen_test.mocks.dartcreate_pin_view_screen_test.mocks.dartname_your_wallet_view_screen_test.mocks.dartrestore_wallet_view_screen_test.mocks.dart
settings_view
services
|
@ -48,8 +48,7 @@ class DbVersionMigrator with WalletDB {
|
|||
case 0:
|
||||
await Hive.openBox<dynamic>(DB.boxNameAllWalletsData);
|
||||
await Hive.openBox<dynamic>(DB.boxNamePrefs);
|
||||
final walletsService =
|
||||
WalletsService(secureStorageInterface: secureStore);
|
||||
final walletsService = WalletsService();
|
||||
final nodeService = NodeService(secureStorageInterface: secureStore);
|
||||
final prefs = Prefs.instance;
|
||||
final walletInfoList = await walletsService.walletNames;
|
||||
|
@ -304,8 +303,7 @@ class DbVersionMigrator with WalletDB {
|
|||
case 8:
|
||||
// migrate
|
||||
await Hive.openBox<dynamic>(DB.boxNameAllWalletsData);
|
||||
final walletsService =
|
||||
WalletsService(secureStorageInterface: secureStore);
|
||||
final walletsService = WalletsService();
|
||||
final walletInfoList = await walletsService.walletNames;
|
||||
await MainDB.instance.initMainDB();
|
||||
for (final walletId in walletInfoList.keys) {
|
||||
|
@ -374,7 +372,7 @@ class DbVersionMigrator with WalletDB {
|
|||
Future<void> _v4(SecureStorageInterface secureStore) async {
|
||||
await Hive.openBox<dynamic>(DB.boxNameAllWalletsData);
|
||||
await Hive.openBox<dynamic>(DB.boxNamePrefs);
|
||||
final walletsService = WalletsService(secureStorageInterface: secureStore);
|
||||
final walletsService = WalletsService();
|
||||
final prefs = Prefs.instance;
|
||||
final walletInfoList = await walletsService.walletNames;
|
||||
await prefs.init();
|
||||
|
@ -487,7 +485,7 @@ class DbVersionMigrator with WalletDB {
|
|||
|
||||
Future<void> _v7(SecureStorageInterface secureStore) async {
|
||||
await Hive.openBox<dynamic>(DB.boxNameAllWalletsData);
|
||||
final walletsService = WalletsService(secureStorageInterface: secureStore);
|
||||
final walletsService = WalletsService();
|
||||
final walletInfoList = await walletsService.walletNames;
|
||||
await MainDB.instance.initMainDB();
|
||||
|
||||
|
@ -573,7 +571,7 @@ class DbVersionMigrator with WalletDB {
|
|||
Future<void> _v10(SecureStorageInterface secureStore) async {
|
||||
await Hive.openBox<dynamic>(DB.boxNameAllWalletsData);
|
||||
await Hive.openBox<dynamic>(DB.boxNamePrefs);
|
||||
final walletsService = WalletsService(secureStorageInterface: secureStore);
|
||||
final walletsService = WalletsService();
|
||||
final prefs = Prefs.instance;
|
||||
final walletInfoList = await walletsService.walletNames;
|
||||
await prefs.init();
|
||||
|
|
|
@ -52,6 +52,8 @@ import 'package:stackwallet/utilities/text_styles.dart';
|
|||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/wallet_info.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/monero_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/supporting/epiccash_wallet_info_extension.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -314,10 +316,22 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
|||
mnemonic: mnemonic,
|
||||
);
|
||||
|
||||
if (wallet is EpiccashWallet) {
|
||||
await wallet.init(isRestore: true);
|
||||
} else {
|
||||
await wallet.init();
|
||||
// TODO: extract interface with isRestore param
|
||||
switch (wallet.runtimeType) {
|
||||
case EpiccashWallet:
|
||||
await (wallet as EpiccashWallet).init(isRestore: true);
|
||||
break;
|
||||
|
||||
case MoneroWallet:
|
||||
await (wallet as MoneroWallet).init(isRestore: true);
|
||||
break;
|
||||
|
||||
case WowneroWallet:
|
||||
await (wallet as WowneroWallet).init(isRestore: true);
|
||||
break;
|
||||
|
||||
default:
|
||||
await wallet.init();
|
||||
}
|
||||
|
||||
await wallet.recover(isRescan: false);
|
||||
|
|
|
@ -467,8 +467,12 @@ abstract class SWB {
|
|||
return false;
|
||||
}
|
||||
|
||||
// if mnemonic verified does not get set the wallet will be deleted on app restart
|
||||
await wallet.info.setMnemonicVerified(isar: MainDB.instance.isar);
|
||||
try {
|
||||
// if mnemonic verified does not get set the wallet will be deleted on app restart
|
||||
await wallet.info.setMnemonicVerified(isar: MainDB.instance.isar);
|
||||
} catch (_) {
|
||||
// Do not interrupt/cancel/fail restore from swb if setMnemonicVerified was already set
|
||||
}
|
||||
|
||||
if (_shouldCancelRestore) {
|
||||
return false;
|
||||
|
|
|
@ -387,6 +387,7 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
|
|||
RouteGenerator.getRoute(
|
||||
builder: (_) => StackRestoreProgressView(
|
||||
jsonString: jsonString,
|
||||
shouldPushToHome: true,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -505,7 +506,7 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
|
|||
await showDialog<dynamic>(
|
||||
context: context,
|
||||
useSafeArea: false,
|
||||
barrierDismissible: true,
|
||||
barrierDismissible: false,
|
||||
builder: (context) {
|
||||
return DesktopDialog(
|
||||
maxHeight: 750,
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/dialogs/cancel_stack_restore_dialog.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart';
|
||||
|
@ -668,7 +669,15 @@ class _StackRestoreProgressViewState
|
|||
? TextButton(
|
||||
onPressed: () async {
|
||||
if (_success) {
|
||||
Navigator.of(context).pop();
|
||||
if (widget.shouldPushToHome) {
|
||||
Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(
|
||||
HomeView.routeName,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} else {
|
||||
if (await _requestCancel()) {
|
||||
await _cancel();
|
||||
|
|
|
@ -144,7 +144,7 @@ class _ForgottenPassphraseRestoreFromSWBState
|
|||
builder: (context) {
|
||||
return DesktopDialog(
|
||||
maxWidth: 580,
|
||||
maxHeight: double.infinity,
|
||||
maxHeight: MediaQuery.of(context).size.height - 64,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
|
@ -162,9 +162,11 @@ class _ForgottenPassphraseRestoreFromSWBState
|
|||
const SizedBox(
|
||||
height: 44,
|
||||
),
|
||||
StackRestoreProgressView(
|
||||
jsonString: jsonString,
|
||||
shouldPushToHome: true,
|
||||
Flexible(
|
||||
child: StackRestoreProgressView(
|
||||
jsonString: jsonString,
|
||||
shouldPushToHome: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -11,26 +11,24 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_libmonero/monero/monero.dart';
|
||||
import 'package:flutter_libmonero/wownero/wownero.dart';
|
||||
import 'package:stackwallet/db/hive/db.dart';
|
||||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
import 'package:stackwallet/services/notifications_service.dart';
|
||||
import 'package:stackwallet/services/trade_sent_from_stack_service.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
class WalletInfo {
|
||||
final Coin coin;
|
||||
final String walletId;
|
||||
final String name;
|
||||
|
||||
const WalletInfo(
|
||||
{required this.coin, required this.walletId, required this.name});
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
const WalletInfo({
|
||||
required this.coin,
|
||||
required this.walletId,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
factory WalletInfo.fromJson(Map<String, dynamic> jsonObject) {
|
||||
return WalletInfo(
|
||||
coin: Coin.values.byName(jsonObject["coin"] as String),
|
||||
|
@ -39,6 +37,7 @@ class WalletInfo {
|
|||
);
|
||||
}
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
Map<String, String> toMap() {
|
||||
return {
|
||||
"name": name,
|
||||
|
@ -47,78 +46,30 @@ class WalletInfo {
|
|||
};
|
||||
}
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
String toJsonString() {
|
||||
return jsonEncode(toMap());
|
||||
}
|
||||
|
||||
@override
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
String toString() {
|
||||
return "WalletInfo: ${toJsonString()}";
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
class WalletsService extends ChangeNotifier {
|
||||
late final SecureStorageInterface _secureStore;
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
Future<Map<String, WalletInfo>>? _walletNames;
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
Future<Map<String, WalletInfo>> get walletNames =>
|
||||
_walletNames ??= _fetchWalletNames();
|
||||
|
||||
WalletsService({
|
||||
required SecureStorageInterface secureStorageInterface,
|
||||
}) {
|
||||
_secureStore = secureStorageInterface;
|
||||
}
|
||||
|
||||
// Future<Coin> getWalletCryptoCurrency({required String walletName}) async {
|
||||
// final id = await getWalletId(walletName);
|
||||
// final currency = DB.instance.get<dynamic>(
|
||||
// boxName: DB.boxNameAllWalletsData, key: "${id}_cryptoCurrency");
|
||||
// return Coin.values.byName(currency as String);
|
||||
// }
|
||||
|
||||
Future<bool> renameWallet({
|
||||
required String from,
|
||||
required String to,
|
||||
required bool shouldNotifyListeners,
|
||||
}) async {
|
||||
if (from == to) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final walletInfo = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNameAllWalletsData, key: 'names') as Map;
|
||||
|
||||
final info = walletInfo.values.firstWhere(
|
||||
(element) => element['name'] == from,
|
||||
orElse: () => <String, String>{}) as Map;
|
||||
|
||||
if (info.isEmpty) {
|
||||
// tried to rename a non existing wallet
|
||||
Logging.instance
|
||||
.log("Tried to rename a non existing wallet!", level: LogLevel.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from != to &&
|
||||
(walletInfo.values.firstWhere((element) => element['name'] == to,
|
||||
orElse: () => <String, String>{}) as Map)
|
||||
.isNotEmpty) {
|
||||
// name already exists
|
||||
Logging.instance.log("wallet with name \"$to\" already exists!",
|
||||
level: LogLevel.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
info["name"] = to;
|
||||
walletInfo[info['id']] = info;
|
||||
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: 'names', value: walletInfo);
|
||||
await refreshWallets(shouldNotifyListeners);
|
||||
return true;
|
||||
}
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
WalletsService();
|
||||
|
||||
@Deprecated("Legacy support only. Do not use.")
|
||||
Future<Map<String, WalletInfo>> _fetchWalletNames() async {
|
||||
final names = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNameAllWalletsData, key: 'names') as Map?;
|
||||
|
@ -149,322 +100,4 @@ class WalletsService extends ChangeNotifier {
|
|||
return mapped.map((name, dyn) => MapEntry(
|
||||
name, WalletInfo.fromJson(Map<String, dynamic>.from(dyn as Map))));
|
||||
}
|
||||
|
||||
Map<String, WalletInfo> fetchWalletsData() {
|
||||
final names = DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: 'names') as Map? ??
|
||||
{};
|
||||
|
||||
Logging.instance.log("Fetched wallet names: $names", level: LogLevel.Info);
|
||||
final mapped = Map<String, dynamic>.from(names);
|
||||
mapped.removeWhere((name, dyn) {
|
||||
final jsonObject = Map<String, dynamic>.from(dyn as Map);
|
||||
try {
|
||||
Coin.values.byName(jsonObject["coin"] as String);
|
||||
return false;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Error, ${jsonObject["coin"]} does not exist",
|
||||
level: LogLevel.Error);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return mapped.map((name, dyn) => MapEntry(
|
||||
name, WalletInfo.fromJson(Map<String, dynamic>.from(dyn as Map))));
|
||||
}
|
||||
|
||||
Future<void> addExistingStackWallet({
|
||||
required String name,
|
||||
required String walletId,
|
||||
required Coin coin,
|
||||
required bool shouldNotifyListeners,
|
||||
}) async {
|
||||
final _names = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNameAllWalletsData, key: 'names') as Map?;
|
||||
|
||||
Map<String, dynamic> names;
|
||||
if (_names == null) {
|
||||
names = {};
|
||||
} else {
|
||||
names = Map<String, dynamic>.from(_names);
|
||||
}
|
||||
|
||||
if (names.keys.contains(walletId)) {
|
||||
throw Exception("Wallet with walletId \"$walletId\" already exists!");
|
||||
}
|
||||
if (names.values.where((element) => element['name'] == name).isNotEmpty) {
|
||||
throw Exception("Wallet with name \"$name\" already exists!");
|
||||
}
|
||||
|
||||
names[walletId] = {
|
||||
"id": walletId,
|
||||
"coin": coin.name,
|
||||
"name": name,
|
||||
};
|
||||
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: 'names', value: names);
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${walletId}_cryptoCurrency",
|
||||
value: coin.name);
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${walletId}_mnemonicHasBeenVerified",
|
||||
value: false);
|
||||
await DB.instance.addWalletBox(walletId: walletId);
|
||||
await refreshWallets(shouldNotifyListeners);
|
||||
}
|
||||
|
||||
/// returns the new walletId if successful, otherwise null
|
||||
Future<String?> addNewWallet({
|
||||
required String name,
|
||||
required Coin coin,
|
||||
required bool shouldNotifyListeners,
|
||||
}) async {
|
||||
final _names = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNameAllWalletsData, key: 'names') as Map?;
|
||||
|
||||
Map<String, dynamic> names;
|
||||
if (_names == null) {
|
||||
names = {};
|
||||
} else {
|
||||
names = Map<String, dynamic>.from(_names);
|
||||
}
|
||||
|
||||
// Prevent overwriting or storing empty names
|
||||
if (name.isEmpty ||
|
||||
names.values.where((element) => element['name'] == name).isNotEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final id = const Uuid().v1();
|
||||
names[id] = {
|
||||
"id": id,
|
||||
"coin": coin.name,
|
||||
"name": name,
|
||||
};
|
||||
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: 'names', value: names);
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${id}_cryptoCurrency",
|
||||
value: coin.name);
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${id}_mnemonicHasBeenVerified",
|
||||
value: false);
|
||||
await DB.instance.addWalletBox(walletId: id);
|
||||
await refreshWallets(shouldNotifyListeners);
|
||||
return id;
|
||||
}
|
||||
|
||||
Future<List<String>> getFavoriteWalletIds() async {
|
||||
return DB.instance
|
||||
.values<String>(boxName: DB.boxNameFavoriteWallets)
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<void> saveFavoriteWalletIds(List<String> walletIds) async {
|
||||
await DB.instance.deleteAll<String>(boxName: DB.boxNameFavoriteWallets);
|
||||
await DB.instance
|
||||
.addAll(boxName: DB.boxNameFavoriteWallets, values: walletIds);
|
||||
//todo: check if print needed
|
||||
// debugPrint("saveFavoriteWalletIds list: $walletIds");
|
||||
}
|
||||
|
||||
Future<void> addFavorite(String walletId) async {
|
||||
final list = await getFavoriteWalletIds();
|
||||
if (!list.contains(walletId)) {
|
||||
list.add(walletId);
|
||||
}
|
||||
await saveFavoriteWalletIds(list);
|
||||
}
|
||||
|
||||
Future<void> removeFavorite(String walletId) async {
|
||||
final list = await getFavoriteWalletIds();
|
||||
list.remove(walletId);
|
||||
await saveFavoriteWalletIds(list);
|
||||
}
|
||||
|
||||
Future<void> moveFavorite({
|
||||
required int fromIndex,
|
||||
required int toIndex,
|
||||
}) async {
|
||||
final list = await getFavoriteWalletIds();
|
||||
if (fromIndex < toIndex) {
|
||||
toIndex -= 1;
|
||||
}
|
||||
final walletId = list.removeAt(fromIndex);
|
||||
list.insert(toIndex, walletId);
|
||||
await saveFavoriteWalletIds(list);
|
||||
}
|
||||
|
||||
Future<bool> checkForDuplicate(String name) async {
|
||||
final names = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNameAllWalletsData, key: 'names') as Map?;
|
||||
if (names == null) return false;
|
||||
|
||||
return names.values.where((element) => element['name'] == name).isNotEmpty;
|
||||
}
|
||||
|
||||
Future<String?> getWalletId(String walletName) async {
|
||||
final names = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNameAllWalletsData, key: 'names') as Map;
|
||||
final shells =
|
||||
names.values.where((element) => element['name'] == walletName);
|
||||
if (shells.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
return shells.first["id"] as String;
|
||||
}
|
||||
|
||||
Future<bool> isMnemonicVerified({required String walletId}) async {
|
||||
final isVerified = DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${walletId}_mnemonicHasBeenVerified") as bool?;
|
||||
|
||||
if (isVerified == null) {
|
||||
Logging.instance.log(
|
||||
"isMnemonicVerified(walletId: $walletId) returned null which should never happen!",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
throw Exception(
|
||||
"isMnemonicVerified(walletId: $walletId) returned null which should never happen!");
|
||||
} else {
|
||||
return isVerified;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setMnemonicVerified({required String walletId}) async {
|
||||
final isVerified = DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${walletId}_mnemonicHasBeenVerified") as bool?;
|
||||
|
||||
if (isVerified == null) {
|
||||
Logging.instance.log(
|
||||
"setMnemonicVerified(walletId: $walletId) tried running on non existent wallet!",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
throw Exception(
|
||||
"setMnemonicVerified(walletId: $walletId) tried running on non existent wallet!");
|
||||
} else if (isVerified) {
|
||||
Logging.instance.log(
|
||||
"setMnemonicVerified(walletId: $walletId) tried running on already verified wallet!",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
throw Exception(
|
||||
"setMnemonicVerified(walletId: $walletId) tried running on already verified wallet!");
|
||||
} else {
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${walletId}_mnemonicHasBeenVerified",
|
||||
value: true);
|
||||
Logging.instance.log(
|
||||
"setMnemonicVerified(walletId: $walletId) successful",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// pin + mnemonic as well as anything else in secureStore
|
||||
Future<int> deleteWallet(String name, bool shouldNotifyListeners) async {
|
||||
final names = DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: 'names') as Map? ??
|
||||
{};
|
||||
|
||||
final walletId = await getWalletId(name);
|
||||
if (walletId == null) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
Logging.instance.log(
|
||||
"deleteWallet called with name=$name and id=$walletId",
|
||||
level: LogLevel.Warning,
|
||||
);
|
||||
|
||||
final shell = names.remove(walletId);
|
||||
|
||||
if (shell == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO delete derivations!!!
|
||||
await _secureStore.delete(key: "${walletId}_pin");
|
||||
await _secureStore.delete(key: "${walletId}_mnemonic");
|
||||
|
||||
await DB.instance.delete<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: "${walletId}_cryptoCurrency");
|
||||
await DB.instance.delete<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData,
|
||||
key: "${walletId}_mnemonicHasBeenVerified");
|
||||
if (coinFromPrettyName(shell['coin'] as String) == Coin.wownero) {
|
||||
final wowService =
|
||||
wownero.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
await wowService.remove(walletId);
|
||||
Logging.instance
|
||||
.log("monero wallet: $walletId deleted", level: LogLevel.Info);
|
||||
} else if (coinFromPrettyName(shell['coin'] as String) == Coin.monero) {
|
||||
final xmrService =
|
||||
monero.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
await xmrService.remove(walletId);
|
||||
Logging.instance
|
||||
.log("monero wallet: $walletId deleted", level: LogLevel.Info);
|
||||
} else if (coinFromPrettyName(shell['coin'] as String) == Coin.epicCash) {
|
||||
final deleteResult =
|
||||
await deleteEpicWallet(walletId: walletId, secureStore: _secureStore);
|
||||
Logging.instance.log(
|
||||
"epic wallet: $walletId deleted with result: $deleteResult",
|
||||
level: LogLevel.Info);
|
||||
}
|
||||
|
||||
// delete wallet data in main db
|
||||
await MainDB.instance.deleteWalletBlockchainData(walletId);
|
||||
await MainDB.instance.deleteAddressLabels(walletId);
|
||||
await MainDB.instance.deleteTransactionNotes(walletId);
|
||||
|
||||
// box data may currently still be read/written to if wallet was refreshing
|
||||
// when delete was requested so instead of deleting now we mark the wallet
|
||||
// as needs delete by adding it's id to a list which gets checked on app start
|
||||
await DB.instance.add<String>(
|
||||
boxName: DB.boxNameWalletsToDeleteOnStart, value: walletId);
|
||||
|
||||
final lookupService = TradeSentFromStackService();
|
||||
for (final lookup in lookupService.all) {
|
||||
if (lookup.walletIds.contains(walletId)) {
|
||||
// update lookup data to reflect deleted wallet
|
||||
await lookupService.save(
|
||||
tradeWalletLookup: lookup.copyWith(
|
||||
walletIds: lookup.walletIds.where((id) => id != walletId).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// delete notifications tied to deleted wallet
|
||||
for (final notification in NotificationsService.instance.notifications) {
|
||||
if (notification.walletId == walletId) {
|
||||
await NotificationsService.instance.delete(notification, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (names.isEmpty) {
|
||||
await DB.instance.deleteAll<dynamic>(boxName: DB.boxNameAllWalletsData);
|
||||
_walletNames = Future(() => {});
|
||||
notifyListeners();
|
||||
return 2; // error code no wallets on device
|
||||
}
|
||||
|
||||
await DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNameAllWalletsData, key: 'names', value: names);
|
||||
await refreshWallets(shouldNotifyListeners);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<void> refreshWallets(bool shouldNotifyListeners) async {
|
||||
final newNames = await _fetchWalletNames();
|
||||
_walletNames = Future(() => newNames);
|
||||
if (shouldNotifyListeners) notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,17 @@ import 'package:stackwallet/utilities/logger.dart';
|
|||
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
|
||||
|
||||
class BitcoincashWallet extends Bip39HDWallet
|
||||
with ElectrumXInterface, CoinControlInterface, CashFusionInterface {
|
||||
with
|
||||
ElectrumXInterface,
|
||||
BCashInterface,
|
||||
CoinControlInterface,
|
||||
CashFusionInterface {
|
||||
@override
|
||||
int get isarTransactionVersion => 2;
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ class DogecoinWallet extends Bip39HDWallet
|
|||
with ElectrumXInterface, CoinControlInterface {
|
||||
DogecoinWallet(CryptoCurrencyNetwork network) : super(Dogecoin(network));
|
||||
|
||||
@override
|
||||
int get maximumFeerate => 2500000; // 1000x default value
|
||||
|
||||
@override
|
||||
int get isarTransactionVersion => 2;
|
||||
|
||||
|
|
|
@ -16,12 +16,17 @@ import 'package:stackwallet/utilities/logger.dart';
|
|||
import 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
|
||||
|
||||
class EcashWallet extends Bip39HDWallet
|
||||
with ElectrumXInterface, CoinControlInterface, CashFusionInterface {
|
||||
with
|
||||
ElectrumXInterface,
|
||||
BCashInterface,
|
||||
CoinControlInterface,
|
||||
CashFusionInterface {
|
||||
@override
|
||||
int get isarTransactionVersion => 2;
|
||||
|
||||
|
@ -299,8 +304,12 @@ class EcashWallet extends Bip39HDWallet
|
|||
}
|
||||
|
||||
@override
|
||||
Future<({String? blockedReason, bool blocked, String? utxoLabel})>
|
||||
checkBlockUTXO(
|
||||
Future<
|
||||
({
|
||||
String? blockedReason,
|
||||
bool blocked,
|
||||
String? utxoLabel,
|
||||
})> checkBlockUTXO(
|
||||
Map<String, dynamic> jsonUTXO,
|
||||
String? scriptPubKeyHex,
|
||||
Map<String, dynamic> jsonTX,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
|
@ -740,20 +741,32 @@ class FiroWallet extends Bip39HDWallet
|
|||
final sparkAnonymitySet = futureResults[2] as Map<String, dynamic>;
|
||||
final sparkSpentCoinTags = futureResults[3] as Set<String>;
|
||||
|
||||
await Future.wait([
|
||||
recoverLelantusWallet(
|
||||
if (Util.isDesktop) {
|
||||
await Future.wait([
|
||||
recoverLelantusWallet(
|
||||
latestSetId: latestSetId,
|
||||
usedSerialNumbers: usedSerialsSet,
|
||||
setDataMap: setDataMap,
|
||||
),
|
||||
recoverSparkWallet(
|
||||
anonymitySet: sparkAnonymitySet,
|
||||
spentCoinTags: sparkSpentCoinTags,
|
||||
),
|
||||
]);
|
||||
} else {
|
||||
await recoverLelantusWallet(
|
||||
latestSetId: latestSetId,
|
||||
usedSerialNumbers: usedSerialsSet,
|
||||
setDataMap: setDataMap,
|
||||
),
|
||||
recoverSparkWallet(
|
||||
);
|
||||
await recoverSparkWallet(
|
||||
anonymitySet: sparkAnonymitySet,
|
||||
spentCoinTags: sparkSpentCoinTags,
|
||||
),
|
||||
]);
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
await refresh();
|
||||
unawaited(refresh());
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
"Exception rethrown from electrumx_mixin recover(): $e\n$s",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cw_core/monero_transaction_priority.dart';
|
||||
import 'package:cw_core/node.dart';
|
||||
|
@ -247,26 +248,26 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
Future<void> init({bool? isRestore}) async {
|
||||
cwWalletService = xmr_dart.monero
|
||||
.createMoneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
|
||||
if (!(await cwWalletService!.isWalletExit(walletId))) {
|
||||
if (!(await cwWalletService!.isWalletExit(walletId)) && isRestore != true) {
|
||||
WalletInfo walletInfo;
|
||||
WalletCredentials credentials;
|
||||
try {
|
||||
String name = walletId;
|
||||
final dirPath =
|
||||
await pathForWalletDir(name: name, type: WalletType.monero);
|
||||
final path = await pathForWallet(name: name, type: WalletType.monero);
|
||||
await pathForWalletDir(name: walletId, type: WalletType.monero);
|
||||
final path =
|
||||
await pathForWallet(name: walletId, type: WalletType.monero);
|
||||
credentials = xmr_dart.monero.createMoneroNewWalletCredentials(
|
||||
name: name,
|
||||
name: walletId,
|
||||
language: "English",
|
||||
);
|
||||
|
||||
walletInfo = WalletInfo.external(
|
||||
id: WalletBase.idFor(name, WalletType.monero),
|
||||
name: name,
|
||||
id: WalletBase.idFor(walletId, WalletType.monero),
|
||||
name: walletId,
|
||||
type: WalletType.monero,
|
||||
isRecovery: false,
|
||||
restoreHeight: credentials.height ?? 0,
|
||||
|
@ -332,7 +333,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
|
||||
var restoreHeight = cwWalletBase?.walletInfo.restoreHeight;
|
||||
highestPercentCached = 0;
|
||||
await cwWalletBase?.rescan(height: restoreHeight);
|
||||
await cwWalletBase?.rescan(height: restoreHeight ?? 0);
|
||||
});
|
||||
unawaited(refresh());
|
||||
return;
|
||||
|
@ -347,19 +348,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
}
|
||||
|
||||
try {
|
||||
int height = info.restoreHeight;
|
||||
|
||||
// 25 word seed. TODO validate
|
||||
if (height == 0) {
|
||||
height = xmr_dart.monero.getHeigthByDate(
|
||||
date: DateTime.now().subtract(
|
||||
const Duration(
|
||||
// subtract a couple days to ensure we have a buffer for SWB
|
||||
days: 2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final height = max(info.restoreHeight, 0);
|
||||
|
||||
await info.updateRestoreHeight(
|
||||
newRestoreHeight: height,
|
||||
|
|
|
@ -53,29 +53,50 @@ class ParticlWallet extends Bip39HDWallet
|
|||
// ===========================================================================
|
||||
|
||||
@override
|
||||
Future<({bool blocked, String? blockedReason, String? utxoLabel})>
|
||||
checkBlockUTXO(Map<String, dynamic> jsonUTXO, String? scriptPubKeyHex,
|
||||
Map<String, dynamic> jsonTX, String? utxoOwnerAddress) async {
|
||||
Future<
|
||||
({
|
||||
bool blocked,
|
||||
String? blockedReason,
|
||||
String? utxoLabel,
|
||||
})> checkBlockUTXO(
|
||||
Map<String, dynamic> jsonUTXO,
|
||||
String? scriptPubKeyHex,
|
||||
Map<String, dynamic> jsonTX,
|
||||
String? utxoOwnerAddress,
|
||||
) async {
|
||||
bool blocked = false;
|
||||
String? blockedReason;
|
||||
String? utxoLabel;
|
||||
if (jsonUTXO.containsKey('ct_fee')) {
|
||||
// Blind output, ignore for now.
|
||||
blocked = true;
|
||||
blockedReason = "Blind output.";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
} else if (jsonUTXO.containsKey('rangeproof')) {
|
||||
// Private RingCT output, ignore for now.
|
||||
blocked = true;
|
||||
blockedReason = "Confidential output.";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
} else if (jsonUTXO.containsKey('data_hex')) {
|
||||
// Data output, ignore for now.
|
||||
blocked = true;
|
||||
blockedReason = "Data output.";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
} else if (jsonUTXO.containsKey('scriptPubKey')) {
|
||||
// Transparent output. Do nothing.
|
||||
|
||||
final outputs = jsonTX["vout"] as List? ?? [];
|
||||
|
||||
for (final output in outputs) {
|
||||
if (output is Map) {
|
||||
if (output['ct_fee'] != null) {
|
||||
// Blind output, ignore for now.
|
||||
blocked = true;
|
||||
blockedReason = "Blind output.";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
} else if (output['rangeproof'] != null) {
|
||||
// Private RingCT output, ignore for now.
|
||||
blocked = true;
|
||||
blockedReason = "Confidential output.";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
} else if (output['data_hex'] != null) {
|
||||
// Data output, ignore for now.
|
||||
blocked = true;
|
||||
blockedReason = "Data output.";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
} else if (output['scriptPubKey'] != null) {
|
||||
if (output['scriptPubKey']?['asm'] is String &&
|
||||
(output['scriptPubKey']['asm'] as String)
|
||||
.contains("OP_ISCOINSTAKE")) {
|
||||
blocked = true;
|
||||
blockedReason = "Spending staking";
|
||||
utxoLabel = "Unsupported output type.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cw_core/monero_transaction_priority.dart';
|
||||
import 'package:cw_core/node.dart';
|
||||
|
@ -246,27 +247,27 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
Future<void> init({bool? isRestore}) async {
|
||||
cwWalletService = wow_dart.wownero
|
||||
.createWowneroWalletService(DB.instance.moneroWalletInfoBox);
|
||||
|
||||
if (!(await cwWalletService!.isWalletExit(walletId))) {
|
||||
if (!(await cwWalletService!.isWalletExit(walletId)) && isRestore != true) {
|
||||
WalletInfo walletInfo;
|
||||
WalletCredentials credentials;
|
||||
try {
|
||||
String name = walletId;
|
||||
final dirPath =
|
||||
await pathForWalletDir(name: name, type: WalletType.wownero);
|
||||
final path = await pathForWallet(name: name, type: WalletType.wownero);
|
||||
await pathForWalletDir(name: walletId, type: WalletType.wownero);
|
||||
final path =
|
||||
await pathForWallet(name: walletId, type: WalletType.wownero);
|
||||
credentials = wow_dart.wownero.createWowneroNewWalletCredentials(
|
||||
name: name,
|
||||
name: walletId,
|
||||
language: "English",
|
||||
seedWordsLength: 14,
|
||||
);
|
||||
|
||||
walletInfo = WalletInfo.external(
|
||||
id: WalletBase.idFor(name, WalletType.wownero),
|
||||
name: name,
|
||||
id: WalletBase.idFor(walletId, WalletType.wownero),
|
||||
name: walletId,
|
||||
type: WalletType.wownero,
|
||||
isRecovery: false,
|
||||
restoreHeight: credentials.height ?? 0,
|
||||
|
@ -373,7 +374,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
|
||||
var restoreHeight = cwWalletBase?.walletInfo.restoreHeight;
|
||||
highestPercentCached = 0;
|
||||
await cwWalletBase?.rescan(height: restoreHeight);
|
||||
await cwWalletBase?.rescan(height: restoreHeight ?? 0);
|
||||
});
|
||||
unawaited(refresh());
|
||||
return;
|
||||
|
@ -394,17 +395,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
if (seedLength == 14) {
|
||||
height = getSeedHeightSync(mnemonic.trim());
|
||||
} else {
|
||||
// 25 word seed. TODO validate
|
||||
if (height == 0) {
|
||||
height = wow_dart.wownero.getHeightByDate(
|
||||
date: DateTime.now().subtract(
|
||||
const Duration(
|
||||
// subtract a couple days to ensure we have a buffer for SWB
|
||||
days: 2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
height = max(height, 0);
|
||||
}
|
||||
|
||||
// TODO: info.updateRestoreHeight
|
||||
|
|
|
@ -148,7 +148,31 @@ abstract class Wallet<T extends CryptoCurrency> {
|
|||
if (wallet is MnemonicInterface) {
|
||||
if (wallet is CryptonoteWallet) {
|
||||
// currently a special case due to the xmr/wow libraries handling their
|
||||
// own mnemonic generation
|
||||
// own mnemonic generation on new wallet creation
|
||||
// if its a restore we must set them
|
||||
if (mnemonic != null) {
|
||||
if ((await secureStorageInterface.read(
|
||||
key: mnemonicKey(walletId: walletInfo.walletId),
|
||||
)) ==
|
||||
null) {
|
||||
await secureStorageInterface.write(
|
||||
key: mnemonicKey(walletId: walletInfo.walletId),
|
||||
value: mnemonic,
|
||||
);
|
||||
}
|
||||
|
||||
if (mnemonicPassphrase != null) {
|
||||
if ((await secureStorageInterface.read(
|
||||
key: mnemonicPassphraseKey(walletId: walletInfo.walletId),
|
||||
)) ==
|
||||
null) {
|
||||
await secureStorageInterface.write(
|
||||
key: mnemonicPassphraseKey(walletId: walletInfo.walletId),
|
||||
value: mnemonicPassphrase,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await secureStorageInterface.write(
|
||||
key: mnemonicKey(walletId: walletInfo.walletId),
|
||||
|
@ -173,7 +197,7 @@ abstract class Wallet<T extends CryptoCurrency> {
|
|||
|
||||
// Store in db after wallet creation
|
||||
await wallet.mainDB.isar.writeTxn(() async {
|
||||
await wallet.mainDB.isar.walletInfo.put(wallet.info);
|
||||
await wallet.mainDB.isar.walletInfo.put(walletInfo);
|
||||
});
|
||||
|
||||
return wallet;
|
||||
|
|
134
lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart
Normal file
134
lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart
Normal file
|
@ -0,0 +1,134 @@
|
|||
import 'package:bitbox/bitbox.dart' as bitbox;
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/models/isar/models/blockchain_data/v2/input_v2.dart';
|
||||
import 'package:stackwallet/models/isar/models/blockchain_data/v2/output_v2.dart';
|
||||
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
import 'package:stackwallet/models/signing_data.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:stackwallet/wallets/models/tx_data.dart';
|
||||
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
|
||||
|
||||
mixin BCashInterface on Bip39HDWallet, ElectrumXInterface {
|
||||
@override
|
||||
Future<TxData> buildTransaction({
|
||||
required TxData txData,
|
||||
required List<SigningData> utxoSigningData,
|
||||
}) async {
|
||||
Logging.instance
|
||||
.log("Starting buildTransaction ----------", level: LogLevel.Info);
|
||||
|
||||
// TODO: use coinlib
|
||||
|
||||
final builder = bitbox.Bitbox.transactionBuilder(
|
||||
testnet: cryptoCurrency.network == CryptoCurrencyNetwork.test,
|
||||
);
|
||||
|
||||
// temp tx data to show in gui while waiting for real data from server
|
||||
final List<InputV2> tempInputs = [];
|
||||
final List<OutputV2> tempOutputs = [];
|
||||
|
||||
// Add transaction inputs
|
||||
for (int i = 0; i < utxoSigningData.length; i++) {
|
||||
builder.addInput(
|
||||
utxoSigningData[i].utxo.txid,
|
||||
utxoSigningData[i].utxo.vout,
|
||||
);
|
||||
|
||||
tempInputs.add(
|
||||
InputV2.isarCantDoRequiredInDefaultConstructor(
|
||||
scriptSigHex: "000000",
|
||||
scriptSigAsm: null,
|
||||
sequence: 0xffffffff - 1,
|
||||
outpoint: OutpointV2.isarCantDoRequiredInDefaultConstructor(
|
||||
txid: utxoSigningData[i].utxo.txid,
|
||||
vout: utxoSigningData[i].utxo.vout,
|
||||
),
|
||||
addresses: utxoSigningData[i].utxo.address == null
|
||||
? []
|
||||
: [utxoSigningData[i].utxo.address!],
|
||||
valueStringSats: utxoSigningData[i].utxo.value.toString(),
|
||||
witness: null,
|
||||
innerRedeemScriptAsm: null,
|
||||
coinbase: null,
|
||||
walletOwns: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Add transaction output
|
||||
for (var i = 0; i < txData.recipients!.length; i++) {
|
||||
builder.addOutput(
|
||||
normalizeAddress(txData.recipients![i].address),
|
||||
txData.recipients![i].amount.raw.toInt(),
|
||||
);
|
||||
|
||||
tempOutputs.add(
|
||||
OutputV2.isarCantDoRequiredInDefaultConstructor(
|
||||
scriptPubKeyHex: "000000",
|
||||
valueStringSats: txData.recipients![i].amount.raw.toString(),
|
||||
addresses: [
|
||||
txData.recipients![i].address.toString(),
|
||||
],
|
||||
walletOwns: (await mainDB.isar.addresses
|
||||
.where()
|
||||
.walletIdEqualTo(walletId)
|
||||
.filter()
|
||||
.valueEqualTo(txData.recipients![i].address)
|
||||
.or()
|
||||
.valueEqualTo(normalizeAddress(txData.recipients![i].address))
|
||||
.valueProperty()
|
||||
.findFirst()) !=
|
||||
null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
// Sign the transaction accordingly
|
||||
for (int i = 0; i < utxoSigningData.length; i++) {
|
||||
final bitboxEC = bitbox.ECPair.fromWIF(
|
||||
utxoSigningData[i].keyPair!.toWIF(),
|
||||
);
|
||||
|
||||
builder.sign(
|
||||
i,
|
||||
bitboxEC,
|
||||
utxoSigningData[i].utxo.value,
|
||||
);
|
||||
}
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Caught exception while signing transaction: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
final builtTx = builder.build();
|
||||
final vSize = builtTx.virtualSize();
|
||||
|
||||
return txData.copyWith(
|
||||
raw: builtTx.toHex(),
|
||||
vSize: vSize,
|
||||
tempTx: TransactionV2(
|
||||
walletId: walletId,
|
||||
blockHash: null,
|
||||
hash: builtTx.getId(),
|
||||
txid: builtTx.getId(),
|
||||
height: null,
|
||||
timestamp: DateTime.timestamp().millisecondsSinceEpoch ~/ 1000,
|
||||
inputs: List.unmodifiable(tempInputs),
|
||||
outputs: List.unmodifiable(tempOutputs),
|
||||
version: builtTx.version,
|
||||
type:
|
||||
tempOutputs.map((e) => e.walletOwns).fold(true, (p, e) => p &= e) &&
|
||||
txData.paynymAccountLite == null
|
||||
? TransactionType.sentToSelf
|
||||
: TransactionType.outgoing,
|
||||
subType: TransactionSubType.none,
|
||||
otherData: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -31,6 +31,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
late ElectrumXClient electrumXClient;
|
||||
late CachedElectrumXClient electrumXCachedClient;
|
||||
|
||||
int? get maximumFeerate => null;
|
||||
|
||||
static const _kServerBatchCutoffVersion = [1, 6];
|
||||
List<int>? _serverVersion;
|
||||
bool get serverCanBatch {
|
||||
|
@ -678,6 +680,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
scriptHash: cryptoCurrency.networkParams.p2shPrefix,
|
||||
wif: cryptoCurrency.networkParams.wifPrefix,
|
||||
),
|
||||
maximumFeeRate: maximumFeerate,
|
||||
);
|
||||
const version = 1; // TODO possibly override this for certain coins?
|
||||
txb.setVersion(version);
|
||||
|
|
|
@ -596,6 +596,7 @@ mixin LelantusInterface on Bip39HDWallet, ElectrumXInterface {
|
|||
.isLelantusEqualTo(false)
|
||||
.findAll();
|
||||
|
||||
// TODO: [prio=high] shouldn't these be v2? If it doesn't matter than we can get rid of this logic
|
||||
// Edit the receive transactions with the mint fees.
|
||||
List<Transaction> editedTransactions = [];
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i4;
|
||||
import 'dart:ui' as _i6;
|
||||
import 'dart:ui' as _i5;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/models/node_model.dart' as _i8;
|
||||
import 'package:stackwallet/services/node_service.dart' as _i7;
|
||||
import 'package:stackwallet/models/node_model.dart' as _i7;
|
||||
import 'package:stackwallet/services/node_service.dart' as _i6;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i3;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i8;
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
||||
as _i2;
|
||||
|
||||
|
@ -53,187 +53,7 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i4.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
Map<String, _i3.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i3.WalletInfo>{},
|
||||
) as Map<String, _i3.WalletInfo>);
|
||||
@override
|
||||
_i4.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i5.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i5.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<String?>.value(),
|
||||
) as _i4.Future<String?>);
|
||||
@override
|
||||
_i4.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i4.Future<List<String>>.value(<String>[]),
|
||||
) as _i4.Future<List<String>>);
|
||||
@override
|
||||
_i4.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
_i4.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i4.Future<String?>.value(),
|
||||
) as _i4.Future<String?>);
|
||||
@override
|
||||
_i4.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
_i4.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i4.Future<int>.value(0),
|
||||
) as _i4.Future<int>);
|
||||
@override
|
||||
_i4.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -241,7 +61,7 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
@ -269,7 +89,7 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService {
|
|||
/// A class which mocks [NodeService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
||||
class MockNodeService extends _i1.Mock implements _i6.NodeService {
|
||||
@override
|
||||
_i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod(
|
||||
Invocation.getter(#secureStorageInterface),
|
||||
|
@ -279,15 +99,15 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
),
|
||||
) as _i2.SecureStorageInterface);
|
||||
@override
|
||||
List<_i8.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||
List<_i7.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||
Invocation.getter(#primaryNodes),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
List<_i8.NodeModel> get nodes => (super.noSuchMethod(
|
||||
List<_i7.NodeModel> get nodes => (super.noSuchMethod(
|
||||
Invocation.getter(#nodes),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
bool get hasListeners => (super.noSuchMethod(
|
||||
Invocation.getter(#hasListeners),
|
||||
|
@ -304,8 +124,8 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> setPrimaryNodeFor({
|
||||
required _i5.Coin? coin,
|
||||
required _i8.NodeModel? node,
|
||||
required _i8.Coin? coin,
|
||||
required _i7.NodeModel? node,
|
||||
bool? shouldNotifyListeners = false,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
|
@ -322,40 +142,40 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i8.NodeModel? getPrimaryNodeFor({required _i5.Coin? coin}) =>
|
||||
_i7.NodeModel? getPrimaryNodeFor({required _i8.Coin? coin}) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#getPrimaryNodeFor,
|
||||
[],
|
||||
{#coin: coin},
|
||||
)) as _i8.NodeModel?);
|
||||
)) as _i7.NodeModel?);
|
||||
@override
|
||||
List<_i8.NodeModel> getNodesFor(_i5.Coin? coin) => (super.noSuchMethod(
|
||||
List<_i7.NodeModel> getNodesFor(_i8.Coin? coin) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getNodesFor,
|
||||
[coin],
|
||||
),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
_i8.NodeModel? getNodeById({required String? id}) =>
|
||||
_i7.NodeModel? getNodeById({required String? id}) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#getNodeById,
|
||||
[],
|
||||
{#id: id},
|
||||
)) as _i8.NodeModel?);
|
||||
)) as _i7.NodeModel?);
|
||||
@override
|
||||
List<_i8.NodeModel> failoverNodesFor({required _i5.Coin? coin}) =>
|
||||
List<_i7.NodeModel> failoverNodesFor({required _i8.Coin? coin}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#failoverNodesFor,
|
||||
[],
|
||||
{#coin: coin},
|
||||
),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
_i4.Future<void> add(
|
||||
_i8.NodeModel? node,
|
||||
_i7.NodeModel? node,
|
||||
String? password,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
|
@ -407,7 +227,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> edit(
|
||||
_i8.NodeModel? editedNode,
|
||||
_i7.NodeModel? editedNode,
|
||||
String? password,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
|
@ -433,7 +253,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -441,7 +261,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/locale_service.dart' as _i6;
|
||||
import 'package:stackwallet/services/locale_service.dart' as _i5;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -39,187 +38,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -227,7 +46,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
@ -255,7 +74,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
/// A class which mocks [LocaleService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
||||
class MockLocaleService extends _i1.Mock implements _i5.LocaleService {
|
||||
@override
|
||||
String get locale => (super.noSuchMethod(
|
||||
Invocation.getter(#locale),
|
||||
|
@ -277,7 +96,7 @@ class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
|||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -285,7 +104,7 @@ class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/locale_service.dart' as _i6;
|
||||
import 'package:stackwallet/services/locale_service.dart' as _i5;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -39,187 +38,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -227,7 +46,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
@ -255,7 +74,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
/// A class which mocks [LocaleService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
||||
class MockLocaleService extends _i1.Mock implements _i5.LocaleService {
|
||||
@override
|
||||
String get locale => (super.noSuchMethod(
|
||||
Invocation.getter(#locale),
|
||||
|
@ -277,7 +96,7 @@ class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
|||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -285,7 +104,7 @@ class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/locale_service.dart' as _i6;
|
||||
import 'package:stackwallet/services/locale_service.dart' as _i5;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -39,187 +38,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -227,7 +46,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
@ -255,7 +74,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
/// A class which mocks [LocaleService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
||||
class MockLocaleService extends _i1.Mock implements _i5.LocaleService {
|
||||
@override
|
||||
String get locale => (super.noSuchMethod(
|
||||
Invocation.getter(#locale),
|
||||
|
@ -277,7 +96,7 @@ class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
|||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -285,7 +104,7 @@ class MockLocaleService extends _i1.Mock implements _i6.LocaleService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -38,187 +37,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -226,7 +45,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i4;
|
||||
import 'dart:ui' as _i6;
|
||||
import 'dart:ui' as _i5;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/models/node_model.dart' as _i8;
|
||||
import 'package:stackwallet/services/node_service.dart' as _i7;
|
||||
import 'package:stackwallet/models/node_model.dart' as _i7;
|
||||
import 'package:stackwallet/services/node_service.dart' as _i6;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i3;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i8;
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
||||
as _i2;
|
||||
|
||||
|
@ -53,187 +53,7 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i4.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
Map<String, _i3.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i3.WalletInfo>{},
|
||||
) as Map<String, _i3.WalletInfo>);
|
||||
@override
|
||||
_i4.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i5.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i5.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<String?>.value(),
|
||||
) as _i4.Future<String?>);
|
||||
@override
|
||||
_i4.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i4.Future<List<String>>.value(<String>[]),
|
||||
) as _i4.Future<List<String>>);
|
||||
@override
|
||||
_i4.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
_i4.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i4.Future<String?>.value(),
|
||||
) as _i4.Future<String?>);
|
||||
@override
|
||||
_i4.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
_i4.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i4.Future<int>.value(0),
|
||||
) as _i4.Future<int>);
|
||||
@override
|
||||
_i4.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -241,7 +61,7 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
@ -269,7 +89,7 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService {
|
|||
/// A class which mocks [NodeService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
||||
class MockNodeService extends _i1.Mock implements _i6.NodeService {
|
||||
@override
|
||||
_i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod(
|
||||
Invocation.getter(#secureStorageInterface),
|
||||
|
@ -279,15 +99,15 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
),
|
||||
) as _i2.SecureStorageInterface);
|
||||
@override
|
||||
List<_i8.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||
List<_i7.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||
Invocation.getter(#primaryNodes),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
List<_i8.NodeModel> get nodes => (super.noSuchMethod(
|
||||
List<_i7.NodeModel> get nodes => (super.noSuchMethod(
|
||||
Invocation.getter(#nodes),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
bool get hasListeners => (super.noSuchMethod(
|
||||
Invocation.getter(#hasListeners),
|
||||
|
@ -304,8 +124,8 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> setPrimaryNodeFor({
|
||||
required _i5.Coin? coin,
|
||||
required _i8.NodeModel? node,
|
||||
required _i8.Coin? coin,
|
||||
required _i7.NodeModel? node,
|
||||
bool? shouldNotifyListeners = false,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
|
@ -322,40 +142,40 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i8.NodeModel? getPrimaryNodeFor({required _i5.Coin? coin}) =>
|
||||
_i7.NodeModel? getPrimaryNodeFor({required _i8.Coin? coin}) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#getPrimaryNodeFor,
|
||||
[],
|
||||
{#coin: coin},
|
||||
)) as _i8.NodeModel?);
|
||||
)) as _i7.NodeModel?);
|
||||
@override
|
||||
List<_i8.NodeModel> getNodesFor(_i5.Coin? coin) => (super.noSuchMethod(
|
||||
List<_i7.NodeModel> getNodesFor(_i8.Coin? coin) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getNodesFor,
|
||||
[coin],
|
||||
),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
_i8.NodeModel? getNodeById({required String? id}) =>
|
||||
_i7.NodeModel? getNodeById({required String? id}) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#getNodeById,
|
||||
[],
|
||||
{#id: id},
|
||||
)) as _i8.NodeModel?);
|
||||
)) as _i7.NodeModel?);
|
||||
@override
|
||||
List<_i8.NodeModel> failoverNodesFor({required _i5.Coin? coin}) =>
|
||||
List<_i7.NodeModel> failoverNodesFor({required _i8.Coin? coin}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#failoverNodesFor,
|
||||
[],
|
||||
{#coin: coin},
|
||||
),
|
||||
returnValue: <_i8.NodeModel>[],
|
||||
) as List<_i8.NodeModel>);
|
||||
returnValue: <_i7.NodeModel>[],
|
||||
) as List<_i7.NodeModel>);
|
||||
@override
|
||||
_i4.Future<void> add(
|
||||
_i8.NodeModel? node,
|
||||
_i7.NodeModel? node,
|
||||
String? password,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
|
@ -407,7 +227,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> edit(
|
||||
_i8.NodeModel? editedNode,
|
||||
_i7.NodeModel? editedNode,
|
||||
String? password,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
|
@ -433,7 +253,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -441,7 +261,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -38,187 +37,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -226,7 +45,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i5;
|
||||
import 'dart:ui' as _i8;
|
||||
import 'dart:ui' as _i7;
|
||||
|
||||
import 'package:barcode_scan2/barcode_scan2.dart' as _i2;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/models/node_model.dart' as _i10;
|
||||
import 'package:stackwallet/services/node_service.dart' as _i9;
|
||||
import 'package:stackwallet/models/node_model.dart' as _i9;
|
||||
import 'package:stackwallet/services/node_service.dart' as _i8;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i6;
|
||||
import 'package:stackwallet/utilities/barcode_scanner_interface.dart' as _i4;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i7;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i10;
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
||||
as _i3;
|
||||
|
||||
|
@ -94,187 +94,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i5.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<bool>.value(false),
|
||||
) as _i5.Future<bool>);
|
||||
@override
|
||||
Map<String, _i6.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i6.WalletInfo>{},
|
||||
) as Map<String, _i6.WalletInfo>);
|
||||
@override
|
||||
_i5.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i7.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i7.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<String?>.value(),
|
||||
) as _i5.Future<String?>);
|
||||
@override
|
||||
_i5.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i5.Future<List<String>>.value(<String>[]),
|
||||
) as _i5.Future<List<String>>);
|
||||
@override
|
||||
_i5.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i5.Future<bool>.value(false),
|
||||
) as _i5.Future<bool>);
|
||||
@override
|
||||
_i5.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i5.Future<String?>.value(),
|
||||
) as _i5.Future<String?>);
|
||||
@override
|
||||
_i5.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i5.Future<bool>.value(false),
|
||||
) as _i5.Future<bool>);
|
||||
@override
|
||||
_i5.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i5.Future<int>.value(0),
|
||||
) as _i5.Future<int>);
|
||||
@override
|
||||
_i5.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i7.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -282,7 +102,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
@ -310,7 +130,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService {
|
|||
/// A class which mocks [NodeService].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
||||
class MockNodeService extends _i1.Mock implements _i8.NodeService {
|
||||
@override
|
||||
_i3.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod(
|
||||
Invocation.getter(#secureStorageInterface),
|
||||
|
@ -320,15 +140,15 @@ class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
|||
),
|
||||
) as _i3.SecureStorageInterface);
|
||||
@override
|
||||
List<_i10.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||
List<_i9.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||
Invocation.getter(#primaryNodes),
|
||||
returnValue: <_i10.NodeModel>[],
|
||||
) as List<_i10.NodeModel>);
|
||||
returnValue: <_i9.NodeModel>[],
|
||||
) as List<_i9.NodeModel>);
|
||||
@override
|
||||
List<_i10.NodeModel> get nodes => (super.noSuchMethod(
|
||||
List<_i9.NodeModel> get nodes => (super.noSuchMethod(
|
||||
Invocation.getter(#nodes),
|
||||
returnValue: <_i10.NodeModel>[],
|
||||
) as List<_i10.NodeModel>);
|
||||
returnValue: <_i9.NodeModel>[],
|
||||
) as List<_i9.NodeModel>);
|
||||
@override
|
||||
bool get hasListeners => (super.noSuchMethod(
|
||||
Invocation.getter(#hasListeners),
|
||||
|
@ -345,8 +165,8 @@ class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
|||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<void> setPrimaryNodeFor({
|
||||
required _i7.Coin? coin,
|
||||
required _i10.NodeModel? node,
|
||||
required _i10.Coin? coin,
|
||||
required _i9.NodeModel? node,
|
||||
bool? shouldNotifyListeners = false,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
|
@ -363,40 +183,40 @@ class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
|||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i10.NodeModel? getPrimaryNodeFor({required _i7.Coin? coin}) =>
|
||||
_i9.NodeModel? getPrimaryNodeFor({required _i10.Coin? coin}) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#getPrimaryNodeFor,
|
||||
[],
|
||||
{#coin: coin},
|
||||
)) as _i10.NodeModel?);
|
||||
)) as _i9.NodeModel?);
|
||||
@override
|
||||
List<_i10.NodeModel> getNodesFor(_i7.Coin? coin) => (super.noSuchMethod(
|
||||
List<_i9.NodeModel> getNodesFor(_i10.Coin? coin) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getNodesFor,
|
||||
[coin],
|
||||
),
|
||||
returnValue: <_i10.NodeModel>[],
|
||||
) as List<_i10.NodeModel>);
|
||||
returnValue: <_i9.NodeModel>[],
|
||||
) as List<_i9.NodeModel>);
|
||||
@override
|
||||
_i10.NodeModel? getNodeById({required String? id}) =>
|
||||
_i9.NodeModel? getNodeById({required String? id}) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#getNodeById,
|
||||
[],
|
||||
{#id: id},
|
||||
)) as _i10.NodeModel?);
|
||||
)) as _i9.NodeModel?);
|
||||
@override
|
||||
List<_i10.NodeModel> failoverNodesFor({required _i7.Coin? coin}) =>
|
||||
List<_i9.NodeModel> failoverNodesFor({required _i10.Coin? coin}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#failoverNodesFor,
|
||||
[],
|
||||
{#coin: coin},
|
||||
),
|
||||
returnValue: <_i10.NodeModel>[],
|
||||
) as List<_i10.NodeModel>);
|
||||
returnValue: <_i9.NodeModel>[],
|
||||
) as List<_i9.NodeModel>);
|
||||
@override
|
||||
_i5.Future<void> add(
|
||||
_i10.NodeModel? node,
|
||||
_i9.NodeModel? node,
|
||||
String? password,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
|
@ -448,7 +268,7 @@ class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
|||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<void> edit(
|
||||
_i10.NodeModel? editedNode,
|
||||
_i9.NodeModel? editedNode,
|
||||
String? password,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
|
@ -474,7 +294,7 @@ class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
|||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
void addListener(_i8.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i7.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -482,7 +302,7 @@ class MockNodeService extends _i1.Mock implements _i9.NodeService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -38,187 +37,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -226,7 +45,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -38,187 +37,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -226,7 +45,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -38,187 +37,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -226,7 +45,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -305,186 +305,6 @@ class MockWalletsService extends _i1.Mock implements _i9.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i4.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
Map<String, _i9.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i9.WalletInfo>{},
|
||||
) as Map<String, _i9.WalletInfo>);
|
||||
@override
|
||||
_i4.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i5.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i5.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<String?>.value(),
|
||||
) as _i4.Future<String?>);
|
||||
@override
|
||||
_i4.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i4.Future<List<String>>.value(<String>[]),
|
||||
) as _i4.Future<List<String>>);
|
||||
@override
|
||||
_i4.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
_i4.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i4.Future<String?>.value(),
|
||||
) as _i4.Future<String?>);
|
||||
@override
|
||||
_i4.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i4.Future<bool>.value(false),
|
||||
) as _i4.Future<bool>);
|
||||
@override
|
||||
_i4.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
_i4.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i4.Future<int>.value(0),
|
||||
) as _i4.Future<int>);
|
||||
@override
|
||||
_i4.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
) as _i4.Future<void>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
import 'dart:ui' as _i5;
|
||||
import 'dart:ui' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i4;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
|
@ -38,187 +37,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
_i3.Future<bool> renameWallet({
|
||||
required String? from,
|
||||
required String? to,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#renameWallet,
|
||||
[],
|
||||
{
|
||||
#from: from,
|
||||
#to: to,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
Map<String, _i2.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchWalletsData,
|
||||
[],
|
||||
),
|
||||
returnValue: <String, _i2.WalletInfo>{},
|
||||
) as Map<String, _i2.WalletInfo>);
|
||||
@override
|
||||
_i3.Future<void> addExistingStackWallet({
|
||||
required String? name,
|
||||
required String? walletId,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addExistingStackWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#walletId: walletId,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<String?> addNewWallet({
|
||||
required String? name,
|
||||
required _i4.Coin? coin,
|
||||
required bool? shouldNotifyListeners,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addNewWallet,
|
||||
[],
|
||||
{
|
||||
#name: name,
|
||||
#coin: coin,
|
||||
#shouldNotifyListeners: shouldNotifyListeners,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getFavoriteWalletIds,
|
||||
[],
|
||||
),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#saveFavoriteWalletIds,
|
||||
[walletIds],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeFavorite,
|
||||
[walletId],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> moveFavorite({
|
||||
required int? fromIndex,
|
||||
required int? toIndex,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#moveFavorite,
|
||||
[],
|
||||
{
|
||||
#fromIndex: fromIndex,
|
||||
#toIndex: toIndex,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#checkForDuplicate,
|
||||
[name],
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getWalletId,
|
||||
[walletName],
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<bool> isMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#isMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<bool>.value(false),
|
||||
) as _i3.Future<bool>);
|
||||
@override
|
||||
_i3.Future<void> setMnemonicVerified({required String? walletId}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#setMnemonicVerified,
|
||||
[],
|
||||
{#walletId: walletId},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<int> deleteWallet(
|
||||
String? name,
|
||||
bool? shouldNotifyListeners,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteWallet,
|
||||
[
|
||||
name,
|
||||
shouldNotifyListeners,
|
||||
],
|
||||
),
|
||||
returnValue: _i3.Future<int>.value(0),
|
||||
) as _i3.Future<int>);
|
||||
@override
|
||||
_i3.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#refreshWallets,
|
||||
[shouldNotifyListeners],
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
void addListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void addListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addListener,
|
||||
[listener],
|
||||
|
@ -226,7 +45,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod(
|
||||
void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#removeListener,
|
||||
[listener],
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:hive_test/hive_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:stackwallet/db/hive/db.dart';
|
||||
import 'package:stackwallet/services/wallets_service.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
|
||||
@GenerateMocks([SecureStorageWrapper])
|
||||
void main() {
|
||||
setUp(() async {
|
||||
await setUpTestHive();
|
||||
final wallets = await Hive.openBox<dynamic>(DB.boxNameAllWalletsData);
|
||||
await wallets.put('names', {
|
||||
"wallet_id": {
|
||||
"name": "My Firo Wallet",
|
||||
"id": "wallet_id",
|
||||
"coin": "bitcoin",
|
||||
},
|
||||
"wallet_id2": {
|
||||
"name": "wallet2",
|
||||
"id": "wallet_id2",
|
||||
"coin": "bitcoin",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("get walletNames", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect((await service.walletNames).toString(),
|
||||
'{wallet_id: WalletInfo: {"name":"My Firo Wallet","id":"wallet_id","coin":"bitcoin"}, wallet_id2: WalletInfo: {"name":"wallet2","id":"wallet_id2","coin":"bitcoin"}}');
|
||||
});
|
||||
|
||||
test("get null wallet names", () async {
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('names', null);
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(await service.walletNames, <String, WalletInfo>{});
|
||||
expect((await service.walletNames).toString(), '{}');
|
||||
});
|
||||
|
||||
test("rename wallet to same name", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(
|
||||
await service.renameWallet(
|
||||
from: "My Firo Wallet",
|
||||
to: "My Firo Wallet",
|
||||
shouldNotifyListeners: false),
|
||||
true);
|
||||
expect((await service.walletNames).toString(),
|
||||
'{wallet_id: WalletInfo: {"name":"My Firo Wallet","id":"wallet_id","coin":"bitcoin"}, wallet_id2: WalletInfo: {"name":"wallet2","id":"wallet_id2","coin":"bitcoin"}}');
|
||||
});
|
||||
|
||||
test("rename wallet to new name", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(
|
||||
await service.renameWallet(
|
||||
from: "My Firo Wallet",
|
||||
to: "My New Wallet",
|
||||
shouldNotifyListeners: false),
|
||||
true);
|
||||
|
||||
expect((await service.walletNames).toString(),
|
||||
'{wallet_id: WalletInfo: {"name":"My New Wallet","id":"wallet_id","coin":"bitcoin"}, wallet_id2: WalletInfo: {"name":"wallet2","id":"wallet_id2","coin":"bitcoin"}}');
|
||||
});
|
||||
|
||||
test("attempt rename wallet to another existing name", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(
|
||||
await service.renameWallet(
|
||||
from: "My Firo Wallet",
|
||||
to: "wallet2",
|
||||
shouldNotifyListeners: false),
|
||||
false);
|
||||
expect((await service.walletNames).toString(),
|
||||
'{wallet_id: WalletInfo: {"name":"My Firo Wallet","id":"wallet_id","coin":"bitcoin"}, wallet_id2: WalletInfo: {"name":"wallet2","id":"wallet_id2","coin":"bitcoin"}}');
|
||||
});
|
||||
|
||||
test("add new wallet name", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(
|
||||
await service.addNewWallet(
|
||||
name: "wallet3", coin: Coin.bitcoin, shouldNotifyListeners: false),
|
||||
isA<String>());
|
||||
expect((await service.walletNames).length, 3);
|
||||
});
|
||||
|
||||
test("add duplicate wallet name fails", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(
|
||||
await service.addNewWallet(
|
||||
name: "wallet2", coin: Coin.bitcoin, shouldNotifyListeners: false),
|
||||
null);
|
||||
expect((await service.walletNames).length, 2);
|
||||
});
|
||||
|
||||
test("check for duplicates when null names", () async {
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('names', null);
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(await service.checkForDuplicate("anything"), false);
|
||||
});
|
||||
|
||||
test("check for duplicates when some names with no matches", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(await service.checkForDuplicate("anything"), false);
|
||||
});
|
||||
|
||||
test("check for duplicates when some names with a match", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(await service.checkForDuplicate("wallet2"), true);
|
||||
});
|
||||
|
||||
test("get existing wallet id", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
expect(await service.getWalletId("wallet2"), "wallet_id2");
|
||||
});
|
||||
|
||||
test("get non existent wallet id", () async {
|
||||
final service = WalletsService(secureStorageInterface: FakeSecureStorage());
|
||||
await expectLater(await service.getWalletId("wallet 99"), null);
|
||||
});
|
||||
|
||||
// test("delete a wallet", () async {
|
||||
// await Hive.openBox<String>(DB.boxNameWalletsToDeleteOnStart);
|
||||
// await Hive.openBox<TradeWalletLookup>(DB.boxNameTradeLookup);
|
||||
// await Hive.openBox<NotificationModel>(DB.boxNameNotifications);
|
||||
// final secureStore = MockSecureStorageWrapper();
|
||||
//
|
||||
// when(secureStore.delete(key: "wallet_id_pin")).thenAnswer((_) async {});
|
||||
// when(secureStore.delete(key: "wallet_id_mnemonic"))
|
||||
// .thenAnswer((_) async {});
|
||||
//
|
||||
// final service = WalletsService(secureStorageInterface: secureStore);
|
||||
//
|
||||
// expect(await service.deleteWallet("My Firo Wallet", false), 0);
|
||||
// expect((await service.walletNames).length, 1);
|
||||
//
|
||||
// verify(secureStore.delete(key: "wallet_id_pin")).called(1);
|
||||
// verify(secureStore.delete(key: "wallet_id_mnemonic")).called(1);
|
||||
//
|
||||
// verifyNoMoreInteractions(secureStore);
|
||||
// });
|
||||
//
|
||||
// test("delete last wallet", () async {
|
||||
// await Hive.openBox<String>(DB.boxNameWalletsToDeleteOnStart);
|
||||
// await Hive.openBox<TradeWalletLookup>(DB.boxNameTradeLookup);
|
||||
// await Hive.openBox<NotificationModel>(DB.boxNameNotifications);
|
||||
// final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
// await wallets.put('names', {
|
||||
// "wallet_id": {
|
||||
// "name": "My Firo Wallet",
|
||||
// "id": "wallet_id",
|
||||
// "coin": "bitcoin",
|
||||
// },
|
||||
// });
|
||||
// final secureStore = MockSecureStorageWrapper();
|
||||
//
|
||||
// when(secureStore.delete(key: "wallet_id_pin")).thenAnswer((_) async {});
|
||||
// when(secureStore.delete(key: "wallet_id_mnemonic"))
|
||||
// .thenAnswer((_) async {});
|
||||
//
|
||||
// final service = WalletsService(secureStorageInterface: secureStore);
|
||||
//
|
||||
// expect(await service.deleteWallet("My Firo Wallet", false), 2);
|
||||
// expect((await service.walletNames).length, 0);
|
||||
//
|
||||
// verify(secureStore.delete(key: "wallet_id_pin")).called(1);
|
||||
// verify(secureStore.delete(key: "wallet_id_mnemonic")).called(1);
|
||||
//
|
||||
// verifyNoMoreInteractions(secureStore);
|
||||
// });
|
||||
|
||||
// test("get", () async {
|
||||
// final service = WalletsService();
|
||||
// });
|
||||
|
||||
tearDown(() async {
|
||||
await tearDownTestHive();
|
||||
});
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
// Mocks generated by Mockito 5.4.2 from annotations
|
||||
// in stackwallet/test/services/wallets_service_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart' as _i4;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
||||
as _i2;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
/// A class which mocks [SecureStorageWrapper].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockSecureStorageWrapper extends _i1.Mock
|
||||
implements _i2.SecureStorageWrapper {
|
||||
MockSecureStorageWrapper() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i3.Future<List<String>> get keys => (super.noSuchMethod(
|
||||
Invocation.getter(#keys),
|
||||
returnValue: _i3.Future<List<String>>.value(<String>[]),
|
||||
) as _i3.Future<List<String>>);
|
||||
@override
|
||||
_i3.Future<String?> read({
|
||||
required String? key,
|
||||
_i4.IOSOptions? iOptions,
|
||||
_i4.AndroidOptions? aOptions,
|
||||
_i4.LinuxOptions? lOptions,
|
||||
_i4.WebOptions? webOptions,
|
||||
_i4.MacOsOptions? mOptions,
|
||||
_i4.WindowsOptions? wOptions,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#read,
|
||||
[],
|
||||
{
|
||||
#key: key,
|
||||
#iOptions: iOptions,
|
||||
#aOptions: aOptions,
|
||||
#lOptions: lOptions,
|
||||
#webOptions: webOptions,
|
||||
#mOptions: mOptions,
|
||||
#wOptions: wOptions,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<String?>.value(),
|
||||
) as _i3.Future<String?>);
|
||||
@override
|
||||
_i3.Future<void> write({
|
||||
required String? key,
|
||||
required String? value,
|
||||
_i4.IOSOptions? iOptions,
|
||||
_i4.AndroidOptions? aOptions,
|
||||
_i4.LinuxOptions? lOptions,
|
||||
_i4.WebOptions? webOptions,
|
||||
_i4.MacOsOptions? mOptions,
|
||||
_i4.WindowsOptions? wOptions,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#write,
|
||||
[],
|
||||
{
|
||||
#key: key,
|
||||
#value: value,
|
||||
#iOptions: iOptions,
|
||||
#aOptions: aOptions,
|
||||
#lOptions: lOptions,
|
||||
#webOptions: webOptions,
|
||||
#mOptions: mOptions,
|
||||
#wOptions: wOptions,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> delete({
|
||||
required String? key,
|
||||
_i4.IOSOptions? iOptions,
|
||||
_i4.AndroidOptions? aOptions,
|
||||
_i4.LinuxOptions? lOptions,
|
||||
_i4.WebOptions? webOptions,
|
||||
_i4.MacOsOptions? mOptions,
|
||||
_i4.WindowsOptions? wOptions,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#delete,
|
||||
[],
|
||||
{
|
||||
#key: key,
|
||||
#iOptions: iOptions,
|
||||
#aOptions: aOptions,
|
||||
#lOptions: lOptions,
|
||||
#webOptions: webOptions,
|
||||
#mOptions: mOptions,
|
||||
#wOptions: wOptions,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
@override
|
||||
_i3.Future<void> deleteAll({
|
||||
_i4.IOSOptions? iOptions,
|
||||
_i4.AndroidOptions? aOptions,
|
||||
_i4.LinuxOptions? lOptions,
|
||||
_i4.WebOptions? webOptions,
|
||||
_i4.MacOsOptions? mOptions,
|
||||
_i4.WindowsOptions? wOptions,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteAll,
|
||||
[],
|
||||
{
|
||||
#iOptions: iOptions,
|
||||
#aOptions: aOptions,
|
||||
#lOptions: lOptions,
|
||||
#webOptions: webOptions,
|
||||
#mOptions: mOptions,
|
||||
#wOptions: wOptions,
|
||||
},
|
||||
),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
) as _i3.Future<void>);
|
||||
}
|
Loading…
Reference in a new issue