Merge pull request #563 from cypherstack/persistence

Persistent socket connections when possible
This commit is contained in:
julian-CStack 2023-05-29 17:14:04 -06:00 committed by GitHub
commit 6fcabcaed3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 619 additions and 685 deletions

View file

@ -132,13 +132,12 @@ class ElectrumX {
final response = await _rpcClient!.request(jsonRequestString);
print("=================================================");
print("TYPE: ${response.runtimeType}");
print("RESPONSE: $response");
print("=================================================");
if (response.exception != null) {
throw response.exception!;
}
if (response["error"] != null) {
if (response["error"]
if (response.data["error"] != null) {
if (response.data["error"]
.toString()
.contains("No such mempool or blockchain transaction")) {
throw NoSuchTransactionException(
@ -148,11 +147,15 @@ class ElectrumX {
}
throw Exception(
"JSONRPC response \ncommand: $command \nargs: $args \nerror: $response");
"JSONRPC response\n"
" command: $command\n"
" args: $args\n"
" error: $response.data",
);
}
currentFailoverIndex = -1;
return response;
return response.data;
} on WifiOnlyException {
rethrow;
} on SocketException {
@ -233,7 +236,13 @@ class ElectrumX {
// Logging.instance.log("batch request: $request");
// send batch request
final response = (await _rpcClient!.request(request)) as List<dynamic>;
final jsonRpcResponse = (await _rpcClient!.request(request));
if (jsonRpcResponse.exception != null) {
throw jsonRpcResponse.exception!;
}
final response = jsonRpcResponse.data as List;
// check for errors, format and throw if there are any
final List<String> errors = [];

View file

@ -1,12 +1,12 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:mutex/mutex.dart';
import 'package:stackwallet/utilities/logger.dart';
// hacky fix to receive large jsonrpc responses
// Json RPC class to handle connecting to electrumx servers
class JsonRPC {
JsonRPC({
required this.host,
@ -25,90 +25,60 @@ class JsonRPC {
StreamSubscription<Uint8List>? _subscription;
void _dataHandler(List<int> data) {
if (_requestQueue.isEmpty) {
// probably just return although this case should never actually hit
return;
}
_requestQueue.nextIncompleteReq.then((req) {
if (req != null) {
req.appendDataAndCheckIfComplete(data);
final req = _requestQueue.next;
req.appendDataAndCheckIfComplete(data);
if (req.isComplete) {
_onReqCompleted(req);
}
if (req.isComplete) {
_onReqCompleted(req);
}
} else {
Logging.instance.log(
"_dataHandler found a null req!",
level: LogLevel.Warning,
);
}
});
}
void _errorHandler(Object error, StackTrace trace) {
Logging.instance.log(
"JsonRPC errorHandler: $error\n$trace",
level: LogLevel.Error,
);
final req = _requestQueue.next;
req.completer.completeError(error, trace);
_onReqCompleted(req);
_requestQueue.nextIncompleteReq.then((req) {
if (req != null) {
req.completer.completeError(error, trace);
_onReqCompleted(req);
}
});
}
void _doneHandler() {
Logging.instance.log(
"JsonRPC doneHandler: "
"connection closed to $host:$port, destroying socket",
level: LogLevel.Info,
);
if (_requestQueue.isNotEmpty) {
Logging.instance.log(
"JsonRPC doneHandler: queue not empty but connection closed, "
"completing pending requests with errors",
level: LogLevel.Error,
);
for (final req in _requestQueue.queue) {
if (!req.isComplete) {
try {
throw Exception(
"JsonRPC doneHandler: socket closed "
"before request could complete",
);
} catch (e, s) {
req.completer.completeError(e, s);
}
}
}
_requestQueue.clear();
}
disconnect();
disconnect(reason: "JsonRPC _doneHandler() called");
}
void _onReqCompleted(_JsonRPCRequest req) {
_requestQueue.remove(req);
if (_requestQueue.isNotEmpty) {
_requestQueue.remove(req).then((_) {
// attempt to send next request
_sendNextAvailableRequest();
}
});
}
void _sendNextAvailableRequest() {
if (_requestQueue.isEmpty) {
// TODO handle properly
throw Exception("JSON RPC queue empty");
}
_requestQueue.nextIncompleteReq.then((req) {
if (req != null) {
// \r\n required by electrumx server
_socket!.write('${req.jsonRequest}\r\n');
final req = _requestQueue.next;
_socket!.write('${req.jsonRequest}\r\n');
req.initiateTimeout(const Duration(seconds: 10));
// Logging.instance.log(
// "JsonRPC request: wrote request ${req.jsonRequest} "
// "to socket $host:$port",
// level: LogLevel.Info,
// );
// TODO different timeout length?
req.initiateTimeout(
const Duration(seconds: 10),
onTimedOut: () {
_requestQueue.remove(req);
},
);
}
});
}
Future<dynamic> request(String jsonRpcRequest) async {
// todo: handle this better?
// Do we need to check the subscription, too?
Future<JsonRPCResponse> request(String jsonRpcRequest) async {
await _requestMutex.protect(() async {
if (_socket == null) {
Logging.instance.log(
@ -121,51 +91,69 @@ class JsonRPC {
final req = _JsonRPCRequest(
jsonRequest: jsonRpcRequest,
completer: Completer<dynamic>(),
completer: Completer<JsonRPCResponse>(),
);
_requestQueue.add(req);
final future = req.completer.future.onError(
(error, stackTrace) async {
await disconnect(
reason: "return req.completer.future.onError: $error\n$stackTrace",
);
return JsonRPCResponse(
exception: error is Exception
? error
: Exception(
"req.completer.future.onError: $error\n$stackTrace",
),
);
},
);
// if this is the only/first request then send it right away
if (_requestQueue.length == 1) {
_sendNextAvailableRequest();
} else {
// Logging.instance.log(
// "JsonRPC request: queued request $jsonRpcRequest "
// "to socket $host:$port",
// level: LogLevel.Info,
// );
}
return req.completer.future.onError(
(error, stackTrace) =>
Exception("return req.completer.future.onError: $error"),
await _requestQueue.add(
req,
onInitialRequestAdded: _sendNextAvailableRequest,
);
return future;
}
void disconnect() {
// TODO: maybe clear req queue here and wrap in mutex?
_subscription?.cancel().then((_) => _subscription = null);
_socket?.destroy();
_socket = null;
Future<void> disconnect({required String reason}) async {
await _requestMutex.protect(() async {
await _subscription?.cancel();
_subscription = null;
_socket?.destroy();
_socket = null;
// clean up remaining queue
await _requestQueue.completeRemainingWithError(
"JsonRPC disconnect() called with reason: \"$reason\"",
);
});
}
Future<void> connect() async {
if (_socket != null) {
throw Exception(
"JsonRPC attempted to connect to an already existing socket!",
);
}
if (useSSL) {
_socket ??= await SecureSocket.connect(
_socket = await SecureSocket.connect(
host,
port,
timeout: connectionTimeout,
onBadCertificate: (_) => true,
); // TODO do not automatically trust bad certificates
} else {
_socket ??= await Socket.connect(
_socket = await Socket.connect(
host,
port,
timeout: connectionTimeout,
);
}
await _subscription?.cancel();
_subscription = _socket!.listen(
_dataHandler,
onError: _errorHandler,
@ -176,36 +164,85 @@ class JsonRPC {
}
class _JsonRPCRequestQueue {
final _lock = Mutex();
final List<_JsonRPCRequest> _rq = [];
void add(_JsonRPCRequest req) => _rq.add(req);
Future<void> add(
_JsonRPCRequest req, {
VoidCallback? onInitialRequestAdded,
}) async {
return await _lock.protect(() async {
_rq.add(req);
if (_rq.length == 1) {
onInitialRequestAdded?.call();
}
});
}
bool remove(_JsonRPCRequest req) => _rq.remove(req);
Future<bool> remove(_JsonRPCRequest req) async {
return await _lock.protect(() async {
final result = _rq.remove(req);
return result;
});
}
void clear() => _rq.clear();
Future<_JsonRPCRequest?> get nextIncompleteReq async {
return await _lock.protect(() async {
int removeCount = 0;
_JsonRPCRequest? returnValue;
for (final req in _rq) {
if (req.isComplete) {
removeCount++;
} else {
returnValue = req;
break;
}
}
bool get isEmpty => _rq.isEmpty;
bool get isNotEmpty => _rq.isNotEmpty;
int get length => _rq.length;
_JsonRPCRequest get next => _rq.first;
List<_JsonRPCRequest> get queue => _rq.toList(growable: false);
_rq.removeRange(0, removeCount);
return returnValue;
});
}
Future<void> completeRemainingWithError(
String error, {
StackTrace? stackTrace,
}) async {
await _lock.protect(() async {
for (final req in _rq) {
if (!req.isComplete) {
req.completer.completeError(Exception(error), stackTrace);
}
}
_rq.clear();
});
}
Future<bool> get isEmpty async {
return await _lock.protect(() async {
return _rq.isEmpty;
});
}
}
class _JsonRPCRequest {
// 0x0A is newline
// https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-basics.html
static const int separatorByte = 0x0A;
final String jsonRequest;
final Completer<dynamic> completer;
final Completer<JsonRPCResponse> completer;
final List<int> _responseData = [];
_JsonRPCRequest({required this.jsonRequest, required this.completer});
void appendDataAndCheckIfComplete(List<int> data) {
_responseData.addAll(data);
// 0x0A is newline
// https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-basics.html
if (data.last == 0x0A) {
if (data.last == separatorByte) {
try {
final response = json.decode(String.fromCharCodes(_responseData));
completer.complete(response);
completer.complete(JsonRPCResponse(data: response));
} catch (e, s) {
Logging.instance.log(
"JsonRPC json.decode: $e\n$s",
@ -216,13 +253,17 @@ class _JsonRPCRequest {
}
}
void initiateTimeout(Duration timeout) {
void initiateTimeout(
Duration timeout, {
VoidCallback? onTimedOut,
}) {
Future<void>.delayed(timeout).then((_) {
if (!isComplete) {
try {
throw Exception("_JsonRPCRequest timed out: $jsonRequest");
} catch (e, s) {
completer.completeError(e, s);
onTimedOut?.call();
}
}
});
@ -230,3 +271,10 @@ class _JsonRPCRequest {
bool get isComplete => completer.isCompleted;
}
class JsonRPCResponse {
final dynamic data;
final Exception? exception;
JsonRPCResponse({this.data, this.exception});
}

View file

@ -1,261 +0,0 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:mutex/mutex.dart';
import 'package:stackwallet/utilities/logger.dart';
// hacky fix to receive large jsonrpc responses
class JsonRPC {
JsonRPC({
required this.host,
required this.port,
this.useSSL = false,
this.connectionTimeout = const Duration(seconds: 60),
});
final bool useSSL;
final String host;
final int port;
final Duration connectionTimeout;
final _requestMutex = Mutex();
final _JsonRPCRequestQueue _requestQueue = _JsonRPCRequestQueue();
Socket? _socket;
StreamSubscription<Uint8List>? _subscription;
void _dataHandler(List<int> data) {
_requestQueue.nextIncompleteReq.then((req) {
if (req != null) {
req.appendDataAndCheckIfComplete(data);
if (req.isComplete) {
_onReqCompleted(req);
}
} else {
Logging.instance.log(
"_dataHandler found a null req!",
level: LogLevel.Warning,
);
}
});
}
void _errorHandler(Object error, StackTrace trace) {
_requestQueue.nextIncompleteReq.then((req) {
if (req != null) {
req.completer.completeError(error, trace);
_onReqCompleted(req);
} else {
Logging.instance.log(
"_errorHandler found a null req!",
level: LogLevel.Warning,
);
}
});
}
void _doneHandler() {
Logging.instance.log(
"JsonRPC doneHandler: "
"connection closed to $host:$port, destroying socket",
level: LogLevel.Info,
);
disconnect(reason: "JsonRPC _doneHandler() called");
}
void _onReqCompleted(_JsonRPCRequest req) {
_requestQueue.remove(req).then((value) {
if (kDebugMode) {
print("Request removed from queue: $value");
}
// attempt to send next request
_sendNextAvailableRequest();
});
}
void _sendNextAvailableRequest() {
_requestQueue.nextIncompleteReq.then((req) {
if (req != null) {
// \r\n required by electrumx server
_socket!.write('${req.jsonRequest}\r\n');
// TODO different timeout length?
req.initiateTimeout(const Duration(seconds: 10));
} else {
Logging.instance.log(
"_sendNextAvailableRequest found a null req!",
level: LogLevel.Warning,
);
}
});
}
// TODO: non dynamic type
Future<dynamic> request(String jsonRpcRequest) async {
await _requestMutex.protect(() async {
if (_socket == null) {
Logging.instance.log(
"JsonRPC request: opening socket $host:$port",
level: LogLevel.Info,
);
await connect();
}
});
final req = _JsonRPCRequest(
jsonRequest: jsonRpcRequest,
completer: Completer<dynamic>(),
);
// if this is the only/first request then send it right away
await _requestQueue.add(
req,
onInitialRequestAdded: _sendNextAvailableRequest,
);
return req.completer.future.onError(
(error, stackTrace) => Exception(
"return req.completer.future.onError: $error",
),
);
}
Future<void> disconnect({String reason = "none"}) async {
await _requestMutex.protect(() async {
await _subscription?.cancel();
_subscription = null;
_socket?.destroy();
_socket = null;
// clean up remaining queue
await _requestQueue.completeRemainingWithError(
"JsonRPC disconnect() called with reason: \"$reason\"",
);
});
}
Future<void> connect() async {
if (_socket != null) {
throw Exception(
"JsonRPC attempted to connect to an already existing socket!",
);
}
if (useSSL) {
_socket = await SecureSocket.connect(
host,
port,
timeout: connectionTimeout,
onBadCertificate: (_) => true,
); // TODO do not automatically trust bad certificates
} else {
_socket = await Socket.connect(
host,
port,
timeout: connectionTimeout,
);
}
_subscription = _socket!.listen(
_dataHandler,
onError: _errorHandler,
onDone: _doneHandler,
cancelOnError: true,
);
}
}
class _JsonRPCRequestQueue {
final m = Mutex();
final List<_JsonRPCRequest> _rq = [];
Future<void> add(
_JsonRPCRequest req, {
VoidCallback? onInitialRequestAdded,
}) async {
return await m.protect(() async {
_rq.add(req);
if (_rq.length == 1) {
onInitialRequestAdded?.call();
}
});
}
Future<bool> remove(_JsonRPCRequest req) async {
return await m.protect(() async => _rq.remove(req));
}
Future<_JsonRPCRequest?> get nextIncompleteReq async {
return await m.protect(() async {
try {
return _rq.firstWhere((e) => !e.isComplete);
} catch (_) {
// no incomplete requests found
return null;
}
});
}
Future<void> completeRemainingWithError(
String error, {
StackTrace? stackTrace,
}) async {
await m.protect(() async {
for (final req in _rq) {
if (!req.isComplete) {
req.completer.completeError(Exception(error), stackTrace);
}
}
_rq.clear();
});
}
Future<bool> get isEmpty async {
return await m.protect(() async {
return _rq.isEmpty;
});
}
}
class _JsonRPCRequest {
final String jsonRequest;
final Completer<dynamic> completer;
final List<int> _responseData = [];
_JsonRPCRequest({required this.jsonRequest, required this.completer});
void appendDataAndCheckIfComplete(List<int> data) {
_responseData.addAll(data);
// 0x0A is newline
// https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-basics.html
if (data.last == 0x0A) {
try {
final response = json.decode(String.fromCharCodes(_responseData));
completer.complete(response);
} catch (e, s) {
Logging.instance.log(
"JsonRPC json.decode: $e\n$s",
level: LogLevel.Error,
);
completer.completeError(e, s);
}
}
}
void initiateTimeout(Duration timeout) {
Future<void>.delayed(timeout).then((_) {
if (!isComplete) {
try {
throw Exception("_JsonRPCRequest timed out: $jsonRequest");
} catch (e, s) {
completer.completeError(e, s);
}
}
});
}
bool get isComplete => completer.isCompleted;
}

View file

@ -50,6 +50,10 @@ class _CurrencyViewState extends ConsumerState<BaseCurrencySettingsView> {
currenciesWithoutSelected.remove(current);
currenciesWithoutSelected.insert(0, current);
ref.read(prefsChangeNotifierProvider).currency = current;
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
ref.read(priceAnd24hChangeNotifierProvider).updatePrice();
}
}
}

View file

@ -1201,13 +1201,18 @@ class BitcoinWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -1072,13 +1072,18 @@ class BitcoinCashWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -1058,13 +1058,18 @@ class DogecoinWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -2680,13 +2680,18 @@ class ECashWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -1616,13 +1616,18 @@ class EpicCashWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -987,13 +987,18 @@ class FiroWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -1189,13 +1189,18 @@ class LitecoinWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -1179,13 +1179,18 @@ class NamecoinWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -1106,13 +1106,18 @@ class ParticlWallet extends CoinServiceAPI
void _periodicPingCheck() async {
bool hasNetwork = await testNetworkConnection();
_isConnected = hasNetwork;
if (_isConnected != hasNetwork) {
NodeConnectionStatus status = hasNetwork
? NodeConnectionStatus.connected
: NodeConnectionStatus.disconnected;
GlobalEventBus.instance
.fire(NodeConnectionStatusChangedEvent(status, walletId, coin));
_isConnected = hasNetwork;
if (hasNetwork) {
unawaited(refresh());
}
}
}

View file

@ -57,16 +57,18 @@ void main() {
const jsonArgs = '["",true]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"error": {
"code": 1,
"message": "None should be a transaction hash",
},
"id": "some requestId",
},
}),
);
final mockPrefs = MockPrefs();
@ -93,13 +95,15 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": {"height": 520481, "hex": "some block hex string"},
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -126,7 +130,9 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -153,9 +159,15 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {"jsonrpc": "2.0", "result": null, "id": "some requestId"},
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": null,
"id": "some requestId",
}),
);
final mockPrefs = MockPrefs();
@ -181,7 +193,9 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -208,9 +222,11 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": {
"genesis_hash":
@ -225,7 +241,7 @@ void main() {
"hash_function": "sha256"
},
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -263,7 +279,9 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -290,13 +308,15 @@ void main() {
const jsonArgs = '["some raw transaction string"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": "the txid of the rawtx",
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -323,7 +343,9 @@ void main() {
const jsonArgs = '["some raw transaction string"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -353,16 +375,18 @@ void main() {
const jsonArgs = '["dummy hash"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": {
"confirmed": 103873966,
"unconfirmed": 23684400,
},
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -389,7 +413,9 @@ void main() {
const jsonArgs = '["dummy hash"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -418,9 +444,11 @@ void main() {
const jsonArgs = '["dummy hash"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": [
{
@ -435,7 +463,7 @@ void main() {
}
],
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -473,7 +501,9 @@ void main() {
const jsonArgs = '["dummy hash"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -502,9 +532,11 @@ void main() {
const jsonArgs = '["dummy hash"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": [
{
@ -523,7 +555,7 @@ void main() {
}
],
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -565,7 +597,9 @@ void main() {
const jsonArgs = '["dummy hash"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -594,13 +628,15 @@ void main() {
const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": SampleGetTransactionData.txData0,
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -629,7 +665,9 @@ void main() {
const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -659,13 +697,15 @@ void main() {
const jsonArgs = '["1",""]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": GetAnonymitySetSampleData.data,
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -692,7 +732,9 @@ void main() {
const jsonArgs = '["1",""]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -721,13 +763,15 @@ void main() {
const jsonArgs = '["some mints"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": "mint meta data",
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -754,7 +798,9 @@ void main() {
const jsonArgs = '["some mints"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -783,13 +829,15 @@ void main() {
const jsonArgs = '["0"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": GetUsedSerialsSampleData.serials,
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -816,7 +864,9 @@ void main() {
const jsonArgs = '["0"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -845,9 +895,15 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {"jsonrpc": "2.0", "result": 1, "id": "some requestId"},
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": 1,
"id": "some requestId",
}),
);
final mockPrefs = MockPrefs();
@ -873,7 +929,9 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -886,7 +944,10 @@ void main() {
prefs: mockPrefs,
failovers: []);
expect(() => client.getLatestCoinId(requestID: "some requestId"),
expect(
() => client.getLatestCoinId(
requestID: "some requestId",
),
throwsA(isA<Exception>()));
verify(mockPrefs.wifiOnly).called(1);
verifyNoMoreInteractions(mockPrefs);
@ -900,13 +961,15 @@ void main() {
const jsonArgs = '["1",""]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": GetAnonymitySetSampleData.data,
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -933,7 +996,9 @@ void main() {
const jsonArgs = '["1",""]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -947,8 +1012,10 @@ void main() {
failovers: []);
expect(
() =>
client.getAnonymitySet(groupId: "1", requestID: "some requestId"),
() => client.getAnonymitySet(
groupId: "1",
requestID: "some requestId",
),
throwsA(isA<Exception>()));
verify(mockPrefs.wifiOnly).called(1);
verifyNoMoreInteractions(mockPrefs);
@ -962,13 +1029,15 @@ void main() {
const jsonArgs = '["some mints"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": "mint meta data",
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -995,7 +1064,9 @@ void main() {
const jsonArgs = '["some mints"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -1010,7 +1081,9 @@ void main() {
expect(
() => client.getMintData(
mints: "some mints", requestID: "some requestId"),
mints: "some mints",
requestID: "some requestId",
),
throwsA(isA<Exception>()));
verify(mockPrefs.wifiOnly).called(1);
verifyNoMoreInteractions(mockPrefs);
@ -1024,13 +1097,15 @@ void main() {
const jsonArgs = '["0"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": GetUsedSerialsSampleData.serials,
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -1057,7 +1132,9 @@ void main() {
const jsonArgs = '["0"]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -1086,9 +1163,15 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {"jsonrpc": "2.0", "result": 1, "id": "some requestId"},
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": 1,
"id": "some requestId",
}),
);
final mockPrefs = MockPrefs();
@ -1114,7 +1197,9 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();
@ -1141,15 +1226,17 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenAnswer(
(_) async => {
(_) async => JsonRPCResponse(data: {
"jsonrpc": "2.0",
"result": {
"rate": 1000,
},
"id": "some requestId"
},
}),
);
final mockPrefs = MockPrefs();
@ -1175,7 +1262,9 @@ void main() {
const jsonArgs = '[]';
when(
mockClient.request(
'{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'),
'{"jsonrpc": "2.0", "id": "some requestId",'
'"method": "$command","params": $jsonArgs}',
),
).thenThrow(Exception());
final mockPrefs = MockPrefs();

View file

@ -33,6 +33,17 @@ class _FakeDuration_0 extends _i1.SmartFake implements Duration {
);
}
class _FakeJsonRPCResponse_1 extends _i1.SmartFake
implements _i2.JsonRPCResponse {
_FakeJsonRPCResponse_1(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
/// A class which mocks [JsonRPC].
///
/// See the documentation for Mockito's code generation for more information.
@ -65,21 +76,31 @@ class MockJsonRPC extends _i1.Mock implements _i2.JsonRPC {
),
) as Duration);
@override
_i3.Future<dynamic> request(String? jsonRpcRequest) => (super.noSuchMethod(
_i3.Future<_i2.JsonRPCResponse> request(String? jsonRpcRequest) =>
(super.noSuchMethod(
Invocation.method(
#request,
[jsonRpcRequest],
),
returnValue: _i3.Future<dynamic>.value(),
) as _i3.Future<dynamic>);
returnValue:
_i3.Future<_i2.JsonRPCResponse>.value(_FakeJsonRPCResponse_1(
this,
Invocation.method(
#request,
[jsonRpcRequest],
),
)),
) as _i3.Future<_i2.JsonRPCResponse>);
@override
void disconnect() => super.noSuchMethod(
_i3.Future<void> disconnect({required String? reason}) => (super.noSuchMethod(
Invocation.method(
#disconnect,
[],
{#reason: reason},
),
returnValueForMissingStub: null,
);
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
) as _i3.Future<void>);
@override
_i3.Future<void> connect() => (super.noSuchMethod(
Invocation.method(

View file

@ -17,7 +17,7 @@ void main() {
'{"jsonrpc": "2.0", "id": "some id","method": "server.ping","params": []}';
final result = await jsonRPC.request(jsonRequestString);
expect(result, {"jsonrpc": "2.0", "result": null, "id": "some id"});
expect(result.data, {"jsonrpc": "2.0", "result": null, "id": "some id"});
});
test("JsonRPC.request fails due to SocketException", () async {

View file

@ -3,24 +3,23 @@
// Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i9;
import 'dart:ui' as _i15;
import 'dart:async' as _i8;
import 'dart:ui' as _i14;
import 'package:local_auth/auth_strings.dart' as _i12;
import 'package:local_auth/local_auth.dart' as _i11;
import 'package:local_auth/auth_strings.dart' as _i11;
import 'package:local_auth/local_auth.dart' as _i10;
import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i7;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i8;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i2;
import 'package:stackwallet/models/balance.dart' as _i5;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16;
import 'package:stackwallet/models/models.dart' as _i4;
import 'package:stackwallet/services/coins/coin_service.dart' as _i3;
import 'package:stackwallet/services/coins/manager.dart' as _i16;
import 'package:stackwallet/services/wallets_service.dart' as _i14;
import 'package:stackwallet/services/coins/manager.dart' as _i15;
import 'package:stackwallet/services/wallets_service.dart' as _i13;
import 'package:stackwallet/utilities/amount/amount.dart' as _i6;
import 'package:stackwallet/utilities/biometrics.dart' as _i13;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i10;
import 'package:stackwallet/utilities/prefs.dart' as _i2;
import 'package:stackwallet/utilities/biometrics.dart' as _i12;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
@ -33,8 +32,8 @@ import 'package:stackwallet/utilities/prefs.dart' as _i2;
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
class _FakePrefs_0 extends _i1.SmartFake implements _i2.Prefs {
_FakePrefs_0(
class _FakeElectrumX_0 extends _i1.SmartFake implements _i2.ElectrumX {
_FakeElectrumX_0(
Object parent,
Invocation parentInvocation,
) : super(
@ -93,38 +92,18 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX {
}
@override
String get server => (super.noSuchMethod(
Invocation.getter(#server),
returnValue: '',
) as String);
@override
int get port => (super.noSuchMethod(
Invocation.getter(#port),
returnValue: 0,
) as int);
@override
bool get useSSL => (super.noSuchMethod(
Invocation.getter(#useSSL),
returnValue: false,
) as bool);
@override
_i2.Prefs get prefs => (super.noSuchMethod(
Invocation.getter(#prefs),
returnValue: _FakePrefs_0(
_i2.ElectrumX get electrumXClient => (super.noSuchMethod(
Invocation.getter(#electrumXClient),
returnValue: _FakeElectrumX_0(
this,
Invocation.getter(#prefs),
Invocation.getter(#electrumXClient),
),
) as _i2.Prefs);
) as _i2.ElectrumX);
@override
List<_i8.ElectrumXNode> get failovers => (super.noSuchMethod(
Invocation.getter(#failovers),
returnValue: <_i8.ElectrumXNode>[],
) as List<_i8.ElectrumXNode>);
@override
_i9.Future<Map<String, dynamic>> getAnonymitySet({
_i8.Future<Map<String, dynamic>> getAnonymitySet({
required String? groupId,
String? blockhash = r'',
required _i10.Coin? coin,
required _i9.Coin? coin,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -137,8 +116,8 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX {
},
),
returnValue:
_i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i9.Future<Map<String, dynamic>>);
_i8.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i8.Future<Map<String, dynamic>>);
@override
String base64ToHex(String? source) => (super.noSuchMethod(
Invocation.method(
@ -156,9 +135,9 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX {
returnValue: '',
) as String);
@override
_i9.Future<Map<String, dynamic>> getTransaction({
_i8.Future<Map<String, dynamic>> getTransaction({
required String? txHash,
required _i10.Coin? coin,
required _i9.Coin? coin,
bool? verbose = true,
}) =>
(super.noSuchMethod(
@ -172,11 +151,11 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX {
},
),
returnValue:
_i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i9.Future<Map<String, dynamic>>);
_i8.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i8.Future<Map<String, dynamic>>);
@override
_i9.Future<List<String>> getUsedCoinSerials({
required _i10.Coin? coin,
_i8.Future<List<String>> getUsedCoinSerials({
required _i9.Coin? coin,
int? startNumber = 0,
}) =>
(super.noSuchMethod(
@ -188,43 +167,43 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX {
#startNumber: startNumber,
},
),
returnValue: _i9.Future<List<String>>.value(<String>[]),
) as _i9.Future<List<String>>);
returnValue: _i8.Future<List<String>>.value(<String>[]),
) as _i8.Future<List<String>>);
@override
_i9.Future<void> clearSharedTransactionCache({required _i10.Coin? coin}) =>
_i8.Future<void> clearSharedTransactionCache({required _i9.Coin? coin}) =>
(super.noSuchMethod(
Invocation.method(
#clearSharedTransactionCache,
[],
{#coin: coin},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
}
/// A class which mocks [LocalAuthentication].
///
/// See the documentation for Mockito's code generation for more information.
class MockLocalAuthentication extends _i1.Mock
implements _i11.LocalAuthentication {
implements _i10.LocalAuthentication {
MockLocalAuthentication() {
_i1.throwOnMissingStub(this);
}
@override
_i9.Future<bool> get canCheckBiometrics => (super.noSuchMethod(
_i8.Future<bool> get canCheckBiometrics => (super.noSuchMethod(
Invocation.getter(#canCheckBiometrics),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<bool> authenticateWithBiometrics({
_i8.Future<bool> authenticateWithBiometrics({
required String? localizedReason,
bool? useErrorDialogs = true,
bool? stickyAuth = false,
_i12.AndroidAuthMessages? androidAuthStrings =
const _i12.AndroidAuthMessages(),
_i12.IOSAuthMessages? iOSAuthStrings = const _i12.IOSAuthMessages(),
_i11.AndroidAuthMessages? androidAuthStrings =
const _i11.AndroidAuthMessages(),
_i11.IOSAuthMessages? iOSAuthStrings = const _i11.IOSAuthMessages(),
bool? sensitiveTransaction = true,
}) =>
(super.noSuchMethod(
@ -240,16 +219,16 @@ class MockLocalAuthentication extends _i1.Mock
#sensitiveTransaction: sensitiveTransaction,
},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<bool> authenticate({
_i8.Future<bool> authenticate({
required String? localizedReason,
bool? useErrorDialogs = true,
bool? stickyAuth = false,
_i12.AndroidAuthMessages? androidAuthStrings =
const _i12.AndroidAuthMessages(),
_i12.IOSAuthMessages? iOSAuthStrings = const _i12.IOSAuthMessages(),
_i11.AndroidAuthMessages? androidAuthStrings =
const _i11.AndroidAuthMessages(),
_i11.IOSAuthMessages? iOSAuthStrings = const _i11.IOSAuthMessages(),
bool? sensitiveTransaction = true,
bool? biometricOnly = false,
}) =>
@ -267,46 +246,46 @@ class MockLocalAuthentication extends _i1.Mock
#biometricOnly: biometricOnly,
},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<bool> stopAuthentication() => (super.noSuchMethod(
_i8.Future<bool> stopAuthentication() => (super.noSuchMethod(
Invocation.method(
#stopAuthentication,
[],
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<bool> isDeviceSupported() => (super.noSuchMethod(
_i8.Future<bool> isDeviceSupported() => (super.noSuchMethod(
Invocation.method(
#isDeviceSupported,
[],
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<List<_i11.BiometricType>> getAvailableBiometrics() =>
_i8.Future<List<_i10.BiometricType>> getAvailableBiometrics() =>
(super.noSuchMethod(
Invocation.method(
#getAvailableBiometrics,
[],
),
returnValue:
_i9.Future<List<_i11.BiometricType>>.value(<_i11.BiometricType>[]),
) as _i9.Future<List<_i11.BiometricType>>);
_i8.Future<List<_i10.BiometricType>>.value(<_i10.BiometricType>[]),
) as _i8.Future<List<_i10.BiometricType>>);
}
/// A class which mocks [Biometrics].
///
/// See the documentation for Mockito's code generation for more information.
class MockBiometrics extends _i1.Mock implements _i13.Biometrics {
class MockBiometrics extends _i1.Mock implements _i12.Biometrics {
MockBiometrics() {
_i1.throwOnMissingStub(this);
}
@override
_i9.Future<bool> authenticate({
_i8.Future<bool> authenticate({
required String? cancelButtonText,
required String? localizedReason,
required String? title,
@ -321,28 +300,28 @@ class MockBiometrics extends _i1.Mock implements _i13.Biometrics {
#title: title,
},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
}
/// A class which mocks [WalletsService].
///
/// See the documentation for Mockito's code generation for more information.
class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
class MockWalletsService extends _i1.Mock implements _i13.WalletsService {
@override
_i9.Future<Map<String, _i14.WalletInfo>> get walletNames =>
_i8.Future<Map<String, _i13.WalletInfo>> get walletNames =>
(super.noSuchMethod(
Invocation.getter(#walletNames),
returnValue: _i9.Future<Map<String, _i14.WalletInfo>>.value(
<String, _i14.WalletInfo>{}),
) as _i9.Future<Map<String, _i14.WalletInfo>>);
returnValue: _i8.Future<Map<String, _i13.WalletInfo>>.value(
<String, _i13.WalletInfo>{}),
) as _i8.Future<Map<String, _i13.WalletInfo>>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i9.Future<bool> renameWallet({
_i8.Future<bool> renameWallet({
required String? from,
required String? to,
required bool? shouldNotifyListeners,
@ -357,21 +336,21 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
Map<String, _i14.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Map<String, _i13.WalletInfo> fetchWalletsData() => (super.noSuchMethod(
Invocation.method(
#fetchWalletsData,
[],
),
returnValue: <String, _i14.WalletInfo>{},
) as Map<String, _i14.WalletInfo>);
returnValue: <String, _i13.WalletInfo>{},
) as Map<String, _i13.WalletInfo>);
@override
_i9.Future<void> addExistingStackWallet({
_i8.Future<void> addExistingStackWallet({
required String? name,
required String? walletId,
required _i10.Coin? coin,
required _i9.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
@ -385,13 +364,13 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<String?> addNewWallet({
_i8.Future<String?> addNewWallet({
required String? name,
required _i10.Coin? coin,
required _i9.Coin? coin,
required bool? shouldNotifyListeners,
}) =>
(super.noSuchMethod(
@ -404,46 +383,46 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
#shouldNotifyListeners: shouldNotifyListeners,
},
),
returnValue: _i9.Future<String?>.value(),
) as _i9.Future<String?>);
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
_i9.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
_i8.Future<List<String>> getFavoriteWalletIds() => (super.noSuchMethod(
Invocation.method(
#getFavoriteWalletIds,
[],
),
returnValue: _i9.Future<List<String>>.value(<String>[]),
) as _i9.Future<List<String>>);
returnValue: _i8.Future<List<String>>.value(<String>[]),
) as _i8.Future<List<String>>);
@override
_i9.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
_i8.Future<void> saveFavoriteWalletIds(List<String>? walletIds) =>
(super.noSuchMethod(
Invocation.method(
#saveFavoriteWalletIds,
[walletIds],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
_i8.Future<void> addFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#addFavorite,
[walletId],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
_i8.Future<void> removeFavorite(String? walletId) => (super.noSuchMethod(
Invocation.method(
#removeFavorite,
[walletId],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> moveFavorite({
_i8.Future<void> moveFavorite({
required int? fromIndex,
required int? toIndex,
}) =>
@ -456,48 +435,48 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
#toIndex: toIndex,
},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
_i8.Future<bool> checkForDuplicate(String? name) => (super.noSuchMethod(
Invocation.method(
#checkForDuplicate,
[name],
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
_i8.Future<String?> getWalletId(String? walletName) => (super.noSuchMethod(
Invocation.method(
#getWalletId,
[walletName],
),
returnValue: _i9.Future<String?>.value(),
) as _i9.Future<String?>);
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
_i9.Future<bool> isMnemonicVerified({required String? walletId}) =>
_i8.Future<bool> isMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#isMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<void> setMnemonicVerified({required String? walletId}) =>
_i8.Future<void> setMnemonicVerified({required String? walletId}) =>
(super.noSuchMethod(
Invocation.method(
#setMnemonicVerified,
[],
{#walletId: walletId},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<int> deleteWallet(
_i8.Future<int> deleteWallet(
String? name,
bool? shouldNotifyListeners,
) =>
@ -509,20 +488,20 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
shouldNotifyListeners,
],
),
returnValue: _i9.Future<int>.value(0),
) as _i9.Future<int>);
returnValue: _i8.Future<int>.value(0),
) as _i8.Future<int>);
@override
_i9.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
_i8.Future<void> refreshWallets(bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#refreshWallets,
[shouldNotifyListeners],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod(
void addListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
@ -530,7 +509,7 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
returnValueForMissingStub: null,
);
@override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod(
void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],
@ -558,7 +537,7 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService {
/// A class which mocks [Manager].
///
/// See the documentation for Mockito's code generation for more information.
class MockManager extends _i1.Mock implements _i16.Manager {
class MockManager extends _i1.Mock implements _i15.Manager {
@override
bool get isActiveWallet => (super.noSuchMethod(
Invocation.getter(#isActiveWallet),
@ -586,10 +565,10 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValue: false,
) as bool);
@override
_i10.Coin get coin => (super.noSuchMethod(
_i9.Coin get coin => (super.noSuchMethod(
Invocation.getter(#coin),
returnValue: _i10.Coin.bitcoin,
) as _i10.Coin);
returnValue: _i9.Coin.bitcoin,
) as _i9.Coin);
@override
bool get isRefreshing => (super.noSuchMethod(
Invocation.getter(#isRefreshing),
@ -622,23 +601,23 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValueForMissingStub: null,
);
@override
_i9.Future<_i4.FeeObject> get fees => (super.noSuchMethod(
_i8.Future<_i4.FeeObject> get fees => (super.noSuchMethod(
Invocation.getter(#fees),
returnValue: _i9.Future<_i4.FeeObject>.value(_FakeFeeObject_2(
returnValue: _i8.Future<_i4.FeeObject>.value(_FakeFeeObject_2(
this,
Invocation.getter(#fees),
)),
) as _i9.Future<_i4.FeeObject>);
) as _i8.Future<_i4.FeeObject>);
@override
_i9.Future<int> get maxFee => (super.noSuchMethod(
_i8.Future<int> get maxFee => (super.noSuchMethod(
Invocation.getter(#maxFee),
returnValue: _i9.Future<int>.value(0),
) as _i9.Future<int>);
returnValue: _i8.Future<int>.value(0),
) as _i8.Future<int>);
@override
_i9.Future<String> get currentReceivingAddress => (super.noSuchMethod(
_i8.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
returnValue: _i9.Future<String>.value(''),
) as _i9.Future<String>);
returnValue: _i8.Future<String>.value(''),
) as _i8.Future<String>);
@override
_i5.Balance get balance => (super.noSuchMethod(
Invocation.getter(#balance),
@ -648,16 +627,16 @@ class MockManager extends _i1.Mock implements _i16.Manager {
),
) as _i5.Balance);
@override
_i9.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
_i8.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i9.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i9.Future<List<_i17.Transaction>>);
_i8.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i8.Future<List<_i16.Transaction>>);
@override
_i9.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
_i8.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i9.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i9.Future<List<_i17.UTXO>>);
returnValue: _i8.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i8.Future<List<_i16.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(
@ -677,15 +656,15 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValue: '',
) as String);
@override
_i9.Future<List<String>> get mnemonic => (super.noSuchMethod(
_i8.Future<List<String>> get mnemonic => (super.noSuchMethod(
Invocation.getter(#mnemonic),
returnValue: _i9.Future<List<String>>.value(<String>[]),
) as _i9.Future<List<String>>);
returnValue: _i8.Future<List<String>>.value(<String>[]),
) as _i8.Future<List<String>>);
@override
_i9.Future<String?> get mnemonicPassphrase => (super.noSuchMethod(
_i8.Future<String?> get mnemonicPassphrase => (super.noSuchMethod(
Invocation.getter(#mnemonicPassphrase),
returnValue: _i9.Future<String?>.value(),
) as _i9.Future<String?>);
returnValue: _i8.Future<String?>.value(),
) as _i8.Future<String?>);
@override
bool get isConnected => (super.noSuchMethod(
Invocation.getter(#isConnected),
@ -727,24 +706,24 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValue: false,
) as bool);
@override
_i9.Future<String> get xpub => (super.noSuchMethod(
_i8.Future<String> get xpub => (super.noSuchMethod(
Invocation.getter(#xpub),
returnValue: _i9.Future<String>.value(''),
) as _i9.Future<String>);
returnValue: _i8.Future<String>.value(''),
) as _i8.Future<String>);
@override
bool get hasListeners => (super.noSuchMethod(
Invocation.getter(#hasListeners),
returnValue: false,
) as bool);
@override
_i9.Future<void> updateNode(bool? shouldRefresh) => (super.noSuchMethod(
_i8.Future<void> updateNode(bool? shouldRefresh) => (super.noSuchMethod(
Invocation.method(
#updateNode,
[shouldRefresh],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
void dispose() => super.noSuchMethod(
Invocation.method(
@ -754,7 +733,7 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValueForMissingStub: null,
);
@override
_i9.Future<Map<String, dynamic>> prepareSend({
_i8.Future<Map<String, dynamic>> prepareSend({
required String? address,
required _i6.Amount? amount,
Map<String, dynamic>? args,
@ -770,27 +749,27 @@ class MockManager extends _i1.Mock implements _i16.Manager {
},
),
returnValue:
_i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i9.Future<Map<String, dynamic>>);
_i8.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i8.Future<Map<String, dynamic>>);
@override
_i9.Future<String> confirmSend({required Map<String, dynamic>? txData}) =>
_i8.Future<String> confirmSend({required Map<String, dynamic>? txData}) =>
(super.noSuchMethod(
Invocation.method(
#confirmSend,
[],
{#txData: txData},
),
returnValue: _i9.Future<String>.value(''),
) as _i9.Future<String>);
returnValue: _i8.Future<String>.value(''),
) as _i8.Future<String>);
@override
_i9.Future<void> refresh() => (super.noSuchMethod(
_i8.Future<void> refresh() => (super.noSuchMethod(
Invocation.method(
#refresh,
[],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
bool validateAddress(String? address) => (super.noSuchMethod(
Invocation.method(
@ -800,33 +779,33 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValue: false,
) as bool);
@override
_i9.Future<bool> testNetworkConnection() => (super.noSuchMethod(
_i8.Future<bool> testNetworkConnection() => (super.noSuchMethod(
Invocation.method(
#testNetworkConnection,
[],
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<void> initializeNew() => (super.noSuchMethod(
_i8.Future<void> initializeNew() => (super.noSuchMethod(
Invocation.method(
#initializeNew,
[],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> initializeExisting() => (super.noSuchMethod(
_i8.Future<void> initializeExisting() => (super.noSuchMethod(
Invocation.method(
#initializeExisting,
[],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> recoverFromMnemonic({
_i8.Future<void> recoverFromMnemonic({
required String? mnemonic,
String? mnemonicPassphrase,
required int? maxUnusedAddressGap,
@ -845,20 +824,20 @@ class MockManager extends _i1.Mock implements _i16.Manager {
#height: height,
},
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> exitCurrentWallet() => (super.noSuchMethod(
_i8.Future<void> exitCurrentWallet() => (super.noSuchMethod(
Invocation.method(
#exitCurrentWallet,
[],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<void> fullRescan(
_i8.Future<void> fullRescan(
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
@ -870,11 +849,11 @@ class MockManager extends _i1.Mock implements _i16.Manager {
maxNumberOfIndexesToCheck,
],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
_i9.Future<_i6.Amount> estimateFeeFor(
_i8.Future<_i6.Amount> estimateFeeFor(
_i6.Amount? amount,
int? feeRate,
) =>
@ -886,7 +865,7 @@ class MockManager extends _i1.Mock implements _i16.Manager {
feeRate,
],
),
returnValue: _i9.Future<_i6.Amount>.value(_FakeAmount_4(
returnValue: _i8.Future<_i6.Amount>.value(_FakeAmount_4(
this,
Invocation.method(
#estimateFeeFor,
@ -896,26 +875,26 @@ class MockManager extends _i1.Mock implements _i16.Manager {
],
),
)),
) as _i9.Future<_i6.Amount>);
) as _i8.Future<_i6.Amount>);
@override
_i9.Future<bool> generateNewAddress() => (super.noSuchMethod(
_i8.Future<bool> generateNewAddress() => (super.noSuchMethod(
Invocation.method(
#generateNewAddress,
[],
),
returnValue: _i9.Future<bool>.value(false),
) as _i9.Future<bool>);
returnValue: _i8.Future<bool>.value(false),
) as _i8.Future<bool>);
@override
_i9.Future<void> resetRescanOnOpen() => (super.noSuchMethod(
_i8.Future<void> resetRescanOnOpen() => (super.noSuchMethod(
Invocation.method(
#resetRescanOnOpen,
[],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
returnValue: _i8.Future<void>.value(),
returnValueForMissingStub: _i8.Future<void>.value(),
) as _i8.Future<void>);
@override
void addListener(_i15.VoidCallback? listener) => super.noSuchMethod(
void addListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#addListener,
[listener],
@ -923,7 +902,7 @@ class MockManager extends _i1.Mock implements _i16.Manager {
returnValueForMissingStub: null,
);
@override
void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod(
void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(
#removeListener,
[listener],