part of 'methods.dart'; class ElectrumWorkerConnectionRequest implements ElectrumWorkerRequest { ElectrumWorkerConnectionRequest({required this.uri}); final Uri uri; @override final String method = ElectrumWorkerMethods.connect.method; @override factory ElectrumWorkerConnectionRequest.fromJson(Map json) { return ElectrumWorkerConnectionRequest(uri: Uri.parse(json['params'] as String)); } @override Map toJson() { return {'method': method, 'params': uri.toString()}; } } class ElectrumWorkerConnectionError extends ElectrumWorkerErrorResponse { ElectrumWorkerConnectionError({required String error}) : super(error: error); @override String get method => ElectrumWorkerMethods.connect.method; } class ElectrumWorkerConnectionResponse extends ElectrumWorkerResponse { ElectrumWorkerConnectionResponse({required ConnectionStatus status, super.error}) : super( result: status, method: ElectrumWorkerMethods.connect.method, ); @override String resultJson(result) { return result.toString(); } @override factory ElectrumWorkerConnectionResponse.fromJson(Map json) { return ElectrumWorkerConnectionResponse( status: ConnectionStatus.values.firstWhere( (e) => e.toString() == json['result'] as String, ), error: json['error'] as String?, ); } }