clean up unused code

This commit is contained in:
julian 2024-01-16 16:47:34 -06:00
parent 831441335c
commit e90baa39e8
17 changed files with 227 additions and 5551 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,227 +0,0 @@
// import 'dart:async';
//
// import 'package:bip39/bip39.dart' as bip39;
// import 'package:isar/isar.dart';
// import 'package:stackwallet/db/isar/main_db.dart';
// import 'package:stackwallet/models/balance.dart' as SWBalance;
// import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'
// as SWAddress;
// import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'
// as SWTransaction;
// import 'package:stackwallet/models/isar/models/blockchain_data/utxo.dart';
// import 'package:stackwallet/models/node_model.dart';
// import 'package:stackwallet/models/paymint/fee_object_model.dart';
// import 'package:stackwallet/services/coins/coin_service.dart';
// import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
// import 'package:stackwallet/services/event_bus/events/global/updated_in_background_event.dart';
// import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
// import 'package:stackwallet/services/event_bus/global_event_bus.dart';
// import 'package:stackwallet/services/mixins/wallet_cache.dart';
// import 'package:stackwallet/services/mixins/wallet_db.dart';
// import 'package:stackwallet/services/node_service.dart';
// import 'package:stackwallet/services/transaction_notification_tracker.dart';
// import 'package:stackwallet/utilities/amount/amount.dart';
// import 'package:stackwallet/utilities/constants.dart';
// import 'package:stackwallet/utilities/default_nodes.dart';
// import 'package:stackwallet/utilities/enums/coin_enum.dart';
// import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
// import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
// import 'package:stackwallet/utilities/logger.dart';
// import 'package:stackwallet/utilities/prefs.dart';
// import 'package:stackwallet/utilities/test_stellar_node_connection.dart';
// import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';
// import 'package:tuple/tuple.dart';
//
// const int MINIMUM_CONFIRMATIONS = 1;
//
// class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
// late StellarSDK stellarSdk;
// late Network stellarNetwork;
//
// StellarWallet({
// required String walletId,
// required String walletName,
// required Coin coin,
// required TransactionNotificationTracker tracker,
// required SecureStorageInterface secureStore,
// MainDB? mockableOverride,
// }) {
// txTracker = tracker;
// _walletId = walletId;
// _walletName = walletName;
// _coin = coin;
// _secureStore = secureStore;
// initCache(walletId, coin);
// initWalletDB(mockableOverride: mockableOverride);
//
// if (coin.isTestNet) {
// stellarNetwork = Network.TESTNET;
// } else {
// stellarNetwork = Network.PUBLIC;
// }
//
// _updateNode();
// }
//
// Future<void> updateTransactions() async {
// try {
// List<Tuple2<SWTransaction.Transaction, SWAddress.Address?>>
// transactionList = [];
// Page<OperationResponse> payments;
// try {
// payments = await stellarSdk.payments
// .forAccount(await getAddressSW())
// .order(RequestBuilderOrder.DESC)
// .execute()
// .onError((error, stackTrace) => throw error!);
// } catch (e) {
// if (e is ErrorResponse &&
// e.body.contains("The resource at the url requested was not found. "
// "This usually occurs for one of two reasons: "
// "The url requested is not valid, or no data in our database "
// "could be found with the parameters provided.")) {
// // probably just doesn't have any history yet or whatever stellar needs
// return;
// } else {
// Logging.instance.log(
// "Stellar $walletName $walletId failed to fetch transactions",
// level: LogLevel.Warning,
// );
// rethrow;
// }
// }
// for (OperationResponse response in payments.records!) {
// // PaymentOperationResponse por;
// if (response is PaymentOperationResponse) {
// PaymentOperationResponse por = response;
//
// SWTransaction.TransactionType type;
// if (por.sourceAccount == await getAddressSW()) {
// type = SWTransaction.TransactionType.outgoing;
// } else {
// type = SWTransaction.TransactionType.incoming;
// }
// final amount = Amount(
// rawValue: BigInt.parse(float
// .parse(por.amount!)
// .toStringAsFixed(coin.decimals)
// .replaceAll(".", "")),
// fractionDigits: coin.decimals,
// );
// int fee = 0;
// int height = 0;
// //Query the transaction linked to the payment,
// // por.transaction returns a null sometimes
// TransactionResponse tx =
// await stellarSdk.transactions.transaction(por.transactionHash!);
//
// if (tx.hash.isNotEmpty) {
// fee = tx.feeCharged!;
// height = tx.ledger;
// }
// var theTransaction = SWTransaction.Transaction(
// walletId: walletId,
// txid: por.transactionHash!,
// timestamp:
// DateTime.parse(por.createdAt!).millisecondsSinceEpoch ~/ 1000,
// type: type,
// subType: SWTransaction.TransactionSubType.none,
// amount: 0,
// amountString: amount.toJsonString(),
// fee: fee,
// height: height,
// isCancelled: false,
// isLelantus: false,
// slateId: "",
// otherData: "",
// inputs: [],
// outputs: [],
// nonce: 0,
// numberOfMessages: null,
// );
// SWAddress.Address? receivingAddress = await _currentReceivingAddress;
// SWAddress.Address address =
// type == SWTransaction.TransactionType.incoming
// ? receivingAddress!
// : SWAddress.Address(
// walletId: walletId,
// value: por.sourceAccount!,
// publicKey:
// KeyPair.fromAccountId(por.sourceAccount!).publicKey,
// derivationIndex: 0,
// derivationPath: null,
// type: SWAddress.AddressType.unknown, // TODO: set type
// subType: SWAddress.AddressSubType.unknown);
// Tuple2<SWTransaction.Transaction, SWAddress.Address> tuple =
// Tuple2(theTransaction, address);
// transactionList.add(tuple);
// } else if (response is CreateAccountOperationResponse) {
// CreateAccountOperationResponse caor = response;
// SWTransaction.TransactionType type;
// if (caor.sourceAccount == await getAddressSW()) {
// type = SWTransaction.TransactionType.outgoing;
// } else {
// type = SWTransaction.TransactionType.incoming;
// }
// final amount = Amount(
// rawValue: BigInt.parse(float
// .parse(caor.startingBalance!)
// .toStringAsFixed(coin.decimals)
// .replaceAll(".", "")),
// fractionDigits: coin.decimals,
// );
// int fee = 0;
// int height = 0;
// TransactionResponse tx =
// await stellarSdk.transactions.transaction(caor.transactionHash!);
// if (tx.hash.isNotEmpty) {
// fee = tx.feeCharged!;
// height = tx.ledger;
// }
// var theTransaction = SWTransaction.Transaction(
// walletId: walletId,
// txid: caor.transactionHash!,
// timestamp:
// DateTime.parse(caor.createdAt!).millisecondsSinceEpoch ~/ 1000,
// type: type,
// subType: SWTransaction.TransactionSubType.none,
// amount: 0,
// amountString: amount.toJsonString(),
// fee: fee,
// height: height,
// isCancelled: false,
// isLelantus: false,
// slateId: "",
// otherData: "",
// inputs: [],
// outputs: [],
// nonce: 0,
// numberOfMessages: null,
// );
// SWAddress.Address? receivingAddress = await _currentReceivingAddress;
// SWAddress.Address address =
// type == SWTransaction.TransactionType.incoming
// ? receivingAddress!
// : SWAddress.Address(
// walletId: walletId,
// value: caor.sourceAccount!,
// publicKey:
// KeyPair.fromAccountId(caor.sourceAccount!).publicKey,
// derivationIndex: 0,
// derivationPath: null,
// type: SWAddress.AddressType.unknown, // TODO: set type
// subType: SWAddress.AddressSubType.unknown);
// Tuple2<SWTransaction.Transaction, SWAddress.Address> tuple =
// Tuple2(theTransaction, address);
// transactionList.add(tuple);
// }
// }
// await db.addNewTransactionData(transactionList, walletId);
// } catch (e, s) {
// Logging.instance.log(
// "Exception rethrown from updateTransactions(): $e\n$s",
// level: LogLevel.Error);
// rethrow;
// }
// }
// }

View file

