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

View file

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

View file

@ -58,7 +58,7 @@ class ElectrumXNode {
} }
} }
class ElectrumX { class ElectrumXClient {
String get host => _host; String get host => _host;
late String _host; late String _host;
@ -81,7 +81,7 @@ class ElectrumX {
// add finalizer to cancel stream subscription when all references to an // add finalizer to cancel stream subscription when all references to an
// instance of ElectrumX becomes inaccessible // instance of ElectrumX becomes inaccessible
static final Finalizer<ElectrumX> _finalizer = Finalizer( static final Finalizer<ElectrumXClient> _finalizer = Finalizer(
(p0) { (p0) {
p0._torPreferenceListener?.cancel(); p0._torPreferenceListener?.cancel();
p0._torStatusListener?.cancel(); p0._torStatusListener?.cancel();
@ -93,7 +93,7 @@ class ElectrumX {
final Mutex _torConnectingLock = Mutex(); final Mutex _torConnectingLock = Mutex();
bool _requireMutex = false; bool _requireMutex = false;
ElectrumX({ ElectrumXClient({
required String host, required String host,
required int port, required int port,
required bool useSSL, required bool useSSL,
@ -158,14 +158,14 @@ class ElectrumX {
); );
} }
factory ElectrumX.from({ factory ElectrumXClient.from({
required ElectrumXNode node, required ElectrumXNode node,
required Prefs prefs, required Prefs prefs,
required List<ElectrumXNode> failovers, required List<ElectrumXNode> failovers,
TorService? torService, TorService? torService,
EventBus? globalEventBusForTesting, EventBus? globalEventBusForTesting,
}) { }) {
return ElectrumX( return ElectrumXClient(
host: node.address, host: node.address,
port: node.port, port: node.port,
useSSL: node.useSSL, 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:flutter_svg/flutter_svg.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart'; import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.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/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart'; import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
@ -367,7 +367,7 @@ class HiddenSettings extends StatelessWidget {
.getPrimaryNodeFor( .getPrimaryNodeFor(
coin: Coin.bitcoincash)!; coin: Coin.bitcoincash)!;
final e = ElectrumX.from( final e = ElectrumXClient.from(
node: ElectrumXNode( node: ElectrumXNode(
address: n.host, address: n.host,
port: n.port, port: n.port,
@ -381,7 +381,7 @@ class HiddenSettings extends StatelessWidget {
); );
final ce = final ce =
CachedElectrumX(electrumXClient: e); CachedElectrumXClient(electrumXClient: e);
final txids = [ final txids = [
"", // cashTokenTxid "", // cashTokenTxid
@ -452,7 +452,7 @@ class HiddenSettings extends StatelessWidget {
.getPrimaryNodeFor( .getPrimaryNodeFor(
coin: Coin.bitcoincash)!; coin: Coin.bitcoincash)!;
final e = ElectrumX.from( final e = ElectrumXClient.from(
node: ElectrumXNode( node: ElectrumXNode(
address: n.host, address: n.host,
port: n.port, port: n.port,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ import 'dart:convert';
import 'package:bip47/src/util.dart'; import 'package:bip47/src/util.dart';
import 'package:decimal/decimal.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/input_v2.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/v2/output_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/blockchain_data/v2/transaction_v2.dart';
@ -32,7 +32,7 @@ mixin ElectrumXParsing {
String txHash, String txHash,
Coin coin, Coin coin,
String walletId, String walletId,
CachedElectrumX cachedElectrumX, [ CachedElectrumXClient cachedElectrumX, [
String? debugTitle, String? debugTitle,
]) async { ]) async {
final jsonTx = await cachedElectrumX.getTransaction( 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:fusiondart/fusiondart.dart' as fusion;
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.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/fusion_progress_ui_state.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart'; import 'package:stackwallet/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart';
@ -127,7 +127,7 @@ mixin FusionWalletInterface {
// Passed in wallet functions. // Passed in wallet functions.
late final Future<List<Address>> Function({int numberOfAddresses}) late final Future<List<Address>> Function({int numberOfAddresses})
_getNextUnusedChangeAddresses; _getNextUnusedChangeAddresses;
late final CachedElectrumX Function() _getWalletCachedElectrumX; late final CachedElectrumXClient Function() _getWalletCachedElectrumX;
late final Future<int> Function() _getChainHeight; late final Future<int> Function() _getChainHeight;
late final Future<void> Function() _updateWalletUTXOS; late final Future<void> Function() _updateWalletUTXOS;
late final String Function(String bchAddress, btcdart.NetworkType network) late final String Function(String bchAddress, btcdart.NetworkType network)
@ -155,7 +155,7 @@ mixin FusionWalletInterface {
required MainDB db, required MainDB db,
required Future<List<Address>> Function({int numberOfAddresses}) required Future<List<Address>> Function({int numberOfAddresses})
getNextUnusedChangeAddress, getNextUnusedChangeAddress,
required CachedElectrumX Function() getWalletCachedElectrumX, required CachedElectrumXClient Function() getWalletCachedElectrumX,
required Future<int> Function() getChainHeight, required Future<int> Function() getChainHeight,
required Future<void> Function() updateWalletUTXOS, required Future<void> Function() updateWalletUTXOS,
required Future<String?> mnemonic, 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:isar/isar.dart';
import 'package:pointycastle/digests/sha256.dart'; import 'package:pointycastle/digests/sha256.dart';
import 'package:stackwallet/db/isar/main_db.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/insufficient_balance_exception.dart';
import 'package:stackwallet/exceptions/wallet/paynym_send_exception.dart'; import 'package:stackwallet/exceptions/wallet/paynym_send_exception.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart';
@ -61,7 +61,7 @@ mixin PaynymWalletInterface {
late final btc_dart.NetworkType _network; late final btc_dart.NetworkType _network;
late final Coin _coin; late final Coin _coin;
late final MainDB _db; late final MainDB _db;
late final ElectrumX _electrumXClient; late final ElectrumXClient _electrumXClient;
late final SecureStorageInterface _secureStorage; late final SecureStorageInterface _secureStorage;
late final int _dustLimit; late final int _dustLimit;
late final int _dustLimitP2PKH; late final int _dustLimitP2PKH;
@ -97,7 +97,7 @@ mixin PaynymWalletInterface {
required btc_dart.NetworkType network, required btc_dart.NetworkType network,
required Coin coin, required Coin coin,
required MainDB db, required MainDB db,
required ElectrumX electrumXClient, required ElectrumXClient electrumXClient,
required SecureStorageInterface secureStorage, required SecureStorageInterface secureStorage,
required int dustLimit, required int dustLimit,
required int dustLimitP2PKH, required int dustLimitP2PKH,

View file

@ -12,7 +12,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:stackwallet/db/hive/db.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/exceptions/electrumx/no_such_transaction.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/models/notification_model.dart'; import 'package:stackwallet/models/notification_model.dart';
@ -142,7 +142,7 @@ class NotificationsService extends ChangeNotifier {
)) ))
.toList(); .toList();
final client = ElectrumX.from( final client = ElectrumXClient.from(
node: eNode, node: eNode,
failovers: failovers, failovers: failovers,
prefs: prefs, 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/utilities/extensions/extensions.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.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/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'; import 'package:tuple/tuple.dart';
class BitcoinWallet extends Bip39HDWallet with ElectrumXMixin { class BitcoinWallet extends Bip39HDWallet with ElectrumX {
@override @override
int get isarTransactionVersion => 1; // TODO actually set this to 2 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/utilities/logger.dart';
import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.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/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 @override
int get isarTransactionVersion => 2; int get isarTransactionVersion => 2;
@ -111,7 +111,7 @@ class BitcoincashWallet extends Bip39HDWallet with ElectrumXMixin {
if (storedTx == null || if (storedTx == null ||
storedTx.height == null || storedTx.height == null ||
(storedTx.height != null && storedTx.height! <= 0)) { (storedTx.height != null && storedTx.height! <= 0)) {
final tx = await electrumXCached.getTransaction( final tx = await electrumXCachedClient.getTransaction(
txHash: txHash["tx_hash"] as String, txHash: txHash["tx_hash"] as String,
verbose: true, verbose: true,
coin: cryptoCurrency.coin, coin: cryptoCurrency.coin,
@ -153,7 +153,7 @@ class BitcoincashWallet extends Bip39HDWallet with ElectrumXMixin {
final txid = map["txid"] as String; final txid = map["txid"] as String;
final vout = map["vout"] as int; final vout = map["vout"] as int;
final inputTx = await electrumXCached.getTransaction( final inputTx = await electrumXCachedClient.getTransaction(
txHash: txid, txHash: txid,
coin: cryptoCurrency.coin, 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/coins/dogecoin.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.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/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'; import 'package:tuple/tuple.dart';
class DogecoinWallet extends Bip39HDWallet with ElectrumXMixin { class DogecoinWallet extends Bip39HDWallet with ElectrumX {
DogecoinWallet(CryptoCurrencyNetwork network) : super(Dogecoin(network)); DogecoinWallet(CryptoCurrencyNetwork network) : super(Dogecoin(network));
@override @override

View file

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

View file

@ -13,7 +13,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.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/models/node_model.dart';
import 'package:stackwallet/notifications/show_flush_bar.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/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.namecoin:
case Coin.bitcoincashTestnet: case Coin.bitcoincashTestnet:
case Coin.eCash: case Coin.eCash:
final client = ElectrumX( final client = ElectrumXClient(
host: node.host, host: node.host,
port: node.port, port: node.port,
useSSL: node.useSSL, useSSL: node.useSSL,

View file

@ -13,7 +13,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.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/models/node_model.dart';
import 'package:stackwallet/notifications/show_flush_bar.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/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.namecoin:
case Coin.bitcoincashTestnet: case Coin.bitcoincashTestnet:
case Coin.eCash: case Coin.eCash:
final client = ElectrumX( final client = ElectrumXClient(
host: node.host, host: node.host,
port: node.port, port: node.port,
useSSL: node.useSSL, 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:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.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/electrumx_rpc/electrumx.dart'; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/prefs.dart'; import 'package:stackwallet/utilities/prefs.dart';
import 'cached_electrumx_test.mocks.dart'; import 'cached_electrumx_test.mocks.dart';
// import 'sample_data/get_anonymity_set_sample_data.dart'; // import 'sample_data/get_anonymity_set_sample_data.dart';
@GenerateMocks([ElectrumX, Prefs]) @GenerateMocks([ElectrumXClient, Prefs])
void main() { void main() {
group("tests using mock hive", () { group("tests using mock hive", () {
setUp(() async { setUp(() async {
@ -123,7 +123,7 @@ void main() {
), ),
).thenThrow(Exception()); ).thenThrow(Exception());
final cachedClient = CachedElectrumX( final cachedClient = CachedElectrumXClient(
electrumXClient: client, electrumXClient: client,
); );
@ -136,7 +136,7 @@ void main() {
}); });
test("clearSharedTransactionCache", () async { test("clearSharedTransactionCache", () async {
final cachedClient = CachedElectrumX( final cachedClient = CachedElectrumXClient(
electrumXClient: MockElectrumX(), electrumXClient: MockElectrumX(),
); );
@ -164,8 +164,8 @@ void main() {
useSSL: true, 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:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1; 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' import 'package:stackwallet/services/mixins/fusion_wallet_interface.dart'
as _i3; as _i3;
import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i9; 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. /// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient {
MockElectrumX() { MockElectrumXClient() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }

View file

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

View file

@ -6,7 +6,7 @@ import 'package:local_auth/local_auth.dart';
// import 'package:mockingjay/mockingjay.dart' as mockingjay; // import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
// import 'package:mockito/mockito.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/notifications/campfire_alert.dart';
// import 'package:stackwallet/pages/settings_view/settings_subviews/wallet_settings_view.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'; // import 'wallet_settings_view_screen_test.mocks.dart';
@GenerateMocks([ @GenerateMocks([
CachedElectrumX, CachedElectrumXClient,
LocalAuthentication, LocalAuthentication,
Biometrics, Biometrics,
], customMocks: [ ], 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/auth_strings.dart' as _i7;
import 'package:local_auth/local_auth.dart' as _i6; import 'package:local_auth/local_auth.dart' as _i6;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i3; import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i3;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i2; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i2;
import 'package:stackwallet/services/wallets_service.dart' as _i9; import 'package:stackwallet/services/wallets_service.dart' as _i9;
import 'package:stackwallet/utilities/biometrics.dart' as _i8; import 'package:stackwallet/utilities/biometrics.dart' as _i8;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5; 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: camel_case_types
// ignore_for_file: subtype_of_sealed_class // ignore_for_file: subtype_of_sealed_class
class _FakeElectrumX_0 extends _i1.SmartFake implements _i2.ElectrumX { class _FakeElectrumXClient_0 extends _i1.SmartFake
_FakeElectrumX_0( implements _i2.ElectrumXClient {
_FakeElectrumXClient_0(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : 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. /// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i3.CachedElectrumX { class MockCachedElectrumXClient extends _i1.Mock
MockCachedElectrumX() { implements _i3.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i2.ElectrumX get electrumXClient => (super.noSuchMethod( _i2.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient), Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_0( returnValue: _FakeElectrumXClient_0(
this, this,
Invocation.getter(#electrumXClient), Invocation.getter(#electrumXClient),
), ),
) as _i2.ElectrumX); ) as _i2.ElectrumXClient);
@override @override
_i4.Future<Map<String, dynamic>> getAnonymitySet({ _i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId, required String? groupId,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,8 +4,8 @@ import 'package:hive/hive.dart';
import 'package:hive_test/hive_test.dart'; import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.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/electrumx_rpc/electrumx.dart'; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart'; import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'; import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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'; import 'namecoin_wallet_test_parameters.dart';
@GenerateMocks([ @GenerateMocks([
ElectrumX, ElectrumXClient,
CachedElectrumX, CachedElectrumXClient,
TransactionNotificationTracker, TransactionNotificationTracker,
]) ])
void main() { void main() {

View file

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

View file

@ -4,8 +4,8 @@ import 'package:hive/hive.dart';
import 'package:hive_test/hive_test.dart'; import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.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/electrumx_rpc/electrumx.dart'; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart'; import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'; import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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'; import 'particl_wallet_test_parameters.dart';
@GenerateMocks([ @GenerateMocks([
ElectrumX, ElectrumXClient,
CachedElectrumX, CachedElectrumXClient,
TransactionNotificationTracker, TransactionNotificationTracker,
]) ])
void main() { void main() {

View file

@ -7,8 +7,8 @@ import 'dart:async' as _i4;
import 'package:decimal/decimal.dart' as _i2; import 'package:decimal/decimal.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i5;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i3;
import 'package:stackwallet/services/transaction_notification_tracker.dart' import 'package:stackwallet/services/transaction_notification_tracker.dart'
as _i7; as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6; 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 { class _FakeElectrumXClient_2 extends _i1.SmartFake
_FakeElectrumX_2( implements _i3.ElectrumXClient {
_FakeElectrumXClient_2(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : 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. /// See the documentation for Mockito's code generation for more information.
class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient {
MockElectrumX() { MockElectrumXClient() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@ -414,22 +415,23 @@ class MockElectrumX extends _i1.Mock implements _i3.ElectrumX {
) as _i4.Future<_i2.Decimal>); ) 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. /// See the documentation for Mockito's code generation for more information.
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX { class MockCachedElectrumXClient extends _i1.Mock
MockCachedElectrumX() { implements _i5.CachedElectrumXClient {
MockCachedElectrumXClient() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i3.ElectrumX get electrumXClient => (super.noSuchMethod( _i3.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient), Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_2( returnValue: _FakeElectrumXClient_2(
this, this,
Invocation.getter(#electrumXClient), Invocation.getter(#electrumXClient),
), ),
) as _i3.ElectrumX); ) as _i3.ElectrumXClient);
@override @override
_i4.Future<Map<String, dynamic>> getAnonymitySet({ _i4.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId, 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:isar/isar.dart' 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/electrumx_rpc/cached_electrumx.dart' as _i11; import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i11;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i10;
import 'package:stackwallet/models/balance.dart' as _i7; 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/block_explorer.dart' as _i37;
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart' 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 { class _FakeElectrumXClient_7 extends _i1.SmartFake
_FakeElectrumX_7( implements _i10.ElectrumXClient {
_FakeElectrumXClient_7(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -141,9 +142,9 @@ class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX {
); );
} }
class _FakeCachedElectrumX_8 extends _i1.SmartFake class _FakeCachedElectrumXClient_8 extends _i1.SmartFake
implements _i11.CachedElectrumX { implements _i11.CachedElectrumXClient {
_FakeCachedElectrumX_8( _FakeCachedElectrumXClient_8(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -828,21 +829,21 @@ class MockFiroWallet extends _i1.Mock implements _i23.FiroWallet {
returnValue: false, returnValue: false,
) as bool); ) as bool);
@override @override
_i10.ElectrumX get electrumXClient => (super.noSuchMethod( _i10.ElectrumXClient get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient), Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_7( returnValue: _FakeElectrumXClient_7(
this, this,
Invocation.getter(#electrumXClient), Invocation.getter(#electrumXClient),
), ),
) as _i10.ElectrumX); ) as _i10.ElectrumXClient);
@override @override
_i11.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( _i11.CachedElectrumXClient get cachedElectrumXClient => (super.noSuchMethod(
Invocation.getter(#cachedElectrumXClient), Invocation.getter(#cachedElectrumXClient),
returnValue: _FakeCachedElectrumX_8( returnValue: _FakeCachedElectrumXClient_8(
this, this,
Invocation.getter(#cachedElectrumXClient), Invocation.getter(#cachedElectrumXClient),
), ),
) as _i11.CachedElectrumX); ) as _i11.CachedElectrumXClient);
@override @override
bool get lelantusCoinIsarRescanRequired => (super.noSuchMethod( bool get lelantusCoinIsarRescanRequired => (super.noSuchMethod(
Invocation.getter(#lelantusCoinIsarRescanRequired), Invocation.getter(#lelantusCoinIsarRescanRequired),
@ -1428,7 +1429,7 @@ class MockFiroWallet extends _i1.Mock implements _i23.FiroWallet {
) as _i18.Future<List<Map<String, dynamic>>>); ) as _i18.Future<List<Map<String, dynamic>>>);
@override @override
_i18.Future<Map<_i22.Address, _i22.Transaction>> getJMintTransactions( _i18.Future<Map<_i22.Address, _i22.Transaction>> getJMintTransactions(
_i11.CachedElectrumX? cachedClient, _i11.CachedElectrumXClient? cachedClient,
List<String>? transactions, List<String>? transactions,
_i17.Coin? coin, _i17.Coin? coin,
) => ) =>