refactor various electrumx class names

This commit is contained in:
julian 2023-11-14 14:31:53 -06:00
parent 7377a9d6e7
commit 5b5908196d
43 changed files with 333 additions and 315 deletions

View file

@ -13,7 +13,7 @@ import 'package:isar/isar.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/db/migrate_wallets_to_isar.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/contact.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
@ -55,7 +55,7 @@ class DbVersionMigrator with WalletDB {
final walletInfoList = await walletsService.walletNames;
await prefs.init();
ElectrumX? client;
ElectrumXClient? client;
int? latestSetId;
// only instantiate client if there are firo wallets
@ -77,7 +77,7 @@ class DbVersionMigrator with WalletDB {
)
.toList();
client = ElectrumX.from(
client = ElectrumXClient.from(
node: ElectrumXNode(
address: node.host,
port: node.port,

View file

@ -11,24 +11,24 @@
import 'dart:convert';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:string_validator/string_validator.dart';
class CachedElectrumX {
final ElectrumX electrumXClient;
class CachedElectrumXClient {
final ElectrumXClient electrumXClient;
static const minCacheConfirms = 30;
const CachedElectrumX({
const CachedElectrumXClient({
required this.electrumXClient,
});
factory CachedElectrumX.from({
required ElectrumX electrumXClient,
factory CachedElectrumXClient.from({
required ElectrumXClient electrumXClient,
}) =>
CachedElectrumX(
CachedElectrumXClient(
electrumXClient: electrumXClient,
);

View file

@ -58,7 +58,7 @@ class ElectrumXNode {
}
}
class ElectrumX {
class ElectrumXClient {
String get host => _host;
late String _host;
@ -81,7 +81,7 @@ class ElectrumX {
// add finalizer to cancel stream subscription when all references to an
// instance of ElectrumX becomes inaccessible
static final Finalizer<ElectrumX> _finalizer = Finalizer(
static final Finalizer<ElectrumXClient> _finalizer = Finalizer(
(p0) {
p0._torPreferenceListener?.cancel();
p0._torStatusListener?.cancel();
@ -93,7 +93,7 @@ class ElectrumX {
final Mutex _torConnectingLock = Mutex();
bool _requireMutex = false;
ElectrumX({
ElectrumXClient({
required String host,
required int port,
required bool useSSL,
@ -158,14 +158,14 @@ class ElectrumX {
);
}
factory ElectrumX.from({
factory ElectrumXClient.from({
required ElectrumXNode node,
required Prefs prefs,
required List<ElectrumXNode> failovers,
TorService? torService,
EventBus? globalEventBusForTesting,
}) {
return ElectrumX(
return ElectrumXClient(
host: node.address,
port: node.port,
useSSL: node.useSSL,

View file

@ -18,8 +18,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
@ -367,7 +367,7 @@ class HiddenSettings extends StatelessWidget {
.getPrimaryNodeFor(
coin: Coin.bitcoincash)!;
final e = ElectrumX.from(
final e = ElectrumXClient.from(
node: ElectrumXNode(
address: n.host,
port: n.port,
@ -381,7 +381,7 @@ class HiddenSettings extends StatelessWidget {
);
final ce =
CachedElectrumX(electrumXClient: e);
CachedElectrumXClient(electrumXClient: e);
final txids = [
"", // cashTokenTxid
@ -452,7 +452,7 @@ class HiddenSettings extends StatelessWidget {
.getPrimaryNodeFor(
coin: Coin.bitcoincash)!;
final e = ElectrumX.from(
final e = ElectrumXClient.from(
node: ElectrumXNode(
address: n.host,
port: n.port,

View file

@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/secure_store_provider.dart';
@ -170,7 +170,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
case Coin.bitcoincashTestnet:
case Coin.firoTestNet:
case Coin.dogecoinTestNet:
final client = ElectrumX(
final client = ElectrumXClient(
host: formData.host!,
port: formData.port!,
useSSL: formData.useSSL!,

View file

@ -13,7 +13,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import 'package:stackwallet/providers/global/secure_store_provider.dart';
@ -147,7 +147,7 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
case Coin.litecoinTestNet:
case Coin.bitcoincashTestnet:
case Coin.eCash:
final client = ElectrumX(
final client = ElectrumXClient(
host: node!.host,
port: node.port,
useSSL: node.useSSL,

View file

@ -22,8 +22,8 @@ import 'package:bs58check/bs58check.dart' as bs58check;
import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'
as stack_address;
@ -125,8 +125,8 @@ class BitcoinCashWallet extends CoinServiceAPI
required String walletId,
required String walletName,
required Coin coin,
required ElectrumX client,
required CachedElectrumX cachedClient,
required ElectrumXClient client,
required CachedElectrumXClient cachedClient,
required TransactionNotificationTracker tracker,
required SecureStorageInterface secureStore,
MainDB? mockableOverride,
@ -1371,13 +1371,13 @@ class BitcoinCashWallet extends CoinServiceAPI
@override
set walletName(String newName) => _walletName = newName;
late ElectrumX _electrumXClient;
late ElectrumXClient _electrumXClient;
ElectrumX get electrumXClient => _electrumXClient;
ElectrumXClient get electrumXClient => _electrumXClient;
late CachedElectrumX _cachedElectrumXClient;
late CachedElectrumXClient _cachedElectrumXClient;
CachedElectrumX get cachedElectrumXClient => _cachedElectrumXClient;
CachedElectrumXClient get cachedElectrumXClient => _cachedElectrumXClient;
late SecureStorageInterface _secureStore;
@ -1394,12 +1394,12 @@ class BitcoinCashWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_electrumXClient = ElectrumX.from(
_electrumXClient = ElectrumXClient.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
_cachedElectrumXClient = CachedElectrumXClient.from(
electrumXClient: _electrumXClient,
);

View file

@ -8,8 +8,8 @@
*
*/
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
import 'package:stackwallet/models/node_model.dart';
@ -64,7 +64,7 @@ abstract class CoinServiceAPI {
id: node.id,
useSSL: node.useSSL,
);
final client = ElectrumX.from(
final client = ElectrumXClient.from(
node: electrumxNode,
failovers: failovers
.map((e) => ElectrumXNode(
@ -77,7 +77,7 @@ abstract class CoinServiceAPI {
.toList(),
prefs: prefs,
);
final cachedClient = CachedElectrumX.from(
final cachedClient = CachedElectrumXClient.from(
electrumXClient: client,
);
switch (coin) {

View file

@ -23,8 +23,8 @@ import 'package:isar/isar.dart';
import 'package:lelantus/lelantus.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
import 'package:stackwallet/models/lelantus_fee_data.dart';
@ -688,7 +688,7 @@ Future<dynamic> isolateCreateJoinSplitTransaction(
};
}
Future<int> getBlockHead(ElectrumX client) async {
Future<int> getBlockHead(ElectrumXClient client) async {
try {
final tip = await client.getBlockHeadTip();
return tip["height"] as int;
@ -751,8 +751,8 @@ class FiroWallet extends CoinServiceAPI
required String walletId,
required String walletName,
required Coin coin,
required ElectrumX client,
required CachedElectrumX cachedClient,
required ElectrumXClient client,
required CachedElectrumXClient cachedClient,
required TransactionNotificationTracker tracker,
required SecureStorageInterface secureStore,
MainDB? mockableOverride,
@ -1248,13 +1248,13 @@ class FiroWallet extends CoinServiceAPI
return data;
}
late ElectrumX _electrumXClient;
late ElectrumXClient _electrumXClient;
ElectrumX get electrumXClient => _electrumXClient;
ElectrumXClient get electrumXClient => _electrumXClient;
late CachedElectrumX _cachedElectrumXClient;
late CachedElectrumXClient _cachedElectrumXClient;
CachedElectrumX get cachedElectrumXClient => _cachedElectrumXClient;
CachedElectrumXClient get cachedElectrumXClient => _cachedElectrumXClient;
late SecureStorageInterface _secureStore;
@ -1860,12 +1860,12 @@ class FiroWallet extends CoinServiceAPI
)
.toList();
final newNode = await _getCurrentNode();
_electrumXClient = ElectrumX.from(
_electrumXClient = ElectrumXClient.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
_cachedElectrumXClient = CachedElectrumXClient.from(
electrumXClient: _electrumXClient,
);
@ -4990,7 +4990,7 @@ class FiroWallet extends CoinServiceAPI
Future<Map<isar_models.Address, isar_models.Transaction>>
getJMintTransactions(
CachedElectrumX cachedClient,
CachedElectrumXClient cachedClient,
List<String> transactions,
// String currency,
Coin coin,

View file

@ -22,8 +22,8 @@ import 'package:decimal/decimal.dart';
import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
import 'package:stackwallet/models/paymint/fee_object_model.dart';
@ -121,8 +121,8 @@ class LitecoinWallet extends CoinServiceAPI
required String walletId,
required String walletName,
required Coin coin,
required ElectrumX client,
required CachedElectrumX cachedClient,
required ElectrumXClient client,
required CachedElectrumXClient cachedClient,
required TransactionNotificationTracker tracker,
required SecureStorageInterface secureStore,
MainDB? mockableOverride,
@ -1380,13 +1380,13 @@ class LitecoinWallet extends CoinServiceAPI
@override
set walletName(String newName) => _walletName = newName;
late ElectrumX _electrumXClient;
late ElectrumXClient _electrumXClient;
ElectrumX get electrumXClient => _electrumXClient;
ElectrumXClient get electrumXClient => _electrumXClient;
late CachedElectrumX _cachedElectrumXClient;
late CachedElectrumXClient _cachedElectrumXClient;
CachedElectrumX get cachedElectrumXClient => _cachedElectrumXClient;
CachedElectrumXClient get cachedElectrumXClient => _cachedElectrumXClient;
late SecureStorageInterface _secureStore;
@ -1403,12 +1403,12 @@ class LitecoinWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_electrumXClient = ElectrumX.from(
_electrumXClient = ElectrumXClient.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
_cachedElectrumXClient = CachedElectrumXClient.from(
electrumXClient: _electrumXClient,
);

View file

@ -22,8 +22,8 @@ import 'package:decimal/decimal.dart';
import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
import 'package:stackwallet/models/paymint/fee_object_model.dart';
@ -109,8 +109,8 @@ class NamecoinWallet extends CoinServiceAPI
required String walletId,
required String walletName,
required Coin coin,
required ElectrumX client,
required CachedElectrumX cachedClient,
required ElectrumXClient client,
required CachedElectrumXClient cachedClient,
required TransactionNotificationTracker tracker,
required SecureStorageInterface secureStore,
MainDB? mockableOverride,
@ -1362,13 +1362,13 @@ class NamecoinWallet extends CoinServiceAPI
@override
set walletName(String newName) => _walletName = newName;
late ElectrumX _electrumXClient;
late ElectrumXClient _electrumXClient;
ElectrumX get electrumXClient => _electrumXClient;
ElectrumXClient get electrumXClient => _electrumXClient;
late CachedElectrumX _cachedElectrumXClient;
late CachedElectrumXClient _cachedElectrumXClient;
CachedElectrumX get cachedElectrumXClient => _cachedElectrumXClient;
CachedElectrumXClient get cachedElectrumXClient => _cachedElectrumXClient;
late SecureStorageInterface _secureStore;
@ -1385,12 +1385,12 @@ class NamecoinWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_electrumXClient = ElectrumX.from(
_electrumXClient = ElectrumXClient.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
_cachedElectrumXClient = CachedElectrumXClient.from(
electrumXClient: _electrumXClient,
);

View file

@ -22,8 +22,8 @@ import 'package:decimal/decimal.dart';
import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
import 'package:stackwallet/models/paymint/fee_object_model.dart';
@ -104,8 +104,8 @@ class ParticlWallet extends CoinServiceAPI
required String walletId,
required String walletName,
required Coin coin,
required ElectrumX client,
required CachedElectrumX cachedClient,
required ElectrumXClient client,
required CachedElectrumXClient cachedClient,
required TransactionNotificationTracker tracker,
required SecureStorageInterface secureStore,
MainDB? mockableOverride,
@ -1290,13 +1290,13 @@ class ParticlWallet extends CoinServiceAPI
@override
set walletName(String newName) => _walletName = newName;
late ElectrumX _electrumXClient;
late ElectrumXClient _electrumXClient;
ElectrumX get electrumXClient => _electrumXClient;
ElectrumXClient get electrumXClient => _electrumXClient;
late CachedElectrumX _cachedElectrumXClient;
late CachedElectrumXClient _cachedElectrumXClient;
CachedElectrumX get cachedElectrumXClient => _cachedElectrumXClient;
CachedElectrumXClient get cachedElectrumXClient => _cachedElectrumXClient;
late SecureStorageInterface _secureStore;
@ -1313,12 +1313,12 @@ class ParticlWallet extends CoinServiceAPI
))
.toList();
final newNode = await getCurrentNode();
_electrumXClient = ElectrumX.from(
_electrumXClient = ElectrumXClient.from(
node: newNode,
prefs: _prefs,
failovers: failovers,
);
_cachedElectrumXClient = CachedElectrumX.from(
_cachedElectrumXClient = CachedElectrumXClient.from(
electrumXClient: _electrumXClient,
);

View file

@ -12,7 +12,7 @@ import 'dart:convert';
import 'package:bip47/src/util.dart';
import 'package:decimal/decimal.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.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';
@ -32,7 +32,7 @@ mixin ElectrumXParsing {
String txHash,
Coin coin,
String walletId,
CachedElectrumX cachedElectrumX, [
CachedElectrumXClient cachedElectrumX, [
String? debugTitle,
]) async {
final jsonTx = await cachedElectrumX.getTransaction(

View file

@ -8,7 +8,7 @@ import 'package:flutter/foundation.dart';
import 'package:fusiondart/fusiondart.dart' as fusion;
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/models/fusion_progress_ui_state.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart';
@ -127,7 +127,7 @@ mixin FusionWalletInterface {
// Passed in wallet functions.
late final Future<List<Address>> Function({int numberOfAddresses})
_getNextUnusedChangeAddresses;
late final CachedElectrumX Function() _getWalletCachedElectrumX;
late final CachedElectrumXClient Function() _getWalletCachedElectrumX;
late final Future<int> Function() _getChainHeight;
late final Future<void> Function() _updateWalletUTXOS;
late final String Function(String bchAddress, btcdart.NetworkType network)
@ -155,7 +155,7 @@ mixin FusionWalletInterface {
required MainDB db,
required Future<List<Address>> Function({int numberOfAddresses})
getNextUnusedChangeAddress,
required CachedElectrumX Function() getWalletCachedElectrumX,
required CachedElectrumXClient Function() getWalletCachedElectrumX,
required Future<int> Function() getChainHeight,
required Future<void> Function() updateWalletUTXOS,
required Future<String?> mnemonic,

View file

@ -21,7 +21,7 @@ import 'package:bitcoindart/src/utils/script.dart' as bscript;
import 'package:isar/isar.dart';
import 'package:pointycastle/digests/sha256.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/exceptions/wallet/insufficient_balance_exception.dart';
import 'package:stackwallet/exceptions/wallet/paynym_send_exception.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart';
@ -61,7 +61,7 @@ mixin PaynymWalletInterface {
late final btc_dart.NetworkType _network;
late final Coin _coin;
late final MainDB _db;
late final ElectrumX _electrumXClient;
late final ElectrumXClient _electrumXClient;
late final SecureStorageInterface _secureStorage;
late final int _dustLimit;
late final int _dustLimitP2PKH;
@ -97,7 +97,7 @@ mixin PaynymWalletInterface {
required btc_dart.NetworkType network,
required Coin coin,
required MainDB db,
required ElectrumX electrumXClient,
required ElectrumXClient electrumXClient,
required SecureStorageInterface secureStorage,
required int dustLimit,
required int dustLimitP2PKH,

View file

@ -12,7 +12,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/exceptions/electrumx/no_such_transaction.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/models/notification_model.dart';
@ -142,7 +142,7 @@ class NotificationsService extends ChangeNotifier {
))
.toList();
final client = ElectrumX.from(
final client = ElectrumXClient.from(
node: eNode,
failovers: failovers,
prefs: prefs,

View file

@ -5,10 +5,10 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/extensions/extensions.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx_mixin.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart';
import 'package:tuple/tuple.dart';
class BitcoinWallet extends Bip39HDWallet with ElectrumXMixin {
class BitcoinWallet extends Bip39HDWallet with ElectrumX {
@override
int get isarTransactionVersion => 1; // TODO actually set this to 2

View file

@ -15,9 +15,9 @@ import 'package:stackwallet/utilities/extensions/extensions.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx_mixin.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart';
class BitcoincashWallet extends Bip39HDWallet with ElectrumXMixin {
class BitcoincashWallet extends Bip39HDWallet with ElectrumX {
@override
int get isarTransactionVersion => 2;
@ -111,7 +111,7 @@ class BitcoincashWallet extends Bip39HDWallet with ElectrumXMixin {
if (storedTx == null ||
storedTx.height == null ||
(storedTx.height != null && storedTx.height! <= 0)) {
final tx = await electrumXCached.getTransaction(
final tx = await electrumXCachedClient.getTransaction(
txHash: txHash["tx_hash"] as String,
verbose: true,
coin: cryptoCurrency.coin,
@ -153,7 +153,7 @@ class BitcoincashWallet extends Bip39HDWallet with ElectrumXMixin {
final txid = map["txid"] as String;
final vout = map["vout"] as int;
final inputTx = await electrumXCached.getTransaction(
final inputTx = await electrumXCachedClient.getTransaction(
txHash: txid,
coin: cryptoCurrency.coin,
);

View file

@ -5,10 +5,10 @@ import 'package:stackwallet/utilities/extensions/extensions.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/dogecoin.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx_mixin.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart';
import 'package:tuple/tuple.dart';
class DogecoinWallet extends Bip39HDWallet with ElectrumXMixin {
class DogecoinWallet extends Bip39HDWallet with ElectrumX {
DogecoinWallet(CryptoCurrencyNetwork network) : super(Dogecoin(network));
@override

View file

@ -15,9 +15,9 @@ import 'package:stackwallet/utilities/extensions/extensions.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/ecash.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx_mixin.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart';
class EcashWallet extends Bip39HDWallet with ElectrumXMixin {
class EcashWallet extends Bip39HDWallet with ElectrumX {
@override
int get isarTransactionVersion => 2;
@ -111,7 +111,7 @@ class EcashWallet extends Bip39HDWallet with ElectrumXMixin {
if (storedTx == null ||
storedTx.height == null ||
(storedTx.height != null && storedTx.height! <= 0)) {
final tx = await electrumXCached.getTransaction(
final tx = await electrumXCachedClient.getTransaction(
txHash: txHash["tx_hash"] as String,
verbose: true,
coin: cryptoCurrency.coin,
@ -153,7 +153,7 @@ class EcashWallet extends Bip39HDWallet with ElectrumXMixin {
final txid = map["txid"] as String;
final vout = map["vout"] as int;
final inputTx = await electrumXCached.getTransaction(
final inputTx = await electrumXCachedClient.getTransaction(
txHash: txid,
coin: cryptoCurrency.coin,
);

View file

@ -6,8 +6,8 @@ import 'package:bitcoindart/bitcoindart.dart' as bitcoindart;
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:decimal/decimal.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/models/signing_data.dart';
@ -21,9 +21,9 @@ import 'package:stackwallet/wallets/models/tx_data.dart';
import 'package:stackwallet/wallets/wallet/intermediate/bip39_hd_wallet.dart';
import 'package:uuid/uuid.dart';
mixin ElectrumXMixin on Bip39HDWallet {
late ElectrumX electrumX;
late CachedElectrumX electrumXCached;
mixin ElectrumX on Bip39HDWallet {
late ElectrumXClient electrumXClient;
late CachedElectrumXClient electrumXCachedClient;
double? _serverVersion;
bool get serverCanBatch => _serverVersion != null && _serverVersion! >= 1.6;
@ -671,7 +671,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
Future<int> fetchChainHeight() async {
try {
final result = await electrumX.getBlockHeadTip();
final result = await electrumXClient.getBlockHeadTip();
return result["height"] as int;
} catch (e) {
rethrow;
@ -680,7 +680,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
Future<int> fetchTxCount({required String addressScriptHash}) async {
final transactions =
await electrumX.getHistory(scripthash: addressScriptHash);
await electrumXClient.getHistory(scripthash: addressScriptHash);
return transactions.length;
}
@ -694,7 +694,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
cryptoCurrency.addressToScriptHash(address: entry.value),
];
}
final response = await electrumX.getBatchHistory(args: args);
final response = await electrumXClient.getBatchHistory(args: args);
final Map<String, int> result = {};
for (final entry in response.entries) {
@ -728,7 +728,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
List<Map<String, dynamic>> allTransactions = [];
for (final data in allTxHashes) {
final tx = await electrumXCached.getTransaction(
final tx = await electrumXCachedClient.getTransaction(
txHash: data.txHash,
verbose: true,
coin: cryptoCurrency.coin,
@ -783,13 +783,13 @@ mixin ElectrumXMixin on Bip39HDWallet {
.toList();
final newNode = await getCurrentElectrumXNode();
electrumX = ElectrumX.from(
electrumXClient = ElectrumXClient.from(
node: newNode,
prefs: prefs,
failovers: failovers,
);
electrumXCached = CachedElectrumX.from(
electrumXClient: electrumX,
electrumXCachedClient = CachedElectrumXClient.from(
electrumXClient: electrumXClient,
);
}
@ -973,7 +973,8 @@ mixin ElectrumXMixin on Bip39HDWallet {
}
for (int i = 0; i < batches.length; i++) {
final response = await electrumX.getBatchHistory(args: batches[i]!);
final response =
await electrumXClient.getBatchHistory(args: batches[i]!);
for (final entry in response.entries) {
for (int j = 0; j < entry.value.length; j++) {
entry.value[j]["address"] = requestIdToAddressMap[entry.key];
@ -989,7 +990,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
address: allAddresses.elementAt(1),
);
final response = await electrumX.getHistory(
final response = await electrumXClient.getHistory(
scripthash: scriptHash,
);
@ -1014,7 +1015,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
Future<UTXO> parseUTXO({
required Map<String, dynamic> jsonUTXO,
}) async {
final txn = await electrumXCached.getTransaction(
final txn = await electrumXCachedClient.getTransaction(
txHash: jsonUTXO["tx_hash"] as String,
verbose: true,
coin: cryptoCurrency.coin,
@ -1103,7 +1104,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
final prevOut = input["vout"] as int;
// fetch input tx to get address
final inputTx = await electrumXCached.getTransaction(
final inputTx = await electrumXCachedClient.getTransaction(
txHash: prevTxid,
coin: cryptoCurrency.coin,
);
@ -1321,7 +1322,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
@override
Future<bool> pingCheck() async {
try {
final result = await electrumX.ping();
final result = await electrumXClient.ping();
return result;
} catch (_) {
return false;
@ -1341,9 +1342,9 @@ mixin ElectrumXMixin on Bip39HDWallet {
try {
const int f = 1, m = 5, s = 20;
final fast = await electrumX.estimateFee(blocks: f);
final medium = await electrumX.estimateFee(blocks: m);
final slow = await electrumX.estimateFee(blocks: s);
final fast = await electrumXClient.estimateFee(blocks: f);
final medium = await electrumXClient.estimateFee(blocks: m);
final slow = await electrumXClient.estimateFee(blocks: s);
final feeObject = FeeObject(
numberOfBlocksFast: f,
@ -1523,7 +1524,8 @@ mixin ElectrumXMixin on Bip39HDWallet {
await refreshMutex.protect(() async {
if (isRescan) {
// clear cache
await electrumXCached.clearSharedTransactionCache(coin: info.coin);
await electrumXCachedClient.clearSharedTransactionCache(
coin: info.coin);
// clear blockchain info
await mainDB.deleteWalletBlockchainData(walletId);
}
@ -1662,7 +1664,8 @@ mixin ElectrumXMixin on Bip39HDWallet {
}
for (int i = 0; i < batches.length; i++) {
final response = await electrumX.getBatchUTXOs(args: batches[i]!);
final response =
await electrumXClient.getBatchUTXOs(args: batches[i]!);
for (final entry in response.entries) {
if (entry.value.isNotEmpty) {
fetchedUtxoList.add(entry.value);
@ -1675,7 +1678,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
address: allAddresses[i].value,
);
final utxos = await electrumX.getUTXOs(scripthash: scriptHash);
final utxos = await electrumXClient.getUTXOs(scripthash: scriptHash);
if (utxos.isNotEmpty) {
fetchedUtxoList.add(utxos);
}
@ -1708,7 +1711,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
try {
Logging.instance.log("confirmSend txData: $txData", level: LogLevel.Info);
final txHash = await electrumX.broadcastTransaction(
final txHash = await electrumXClient.broadcastTransaction(
rawTx: txData.raw!,
);
Logging.instance.log("Sent txHash: $txHash", level: LogLevel.Info);
@ -1825,7 +1828,7 @@ mixin ElectrumXMixin on Bip39HDWallet {
@override
Future<void> init() async {
try {
final features = await electrumX
final features = await electrumXClient
.getServerFeatures()
.timeout(const Duration(seconds: 3));

View file

@ -32,7 +32,7 @@ import 'package:stackwallet/wallets/wallet/impl/bitcoincash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/ecash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx_mixin.dart';
import 'package:stackwallet/wallets/wallet/mixins/electrumx.dart';
import 'package:stackwallet/wallets/wallet/mixins/mnemonic_based_wallet.dart';
import 'package:stackwallet/wallets/wallet/mixins/multi_address.dart';
import 'package:stackwallet/wallets/wallet/private_key_based_wallet.dart';
@ -226,7 +226,7 @@ abstract class Wallet<T extends CryptoCurrency> {
wallet.prefs = prefs;
wallet.nodeService = nodeService;
if (wallet is ElectrumXMixin) {
if (wallet is ElectrumX) {
// initialize electrumx instance
await wallet.updateNode();
}

View file

@ -13,7 +13,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
@ -168,7 +168,7 @@ class _NodeCardState extends ConsumerState<NodeCard> {
case Coin.namecoin:
case Coin.bitcoincashTestnet:
case Coin.eCash:
final client = ElectrumX(
final client = ElectrumXClient(
host: node.host,
port: node.port,
useSSL: node.useSSL,

View file

@ -13,7 +13,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
@ -151,7 +151,7 @@ class NodeOptionsSheet extends ConsumerWidget {
case Coin.namecoin:
case Coin.bitcoincashTestnet:
case Coin.eCash:
final client = ElectrumX(
final client = ElectrumXClient(
host: node.host,
port: node.port,
useSSL: node.useSSL,

View file

@ -2,15 +2,15 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/prefs.dart';
import 'cached_electrumx_test.mocks.dart';
// import 'sample_data/get_anonymity_set_sample_data.dart';
@GenerateMocks([ElectrumX, Prefs])
@GenerateMocks([ElectrumXClient, Prefs])
void main() {
group("tests using mock hive", () {
setUp(() async {
@ -123,7 +123,7 @@ void main() {
),
).thenThrow(Exception());
final cachedClient = CachedElectrumX(
final cachedClient = CachedElectrumXClient(
electrumXClient: client,
);
@ -136,7 +136,7 @@ void main() {
});
test("clearSharedTransactionCache", () async {
final cachedClient = CachedElectrumX(
final cachedClient = CachedElectrumXClient(
electrumXClient: MockElectrumX(),
);
@ -164,8 +164,8 @@ void main() {
useSSL: true,
);
final client = CachedElectrumX.from(electrumXClient: MockElectrumX());
final client = CachedElectrumXClient.from(electrumXClient: MockElectrumX());
expect(client, isA<CachedElectrumX>());
expect(client, isA<CachedElectrumXClient>());
});
}

View file

@ -8,7 +8,7 @@ import 'dart:ui' as _i11;
import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i4;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i4;
import 'package:stackwallet/services/mixins/fusion_wallet_interface.dart'
as _i3;
import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i9;
@ -58,11 +58,11 @@ class _FakeFusionInfo_2 extends _i1.SmartFake implements _i3.FusionInfo {
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i4.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}

View file

@ -3,7 +3,7 @@ import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/rpc.dart';
import 'package:stackwallet/services/event_bus/events/global/tor_connection_status_changed_event.dart';
import 'package:stackwallet/services/tor_service.dart';
@ -45,7 +45,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
final client = ElectrumX.from(
final client = ElectrumXClient.from(
node: node,
failovers: [],
prefs: mockPrefs,
@ -87,7 +87,7 @@ void main() {
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -127,7 +127,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -162,7 +162,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -202,7 +202,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -236,7 +236,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -287,7 +287,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -333,7 +333,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -373,7 +373,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -408,7 +408,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -454,7 +454,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -489,7 +489,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -542,7 +542,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -588,7 +588,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -645,7 +645,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -695,7 +695,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -737,7 +737,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -774,7 +774,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -817,7 +817,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -852,7 +852,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -894,7 +894,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -929,7 +929,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -971,7 +971,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1006,7 +1006,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1048,7 +1048,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1082,7 +1082,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1125,7 +1125,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1160,7 +1160,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1204,7 +1204,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1239,7 +1239,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1283,7 +1283,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1318,7 +1318,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1360,7 +1360,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1394,7 +1394,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1436,7 +1436,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1470,7 +1470,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1492,7 +1492,7 @@ void main() {
when(mockPrefs.useTor).thenAnswer((realInvocation) => false);
final torService = MockTorService();
when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final client = ElectrumX(
final client = ElectrumXClient(
client: null,
port: -10,
host: "_ :sa %",
@ -1532,7 +1532,7 @@ void main() {
when(mockTorService.status)
.thenAnswer((_) => TorConnectionStatus.disconnected);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1584,7 +1584,7 @@ void main() {
port: -1
)); // Port is set to -1 until Tor is enabled.
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1636,7 +1636,7 @@ void main() {
when(mockTorService.getProxyInfo())
.thenAnswer((_) => (host: InternetAddress('1.2.3.4'), port: 42));
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1692,7 +1692,7 @@ void main() {
when(mockTorService.status)
.thenAnswer((_) => TorConnectionStatus.disconnected);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,
@ -1748,7 +1748,7 @@ void main() {
when(mockTorService.status)
.thenAnswer((_) => TorConnectionStatus.disconnected);
final client = ElectrumX(
final client = ElectrumXClient(
host: "some server",
port: 0,
useSSL: true,

View file

@ -6,7 +6,7 @@ import 'package:local_auth/local_auth.dart';
// import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:mockito/annotations.dart';
// import 'package:mockito/mockito.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
// import 'package:stackwallet/notifications/campfire_alert.dart';
// import 'package:stackwallet/pages/settings_view/settings_subviews/wallet_settings_view.dart';
@ -20,7 +20,7 @@ import 'package:stackwallet/utilities/biometrics.dart';
// import 'wallet_settings_view_screen_test.mocks.dart';
@GenerateMocks([
CachedElectrumX,
CachedElectrumXClient,
LocalAuthentication,
Biometrics,
], customMocks: [

View file

@ -9,8 +9,8 @@ import 'dart:ui' as _i10;
import 'package:local_auth/auth_strings.dart' as _i7;
import 'package:local_auth/local_auth.dart' as _i6;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i2;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i2;
import 'package:stackwallet/services/wallets_service.dart' as _i9;
import 'package:stackwallet/utilities/biometrics.dart' as _i8;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5;
@ -26,8 +26,9 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5;
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
class _FakeElectrumX_0 extends _i1.SmartFake implements _i2.ElectrumX {
_FakeElectrumX_0(
class _FakeElectrumXClient_0 extends _i1.SmartFake
implements _i2.ElectrumXClient {
_FakeElectrumXClient_0(
Object parent,
Invocation parentInvocation,
) : super(
@ -36,22 +37,23 @@ class _FakeElectrumX_0 extends _i1.SmartFake implements _i2.ElectrumX {
);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i3.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i3.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i2.ElectrumX get electrumXClient => (super.noSuchMethod(
_i2.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_0(
returnValue: _FakeElectrumXClient_0(
this,
Invocation.getter(#electrumXClient),
),
) as _i2.ElectrumX);
) as _i2.ElectrumXClient);
@override
_i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -1,11 +1,11 @@
import 'package:mockito/annotations.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
@GenerateMocks([
ElectrumX,
CachedElectrumX,
ElectrumXClient,
CachedElectrumXClient,
TransactionNotificationTracker,
])
void main() async {

View file

@ -7,8 +7,8 @@ import 'dart:async' as _i4;
import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/services/transaction_notification_tracker.dart'
as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6;
@ -44,8 +44,9 @@ class _FakeDecimal_1 extends _i1.SmartFake implements _i2.Decimal {
);
}
class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
_FakeElectrumX_2(
class _FakeElectrumXClient_2 extends _i1.SmartFake
implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent,
Invocation parentInvocation,
) : super(
@ -54,11 +55,11 @@ class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@ -414,22 +415,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i4.Future<_i2.Decimal>);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i5.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod(
_i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2(
returnValue: _FakeElectrumXClient_2(
this,
Invocation.getter(#electrumXClient),
),
) as _i3.ElectrumX);
) as _i3.ElectrumXClient);
@override
_i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -5,8 +5,8 @@ import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
@ -19,8 +19,8 @@ import 'bitcoincash_wallet_test.mocks.dart';
import 'bitcoincash_wallet_test_parameters.dart';
@GenerateMocks([
ElectrumX,
CachedElectrumX,
ElectrumXClient,
CachedElectrumXClient,
TransactionNotificationTracker,
])
void main() async {

View file

@ -7,8 +7,8 @@ import 'dart:async' as _i4;
import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/services/transaction_notification_tracker.dart'
as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6;
@ -44,8 +44,9 @@ class _FakeDecimal_1 extends _i1.SmartFake implements _i2.Decimal {
);
}
class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
_FakeElectrumX_2(
class _FakeElectrumXClient_2 extends _i1.SmartFake
implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent,
Invocation parentInvocation,
) : super(
@ -54,11 +55,11 @@ class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@ -414,22 +415,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i4.Future<_i2.Decimal>);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i5.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod(
_i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2(
returnValue: _FakeElectrumXClient_2(
this,
Invocation.getter(#electrumXClient),
),
) as _i3.ElectrumX);
) as _i3.ElectrumXClient);
@override
_i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -1,11 +1,11 @@
import 'package:mockito/annotations.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
@GenerateMocks([
ElectrumX,
CachedElectrumX,
ElectrumXClient,
CachedElectrumXClient,
TransactionNotificationTracker,
])
void main() {

View file

@ -7,8 +7,8 @@ import 'dart:async' as _i4;
import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/services/transaction_notification_tracker.dart'
as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6;
@ -44,8 +44,9 @@ class _FakeDecimal_1 extends _i1.SmartFake implements _i2.Decimal {
);
}
class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
_FakeElectrumX_2(
class _FakeElectrumXClient_2 extends _i1.SmartFake
implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent,
Invocation parentInvocation,
) : super(
@ -54,11 +55,11 @@ class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@ -414,22 +415,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i4.Future<_i2.Decimal>);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i5.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod(
_i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2(
returnValue: _FakeElectrumXClient_2(
this,
Invocation.getter(#electrumXClient),
),
) as _i3.ElectrumX);
) as _i3.ElectrumXClient);
@override
_i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -9,8 +9,8 @@ import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/models/lelantus_fee_data.dart';
import 'package:stackwallet/models/paymint/transactions_model.dart' as old;
@ -29,8 +29,8 @@ import 'sample_data/gethistory_samples.dart';
import 'sample_data/transaction_data_samples.dart';
@GenerateMocks([
ElectrumX,
CachedElectrumX,
ElectrumXClient,
CachedElectrumXClient,
TransactionNotificationTracker,
MainDB,
])

View file

@ -9,8 +9,8 @@ import 'package:decimal/decimal.dart' as _i2;
import 'package:isar/isar.dart' as _i4;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i9;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i6;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i6;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/models/isar/models/block_explorer.dart' as _i12;
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart'
as _i15;
@ -53,8 +53,9 @@ class _FakeDecimal_1 extends _i1.SmartFake implements _i2.Decimal {
);
}
class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
_FakeElectrumX_2(
class _FakeElectrumXClient_2 extends _i1.SmartFake
implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent,
Invocation parentInvocation,
) : super(
@ -84,11 +85,11 @@ class _FakeQueryBuilder_4<OBJ, R, S> extends _i1.SmartFake
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@ -444,22 +445,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i5.Future<_i2.Decimal>);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i6.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod(
_i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2(
returnValue: _FakeElectrumXClient_2(
this,
Invocation.getter(#electrumXClient),
),
) as _i3.ElectrumX);
) as _i3.ElectrumXClient);
@override
_i5.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -4,8 +4,8 @@ import 'package:hive/hive.dart';
import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
@ -18,8 +18,8 @@ import 'namecoin_wallet_test.mocks.dart';
import 'namecoin_wallet_test_parameters.dart';
@GenerateMocks([
ElectrumX,
CachedElectrumX,
ElectrumXClient,
CachedElectrumXClient,
TransactionNotificationTracker,
])
void main() {

View file

@ -7,8 +7,8 @@ import 'dart:async' as _i4;
import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/services/transaction_notification_tracker.dart'
as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6;
@ -44,8 +44,9 @@ class _FakeDecimal_1 extends _i1.SmartFake implements _i2.Decimal {
);
}
class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
_FakeElectrumX_2(
class _FakeElectrumXClient_2 extends _i1.SmartFake
implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent,
Invocation parentInvocation,
) : super(
@ -54,11 +55,11 @@ class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@ -414,22 +415,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i4.Future<_i2.Decimal>);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i5.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod(
_i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2(
returnValue: _FakeElectrumXClient_2(
this,
Invocation.getter(#electrumXClient),
),
) as _i3.ElectrumX);
) as _i3.ElectrumXClient);
@override
_i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -4,8 +4,8 @@ import 'package:hive/hive.dart';
import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart';
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
@ -18,8 +18,8 @@ import 'particl_wallet_test.mocks.dart';
import 'particl_wallet_test_parameters.dart';
@GenerateMocks([
ElectrumX,
CachedElectrumX,
ElectrumXClient,
CachedElectrumXClient,
TransactionNotificationTracker,
])
void main() {

View file

@ -7,8 +7,8 @@ import 'dart:async' as _i4;
import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/services/transaction_notification_tracker.dart'
as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6;
@ -44,8 +44,9 @@ class _FakeDecimal_1 extends _i1.SmartFake implements _i2.Decimal {
);
}
class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
_FakeElectrumX_2(
class _FakeElectrumXClient_2 extends _i1.SmartFake
implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent,
Invocation parentInvocation,
) : super(
@ -54,11 +55,11 @@ class _FakeElectrumX_2 extends _i1.SmartFake implements _i3.ElectrumX {
);
}
/// A class which mocks [ElectrumX].
/// A class which mocks [ElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
MockElectrumX() {
class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@ -414,22 +415,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i4.Future<_i2.Decimal>);
}
/// A class which mocks [CachedElectrumX].
/// A class which mocks [CachedElectrumXClient].
///
/// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
MockCachedElectrumX() {
class MockCachedElectrumXClient extends _i1.Mock
implements _i5.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this);
}
@override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod(
_i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2(
returnValue: _FakeElectrumXClient_2(
this,
Invocation.getter(#electrumXClient),
),
) as _i3.ElectrumX);
) as _i3.ElectrumXClient);
@override
_i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,

View file

@ -11,8 +11,8 @@ import 'package:decimal/decimal.dart' as _i31;
import 'package:isar/isar.dart' as _i15;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10;
import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i11;
import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i10;
import 'package:stackwallet/models/balance.dart' as _i7;
import 'package:stackwallet/models/isar/models/block_explorer.dart' as _i37;
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart'
@ -131,8 +131,9 @@ class _FakeTransactionNotificationTracker_6 extends _i1.SmartFake
);
}
class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX {
_FakeElectrumX_7(
class _FakeElectrumXClient_7 extends _i1.SmartFake
implements _i10.ElectrumXClient {
_FakeElectrumXClient_7(
Object parent,
Invocation parentInvocation,
) : super(
@ -141,9 +142,9 @@ class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX {
);
}
class _FakeCachedElectrumX_8 extends _i1.SmartFake
implements _i11.CachedElectrumX {
_FakeCachedElectrumX_8(
class _FakeCachedElectrumXClient_8 extends _i1.SmartFake
implements _i11.CachedElectrumXClient {
_FakeCachedElectrumXClient_8(
Object parent,
Invocation parentInvocation,
) : super(
@ -828,21 +829,21 @@ class MockFiroWallet extends _i1.Mock implements _i23.FiroWallet {
returnValue: false,
) as bool);
@override
_i10.ElectrumX get electrumXClient => (super.noSuchMethod(
_i10.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_7(
returnValue: _FakeElectrumXClient_7(
this,
Invocation.getter(#electrumXClient),
),
) as _i10.ElectrumX);
) as _i10.ElectrumXClient);
@override
_i11.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod(
_i11.CachedElectrumXClient get cachedElectrumXClient => (super.noSuchMethod(
Invocation.getter(#cachedElectrumXClient),
returnValue: _FakeCachedElectrumX_8(
returnValue: _FakeCachedElectrumXClient_8(
this,
Invocation.getter(#cachedElectrumXClient),
),
) as _i11.CachedElectrumX);
) as _i11.CachedElectrumXClient);
@override
bool get lelantusCoinIsarRescanRequired => (super.noSuchMethod(
Invocation.getter(#lelantusCoinIsarRescanRequired),
@ -1428,7 +1429,7 @@ class MockFiroWallet extends _i1.Mock implements _i23.FiroWallet {
) as _i18.Future<List<Map<String, dynamic>>>);
@override
_i18.Future<Map<_i22.Address, _i22.Transaction>> getJMintTransactions(
_i11.CachedElectrumX? cachedClient,
_i11.CachedElectrumXClient? cachedClient,
List<String>? transactions,
_i17.Coin? coin,
) =>