@ -1,375 +0,0 @@
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'dart:convert';
import 'package:bip47/src/util.dart';
import 'package:decimal/decimal.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.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/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/util.dart' as util;
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
import 'package:tuple/tuple.dart';
mixin ElectrumXParsing {
Future<TransactionV2> getTransaction(
String txHash,
Coin coin,
String walletId,
CachedElectrumXClient cachedElectrumX, [
String? debugTitle,
]) async {
final jsonTx = await cachedElectrumX.getTransaction(
txHash: txHash,
coin: coin,
);
print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
util.Util.printJson(jsonTx, debugTitle);
print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
// parse inputs
final List<InputV2> inputs = [];
for (final jsonInput in jsonTx["vin"] as List) {
final map = Map<String, dynamic>.from(jsonInput as Map);
final List<String> addresses = [];
String valueStringSats = "0";
OutpointV2? outpoint;
final coinbase = map["coinbase"] as String?;
if (coinbase == null) {
final txid = map["txid"] as String;
final vout = map["vout"] as int;
final inputTx =
await cachedElectrumX.getTransaction(txHash: txid, coin: coin);
final prevOutJson = Map<String, dynamic>.from(
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map);
final prevOut = OutputV2.fromElectrumXJson(
prevOutJson,
decimalPlaces: coin.decimals,
walletOwns: false,
);
outpoint = OutpointV2.isarCantDoRequiredInDefaultConstructor(
txid: txid,
vout: vout,
);
valueStringSats = prevOut.valueStringSats;
addresses.addAll(prevOut.addresses);
}
final input = InputV2.isarCantDoRequiredInDefaultConstructor(
scriptSigHex: map["scriptSig"]?["hex"] as String?,
scriptSigAsm: map["scriptSig"]?["asm"] as String?,
sequence: map["sequence"] as int?,
outpoint: outpoint,
valueStringSats: valueStringSats,
addresses: addresses,
witness: map["witness"] as String?,
coinbase: coinbase,
innerRedeemScriptAsm: map["innerRedeemscriptAsm"] as String?,
walletOwns: false,
);
inputs.add(input);
}
// parse outputs
final List<OutputV2> outputs = [];
for (final outputJson in jsonTx["vout"] as List) {
final output = OutputV2.fromElectrumXJson(
Map<String, dynamic>.from(outputJson as Map),
decimalPlaces: coin.decimals,
walletOwns: false,
);
outputs.add(output);
}
return TransactionV2(
walletId: walletId,
blockHash: jsonTx["blockhash"] as String?,
hash: jsonTx["hash"] as String,
txid: jsonTx["txid"] as String,
height: jsonTx["height"] as int?,
version: jsonTx["version"] as int,
timestamp: jsonTx["blocktime"] as int? ??
DateTime.timestamp().millisecondsSinceEpoch ~/ 1000,
inputs: List.unmodifiable(inputs),
outputs: List.unmodifiable(outputs),
subType: TransactionSubType.none,
type: TransactionType.unknown,
otherData: null,
);
}
Future<Tuple2<Transaction, Address>> parseTransaction(
Map<String, dynamic> txData,
dynamic electrumxClient,
List<Address> myAddresses,
Coin coin,
int minConfirms,
String walletId,
) async {
Set<String> receivingAddresses = myAddresses
.where((e) =>
e.subType == AddressSubType.receiving ||
e.subType == AddressSubType.paynymReceive ||
e.subType == AddressSubType.paynymNotification)
.map((e) => e.value)
.toSet();
Set<String> changeAddresses = myAddresses
.where((e) => e.subType == AddressSubType.change)
.map((e) => e.value)
.toSet();
Set<String> inputAddresses = {};
Set<String> outputAddresses = {};
Amount totalInputValue = Amount(
rawValue: BigInt.zero,
fractionDigits: coin.decimals,
);
Amount totalOutputValue = Amount(
rawValue: BigInt.zero,
fractionDigits: coin.decimals,
);
Amount amountSentFromWallet = Amount(
rawValue: BigInt.zero,
fractionDigits: coin.decimals,
);
Amount amountReceivedInWallet = Amount(
rawValue: BigInt.zero,
fractionDigits: coin.decimals,
);
Amount changeAmount = Amount(
rawValue: BigInt.zero,
fractionDigits: coin.decimals,
);
// parse inputs
for (final input in txData["vin"] as List) {
final prevTxid = input["txid"] as String;
final prevOut = input["vout"] as int;
// fetch input tx to get address
final inputTx = await electrumxClient.getTransaction(
txHash: prevTxid,
coin: coin,
);
for (final output in inputTx["vout"] as List) {
// check matching output
if (prevOut == output["n"]) {
// get value
final value = Amount.fromDecimal(
Decimal.parse(output["value"].toString()),
fractionDigits: coin.decimals,
);
// add value to total
totalInputValue += value;
// get input(prevOut) address
final address = output["scriptPubKey"]?["addresses"]?[0] as String? ??
output["scriptPubKey"]?["address"] as String?;
if (address != null) {
inputAddresses.add(address);
// if input was from my wallet, add value to amount sent
if (receivingAddresses.contains(address) ||
changeAddresses.contains(address)) {
amountSentFromWallet += value;
}
}
}
}
}
// parse outputs
for (final output in txData["vout"] as List) {
// get value
final value = Amount.fromDecimal(
Decimal.parse(output["value"].toString()),
fractionDigits: coin.decimals,
);
// add value to total
totalOutputValue += value;
// get output address
final address = output["scriptPubKey"]?["addresses"]?[0] as String? ??
output["scriptPubKey"]?["address"] as String?;
if (address != null) {
outputAddresses.add(address);
// if output was to my wallet, add value to amount received
if (receivingAddresses.contains(address)) {
amountReceivedInWallet += value;
} else if (changeAddresses.contains(address)) {
changeAmount += value;
}
}
}
final mySentFromAddresses = [
...receivingAddresses.intersection(inputAddresses),
...changeAddresses.intersection(inputAddresses)
];
final myReceivedOnAddresses =
receivingAddresses.intersection(outputAddresses);
final myChangeReceivedOnAddresses =
changeAddresses.intersection(outputAddresses);
final fee = totalInputValue - totalOutputValue;
// this is the address initially used to fetch the txid
Address transactionAddress = txData["address"] as Address;
TransactionType type;
Amount amount;
if (mySentFromAddresses.isNotEmpty && myReceivedOnAddresses.isNotEmpty) {
// tx is sent to self
type = TransactionType.sentToSelf;
// should be 0
amount =
amountSentFromWallet - amountReceivedInWallet - fee - changeAmount;
} else if (mySentFromAddresses.isNotEmpty) {
// outgoing tx
type = TransactionType.outgoing;
amount = amountSentFromWallet - changeAmount - fee;
// non wallet addresses found in tx outputs
final nonWalletOutAddresses = outputAddresses.difference(
myChangeReceivedOnAddresses,
);
if (nonWalletOutAddresses.isNotEmpty) {
final possible = nonWalletOutAddresses.first;
if (transactionAddress.value != possible) {
transactionAddress = Address(
walletId: walletId,
value: possible,
derivationIndex: -1,
derivationPath: null,
subType: AddressSubType.nonWallet,
type: AddressType.nonWallet,
publicKey: [],
);
}
} else {
// some other type of tx where the receiving address is
// one of my change addresses
type = TransactionType.sentToSelf;
amount = changeAmount;
}
} else {
// incoming tx
type = TransactionType.incoming;
amount = amountReceivedInWallet;
}
List<Output> outs = [];
List<Input> ins = [];
for (final json in txData["vin"] as List) {
bool isCoinBase = json['coinbase'] != null;
String? witness;
if (json['witness'] != null && json['witness'] is String) {
witness = json['witness'] as String;
} else if (json['txinwitness'] != null) {
if (json['txinwitness'] is List) {
witness = jsonEncode(json['txinwitness']);
}
}
final input = Input(
txid: json['txid'] as String,
vout: json['vout'] as int? ?? -1,
scriptSig: json['scriptSig']?['hex'] as String?,
scriptSigAsm: json['scriptSig']?['asm'] as String?,
isCoinbase: isCoinBase ? isCoinBase : json['is_coinbase'] as bool?,
sequence: json['sequence'] as int?,
innerRedeemScriptAsm: json['innerRedeemscriptAsm'] as String?,
witness: witness,
);
ins.add(input);
}
for (final json in txData["vout"] as List) {
final output = Output(
scriptPubKey: json['scriptPubKey']?['hex'] as String?,
scriptPubKeyAsm: json['scriptPubKey']?['asm'] as String?,
scriptPubKeyType: json['scriptPubKey']?['type'] as String?,
scriptPubKeyAddress:
json["scriptPubKey"]?["addresses"]?[0] as String? ??
json['scriptPubKey']?['type'] as String? ??
"",
value: Amount.fromDecimal(
Decimal.parse(json["value"].toString()),
fractionDigits: coin.decimals,
).raw.toInt(),
);
outs.add(output);
}
TransactionSubType txSubType = TransactionSubType.none;
if (this is PaynymInterface && outs.length > 1 && ins.isNotEmpty) {
for (int i = 0; i < outs.length; i++) {
List<String>? scriptChunks = outs[i].scriptPubKeyAsm?.split(" ");
if (scriptChunks?.length == 2 && scriptChunks?[0] == "OP_RETURN") {
final blindedPaymentCode = scriptChunks![1];
final bytes = blindedPaymentCode.fromHex;
// https://en.bitcoin.it/wiki/BIP_0047#Sending
if (bytes.length == 80 && bytes.first == 1) {
txSubType = TransactionSubType.bip47Notification;
}
}
}
}
final tx = Transaction(
walletId: walletId,
txid: txData["txid"] as String,
timestamp: txData["blocktime"] as int? ??
(DateTime.now().millisecondsSinceEpoch ~/ 1000),
type: type,
subType: txSubType,
// amount may overflow. Deprecated. Use amountString
amount: amount.raw.toInt(),
amountString: amount.toJsonString(),
fee: fee.raw.toInt(),
height: txData["height"] as int?,
isCancelled: false,
isLelantus: false,
slateId: null,
otherData: null,
nonce: null,
inputs: ins,
outputs: outs,
numberOfMessages: null,
);
return Tuple2(tx, transactionAddress);
}
}

View file

@ -1,15 +0,0 @@
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
class WalletsService {
late final SecureStorageInterface _secureStore;
late final MainDB _mainDB;
WalletsService({
required SecureStorageInterface secureStorageInterface,
required MainDB mainDB,
}) {
_secureStore = secureStorageInterface;
_mainDB = mainDB;
}
}

View file

@ -2,13 +2,11 @@ import 'package:mockito/annotations.dart';
import 'package:stackwallet/services/locale_service.dart'; import 'package:stackwallet/services/locale_service.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/wallets.dart'; import 'package:stackwallet/services/wallets.dart';
import 'package:stackwallet/services/wallets_service.dart';
import 'package:stackwallet/themes/theme_service.dart'; import 'package:stackwallet/themes/theme_service.dart';
import 'package:stackwallet/utilities/prefs.dart'; import 'package:stackwallet/utilities/prefs.dart';
@GenerateMocks([ @GenerateMocks([
Wallets, Wallets,
WalletsService,
NodeService, NodeService,
LocaleService, LocaleService,
ThemeService, ThemeService,

View file

@ -4,23 +4,22 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i10; import 'dart:async' as _i10;
import 'dart:typed_data' as _i20; import 'dart:typed_data' as _i19;
import 'dart:ui' as _i15; import 'dart:ui' as _i15;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i19; import 'package:stackwallet/models/isar/stack_theme.dart' as _i18;
import 'package:stackwallet/models/node_model.dart' as _i16; import 'package:stackwallet/models/node_model.dart' as _i13;
import 'package:stackwallet/networking/http.dart' as _i7; import 'package:stackwallet/networking/http.dart' as _i7;
import 'package:stackwallet/services/locale_service.dart' as _i17; import 'package:stackwallet/services/locale_service.dart' as _i16;
import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/node_service.dart' as _i2;
import 'package:stackwallet/services/wallets.dart' as _i9; import 'package:stackwallet/services/wallets.dart' as _i9;
import 'package:stackwallet/services/wallets_service.dart' as _i13; import 'package:stackwallet/themes/theme_service.dart' as _i17;
import 'package:stackwallet/themes/theme_service.dart' as _i18; import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i22;
import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i23; import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i21;
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i22;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i14; import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i14;
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i21; import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i20;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i6; as _i6;
import 'package:stackwallet/utilities/prefs.dart' as _i12; import 'package:stackwallet/utilities/prefs.dart' as _i12;
@ -208,6 +207,7 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
_i10.Future<void> loadAfterStackRestore( _i10.Future<void> loadAfterStackRestore(
_i12.Prefs? prefs, _i12.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -215,6 +215,7 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i10.Future<void>.value(), returnValue: _i10.Future<void>.value(),
@ -222,240 +223,6 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
) as _i10.Future<void>); ) as _i10.Future<void>);
} }
/// A class which mocks [WalletsService].
///
/// See the documentation for Mockito's code generation for more information.
class MockWalletsService extends _i1.Mock implements _i13.WalletsService {
MockWalletsService() {
_i1.throwOnMissingStub(this);
}
@override
_i10.Future<Map<String, _i13.WalletInfo>> get walletNames =>
(super.noSuchMethod(
Invocation.getter(#walletNames),
returnValue: _i10.Future<Map<String, _i13.WalletInfo>>.value(
<String, _i13.WalletInfo>{}),
) as _i10.Future<Map<String, _i13.WalletInfo>>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i10.Future<bool> renameWallet({
required String? from,
required String? to,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#renameWallet,
[],
{
#from: from,
#to: to,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
@override
Map<String, _i13.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Invocation.method(
#fetchWalletsData,
[],
),
returnValue: <String, _i13.WalletInfo>{},
) as Map<String, _i13.WalletInfo>);
@override
_i10.Future<void> addExistingStackWallet({
required String? name,
required String? walletId,
required _i14.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addExistingStackWallet,
[],
{
#name: name,
#walletId: walletId,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<String?> addNewWallet({
required String? name,
required _i14.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addNewWallet,
[],
{
#name: name,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<String?>.value(),
) as _i10.Future<String?>);
@override
_i10.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
Invocation.method(
#getFavoriteWalletIds,
[],
),
returnValue: _i10.Future<List<String>>.value(<String>[]),
) as _i10.Future<List<String>>);
@override
_i10.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
(super.noSuchMethod(
Invocation.method(
#saveFavoriteWalletIds,
[walletIds],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#addFavorite,
[walletId],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#removeFavorite,
[walletId],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<void> moveFavorite({
required int? fromIndex,
required int? toIndex,
}) =>
(super.noSuchMethod(
Invocation.method(
#moveFavorite,
[],
{
#fromIndex: fromIndex,
#toIndex: toIndex,
},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
Invocation.method(
#checkForDuplicate,
[name],
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
@override
_i10.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
Invocation.method(
#getWalletId,
[walletName],
),
returnValue: _i10.Future<String?>.value(),
) as _i10.Future<String?>);
@override
_i10.Future<bool> isMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#isMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
@override
_i10.Future<void> setMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#setMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<int> deleteWallet(
String? name,
bool? shouldNotifyListeners,
) =>
(super.noSuchMethod(
Invocation.method(
#deleteWallet,
[
name,
shouldNotifyListeners,
],
),
returnValue: _i10.Future<int>.value(0),
) as _i10.Future<int>);
@override
_i10.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#refreshWallets,
[shouldNotifyListeners],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
#dispose,
[],
),
returnValueForMissingStub: null,
);
@override
void notifyListeners() => super.noSuchMethod(
Invocation.method(
#notifyListeners,
[],
),
returnValueForMissingStub: null,
);
}
/// A class which mocks [NodeService]. /// A class which mocks [NodeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
@ -473,15 +240,15 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
), ),
) as _i6.SecureStorageInterface); ) as _i6.SecureStorageInterface);
@override @override
List<_i16.NodeModel> get primaryNodes => (super.noSuchMethod( List<_i13.NodeModel> get primaryNodes => (super.noSuchMethod(
Invocation.getter(#primaryNodes), Invocation.getter(#primaryNodes),
returnValue: <_i16.NodeModel>[], returnValue: <_i13.NodeModel>[],
) as List<_i16.NodeModel>); ) as List<_i13.NodeModel>);
@override @override
List<_i16.NodeModel> get nodes => (super.noSuchMethod( List<_i13.NodeModel> get nodes => (super.noSuchMethod(
Invocation.getter(#nodes), Invocation.getter(#nodes),
returnValue: <_i16.NodeModel>[], returnValue: <_i13.NodeModel>[],
) as List<_i16.NodeModel>); ) as List<_i13.NodeModel>);
@override @override
bool get hasListeners => (super.noSuchMethod( bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners), Invocation.getter(#hasListeners),
@ -499,7 +266,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
@override @override
_i10.Future<void> setPrimaryNodeFor({ _i10.Future<void> setPrimaryNodeFor({
required _i14.Coin? coin, required _i14.Coin? coin,
required _i16.NodeModel? node, required _i13.NodeModel? node,
bool? shouldNotifyListeners = false, bool? shouldNotifyListeners = false,
}) => }) =>
(super.noSuchMethod( (super.noSuchMethod(
@ -516,40 +283,40 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: _i10.Future<void>.value(), returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i16.NodeModel? getPrimaryNodeFor({required _i14.Coin? coin}) => _i13.NodeModel? getPrimaryNodeFor({required _i14.Coin? coin}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getPrimaryNodeFor, #getPrimaryNodeFor,
[], [],
{#coin: coin}, {#coin: coin},
)) as _i16.NodeModel?); )) as _i13.NodeModel?);
@override @override
List<_i16.NodeModel> getNodesFor(_i14.Coin? coin) => (super.noSuchMethod( List<_i13.NodeModel> getNodesFor(_i14.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#getNodesFor, #getNodesFor,
[coin], [coin],
), ),
returnValue: <_i16.NodeModel>[], returnValue: <_i13.NodeModel>[],
) as List<_i16.NodeModel>); ) as List<_i13.NodeModel>);
@override @override
_i16.NodeModel? getNodeById({required String? id}) => _i13.NodeModel? getNodeById({required String? id}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getNodeById, #getNodeById,
[], [],
{#id: id}, {#id: id},
)) as _i16.NodeModel?); )) as _i13.NodeModel?);
@override @override
List<_i16.NodeModel> failoverNodesFor({required _i14.Coin? coin}) => List<_i13.NodeModel> failoverNodesFor({required _i14.Coin? coin}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#failoverNodesFor, #failoverNodesFor,
[], [],
{#coin: coin}, {#coin: coin},
), ),
returnValue: <_i16.NodeModel>[], returnValue: <_i13.NodeModel>[],
) as List<_i16.NodeModel>); ) as List<_i13.NodeModel>);
@override @override
_i10.Future<void> add( _i10.Future<void> add(
_i16.NodeModel? node, _i13.NodeModel? node,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -601,7 +368,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i10.Future<void> edit( _i10.Future<void> edit(
_i16.NodeModel? editedNode, _i13.NodeModel? editedNode,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -663,7 +430,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
/// A class which mocks [LocaleService]. /// A class which mocks [LocaleService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockLocaleService extends _i1.Mock implements _i17.LocaleService { class MockLocaleService extends _i1.Mock implements _i16.LocaleService {
MockLocaleService() { MockLocaleService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -725,7 +492,7 @@ class MockLocaleService extends _i1.Mock implements _i17.LocaleService {
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i18.ThemeService { class MockThemeService extends _i1.Mock implements _i17.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -755,10 +522,10 @@ class MockThemeService extends _i1.Mock implements _i18.ThemeService {
), ),
) as _i3.MainDB); ) as _i3.MainDB);
@override @override
List<_i19.StackTheme> get installedThemes => (super.noSuchMethod( List<_i18.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i19.StackTheme>[], returnValue: <_i18.StackTheme>[],
) as List<_i19.StackTheme>); ) as List<_i18.StackTheme>);
@override @override
void init(_i3.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
@ -768,7 +535,7 @@ class MockThemeService extends _i1.Mock implements _i18.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i10.Future<void> install({required _i20.Uint8List? themeArchiveData}) => _i10.Future<void> install({required _i19.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
@ -808,33 +575,33 @@ class MockThemeService extends _i1.Mock implements _i18.ThemeService {
returnValue: _i10.Future<bool>.value(false), returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>); ) as _i10.Future<bool>);
@override @override
_i10.Future<List<_i18.StackThemeMetaData>> fetchThemes() => _i10.Future<List<_i17.StackThemeMetaData>> fetchThemes() =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i10.Future<List<_i18.StackThemeMetaData>>.value( returnValue: _i10.Future<List<_i17.StackThemeMetaData>>.value(
<_i18.StackThemeMetaData>[]), <_i17.StackThemeMetaData>[]),
) as _i10.Future<List<_i18.StackThemeMetaData>>); ) as _i10.Future<List<_i17.StackThemeMetaData>>);
@override @override
_i10.Future<_i20.Uint8List> fetchTheme( _i10.Future<_i19.Uint8List> fetchTheme(
{required _i18.StackThemeMetaData? themeMetaData}) => {required _i17.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i10.Future<_i20.Uint8List>.value(_i20.Uint8List(0)), returnValue: _i10.Future<_i19.Uint8List>.value(_i19.Uint8List(0)),
) as _i10.Future<_i20.Uint8List>); ) as _i10.Future<_i19.Uint8List>);
@override @override
_i19.StackTheme? getTheme({required String? themeId}) => _i18.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i19.StackTheme?); )) as _i18.StackTheme?);
} }
/// A class which mocks [Prefs]. /// A class which mocks [Prefs].
@ -896,12 +663,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i21.SyncingType get syncType => (super.noSuchMethod( _i20.SyncingType get syncType => (super.noSuchMethod(
Invocation.getter(#syncType), Invocation.getter(#syncType),
returnValue: _i21.SyncingType.currentWalletOnly, returnValue: _i20.SyncingType.currentWalletOnly,
) as _i21.SyncingType); ) as _i20.SyncingType);
@override @override
set syncType(_i21.SyncingType? syncType) => super.noSuchMethod( set syncType(_i20.SyncingType? syncType) => super.noSuchMethod(
Invocation.setter( Invocation.setter(
#syncType, #syncType,
syncType, syncType,
@ -1060,12 +827,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i22.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( _i21.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod(
Invocation.getter(#backupFrequencyType), Invocation.getter(#backupFrequencyType),
returnValue: _i22.BackupFrequencyType.everyTenMinutes, returnValue: _i21.BackupFrequencyType.everyTenMinutes,
) as _i22.BackupFrequencyType); ) as _i21.BackupFrequencyType);
@override @override
set backupFrequencyType(_i22.BackupFrequencyType? backupFrequencyType) => set backupFrequencyType(_i21.BackupFrequencyType? backupFrequencyType) =>
super.noSuchMethod( super.noSuchMethod(
Invocation.setter( Invocation.setter(
#backupFrequencyType, #backupFrequencyType,
@ -1260,17 +1027,17 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: _i10.Future<void>.value(), returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i23.AmountUnit amountUnit(_i14.Coin? coin) => (super.noSuchMethod( _i22.AmountUnit amountUnit(_i14.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#amountUnit, #amountUnit,
[coin], [coin],
), ),
returnValue: _i23.AmountUnit.normal, returnValue: _i22.AmountUnit.normal,
) as _i23.AmountUnit); ) as _i22.AmountUnit);
@override @override
void updateAmountUnit({ void updateAmountUnit({
required _i14.Coin? coin, required _i14.Coin? coin,
required _i23.AmountUnit? amountUnit, required _i22.AmountUnit? amountUnit,
}) => }) =>
super.noSuchMethod( super.noSuchMethod(
Invocation.method( Invocation.method(

View file

@ -3,7 +3,6 @@ import 'package:mockito/annotations.dart';
import 'package:stackwallet/services/locale_service.dart'; import 'package:stackwallet/services/locale_service.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/wallets.dart'; import 'package:stackwallet/services/wallets.dart';
import 'package:stackwallet/services/wallets_service.dart';
import 'package:stackwallet/themes/theme_service.dart'; import 'package:stackwallet/themes/theme_service.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/prefs.dart'; import 'package:stackwallet/utilities/prefs.dart';
@ -17,7 +16,6 @@ Amount _a(int i) => Amount.fromDecimal(
@GenerateMocks([ @GenerateMocks([
Wallets, Wallets,
WalletsService,
ThemeService, ThemeService,
Prefs, Prefs,
LocaleService LocaleService

View file

@ -4,23 +4,22 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i10; import 'dart:async' as _i10;
import 'dart:typed_data' as _i18; import 'dart:typed_data' as _i15;
import 'dart:ui' as _i15; import 'dart:ui' as _i20;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i17; import 'package:stackwallet/models/isar/stack_theme.dart' as _i14;
import 'package:stackwallet/models/node_model.dart' as _i23; import 'package:stackwallet/models/node_model.dart' as _i22;
import 'package:stackwallet/networking/http.dart' as _i6; import 'package:stackwallet/networking/http.dart' as _i6;
import 'package:stackwallet/services/locale_service.dart' as _i22; import 'package:stackwallet/services/locale_service.dart' as _i21;
import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/node_service.dart' as _i2;
import 'package:stackwallet/services/wallets.dart' as _i9; import 'package:stackwallet/services/wallets.dart' as _i9;
import 'package:stackwallet/services/wallets_service.dart' as _i13; import 'package:stackwallet/themes/theme_service.dart' as _i13;
import 'package:stackwallet/themes/theme_service.dart' as _i16; import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i18;
import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i21; import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i17;
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i20; import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i19;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i14; import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i16;
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i19;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i8; as _i8;
import 'package:stackwallet/utilities/prefs.dart' as _i12; import 'package:stackwallet/utilities/prefs.dart' as _i12;
@ -208,6 +207,7 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
_i10.Future<void> loadAfterStackRestore( _i10.Future<void> loadAfterStackRestore(
_i12.Prefs? prefs, _i12.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -215,6 +215,7 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i10.Future<void>.value(), returnValue: _i10.Future<void>.value(),
@ -222,244 +223,10 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
) as _i10.Future<void>); ) as _i10.Future<void>);
} }
/// A class which mocks [WalletsService].
///
/// See the documentation for Mockito's code generation for more information.
class MockWalletsService extends _i1.Mock implements _i13.WalletsService {
MockWalletsService() {
_i1.throwOnMissingStub(this);
}
@override
_i10.Future<Map<String, _i13.WalletInfo>> get walletNames =>
(super.noSuchMethod(
Invocation.getter(#walletNames),
returnValue: _i10.Future<Map<String, _i13.WalletInfo>>.value(
<String, _i13.WalletInfo>{}),
) as _i10.Future<Map<String, _i13.WalletInfo>>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i10.Future<bool> renameWallet({
required String? from,
required String? to,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#renameWallet,
[],
{
#from: from,
#to: to,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
@override
Map<String, _i13.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Invocation.method(
#fetchWalletsData,
[],
),
returnValue: <String, _i13.WalletInfo>{},
) as Map<String, _i13.WalletInfo>);
@override
_i10.Future<void> addExistingStackWallet({
required String? name,
required String? walletId,
required _i14.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addExistingStackWallet,
[],
{
#name: name,
#walletId: walletId,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<String?> addNewWallet({
required String? name,
required _i14.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addNewWallet,
[],
{
#name: name,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i10.Future<String?>.value(),
) as _i10.Future<String?>);
@override
_i10.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
Invocation.method(
#getFavoriteWalletIds,
[],
),
returnValue: _i10.Future<List<String>>.value(<String>[]),
) as _i10.Future<List<String>>);
@override
_i10.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
(super.noSuchMethod(
Invocation.method(
#saveFavoriteWalletIds,
[walletIds],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#addFavorite,
[walletId],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#removeFavorite,
[walletId],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<void> moveFavorite({
required int? fromIndex,
required int? toIndex,
}) =>
(super.noSuchMethod(
Invocation.method(
#moveFavorite,
[],
{
#fromIndex: fromIndex,
#toIndex: toIndex,
},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
Invocation.method(
#checkForDuplicate,
[name],
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
@override
_i10.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
Invocation.method(
#getWalletId,
[walletName],
),
returnValue: _i10.Future<String?>.value(),
) as _i10.Future<String?>);
@override
_i10.Future<bool> isMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#isMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>);
@override
_i10.Future<void> setMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#setMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
_i10.Future<int> deleteWallet(
String? name,
bool? shouldNotifyListeners,
) =>
(super.noSuchMethod(
Invocation.method(
#deleteWallet,
[
name,
shouldNotifyListeners,
],
),
returnValue: _i10.Future<int>.value(0),
) as _i10.Future<int>);
@override
_i10.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#refreshWallets,
[shouldNotifyListeners],
),
returnValue: _i10.Future<void>.value(),
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
#dispose,
[],
),
returnValueForMissingStub: null,
);
@override
void notifyListeners() => super.noSuchMethod(
Invocation.method(
#notifyListeners,
[],
),
returnValueForMissingStub: null,
);
}
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i16.ThemeService { class MockThemeService extends _i1.Mock implements _i13.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -489,10 +256,10 @@ class MockThemeService extends _i1.Mock implements _i16.ThemeService {
), ),
) as _i3.MainDB); ) as _i3.MainDB);
@override @override
List<_i17.StackTheme> get installedThemes => (super.noSuchMethod( List<_i14.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i17.StackTheme>[], returnValue: <_i14.StackTheme>[],
) as List<_i17.StackTheme>); ) as List<_i14.StackTheme>);
@override @override
void init(_i3.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
@ -502,7 +269,7 @@ class MockThemeService extends _i1.Mock implements _i16.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i10.Future<void> install({required _i18.Uint8List? themeArchiveData}) => _i10.Future<void> install({required _i15.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
@ -542,33 +309,33 @@ class MockThemeService extends _i1.Mock implements _i16.ThemeService {
returnValue: _i10.Future<bool>.value(false), returnValue: _i10.Future<bool>.value(false),
) as _i10.Future<bool>); ) as _i10.Future<bool>);
@override @override
_i10.Future<List<_i16.StackThemeMetaData>> fetchThemes() => _i10.Future<List<_i13.StackThemeMetaData>> fetchThemes() =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i10.Future<List<_i16.StackThemeMetaData>>.value( returnValue: _i10.Future<List<_i13.StackThemeMetaData>>.value(
<_i16.StackThemeMetaData>[]), <_i13.StackThemeMetaData>[]),
) as _i10.Future<List<_i16.StackThemeMetaData>>); ) as _i10.Future<List<_i13.StackThemeMetaData>>);
@override @override
_i10.Future<_i18.Uint8List> fetchTheme( _i10.Future<_i15.Uint8List> fetchTheme(
{required _i16.StackThemeMetaData? themeMetaData}) => {required _i13.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i10.Future<_i18.Uint8List>.value(_i18.Uint8List(0)), returnValue: _i10.Future<_i15.Uint8List>.value(_i15.Uint8List(0)),
) as _i10.Future<_i18.Uint8List>); ) as _i10.Future<_i15.Uint8List>);
@override @override
_i17.StackTheme? getTheme({required String? themeId}) => _i14.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i17.StackTheme?); )) as _i14.StackTheme?);
} }
/// A class which mocks [Prefs]. /// A class which mocks [Prefs].
@ -630,12 +397,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i19.SyncingType get syncType => (super.noSuchMethod( _i16.SyncingType get syncType => (super.noSuchMethod(
Invocation.getter(#syncType), Invocation.getter(#syncType),
returnValue: _i19.SyncingType.currentWalletOnly, returnValue: _i16.SyncingType.currentWalletOnly,
) as _i19.SyncingType); ) as _i16.SyncingType);
@override @override
set syncType(_i19.SyncingType? syncType) => super.noSuchMethod( set syncType(_i16.SyncingType? syncType) => super.noSuchMethod(
Invocation.setter( Invocation.setter(
#syncType, #syncType,
syncType, syncType,
@ -794,12 +561,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i20.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( _i17.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod(
Invocation.getter(#backupFrequencyType), Invocation.getter(#backupFrequencyType),
returnValue: _i20.BackupFrequencyType.everyTenMinutes, returnValue: _i17.BackupFrequencyType.everyTenMinutes,
) as _i20.BackupFrequencyType); ) as _i17.BackupFrequencyType);
@override @override
set backupFrequencyType(_i20.BackupFrequencyType? backupFrequencyType) => set backupFrequencyType(_i17.BackupFrequencyType? backupFrequencyType) =>
super.noSuchMethod( super.noSuchMethod(
Invocation.setter( Invocation.setter(
#backupFrequencyType, #backupFrequencyType,
@ -994,17 +761,17 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: _i10.Future<void>.value(), returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i21.AmountUnit amountUnit(_i14.Coin? coin) => (super.noSuchMethod( _i18.AmountUnit amountUnit(_i19.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#amountUnit, #amountUnit,
[coin], [coin],
), ),
returnValue: _i21.AmountUnit.normal, returnValue: _i18.AmountUnit.normal,
) as _i21.AmountUnit); ) as _i18.AmountUnit);
@override @override
void updateAmountUnit({ void updateAmountUnit({
required _i14.Coin? coin, required _i19.Coin? coin,
required _i21.AmountUnit? amountUnit, required _i18.AmountUnit? amountUnit,
}) => }) =>
super.noSuchMethod( super.noSuchMethod(
Invocation.method( Invocation.method(
@ -1018,7 +785,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
int maxDecimals(_i14.Coin? coin) => (super.noSuchMethod( int maxDecimals(_i19.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#maxDecimals, #maxDecimals,
[coin], [coin],
@ -1027,7 +794,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
) as int); ) as int);
@override @override
void updateMaxDecimals({ void updateMaxDecimals({
required _i14.Coin? coin, required _i19.Coin? coin,
required int? maxDecimals, required int? maxDecimals,
}) => }) =>
super.noSuchMethod( super.noSuchMethod(
@ -1042,7 +809,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i7.FusionInfo getFusionServerInfo(_i14.Coin? coin) => (super.noSuchMethod( _i7.FusionInfo getFusionServerInfo(_i19.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#getFusionServerInfo, #getFusionServerInfo,
[coin], [coin],
@ -1057,7 +824,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
) as _i7.FusionInfo); ) as _i7.FusionInfo);
@override @override
void setFusionServerInfo( void setFusionServerInfo(
_i14.Coin? coin, _i19.Coin? coin,
_i7.FusionInfo? fusionServerInfo, _i7.FusionInfo? fusionServerInfo,
) => ) =>
super.noSuchMethod( super.noSuchMethod(
@ -1071,7 +838,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( void addListener(_i20.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#addListener, #addListener,
[listener], [listener],
@ -1079,7 +846,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#removeListener, #removeListener,
[listener], [listener],
@ -1107,7 +874,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs {
/// A class which mocks [LocaleService]. /// A class which mocks [LocaleService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockLocaleService extends _i1.Mock implements _i22.LocaleService { class MockLocaleService extends _i1.Mock implements _i21.LocaleService {
MockLocaleService() { MockLocaleService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -1133,7 +900,7 @@ class MockLocaleService extends _i1.Mock implements _i22.LocaleService {
returnValueForMissingStub: _i10.Future<void>.value(), returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( void addListener(_i20.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#addListener, #addListener,
[listener], [listener],
@ -1141,7 +908,7 @@ class MockLocaleService extends _i1.Mock implements _i22.LocaleService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#removeListener, #removeListener,
[listener], [listener],
@ -1179,15 +946,15 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
), ),
) as _i8.SecureStorageInterface); ) as _i8.SecureStorageInterface);
@override @override
List<_i23.NodeModel> get primaryNodes => (super.noSuchMethod( List<_i22.NodeModel> get primaryNodes => (super.noSuchMethod(
Invocation.getter(#primaryNodes), Invocation.getter(#primaryNodes),
returnValue: <_i23.NodeModel>[], returnValue: <_i22.NodeModel>[],
) as List<_i23.NodeModel>); ) as List<_i22.NodeModel>);
@override @override
List<_i23.NodeModel> get nodes => (super.noSuchMethod( List<_i22.NodeModel> get nodes => (super.noSuchMethod(
Invocation.getter(#nodes), Invocation.getter(#nodes),
returnValue: <_i23.NodeModel>[], returnValue: <_i22.NodeModel>[],
) as List<_i23.NodeModel>); ) as List<_i22.NodeModel>);
@override @override
bool get hasListeners => (super.noSuchMethod( bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners), Invocation.getter(#hasListeners),
@ -1204,8 +971,8 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i10.Future<void> setPrimaryNodeFor({ _i10.Future<void> setPrimaryNodeFor({
required _i14.Coin? coin, required _i19.Coin? coin,
required _i23.NodeModel? node, required _i22.NodeModel? node,
bool? shouldNotifyListeners = false, bool? shouldNotifyListeners = false,
}) => }) =>
(super.noSuchMethod( (super.noSuchMethod(
@ -1222,40 +989,40 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: _i10.Future<void>.value(), returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i23.NodeModel? getPrimaryNodeFor({required _i14.Coin? coin}) => _i22.NodeModel? getPrimaryNodeFor({required _i19.Coin? coin}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getPrimaryNodeFor, #getPrimaryNodeFor,
[], [],
{#coin: coin}, {#coin: coin},
)) as _i23.NodeModel?); )) as _i22.NodeModel?);
@override @override
List<_i23.NodeModel> getNodesFor(_i14.Coin? coin) => (super.noSuchMethod( List<_i22.NodeModel> getNodesFor(_i19.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#getNodesFor, #getNodesFor,
[coin], [coin],
), ),
returnValue: <_i23.NodeModel>[], returnValue: <_i22.NodeModel>[],
) as List<_i23.NodeModel>); ) as List<_i22.NodeModel>);
@override @override
_i23.NodeModel? getNodeById({required String? id}) => _i22.NodeModel? getNodeById({required String? id}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getNodeById, #getNodeById,
[], [],
{#id: id}, {#id: id},
)) as _i23.NodeModel?); )) as _i22.NodeModel?);
@override @override
List<_i23.NodeModel> failoverNodesFor({required _i14.Coin? coin}) => List<_i22.NodeModel> failoverNodesFor({required _i19.Coin? coin}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#failoverNodesFor, #failoverNodesFor,
[], [],
{#coin: coin}, {#coin: coin},
), ),
returnValue: <_i23.NodeModel>[], returnValue: <_i22.NodeModel>[],
) as List<_i23.NodeModel>); ) as List<_i22.NodeModel>);
@override @override
_i10.Future<void> add( _i10.Future<void> add(
_i23.NodeModel? node, _i22.NodeModel? node,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -1307,7 +1074,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
_i10.Future<void> edit( _i10.Future<void> edit(
_i23.NodeModel? editedNode, _i22.NodeModel? editedNode,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -1333,7 +1100,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: _i10.Future<void>.value(), returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>); ) as _i10.Future<void>);
@override @override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( void addListener(_i20.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#addListener, #addListener,
[listener], [listener],
@ -1341,7 +1108,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#removeListener, #removeListener,
[listener], [listener],

View file

@ -208,6 +208,7 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
_i10.Future<void> loadAfterStackRestore( _i10.Future<void> loadAfterStackRestore(
_i12.Prefs? prefs, _i12.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -215,6 +216,7 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i10.Future<void>.value(), returnValue: _i10.Future<void>.value(),

View file

@ -1,11 +1,9 @@
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:stackwallet/services/wallets.dart'; import 'package:stackwallet/services/wallets.dart';
import 'package:stackwallet/services/wallets_service.dart';
import 'package:stackwallet/themes/theme_service.dart'; import 'package:stackwallet/themes/theme_service.dart';
@GenerateMocks([ @GenerateMocks([
Wallets, Wallets,
WalletsService,
ThemeService, ThemeService,
], customMocks: []) ], customMocks: [])
void main() { void main() {

View file

@ -4,18 +4,15 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i8; import 'dart:async' as _i8;
import 'dart:typed_data' as _i17; import 'dart:typed_data' as _i14;
import 'dart:ui' as _i14;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i16; import 'package:stackwallet/models/isar/stack_theme.dart' as _i13;
import 'package:stackwallet/networking/http.dart' as _i6; import 'package:stackwallet/networking/http.dart' as _i6;
import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/node_service.dart' as _i2;
import 'package:stackwallet/services/wallets.dart' as _i7; import 'package:stackwallet/services/wallets.dart' as _i7;
import 'package:stackwallet/services/wallets_service.dart' as _i12; import 'package:stackwallet/themes/theme_service.dart' as _i12;
import 'package:stackwallet/themes/theme_service.dart' as _i15;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i13;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i10; as _i10;
import 'package:stackwallet/utilities/prefs.dart' as _i11; import 'package:stackwallet/utilities/prefs.dart' as _i11;
@ -180,6 +177,7 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
_i8.Future<void> loadAfterStackRestore( _i8.Future<void> loadAfterStackRestore(
_i11.Prefs? prefs, _i11.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -187,6 +185,7 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i8.Future<void>.value(), returnValue: _i8.Future<void>.value(),
@ -194,244 +193,10 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
) as _i8.Future<void>); ) as _i8.Future<void>);
} }
/// A class which mocks [WalletsService].
///
/// See the documentation for Mockito's code generation for more information.
class MockWalletsService extends _i1.Mock implements _i12.WalletsService {
MockWalletsService() {
_i1.throwOnMissingStub(this);
}
@override
_i8.Future<Map<String, _i12.WalletInfo>> get walletNames =>
(super.noSuchMethod(
Invocation.getter(#walletNames),
returnValue: _i8.Future<Map<String, _i12.WalletInfo>>.value(
<String, _i12.WalletInfo>{}),
) as _i8.Future<Map<String, _i12.WalletInfo>>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i8.Future<bool> renameWallet({
required String? from,
required String? to,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#renameWallet,
[],
{
#from: from,
#to: to,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
Map<String, _i12.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Invocation.method(
#fetchWalletsData,
[],
),
returnValue: <String, _i12.WalletInfo>{},
) as Map<String, _i12.WalletInfo>);
@override
_i8.Future<void> addExistingStackWallet({
required String? name,
required String? walletId,
required _i13.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addExistingStackWallet,
[],
{
#name: name,
#walletId: walletId,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<String?> addNewWallet({
required String? name,
required _i13.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addNewWallet,
[],
{
#name: name,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
_i8.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
Invocation.method(
#getFavoriteWalletIds,
[],
),
returnValue: _i8.Future<List<String>>.value(<String>[]),
) as _i8.Future<List<String>>);
@override
_i8.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
(super.noSuchMethod(
Invocation.method(
#saveFavoriteWalletIds,
[walletIds],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#addFavorite,
[walletId],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#removeFavorite,
[walletId],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<void> moveFavorite({
required int? fromIndex,
required int? toIndex,
}) =>
(super.noSuchMethod(
Invocation.method(
#moveFavorite,
[],
{
#fromIndex: fromIndex,
#toIndex: toIndex,
},
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
Invocation.method(
#checkForDuplicate,
[name],
),
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i8.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
Invocation.method(
#getWalletId,
[walletName],
),
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
_i8.Future<bool> isMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#isMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i8.Future<void> setMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#setMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<int> deleteWallet(
String? name,
bool? shouldNotifyListeners,
) =>
(super.noSuchMethod(
Invocation.method(
#deleteWallet,
[
name,
shouldNotifyListeners,
],
),
returnValue: _i8.Future<int>.value(0),
) as _i8.Future<int>);
@override
_i8.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#refreshWallets,
[shouldNotifyListeners],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
void addListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
#dispose,
[],
),
returnValueForMissingStub: null,
);
@override
void notifyListeners() => super.noSuchMethod(
Invocation.method(
#notifyListeners,
[],
),
returnValueForMissingStub: null,
);
}
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i15.ThemeService { class MockThemeService extends _i1.Mock implements _i12.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -461,10 +226,10 @@ class MockThemeService extends _i1.Mock implements _i15.ThemeService {
), ),
) as _i3.MainDB); ) as _i3.MainDB);
@override @override
List<_i16.StackTheme> get installedThemes => (super.noSuchMethod( List<_i13.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i16.StackTheme>[], returnValue: <_i13.StackTheme>[],
) as List<_i16.StackTheme>); ) as List<_i13.StackTheme>);
@override @override
void init(_i3.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
@ -474,7 +239,7 @@ class MockThemeService extends _i1.Mock implements _i15.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i8.Future<void> install({required _i17.Uint8List? themeArchiveData}) => _i8.Future<void> install({required _i14.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
@ -514,31 +279,31 @@ class MockThemeService extends _i1.Mock implements _i15.ThemeService {
returnValue: _i8.Future<bool>.value(false), returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>); ) as _i8.Future<bool>);
@override @override
_i8.Future<List<_i15.StackThemeMetaData>> fetchThemes() => _i8.Future<List<_i12.StackThemeMetaData>> fetchThemes() =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i8.Future<List<_i15.StackThemeMetaData>>.value( returnValue: _i8.Future<List<_i12.StackThemeMetaData>>.value(
<_i15.StackThemeMetaData>[]), <_i12.StackThemeMetaData>[]),
) as _i8.Future<List<_i15.StackThemeMetaData>>); ) as _i8.Future<List<_i12.StackThemeMetaData>>);
@override @override
_i8.Future<_i17.Uint8List> fetchTheme( _i8.Future<_i14.Uint8List> fetchTheme(
{required _i15.StackThemeMetaData? themeMetaData}) => {required _i12.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i8.Future<_i17.Uint8List>.value(_i17.Uint8List(0)), returnValue: _i8.Future<_i14.Uint8List>.value(_i14.Uint8List(0)),
) as _i8.Future<_i17.Uint8List>); ) as _i8.Future<_i14.Uint8List>);
@override @override
_i16.StackTheme? getTheme({required String? themeId}) => _i13.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i16.StackTheme?); )) as _i13.StackTheme?);
} }

View file

@ -246,6 +246,7 @@ class MockWallets extends _i1.Mock implements _i10.Wallets {
_i11.Future<void> loadAfterStackRestore( _i11.Future<void> loadAfterStackRestore(
_i14.Prefs? prefs, _i14.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -253,6 +254,7 @@ class MockWallets extends _i1.Mock implements _i10.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i11.Future<void>.value(), returnValue: _i11.Future<void>.value(),
@ -877,11 +879,6 @@ class MockPriceService extends _i1.Mock implements _i21.PriceService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
Set<String> get tokenContractAddressesToCheck => (super.noSuchMethod(
Invocation.getter(#tokenContractAddressesToCheck),
returnValue: <String>{},
) as Set<String>);
@override
Duration get updateInterval => (super.noSuchMethod( Duration get updateInterval => (super.noSuchMethod(
Invocation.getter(#updateInterval), Invocation.getter(#updateInterval),
returnValue: _FakeDuration_4( returnValue: _FakeDuration_4(
@ -890,6 +887,12 @@ class MockPriceService extends _i1.Mock implements _i21.PriceService {
), ),
) as Duration); ) as Duration);
@override @override
_i11.Future<Set<String>> get tokenContractAddressesToCheck =>
(super.noSuchMethod(
Invocation.getter(#tokenContractAddressesToCheck),
returnValue: _i11.Future<Set<String>>.value(<String>{}),
) as _i11.Future<Set<String>>);
@override
bool get hasListeners => (super.noSuchMethod( bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners), Invocation.getter(#hasListeners),
returnValue: false, returnValue: false,

View file

@ -179,6 +179,7 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
_i8.Future<void> loadAfterStackRestore( _i8.Future<void> loadAfterStackRestore(
_i11.Prefs? prefs, _i11.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -186,6 +187,7 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i8.Future<void>.value(), returnValue: _i8.Future<void>.value(),

View file

@ -1,11 +1,9 @@
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/wallets.dart'; import 'package:stackwallet/services/wallets.dart';
import 'package:stackwallet/services/wallets_service.dart';
@GenerateMocks([ @GenerateMocks([
Wallets, Wallets,
WalletsService,
], customMocks: [ ], customMocks: [
MockSpec<NodeService>(returnNullOnMissingStub: true), MockSpec<NodeService>(returnNullOnMissingStub: true),
// MockSpec<WalletsService>(returnNullOnMissingStub: true), // MockSpec<WalletsService>(returnNullOnMissingStub: true),

View file

@ -8,10 +8,9 @@ import 'dart:ui' as _i13;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/node_model.dart' as _i14; import 'package:stackwallet/models/node_model.dart' as _i11;
import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/node_service.dart' as _i2;
import 'package:stackwallet/services/wallets.dart' as _i7; import 'package:stackwallet/services/wallets.dart' as _i7;
import 'package:stackwallet/services/wallets_service.dart' as _i11;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i12; import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i12;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i6; as _i6;
@ -178,6 +177,7 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
_i8.Future<void> loadAfterStackRestore( _i8.Future<void> loadAfterStackRestore(
_i10.Prefs? prefs, _i10.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -185,6 +185,7 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i8.Future<void>.value(), returnValue: _i8.Future<void>.value(),
@ -192,240 +193,6 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
) as _i8.Future<void>); ) as _i8.Future<void>);
} }
/// A class which mocks [WalletsService].
///
/// See the documentation for Mockito's code generation for more information.
class MockWalletsService extends _i1.Mock implements _i11.WalletsService {
MockWalletsService() {
_i1.throwOnMissingStub(this);
}
@override
_i8.Future<Map<String, _i11.WalletInfo>> get walletNames =>
(super.noSuchMethod(
Invocation.getter(#walletNames),
returnValue: _i8.Future<Map<String, _i11.WalletInfo>>.value(
<String, _i11.WalletInfo>{}),
) as _i8.Future<Map<String, _i11.WalletInfo>>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i8.Future<bool> renameWallet({
required String? from,
required String? to,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#renameWallet,
[],
{
#from: from,
#to: to,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
Map<String, _i11.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Invocation.method(
#fetchWalletsData,
[],
),
returnValue: <String, _i11.WalletInfo>{},
) as Map<String, _i11.WalletInfo>);
@override
_i8.Future<void> addExistingStackWallet({
required String? name,
required String? walletId,
required _i12.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addExistingStackWallet,
[],
{
#name: name,
#walletId: walletId,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<String?> addNewWallet({
required String? name,
required _i12.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addNewWallet,
[],
{
#name: name,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
_i8.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
Invocation.method(
#getFavoriteWalletIds,
[],
),
returnValue: _i8.Future<List<String>>.value(<String>[]),
) as _i8.Future<List<String>>);
@override
_i8.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
(super.noSuchMethod(
Invocation.method(
#saveFavoriteWalletIds,
[walletIds],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#addFavorite,
[walletId],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#removeFavorite,
[walletId],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<void> moveFavorite({
required int? fromIndex,
required int? toIndex,
}) =>
(super.noSuchMethod(
Invocation.method(
#moveFavorite,
[],
{
#fromIndex: fromIndex,
#toIndex: toIndex,
},
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
Invocation.method(
#checkForDuplicate,
[name],
),
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i8.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
Invocation.method(
#getWalletId,
[walletName],
),
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
_i8.Future<bool> isMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#isMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i8.Future<void> setMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#setMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i8.Future<int> deleteWallet(
String? name,
bool? shouldNotifyListeners,
) =>
(super.noSuchMethod(
Invocation.method(
#deleteWallet,
[
name,
shouldNotifyListeners,
],
),
returnValue: _i8.Future<int>.value(0),
) as _i8.Future<int>);
@override
_i8.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#refreshWallets,
[shouldNotifyListeners],
),
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
void addListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
#dispose,
[],
),
returnValueForMissingStub: null,
);
@override
void notifyListeners() => super.noSuchMethod(
Invocation.method(
#notifyListeners,
[],
),
returnValueForMissingStub: null,
);
}
/// A class which mocks [NodeService]. /// A class which mocks [NodeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
@ -439,15 +206,15 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
), ),
) as _i6.SecureStorageInterface); ) as _i6.SecureStorageInterface);
@override @override
List<_i14.NodeModel> get primaryNodes => (super.noSuchMethod( List<_i11.NodeModel> get primaryNodes => (super.noSuchMethod(
Invocation.getter(#primaryNodes), Invocation.getter(#primaryNodes),
returnValue: <_i14.NodeModel>[], returnValue: <_i11.NodeModel>[],
) as List<_i14.NodeModel>); ) as List<_i11.NodeModel>);
@override @override
List<_i14.NodeModel> get nodes => (super.noSuchMethod( List<_i11.NodeModel> get nodes => (super.noSuchMethod(
Invocation.getter(#nodes), Invocation.getter(#nodes),
returnValue: <_i14.NodeModel>[], returnValue: <_i11.NodeModel>[],
) as List<_i14.NodeModel>); ) as List<_i11.NodeModel>);
@override @override
bool get hasListeners => (super.noSuchMethod( bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners), Invocation.getter(#hasListeners),
@ -465,7 +232,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
@override @override
_i8.Future<void> setPrimaryNodeFor({ _i8.Future<void> setPrimaryNodeFor({
required _i12.Coin? coin, required _i12.Coin? coin,
required _i14.NodeModel? node, required _i11.NodeModel? node,
bool? shouldNotifyListeners = false, bool? shouldNotifyListeners = false,
}) => }) =>
(super.noSuchMethod( (super.noSuchMethod(
@ -482,40 +249,40 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: _i8.Future<void>.value(), returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>); ) as _i8.Future<void>);
@override @override
_i14.NodeModel? getPrimaryNodeFor({required _i12.Coin? coin}) => _i11.NodeModel? getPrimaryNodeFor({required _i12.Coin? coin}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getPrimaryNodeFor, #getPrimaryNodeFor,
[], [],
{#coin: coin}, {#coin: coin},
)) as _i14.NodeModel?); )) as _i11.NodeModel?);
@override @override
List<_i14.NodeModel> getNodesFor(_i12.Coin? coin) => (super.noSuchMethod( List<_i11.NodeModel> getNodesFor(_i12.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#getNodesFor, #getNodesFor,
[coin], [coin],
), ),
returnValue: <_i14.NodeModel>[], returnValue: <_i11.NodeModel>[],
) as List<_i14.NodeModel>); ) as List<_i11.NodeModel>);
@override @override
_i14.NodeModel? getNodeById({required String? id}) => _i11.NodeModel? getNodeById({required String? id}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getNodeById, #getNodeById,
[], [],
{#id: id}, {#id: id},
)) as _i14.NodeModel?); )) as _i11.NodeModel?);
@override @override
List<_i14.NodeModel> failoverNodesFor({required _i12.Coin? coin}) => List<_i11.NodeModel> failoverNodesFor({required _i12.Coin? coin}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#failoverNodesFor, #failoverNodesFor,
[], [],
{#coin: coin}, {#coin: coin},
), ),
returnValue: <_i14.NodeModel>[], returnValue: <_i11.NodeModel>[],
) as List<_i14.NodeModel>); ) as List<_i11.NodeModel>);
@override @override
_i8.Future<void> add( _i8.Future<void> add(
_i14.NodeModel? node, _i11.NodeModel? node,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -567,7 +334,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
) as _i8.Future<void>); ) as _i8.Future<void>);
@override @override
_i8.Future<void> edit( _i8.Future<void> edit(
_i14.NodeModel? editedNode, _i11.NodeModel? editedNode,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>

View file

@ -6,7 +6,6 @@ import 'package:stackwallet/themes/theme_service.dart';
@GenerateMocks([ @GenerateMocks([
Wallets, Wallets,
WalletsService,
ThemeService, ThemeService,
], customMocks: [ ], customMocks: [
MockSpec<NodeService>(returnNullOnMissingStub: true), MockSpec<NodeService>(returnNullOnMissingStub: true),

View file

@ -4,19 +4,18 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i9; import 'dart:async' as _i9;
import 'dart:typed_data' as _i17; import 'dart:typed_data' as _i14;
import 'dart:ui' as _i14; import 'dart:ui' as _i17;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i16; import 'package:stackwallet/models/isar/stack_theme.dart' as _i13;
import 'package:stackwallet/models/node_model.dart' as _i18; import 'package:stackwallet/models/node_model.dart' as _i15;
import 'package:stackwallet/networking/http.dart' as _i6; import 'package:stackwallet/networking/http.dart' as _i6;
import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/node_service.dart' as _i2;
import 'package:stackwallet/services/wallets.dart' as _i8; import 'package:stackwallet/services/wallets.dart' as _i8;
import 'package:stackwallet/services/wallets_service.dart' as _i12; import 'package:stackwallet/themes/theme_service.dart' as _i12;
import 'package:stackwallet/themes/theme_service.dart' as _i15; import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i16;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i13;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i7; as _i7;
import 'package:stackwallet/utilities/prefs.dart' as _i11; import 'package:stackwallet/utilities/prefs.dart' as _i11;
@ -192,6 +191,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
_i9.Future<void> loadAfterStackRestore( _i9.Future<void> loadAfterStackRestore(
_i11.Prefs? prefs, _i11.Prefs? prefs,
List<_i5.Wallet<_i4.CryptoCurrency>>? wallets, List<_i5.Wallet<_i4.CryptoCurrency>>? wallets,
bool? isDesktop,
) => ) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
@ -199,6 +199,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
[ [
prefs, prefs,
wallets, wallets,
isDesktop,
], ],
), ),
returnValue: _i9.Future<void>.value(), returnValue: _i9.Future<void>.value(),
@ -206,244 +207,10 @@ class MockWallets extends _i1.Mock implements _i8.Wallets {
) as _i9.Future<void>); ) as _i9.Future<void>);
} }
/// A class which mocks [WalletsService].
///
/// See the documentation for Mockito's code generation for more information.
class MockWalletsService extends _i1.Mock implements _i12.WalletsService {
MockWalletsService() {
_i1.throwOnMissingStub(this);
}
@override
_i9.Future<Map<String, _i12.WalletInfo>> get walletNames =>
(super.noSuchMethod(
Invocation.getter(#walletNames),
returnValue: _i9.Future<Map<String, _i12.WalletInfo>>.value(
<String, _i12.WalletInfo>{}),
) as _i9.Future<Map<String, _i12.WalletInfo>>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i9.Future<bool> renameWallet({
required String? from,
required String? to,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#renameWallet,
[],
{
#from: from,
#to: to,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
@override
Map<String, _i12.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Invocation.method(
#fetchWalletsData,
[],
),
returnValue: <String, _i12.WalletInfo>{},
) as Map<String, _i12.WalletInfo>);
@override
_i9.Future<void> addExistingStackWallet({
required String? name,
required String? walletId,
required _i13.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addExistingStackWallet,
[],
{
#name: name,
#walletId: walletId,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<String?> addNewWallet({
required String? name,
required _i13.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
Invocation.method(
#addNewWallet,
[],
{
#name: name,
#coin: coin,
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i9.Future<String?>.value(),
) as _i9.Future<String?>);
@override
_i9.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
Invocation.method(
#getFavoriteWalletIds,
[],
),
returnValue: _i9.Future<List<String>>.value(<String>[]),
) as _i9.Future<List<String>>);
@override
_i9.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
(super.noSuchMethod(
Invocation.method(
#saveFavoriteWalletIds,
[walletIds],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#addFavorite,
[walletId],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#removeFavorite,
[walletId],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<void> moveFavorite({
required int? fromIndex,
required int? toIndex,
}) =>
(super.noSuchMethod(
Invocation.method(
#moveFavorite,
[],
{
#fromIndex: fromIndex,
#toIndex: toIndex,
},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
Invocation.method(
#checkForDuplicate,
[name],
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
@override
_i9.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
Invocation.method(
#getWalletId,
[walletName],
),
returnValue: _i9.Future<String?>.value(),
) as _i9.Future<String?>);
@override
_i9.Future<bool> isMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#isMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
@override
_i9.Future<void> setMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#setMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
_i9.Future<int> deleteWallet(
String? name,
bool? shouldNotifyListeners,
) =>
(super.noSuchMethod(
Invocation.method(
#deleteWallet,
[
name,
shouldNotifyListeners,
],
),
returnValue: _i9.Future<int>.value(0),
) as _i9.Future<int>);
@override
_i9.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#refreshWallets,
[shouldNotifyListeners],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
@override
void addListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
),
returnValueForMissingStub: null,
);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
#dispose,
[],
),
returnValueForMissingStub: null,
);
@override
void notifyListeners() => super.noSuchMethod(
Invocation.method(
#notifyListeners,
[],
),
returnValueForMissingStub: null,
);
}
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i15.ThemeService { class MockThemeService extends _i1.Mock implements _i12.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -473,10 +240,10 @@ class MockThemeService extends _i1.Mock implements _i15.ThemeService {
), ),
) as _i3.MainDB); ) as _i3.MainDB);
@override @override
List<_i16.StackTheme> get installedThemes => (super.noSuchMethod( List<_i13.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i16.StackTheme>[], returnValue: <_i13.StackTheme>[],
) as List<_i16.StackTheme>); ) as List<_i13.StackTheme>);
@override @override
void init(_i3.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
@ -486,7 +253,7 @@ class MockThemeService extends _i1.Mock implements _i15.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i9.Future<void> install({required _i17.Uint8List? themeArchiveData}) => _i9.Future<void> install({required _i14.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
@ -526,33 +293,33 @@ class MockThemeService extends _i1.Mock implements _i15.ThemeService {
returnValue: _i9.Future<bool>.value(false), returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>); ) as _i9.Future<bool>);
@override @override
_i9.Future<List<_i15.StackThemeMetaData>> fetchThemes() => _i9.Future<List<_i12.StackThemeMetaData>> fetchThemes() =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i9.Future<List<_i15.StackThemeMetaData>>.value( returnValue: _i9.Future<List<_i12.StackThemeMetaData>>.value(
<_i15.StackThemeMetaData>[]), <_i12.StackThemeMetaData>[]),
) as _i9.Future<List<_i15.StackThemeMetaData>>); ) as _i9.Future<List<_i12.StackThemeMetaData>>);
@override @override
_i9.Future<_i17.Uint8List> fetchTheme( _i9.Future<_i14.Uint8List> fetchTheme(
{required _i15.StackThemeMetaData? themeMetaData}) => {required _i12.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i9.Future<_i17.Uint8List>.value(_i17.Uint8List(0)), returnValue: _i9.Future<_i14.Uint8List>.value(_i14.Uint8List(0)),
) as _i9.Future<_i17.Uint8List>); ) as _i9.Future<_i14.Uint8List>);
@override @override
_i16.StackTheme? getTheme({required String? themeId}) => _i13.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i16.StackTheme?); )) as _i13.StackTheme?);
} }
/// A class which mocks [NodeService]. /// A class which mocks [NodeService].
@ -568,15 +335,15 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
), ),
) as _i7.SecureStorageInterface); ) as _i7.SecureStorageInterface);
@override @override
List<_i18.NodeModel> get primaryNodes => (super.noSuchMethod( List<_i15.NodeModel> get primaryNodes => (super.noSuchMethod(
Invocation.getter(#primaryNodes), Invocation.getter(#primaryNodes),
returnValue: <_i18.NodeModel>[], returnValue: <_i15.NodeModel>[],
) as List<_i18.NodeModel>); ) as List<_i15.NodeModel>);
@override @override
List<_i18.NodeModel> get nodes => (super.noSuchMethod( List<_i15.NodeModel> get nodes => (super.noSuchMethod(
Invocation.getter(#nodes), Invocation.getter(#nodes),
returnValue: <_i18.NodeModel>[], returnValue: <_i15.NodeModel>[],
) as List<_i18.NodeModel>); ) as List<_i15.NodeModel>);
@override @override
bool get hasListeners => (super.noSuchMethod( bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners), Invocation.getter(#hasListeners),
@ -593,8 +360,8 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
) as _i9.Future<void>); ) as _i9.Future<void>);
@override @override
_i9.Future<void> setPrimaryNodeFor({ _i9.Future<void> setPrimaryNodeFor({
required _i13.Coin? coin, required _i16.Coin? coin,
required _i18.NodeModel? node, required _i15.NodeModel? node,
bool? shouldNotifyListeners = false, bool? shouldNotifyListeners = false,
}) => }) =>
(super.noSuchMethod( (super.noSuchMethod(
@ -611,40 +378,40 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: _i9.Future<void>.value(), returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>); ) as _i9.Future<void>);
@override @override
_i18.NodeModel? getPrimaryNodeFor({required _i13.Coin? coin}) => _i15.NodeModel? getPrimaryNodeFor({required _i16.Coin? coin}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getPrimaryNodeFor, #getPrimaryNodeFor,
[], [],
{#coin: coin}, {#coin: coin},
)) as _i18.NodeModel?); )) as _i15.NodeModel?);
@override @override
List<_i18.NodeModel> getNodesFor(_i13.Coin? coin) => (super.noSuchMethod( List<_i15.NodeModel> getNodesFor(_i16.Coin? coin) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#getNodesFor, #getNodesFor,
[coin], [coin],
), ),
returnValue: <_i18.NodeModel>[], returnValue: <_i15.NodeModel>[],
) as List<_i18.NodeModel>); ) as List<_i15.NodeModel>);
@override @override
_i18.NodeModel? getNodeById({required String? id}) => _i15.NodeModel? getNodeById({required String? id}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getNodeById, #getNodeById,
[], [],
{#id: id}, {#id: id},
)) as _i18.NodeModel?); )) as _i15.NodeModel?);
@override @override
List<_i18.NodeModel> failoverNodesFor({required _i13.Coin? coin}) => List<_i15.NodeModel> failoverNodesFor({required _i16.Coin? coin}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#failoverNodesFor, #failoverNodesFor,
[], [],
{#coin: coin}, {#coin: coin},
), ),
returnValue: <_i18.NodeModel>[], returnValue: <_i15.NodeModel>[],
) as List<_i18.NodeModel>); ) as List<_i15.NodeModel>);
@override @override
_i9.Future<void> add( _i9.Future<void> add(
_i18.NodeModel? node, _i15.NodeModel? node,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -696,7 +463,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
) as _i9.Future<void>); ) as _i9.Future<void>);
@override @override
_i9.Future<void> edit( _i9.Future<void> edit(
_i18.NodeModel? editedNode, _i15.NodeModel? editedNode,
String? password, String? password,
bool? shouldNotifyListeners, bool? shouldNotifyListeners,
) => ) =>
@ -722,7 +489,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: _i9.Future<void>.value(), returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>); ) as _i9.Future<void>);
@override @override
void addListener(_i14.VoidCallback? listener) => super.noSuchMethod( void addListener(_i17.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#addListener, #addListener,
[listener], [listener],
@ -730,7 +497,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod( void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod(
Invocation.method( Invocation.method(
#removeListener, #removeListener,
[listener], [listener],